https://www.x.org/releases/X11R7.7/doc/xproto/x11protocol.html#requests:CopyArea
does not specify what happens when src-drawable and dst-drawable are
the same, and the source rectangle overlaps with the destination
rectangle.
I would like to efficiently scroll a rectangle within my drawable by a specified amount. That is: shift all the pixels in the rectangle in
the horizontal and/or vertical direction by some specified
amount. Afterwards there will be some exposed part of the rectangle
that I'll proceed and render appropriately, but for now I'm trying to determine what is the most efficient way to scroll the rectangle.
Sam <sam@email-scan.com> writes:
I would like to efficiently scroll a rectangle within my drawable by a specified amount. That is: shift all the pixels in the rectangle in
the horizontal and/or vertical direction by some specified
amount. Afterwards there will be some exposed part of the rectangle
that I'll proceed and render appropriately, but for now I'm trying to determine what is the most efficient way to scroll the rectangle.
In any of X11R{5,6,7}, I've been able to use XCopyArea to scroll
overlapping areas up, down, right, left, or obliquely just fine. I
suspect XCopyArea checks the relative positions and copies in the
appropriate order to make copying work.
If your virtual object is smaller than (Dimension) x (Dimension), you
could consider using an Xt widget, and then "scrolling" it by using XtMoveWidget (which conveniently also moves any subwidgets), and by processing Expose and GraphicsExpose events (which you probably have to handle anyway).
If your virtual object is larger, especially if there are any windows or widgets covering the region to be scrolled, then scrolling pixels in a
way that looks nice is harder.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 349 |
Nodes: | 16 (0 / 16) |
Uptime: | 139:36:34 |
Calls: | 7,613 |
Calls today: | 1 |
Files: | 12,789 |
Messages: | 5,684,291 |