 |
Index for Section 9 |
|
 |
Alphabetical listing for R |
|
 |
Bottom of page |
|
recolor_cursor(9r)
NAME
recolor_cursor - Graphics: Changes the foreground and background colors of
the cursor
SYNOPSIS
int (*ws_color_map_functions->recolor_cursor)(
caddr_t cursor_handle,
ws_screen_descriptor *screen,
ws_color_cell *foreground,
ws_color_cell *background );
ARGUMENTS
cursor_handle
Specifies the virtual address (handle) of device-specific information.
Typically this is a pointer to a private data structure that may
contain information such as the address of the hardware, state
information, and other information that may be shared between drivers.
The Workstation Subsystem allows separate handles for the cursor,
colormap, and the screen functions.
screen
Specifies a pointer to the ws_screen_descriptor structure, which
describes the attributes of the screen.
foreground
Specifies a pointer to the ws_color_cell structure, which defines the
foreground color for the cursor specified by cursor_handle.
background
Specifies a pointer to the ws_color_cell structure, which defines the
background color for the cursor specified by cursor_handle.
DATA STRUCTURES
The recolor_cursor function accesses the ws_screen_descriptor and
ws_color_cell structures defined in /usr/sys/include/sys/workstation.h.
DESCRIPTION
The recolor_cursor function recolors the foreground and the background of
the cursor specified by *foreground and *background, respectively.
NOTES
This function is necessary on both gray scale and black-and-white monitors.
RETURN VALUES
If successful, the recolor_cursor function returns 0 (zero). If
unsuccessful, it returns -1.
EXAMPLES
The following example shows how the recolor_cursor function is written for
an ATI Mach64 graphics adapter:
ati64_recolor_cursor(caddr_t cursor_handle,
ws_screen_descriptor screen,
ws_color_cell fg, bg)
{
register struct vga_info *vp =
(struct vga_info *)cursor_handle;
vp->cursor_fg = *fg;
vp->cursor_bg = *bg;
ati64_restore_cursor_color(cursor_handle);
return(0);
}
ati64_restore_cursor_color(caddr_t cursor_handle)
{
register struct vga_info *vp =
(struct vga_info *)cursor_handle;
register struct ati64_type *ap =
&ati64_info[vp->unit];
ws_color_cell entry;
int rshift = 24, gshift = 16, bshift = 8;
unsigned char cur_clr0_b, cur_clr0_g, cur_clr0_r;
unsigned char cur_clr1_b, cur_clr1_g, cur_clr1_r;
unsigned int cur_clr0, cur_clr1;
/* Set up new color. */
cur_clr0_r = (vp->cursor_bg.red >> bshift);
cur_clr0_g = (vp->cursor_bg.green >> bshift);
cur_clr0_b = (vp->cursor_bg.blue >> bshift);
cur_clr0 = ( (cur_clr0_r << rshift) |
(cur_clr0_g << gshift) |
(cur_clr0_b << bshift) );
cur_clr1_r = (vp->cursor_fg.red >> bshift);
cur_clr1_g = (vp->cursor_fg.green >> bshift);
cur_clr1_b = (vp->cursor_fg.blue >> bshift);
cur_clr1 = ( (cur_clr1_r << rshift) |
(cur_clr1_g << gshift) |
(cur_clr1_b << bshift) );
/* Update cursor color with write to chip. */
REGW(vp, ap, CUR_CLR0, cur_clr0);
REGW(vp, ap, CUR_CLR1, cur_clr1);
break;
return(0);
}
FILES
/usr/sys/include/sys/workstation.h
/usr/sys/include/sys/wsdevice.h
SEE ALSO
Data Structures: ws_color_cell(9s), ws_cursor_functions(9s),
ws_screen_descriptor(9s)
 |
Index for Section 9 |
|
 |
Alphabetical listing for R |
|
 |
Top of page |
|