Canvas
===============================================
Canvas - class to represent screen paint area and operations
===============================================
This class can perform automatic coordinates transformations,
so you can draw in Glyph coordinate space or, if you prefer,
in screen coordinates directly
Use constants defined for FontLab module in Fldict to assign attributes
to Canvas object
CONSTRUCTOR
++ Never create Canvas object explicitly - they must be obtained from the FontLab's
window classes
Canvas() - generic constructor, creates an empty Canvas
Canvas(Canvas) - copy constructor
ATTRIBUTES
delta (Point) - horizontal shift during coordinates
transformation
scale (Point(float)) - scaling during coordinates transformation
parent (read-only) - parent object
draw_style (integer, write-only) - sets current drawing mode (copy, XOR,
invert etc.)
pen_color (integer, write-only) - sets current pen color
pen_style (integer, write-only) - sets current pen style (solid, dashed etc.)
brush_color (integer, write-only) - sets current brush color
brush_style (integer, write-only) - sets current brush style (solid, patterned etc.)
text_color (integer, write-only) - sets color for a text
bk_color (integer, write-only) - sets color for a text background
bk_mode (integer, write-only) - sets background mode for a text output
(transparent or opaque)
OPERATIONS
none
METHODS
MoveTo(Point p) | (x, y) - moves current position to p
or (x, y) coordinates
LineTo(Point p) | (x, y) - draws a straight line to the position p
or (x, y) coordinates
CurveTo(Point p0, Point p1, Point p2) - draws a 3th-order Bezier curve
from the current point to points p0, p1, p2
SplineTo(Point p0, Point p1) - draws a 2th-order Bezier curve
from the current point to points p0, p1
Ellipse(Rect r) | (Point p0, Point p1) | (x0, y0, x1, y1)
- draws a filled ellipse
defined by the Rect r,
points p0 and p1
or set of coordinates
Rectangle(Rect r) | (Point p0, Point p1) | (x0, y0, x1, y1)
- draws a filled rectangle
defined by the Rect r,
points p0 and p1
or set of coordinates
Convert(Point p) - converts coordinates
from the source coordinate space
to screen coordinates
UnConvert(Point p) - converts screen coordinates
to the currently defined coordinate space
FitGlyph(Rect r, Glyph g) | (Rect r, Glyph g, WeightVector w)
- recalculates parameters
of coordinate conversion function
to fit glyph g into rectangle r
using currently selected options.
FillGlyph(Glyph g) | (Glyph g, WeightVector w)
- fills the glyph g using current
coordinate transformation.
OutlineGlyph(Glyph g) | (Glyph g, WeightVector w)
- draws the glyph g outline using current
coordinate transformation.
TextOut(Point p, string s) | (x, y, string s)
- draws the string s in the position p or (x, y)
PutImage(Image i, Point p) | (Image i, Point p, int mode)
- puts Image i at the selected point