JWaveView.setNamedColor
setNamedColorSet
JWaveView.setNamedColorSet
method.) You may have a color and a color set with the same name. DefaultRGB
For example, the following calls might appear in a Java client application. They associate names with color objects. These name/color object pairs are sent to the JWAVE wrapper function when the
execute
method is called in the Java application.
myJWaveView.setNamedColor("BACKGROUND", java.awt.Color.lightGray) myJWaveView.setNamedColor("COLOR", java.awt.Color.red)
back = GET_NAMED_COLOR("BACKGROUND", Default='000000'xL) fore = GET_NAMED_COLOR("COLOR", Default = 'ffffff'xL)
back
and fore
can be used in any PV-WAVE expression that takes a color value. For example:
PLOT, x, Color=fore, Background=back
Managing the Color Table
Figure A-1 illustrates how a color table is created in a JWAVE wrapper. When LOAD_JWAVECT is called, a color table is created with the named colors loaded into a subset of the color table.
Figure A-1 A color is retrieved by GET_NAMED_COLOR in the JWAVE wrapper. When LOAD_JWAVECT is called, the named color is loaded into a subset of the specified color table. All remaining colors in the color table are available for use by images.
range=[5, 255]
. Figure A-2 Named colors occupy a subset of the color table.
Example 1-1
; Get colors JWAVE_LOADCT, 1 back = get_Named_Color("BACKGROUND", Default = '000000'xL) fore = get_Named_Color("COLOR", Default = 'ffffff'xL) bot = get_Named_Color("BOTTOM", Default = fore, $ Range_Of_Colors=crange) ; Re-map image values into the range of image colors. s = BYTSCL(s, Top = crange(1)-crange(0)) + crange(0)
Notes and Restrictions
setNamedColorSet
), then GET_NAMED_COLOR returns an array of color indices. This is useful for things such as the CONTOUR procedure's C_Color keyword.
TIP: To create a default color, supply a long integer containing red, green, and blue components of the desired color. For example, the color chartreuse is represented by red=127, green=255, and blue=0 (in hex, 7F, FF, and 00). To create this color, use '00ff7f'xL as a constant. In an equation, you can form this constant using PV-WAVE expressions such as:
red + 256L*(green + 256L*blue)
LONG(red) OR ISHFT(LONG(green), 8) OR ISHFT(LONG(blue), 16)
For more information on color tables and using color in PV-WAVE, refer to the PV-WAVE User's Guide.