ColorSchemeViewerDoc.tioga
Maureen Stone, March 23, 1987 3:20:10 pm PST
COLORSCHEMEVIEWER
CEDAR 7.0 — FOR INTERNAL XEROX USE ONLY
ColorSchemeViewer
Maureen Stone
© Copyright 1987 Xerox Corporation. All rights reserved.
Abstract: A color scheme viewer is a viewer class suitable for providing an interface to a three dimensional, continuous color system or any other similar system. The Viewer class implements a container with three sliders, three editable text viewers, a Set button, which sets the value of the viewer from the value in the text sliders, and a label. The viewer will automatically format itself as a function of size (within reasonable limits)
Created by: Maureen Stone
Maintained by: Maureen Stone <Stone.pa>
Keywords: viewers, color systesm
XEROX  Xerox Corporation
   Palo Alto Research Center
   3333 Coyote Hill Road
   Palo Alto, California 94304

For Internal Xerox Use Only
1. Using a ColorSchemeViewer
A ColorSchemeViewer looks like the following:
[Artwork node; type 'Artwork on' to command tool]
A ColorSchemeViewer
Moving the sliders will update the text viewers. Editing the text viewers and pressing "Set" will set the slider values to the specified values. Each time any of the values change, the client's NotifyProc will be called. The viewer will have been repainted to reflect the change by the time the notify proc is called.
2. ColorSchemeViewer.mesa
The Create procedure makes a new instance of the viewer class, formatted as a function of size. The labels are the short labels on the slider (R, G, B above). The title is the longer title over the sliders (Red, Green, Blue above). The slider width and height is controlled by sw and sh. The label fonts are picked to coordinate with these sizes. The fields parent, wx, wy are of interest for nested viewers (the usual case), and wx, wy is the lower left corner of the lower slider. The viewer width and height is controlled by the size of the contents. The NotifyProc will be called each time one of the values changes.
The Changes type indicates which values have changed. The top slider is "v1", the bottom one "v3". The value "paintViewer" is used to refresh the viewer without changing the values. The value "none" is only there for semantic purity and is currently not used.
Create: PROC [labels: ARRAY [1..3] OF ROPE, sw, sh: INT, notify: NotifyProc, title: ROPENIL, clientData: REFNIL, parent: Viewer ← NIL, wx, wy: INTEGER ← 0] RETURNS [Viewer];
Changes: TYPE = {none, v1, v2, v3, allValues, paintViewer};
NotifyProc: TYPE = PROC [values: ARRAY [1..3] OF REAL, changes: Changes, client: REF];
The client will be notified everytime a value in the viewer changes. The viewer will have been repainted to reflect the change by the time the NotifyProc is called.
The viewer values can be set and read through the ColorSchemeViewer interface.
SetValues: PROC [viewer: Viewer, values: ARRAY [1..3] OF REAL, notify: BOOLEANFALSE] RETURNS [Changes];
SetValues only paints the slider and text viewer contents, leaving the labels alone .
GetValues: PROC[viewer: Viewer] RETURNS[v1, v2, v3: REAL];
While under normal operation the viewer will update itself, clients may need to force a paint, which can be accomplished using the Paint procedure.
Paint: PROC[viewer: Viewer, context: Imager.Context, whatChanged: Changes];