<<<<<<<<<<<<<<<<

xcolormap(x) Xlib xcolormap(x)

NAME

xcolormap - an interface to an X colormap.

DESCRIPTION

The xcolormap provides an interface to an X colormap.

SUPERCLASS

object

INSTANCE VARIABLES

alloc is a boolean value that is used when a colormap is created. If true (1 or AllocAll), all entries in the colormap are allocated when the colormap is created. If false (0 or AllocNone), no colormap cells are allocated.

display is the name of the xdisplay object that specifies the display. The default value is the class xdisplay.

id is a pointer to an X Colormap structure. (This is an X pointer, not a LYMB object pointer. Be careful.)

pixel is the number of the current pixel. The range of this value is 0 < pixel <= colormap size. Make sure to use only colormap entries that you have allocated.

screen is the name of an xscreen instance. If no screen is specified, the default screen of the X display is used. The screen is used during creation, so make sure to set this instance variable before you create the colormap.

visual is the name of the xvisual object that is used when the colormap is created. If no visual is specified, the default visual for the display will be used.

window is the name of the xwindow object that is used when the colormap is created. It is used to get the screen. If no window is specified, the default root window for the display will be used.

MESSAGES

alloc= alloc_value sets the alloc instance variable.

alloc? returns the value of the alloc instance variable on the argument stack.

create_and_copy:colormap_id number_to_copy creates a new colormap and copies the contents of

the argument colormap into the new colormap. The second argument is an optional argument that specifies how many cells to copy. If you do not specify a number, all cells will be copied and the new colormap will be created with all cells allocated, so you will not be able to allocate any new cells in it. If you do specify a number, it should be close to the number of cells in the colormap so you don't get too many false colors. You should only do this in cases where your user interface will need to allocate colors.

create! creates the colormap. This method uses the alloc instance variable and sets the id.

display= display_object_name sets the display instance variable.

display? returns the value of the display instance variable on the argument stack.

id= X_colormap_id sets the id instance variable. Usually the id is set when a colormap is created, but sometimes you will need to set the id. One such case is when you are using the default colormap. You can get the pointer to the default colormap by asking the display. Once you set the id of an xcolormap instance to the pointer, it can be used to access the default colormap. when you set the id in this way, do not call create!.

id? returns the value of the id instance variable on the argument stack. Be careful because this is an X pointer. It cannot be treated as a pointer to a LYMB object.

install! installs the colormap. This should be used with caution since it is unsociable for an application other than the window manager to install a colormap. You might need it if you are using a window manager that is not ICCCM complient and does not install a window's colormap when the window receives keyboard focus.

@ pixel, pixel= pixel sets the pixel instance variable to the argument pixel value. The range of this value is from one to the size of the colormap. Be careful to use only pixels tht you have allocated.

pixel? returns the value of the pixel instance variable on the argument stack.

rgb: rgb stores the rgb at the current pixel value in the map. Be careful to store only into cells that your application has allocated.

rgb? returns the rgb at the current pixel location.

screen? retreives the screen instance variable.

screen= sets the screen instance variable. Note: timing is important. You must set the screen before creation.

visual= visual_object_name sets the visual instance variable.

visual? returns the value of the visual instance variable on the argument stack.

window= window_object_name sets the window instance variable.

window? returns the value of the window instance variable on the argument stack.

writeable? returns whether or not the colormap is writeable or not. This is important because if it isn't, you cannot allocate private color cells. This method will return 1 for true, and 0 for false.

EXAMPLE

/* create a colormap with all cells allocated,

then store black in the first cell */

xcolormap new: the_map

alloc= 1

create!

@1 rgb: (0, 0, 0) ;

SEE ALSO

xdisplay, xvisual, xwindow, xprivate_cells, xshared_cell, xshared_cells.


Last Updated On: Fri Mar 10 15:38:44 1995

Please send comments and suggestions to

its-documentation@rpi.edu

Keyword Search of RPInfo Consulting Pages and NewsCache