MGH_CW_PALETTE_EDITOR Name
MGH_CW_PALETTE_EDITOR Purpose
MGH_CW_PALETTE_EDITOR is a compound widget for the modification of color
palette vectors.
Category
Compound Widgets
Calling Sequence
Widget = MGH_CW_PALETTE_EDITOR(Parent) Inputs
Parent: ID of the parent widget.
Keyword Parameters
DATA: A 3x256 byte array containing the initial color values
for Red, Green and Blue channels. The value supplied
can also be a 4x256 byte array containing the initial
color values and the optional Alpha channel. The value
supplied can also be an IDLgrPalette object reference.
If an IDLgrPalette object reference is supplied it is
used internally and is not destroyed on exit. If an
object reference is supplied the ALPHA keyword to the
MGH_CW_PALETTE_EDITOR_SET routine can be used to supply
the data for the optional Alpha channel.
FILE: Set this keyword to a string representing the name
of the color table file from which the predefined colors
will be read. The default is the IDL system
color table file, <IDL_DIR>/resource/colors/colors1.tbl.
FRAME: If set, a frame will be drawn around the widget.
HISTOGRAM: A 256 element byte vector containing the values for
the optional histogram curve.
HORIZONTAL: Set this keyword for a horizontal layout for the
compound widget. This consists of the controls
to the right of the display area. The default
is a vertical layout with the controls below the
display area.
SELECTION: A two element vector defining the starting and ending
point of the selection region. The default is [0,255].
UNAME: Set this keyword to a string that can be used to identify
the widget. You can associate a name with each widget in
a specific hierarchy, and then use that name to query the
widget hierarchy and get the correct widget ID.
To query the widget hierarchy, use the WIDGET_INFO function
with the FIND_BY_UNAME keyword. The UNAME should be unique
to the widget hierarchy because the FIND_BY_UNAME keyword
returns the ID of the first widget with the specified name.
UVALUE: The "user value" to be assigned to the widget. Each widget
can contain a user-specified value of any data type and
organization. This value is not used by the widget in any
way, but exists entirely for the convenience of the IDL
programmer. This keyword allows you to set this value when
the widget is first created. If UVALUE is not present, the
widget's initial user value is undefined.
XSIZE: The width of the drawable area in pixels. The default width
is 256.
YSIZE: The height of the drawable area in pixels. The default
height is 256. Outputs
The ID of the created widget is returned.
Procedure
Standard Compound widget. Use WIDGET_CONTROL, SET_VALUE and GET_VALUE
to change/read the widget's value. The value supplied to the SET_VALUE
keyword can be any of the three types described by the DATA keyword.
The value returned by the GET_VALUE keyword is a 3x256 or 4x256 array
containing the color vectors and the optional alpha channel if it is
in use. Side Effects
Palette Editor Events:
This widget generates several types of event structures. There are
variations of the palette editor event structure depending on the
specific event being reported. All of these structures contain the
standard three fields (ID, TOP, and HANDLER).
The different palette editor event structures are described below.
Selection Moved
This is the type of structure returned when one of the drag handles
that define the selection region is moved by a user.
event = { MGH_CW_PALETTE_EDITOR_SM, $
ID: state.wCWPalEdTop, $
TOP: wAppTop, $
HANDLER: handler, $
SELECTION: [state.sel_x1, state.sel_x2] $
}
SELECTION indicates a two element vector defining the starting and
ending point of the selection region of color indexes.
Palette Edited
This is the type of structure returned when the user has modified the
color palette.
event = { MGH_CW_PALETTE_EDITOR_PM, $
ID: state.wCWPalEdTop, $
TOP: wAppTop, $
HANDLER: handler $
}
The value of the palette editor will need to be retrieved (i.e.,
WIDGET_CONTROL, GET_VALUE) in order to determine the extent of the
actual user modification.
UTILITY ROUTINES
MGH_CW_PALETTE_EDITOR_GET: Get palette editor compound widget properties.
Calling Sequence
MGH_CW_PALETTE_EDITOR_GET, widgetID Inputs
widgetID: The widget ID of the MGH_CW_PALETTE_EDITOR compound widget.
Keyword Parameters
ALPHA: A 256 element byte array containing the Alpha channel.
FILE: A string containing the path name of the color-table file.
HISTOGRAM: A 256 element byte array containing the histogram curve.
MGH_CW_PALETTE_EDITOR_SET: Set palette editor compound widget properties.
Calling Sequence
MGH_CW_PALETTE_EDITOR_SET, widgetID Inputs
widgetID: The widget ID of the MGH_CW_PALETTE_EDITOR compound widget.
Keyword Parameters
ALPHA: A 256 element byte array containing the Alpha channel
or the scalar value zero to remove the alpha curve
from the display.
FILE: A string containing the path name of the color-table file.
HISTOGRAM: A 256 element byte array containing the histogram curve
or the scalar value zero to remove the histogram from
the display. Example
A = WIDGET_BASE(TITLE='Example', /COLUMN)
B = MGH_CW_PALETTE_EDITOR(A, ....
Modification History
ACY, April, 1999. Written.