5.6 Graphics Exposure

When using XCopyArea() and XCopyPlane() to copy data from one drawable to another, it is possible that certain portions of the source region will be obscured, unmapped, or otherwise unavailable. If this is the case, it may be desirable to generate an event to signal the client that one or more areas in the destination window could not be copied to and should be redrawn some other way.

The graphics_exposures flag in the GC specifies whether or not events should be generated in such a case. There are actually two event types that can be generated if graphics_exposures is set to True:

  • One or more GraphicsExpose events are sent when a destination region cannot be completely drawn because the source region was obscured, unmapped, or otherwise unavailable.

  • A single NoExpose event occurs when the specified source region is completely available.

These event types are not selected by XSelectInput() or in the event_mask attribute; setting graphics_exposures to True is the only way to select them. The graphics_exposures member of the GC can be set with XSetGraphicsExposures().

Figure 5-18 shows a typical XCopyArea() request where the source region is obscured. It shows the areas that would be specified in the GraphicsExpose events generated.

As shown in Figure 5-18, a single XCopyPlane() or XCopyArea() can result in more than one GraphicsExpose event, since the resulting area to be redrawn may be composed of several rectangles. A copy such as the one shown in Figure 5-18 would ...

Get XLIB Programming Manual, Rel. 5, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.