Module bitmapscroller
BitmapScroller -- a container for viewing bitmapped images.
This control is designed to be a generic bitmap viewer that can scroll
to handle large images. In addition, user interaction with the bitmap
is possible through the use of subclasses of the MouseSelector class.
Currently, a crosshair selector and a rubber band selector are
provided, with others to follow.
Coordinate systems
==================
Event coords are in terms of a fixed viewport the size of the client
area of the window containing the scrolled window. The scrolled
window itself has an origin that can be negative relative to this
viewport.
World coordinates are in terms of the size of canvas of the scrolled
window itself, not the smaller size of the viewport onto the scrolled
window. The size of the scrolled window's canvas is determined by the
scaled size of the bitmap containing it.
Coordinate systems example
--------------------------
If the original bitmap is 100 pixels wide and 200 pixels high, and the
zoom factor is 4, the size of both the scaled image and the scrolled
window canvas will be 400 x 800 pixels. If the viewport of the
scrolled window is 200 x 300, some of the scaled bitmap won't be
displayed.
+-------------+
| |--- scaled bitmap
| +------+ |
| | | |
| | |----- scrolled window viewport at location (x, y) of the bitmap
| | | |
| +------+ |
| |
+-------------+
Again, world coordinates are in terms of the scaled bitmap, but event
coordinates are in terms of the viewport. An event coordinate of (0,
0) actually occurs at (x, y) on the bitmap.
@author: Rob McMullen
@version: 0.5
Changelog:
0.4:
* added methods to allow programmatic specification of rubberband
* added setSelection to Rubberband
* added startSelector to BitmapScroller
0.5:
* changed to wx.Overlay for drawing (instead of XOR)
|
|
normalizeBox(box)
Convert any negative measurements in the current box to positive, and
adjust the origin. |
|
|
|
|
boxToExtent(box)
Convert a box specification to an extent specification. |
|
|
|
|
pointInBox(x,
y,
box)
Return True if the given point is contained in the box. |
|
|
|
|
pointOnBox(x,
y,
box,
thickness=1)
Return True if the point is on the outside edge of the box. |
|
|
|
Convert a box specification to an extent specification. I put this
into a seperate function after I realized that I had been implementing it
wrong in several places.
|
pointOnBox(x,
y,
box,
thickness=1)
|
|
Return True if the point is on the outside edge of the box. The
thickness defines how thick the edge should be. This is necessary for
HCI reasons: For example, it's normally very difficult for a user to
manuever the mouse onto a one pixel border.
|
EVT_CROSSHAIR_MOTION
- Value:
<wx._core.PyEventBinder object at 0x6323810>
|
|
EVT_RUBBERBAND_MOTION
- Value:
<wx._core.PyEventBinder object at 0x6323890>
|
|
EVT_RUBBERBAND_SIZE
- Value:
<wx._core.PyEventBinder object at 0x6323850>
|
|