xdwlib package¶
Submodules¶
xdwlib.annotatable module¶
xdwlib.annotation module¶
xdwlib.basedocument module¶
xdwlib.binder module¶
xdwlib.bitmap module¶
xdwlib.common module¶
xdwlib.document module¶
xdwlib.documentinbinder module¶
xdwlib.observer module¶
xdwlib.page module¶
xdwlib.struct module¶
struct.py -- Point and Rect
Copyright (C) 2010 HAYASHI Hideki <hideki@hayasix.com> All rights reserved.
This software is subject to the provisions of the Zope Public License, Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
- class xdwlib.struct.Point(x, y)¶
ベースクラス:
PointPoint represented by 2D coordinate.
>>> p = Point(0, 10) >>> p Point(0.00, 10.00) >>> p + Point(5, 10) Point(5.00, 20.00) >>> p - Point(5, 10) Point(-5.00, 0.00) >>> -p Point(0.00, -10.00) >>> p * 2 Point(0.00, 20.00) >>> p / 2 Point(0.00, 5.00) >>> p.shift(Point(20, 30)) Point(20.00, 40.00) >>> p.shift([20, 30]) Point(20.00, 40.00) >>> p.shift(20) Point(20.00, 10.00) >>> list(p) [0, 10] >>> p == Point(0, 10) True >>> p != Point(0, 10) False >>> p == Point(5, 10) False >>> p != Point(5, 10) True >>> bool(p) True >>> bool(Point(0, 0)) False >>> p.rotate(30) Point(-5.00, 8.66) >>> p.rotate(30, origin=Point(10, 10)) Point(1.34, 5.00)
- ceil()¶
- fix()¶
- floor()¶
- int()¶
- rotate(degree, origin=None)¶
- round(places=0)¶
- shift(pnt, _y=0)¶
- class xdwlib.struct.Rect(left, top, right, bottom)¶
ベースクラス:
_RectHalf-open rectangular region.
A region is represented by half-open coodinate intervals. Left-top coordinate is inclusive but right-bottom one is exclusive.
>>> r = Rect(0, 10, 20, 30) >>> r Rect(0.00, 10.00, 20.00, 30.00) >>> r.position() Point(0.00, 10.00) >>> r.size() Point(20.00, 20.00) >>> r.shift(Point(15, 25)) Rect(15.00, 35.00, 35.00, 55.00) >>> r * 2 Rect(0.00, 10.00, 40.00, 50.00) >>> r / 2 Rect(0.00, 10.00, 10.00, 20.00) >>> list(r) [0, 10, 20, 30] >>> r == Rect(0, 10, 20, 30) True >>> r != Rect(0, 10, 20, 30) False >>> r.position() Point(0.00, 10.00) >>> r.size() Point(20.00, 20.00) >>> r.position_and_size() (Point(0.00, 10.00), Point(20.00, 20.00))
- closed()¶
Get closed version i.e. rigit-bottom is included.
- fix()¶
Special method to adapt to XDW_RECT.
- half_open()¶
Get half-open version i.e. right-bottom is excluded.
- int()¶
Special method to adapt to XDW_RECT.
- position()¶
- position_and_size()¶
- rotate(degree, origin=None)¶
- shift(pnt, _y=0)¶
- size()¶