5.3.6 Interactive Color Tool
This document defines the widget structure and callbacks of the X Color Tools
window within the Xid application. Each widget is specified along with
the specification of the callback function tree. The creation code for the
main colortool window is contained in xid_colortool/ct_interface.c.
Definitions for the widgets is defined in xid_colortool/ct_widgets.h. Most
callbacks for the window are defined in xid_colortool/ct_graphicoperations.c.
Callbacks for Cancel, Dismiss and GamutMatch which are defined in
xid_colortool/ct_functions.c while those for restore and linear share
callbacks in xid_colortool/ct_stretchoperations.c.
Top Level: Colortool_Shell
Main Window: ct_mainWindow
Container: xmFormWidgetClass, ct_mainForm
The layout of the color tool window is centered around the drawing area for the
contrast stretch. The remainder of the widgets are form attatched to the
ct_stretch_drawing widget. The size of the window is fixed to not allow
user resize.
The red, green, blue, and all radio buttons allow
the user to select which of the mapping components to adjust.
Each displayed image has three separate mapping components,
one for the red, one for the green, and one for the blue portion
of the mapping.
Widgets: ct_stretch_color_red, ct_stretch_color_green, ct_stretch_color_blue, ct_stretch_color_all, ct_stretch_color_sat
XmNarmCallback: ct_changecolor (&red|&green|&blue|&allrgb|&satrgb)
Contrast Stretch:
The MB1 (left mouse button) is used to set breakpoints on the
stretch line and move the point to adjust the piece-wise linear
color mapping. MB2 (middle mouse button) is used to delete
previously set breakpoints. The horizontal value represents the
from value and the vertical value is the to value for the
mapping function.
Widget:ct_stretch_drawing
EnterWindowMask: ct_highlightwindow
LeaveWindowMask: ct_unhighlightwindow
Button1MotionMask|ButtonPressMask|ButtonReleaseMask|ExposureMask: ct_drawingevent
Two additional input mechanisms are provided to add easier
entry of specific breakpoints. The horizontal slider allows
entry of the from value or this value can be entered through
the "From" textfield. Similarly, the vertical slider adjusts
the to value for the corresponding from setting and this data
can also be entered through the "To" textfield.
Scale Widgets:ct_scale_horiz, ct_scale_vertical
XmNvalueChangedCallback: ct_change_scale_horiz, ct_change_scale_vertical
XmNdragCallback: ct_drag_scale_horiz, ct_drag_scale_vertical
Text Entry Widgets: ct_horiz_value, ct_vert_value
XmNactivateCallback: ct_change_horiz_text, ct_change_vert_text
Histogram:
The histogram displayed for the selected color represents
the modified color values after applying the contrast stretch.
The range of the histogram automatically scales to the maximum
count for the color plane. The data point for the cumulative
count percentage is selected by either tracking the cursor in
the histogram drawing area or by setting the horizontal slider
value.
Drawing Area Widgets:ct_histo_vert_label, ct_histo_horiz_label, ct_histo_red, ct_hist_fill
The histogram display is made up of four separate drawing areas.
ct_histo_vert_label holds the vertical scale while ct_histo_horiz_label
holds the horizontal scale. The histogram is drawn in ct_histo_red
and ct_hist_fill fills in the lower right corner. The cursor is
tracked in ct_histo_red to display statistics.
StructureNotifyMask: ct_histo_notify
ExposureMask: ct_histo_expose
PointerMotionMask|KeyReleaseMask: ct_histo_pointer
Distributional and Cumulative:
The Distributional and Cumulative radio buttons allow
the user to select the type of histogram to be displayed.
Radio Button Widgets:ct_hist_dist_button, ct_hist_cum_button
XmNarmCallback: ct_hist_type ("D"|"C")
Distributional:
In a distributional histogram, the
x-axis represents gray level values 0
to 255; the y-axis represents the
total number of pixels that have the
corresponding gray level value.
Cumulative:
In a cumulative histogram, the x-axis
represents gray level values 0 to 255;
the y-axis represents the total number
of pixels that have the corresponding gray
level as well as all previous gray levels.
Bar, Stacked Bar, Line Graph Icons:
These icons change the style in which the histogram is displayed.
The bar style displays information for the current color selected or
the sum of red, green and blue when All is selected. The stacked
bar shows red, green and blue on the same histogram with the green
bar stacked on top of red, and the blue bar on top of green. This
allows the individual color histograms to be compared as well as
visualize the overall histogram of the image. The line graph
shows all colors as overlayed line graphs and allows for easier
comparison of the histograms.
Drawn Icon Button Widgets: ct_histo_graph_sum, ct_histo_graph_stacked, ct_histo_graph_line
XmNactivateCallback: ct_hist_graph("A"|"S"|"L")
Scale Arrow Buttons:
The scale arrow buttons and text field provide a mechanism for
changing the vertical scale of the histogram. Each arrow
button press increases/decreases the scale by 10 %. A
specific scale value can be entered directly in the
scale textfield. The maximum scale value of 1 sets the scale
maximum value to the maximum histogram data point. By
decreasing the scale value, the maximum value displayed will
be reduced by the scale factor. Histogram data points larger
than this value will be clipped at the new scale maximum.
Arrow button widgets: ct_histo_up_button, ct_histo_down_button
XmNactivateCallback: ct_histo_up, ct_histo_down
Scale text field widget: ct_histo_scale_text
XmNactivateCallback: ct_change_scale_text
Show Stretch, Hide Stretch:
The Show Stretch button pops up the stretch tool window for
saving and retrieving stretches. The button toggles to Hide
Stretch to provide a convenient mechanism for hiding the
stretch tool.
PushButton widget: ct_show_stretch_button
XmNactivateCallback: ct_popup_stretch
Show Map, Hide Map:
The Show Map button pops up the map tool window for viewing the
current X color map. The button toggles to Hide Map to provide
a convenient mechanism for hiding the map tool.
PushButton widget: ct_show_map_button
XmNactivateCallback: ct_popup_map ( &xidCMap )
TrueColor/PseudoColor:
The TrueColor or PseudoColor option is available depending on the
default X color map. For the SGI with a default PseudoColor
color map, the TrueColor button provides a mechanism to display
a separate image viewing window in 24-bit mode. On DG
workstations with a DirectColor default, the PseudoColor button
provides an 8-bit image viewing window which is useful for HLS
colorspace manipulations.
PushButton widget: ct_remap_image_button
XmNactivateCallback: ct_remap_image
Undo/Redo:
The Undo button deletes the last modification made to the
contrast stretch. After Undo is selected, the button toggles to
Redo which reverses the effect of the Undo and returns the
contrast stretch to the state prior to the Undo.
PushButton widget: ct_undo_redo_button
XmNactivateCallback: ct_undo_redo
Restore:
Selecting the Restore button reloads the mapping that
was applied to the image when the Color Tool function was
initiated.
PushButton widget: ct_restore_button
XmNactivateCallback: ct_stretchoperations(six)
Linear:
Selecting the Linear button loads a linear or identity
mapping. The linear mapping is only applied to the color band
selected or to all bands if the ALL button is set.
PushButton widget: ct_linear_button
XmNactivateCallback: ct_stretchoperations(two)
Cancel:
Selecting the Cancel button closes the Color Tool panel
without saving the current mapping. Note that the current
X color map retains the results of the current contrast stretch.
To restore the color map to the state prior to initiating the
Color Tool, use the Restore button.
PushButton widget: ct_cancel_button
XmNactivateCallback: colortool_cancel
Dismiss:
Selecting the Dismiss button closes the Color Tool panel,
saves the current adjusted mapping, and closes the
other tools shown.
PushButton widget: ct_dismiss_button
XmNactivateCallback: colortool_exit