Skip to Main Content
Volume 7A: XView Programming Manual
book

Volume 7A: XView Programming Manual

by Dan Heller
October 1994
Intermediate to advanced content levelIntermediate to advanced
770 pages
22h 58m
English
O'Reilly Media, Inc.
Content preview from Volume 7A: XView Programming Manual
Example 21-1. The color_logo.c program (continued)
xlogo64_bits, xlogo64_width, xlogo64_height);
/* setup gc for rendering logos to screen */
gcvalues.graphics_exposures = False;
gcvalues.background = pixel_table[WHITE];
gc = XCreateGC(xv_get(frame, XV_DISPLAY), xv_get(frame, XV_XID),
GCBackground | GCGraphicsExposures, &gcvalues);
xv_main_loop(frame);
}
/* Draws onto the canvas using Xlib drawing functions.
* Draw the X logo into the window in three colors. In each case,
* change the GC’s foreground color to the pixel value specified.
*/
void
canvas_repaint_proc(canvas, pw, display, win, xrects)
Canvas canvas; /* unused */
Xv_Window pw; /* unused */
Display *display;
Window win;
Xv_xrectlist *xrects; /* unused */
{
/* Use XCopyPlane because the logo is a 1-bit deep pixmap. */
XSetForeground(display, gc, pixel_table[RED]);
XCopyPlane(display, xlogo, win, gc, 0, 0,
xlogo64_width, xlogo64_height, 64, 64, 1);
XSetForeground(display, gc, pixel_table[GREEN]);
XCopyPlane(display, xlogo, win, gc, 0, 0,
xlogo64_width, xlogo64_height, 192, 64, 1);
XSetForeground(display, gc, pixel_table[BLUE]);
XCopyPlane(display, xlogo, win, gc, 0, 0,
xlogo64_width, xlogo64_height, 320, 64, 1);
}
Example 21-1 uses Xlib routines to draw into the canvas’s paint window. Therefore, the GC’s
foreground color is set to an index from the colormap being used by that paint window. In
order to get the correct color from the colormap, we need
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Volume 6A: Motif Programming Manual

Volume 6A: Motif Programming Manual

David Brennan, Dan Heller, Paula Ferguson
Java™ Media APIs: Cross-Platform Imaging, Media, and Visualization

Java™ Media APIs: Cross-Platform Imaging, Media, and Visualization

Alejandro Terrazas, John Ostuni, Michael Barlow

Publisher Resources

ISBN: 9780937175873