Skip to content

FL.Canvas

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 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 width (integer, read-only) - width of the canvas in pixels height (integer, read-only) - height of the canvas in pixels 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:

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) 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, Pioint p, int mode) - puts Image i at the selected point

Native bases: object

Captured native MRO: Canvas, object

Native new allocation evidence (not an init overload): (args, *kwargs) Create and return a new object. See help(type) for accurate signature.

Complete member index

Every captured member retains its own identity. Identical captured declaration text is linked once; this does not establish native inheritance or interchangeable objects.

Member Kind Signature Summary
Convert function (self, *args: Any, **kwargs: Any) -> Any Native FL.Canvas.Convert; argument details are not documented.
CurveTo function (self, *args: Any, **kwargs: Any) -> Any Native FL.Canvas.CurveTo; argument details are not documented.
Ellipse function (self, *args: Any, **kwargs: Any) -> Any Native FL.Canvas.Ellipse; argument details are not documented.
FillGlyph function (self, *args: Any, **kwargs: Any) -> Any Native FL.Canvas.FillGlyph; argument details are not documented.
FitGlyph function (self, *args: Any, **kwargs: Any) -> Any Native FL.Canvas.FitGlyph; argument details are not documented.
LineTo function (self, *args: Any, **kwargs: Any) -> Any Native FL.Canvas.LineTo; argument details are not documented.
MoveTo function (self, *args: Any, **kwargs: Any) -> Any Native FL.Canvas.MoveTo; argument details are not documented.
OutlineGlyph function (self, *args: Any, **kwargs: Any) -> Any Native FL.Canvas.OutlineGlyph; argument details are not documented.
PutImage function (self, *args: Any, **kwargs: Any) -> Any Native FL.Canvas.PutImage; argument details are not documented.
Rectangle function (self, *args: Any, **kwargs: Any) -> Any Native FL.Canvas.Rectangle; argument details are not documented.
SplineTo function (self, *args: Any, **kwargs: Any) -> Any Native FL.Canvas.SplineTo; argument details are not documented.
TextOut function (self, *args: Any, **kwargs: Any) -> Any Native FL.Canvas.TextOut; argument details are not documented.
UnConvert function (self, *args: Any, **kwargs: Any) -> Any Native FL.Canvas.UnConvert; argument details are not documented.
__init__ function (self, /, *args: Any, **kwargs: Any) -> None Initialize self. (shared captured text)