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

xshared_cells(x) Xlib xshared_cells(x)

NAME

xshared_cells - shared colormap cells

DESCRIPTION

In Xlib, shared cells and private cells are allocated and dealt with very differently. Shared cells are allocated one by one and colors are determined at allocation time. Private cells are allocated in groups and colors may be changed at any time. If an application chooses to use shared cells or private cells depending on the run time environment, it needs a way to treat shared and private cells in a similar manner. The xshared_cells class solves this problem. The messages are a subset of the messages for the xprivate_cells. The difference is that this class uses shared cells.

SUPERCLASS

object

INSTANCE VARIABLES

colormap is the name of the associated xcolormap object. If no colormap is specified, the default colormap for the display will be used.

display is the name of the associated xdisplay object.

number of colors is the number of cells to allocate.

pixel_number is the current cell. The range of this value is 1 <= pixel_number <= number of colors.

pixels is a list of pixel values for the allocated cells. All values are initialized to black.

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 allocation, so make sure to set this instance variable before you allocate the cells.

xshared_cell is a private instance variable.

MESSAGES

allocate! allocates the cells.

color: colorname stores the specified color into the current cell. For a full list of possible colornames, please

refer to the Xlib manuals.

colormap= colormap_object_name sets the colormap instance variable.

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

display= display_object_name sets the display instance variable.

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

free_cells! attempts to free the cells.

number_of_colors= value sets the number_of_colors instance variable.

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

pixel? returns the current pixel.

@ pixel_number, pixel_number= pixel_number sets the pixel_number instance variable.

pixel? returns the pixel_number instance variable.

rgb: rgb stores the rgb into the current cell. The range for the rgb values is 0 <= rgb_value <= 1. Note that this is different from Xlib where rgb values must be in the range 0 <= Xlib_rgb_value <= 65535.

rgb? returns the rgb of the current cell.

screen? retreives the screen instance variable.

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

EXAMPLE

/* create xshared_cells an get pixels for red and green */ scalar new: red_pixel; scalar new: green_pixel;

xshared_cells new: the_cells

number_of_colors= 2

@1 color: red

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

red_pixel = [the_cells @1 pixel?]; green_pixel = [the_cells @2 pixel?];

SEE ALSO

xdisplay, xshared_cell, xcolormap, xprivate_cells


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

Please send comments and suggestions to

its-documentation@rpi.edu

Keyword Search of RPInfo Consulting Pages and NewsCache