ChannelHandler CommandSequence Classes Table of Contents

ColorPicker

Availability  LightWave® 6.0
Component  Layout, Modeler
Header  lwdialog.h

Color pickers prompt the user for a color selection. They replace the operating system's default color selection mechanism, or provide one if no default exists.

See the Color Picker global for a discussion of color pick requests from the host's point of view.

Activation Function

   XCALL_( int ) MyColorPick( int version, GlobalFunc *global,
      LWColorPickLocal *local, void *serverData );

The local argument to a color picker's activation function is an LWColorPickLocal.

   typedef void LWHotColorFunc( void *data, float r, float g, float b );

   typedef struct st_LWColorPickLocal {
      int             result;
      const char     *title;
      float           red, green, blue;
      void           *data;
      LWHotColorFunc *hotFunc;
   } LWColorPickLocal;
result
The result of the request. Set this to 1 if the user selects a color, 0 if the user cancels the request, and a negative number to indicate an error.

title
The title string. This is generally displayed near the top of the color dialog and tells the user the context of the color request.

red, green, blue
The initial color. If the user selects a color, the selected color should be written in these fields. The nominal range for RGB levels is 0.0 to 1.0, but they can be outside this range.

data
A pointer to data that should be passed to the caller's color callback.

hotFunc( data, r, g, b )
A color callback supplied by the host. Call this while the user is playing with any of your color selection mechanisms. This allows the host to update its display interactively as the user selects a color. (The "hot" part of the name refers to this dynamic interaction. This isn't a video color gamut test.)

Example

The simpcolr SDK sample is a simple example of a color picker.