The module provides some vector drawing functions.
New in version 0.3.0.
(collections.Sequence) The attribute names of font metrics.
(collections.Sequence) The list of text align types.
(collections.Sequence) The list of text decoration types.
(collections.Sequence) The list of text gravity types.
Drawing object. It maintains several vector drawing instructions and can get drawn into zero or more Image objects by calling it.
For example, the following code draws a diagonal line to the image:
with Drawing() as draw:
draw.line((0, 0), image.size)
draw(image)
Parameters: | drawing (Drawing) – an optional drawing object to clone. use clone() method rathan than this parameter |
---|
New in version 0.3.0.
Renders the current drawing into the image. You can simply call Drawing instance rather than calling this method. That means the following code which calls Drawing object itself:
drawing(image)
is equivalent to the following code which calls draw() method:
drawing.draw(image)
Parameters: | image (Image) – the image to be drawn |
---|
(basestring) The current font name. It also can be set.
(numbers.Real) The font size. It also can be set.
Queries font metrics from the given text.
Parameters: |
|
---|
(basestring) The text placement gravity used when annotating with text. It’s a string from GRAVITY_TYPES list. It also can be set.
Draws a line start to end.
Parameters: |
|
---|
Draws a rectangle using the current stoke_color, stroke_width, and fill_color.
+--------------------------------------------------+
| ^ ^ |
| | | |
| top | |
| | | |
| v | |
| <-- left --> +-------------------+ bottom |
| | ^ | | |
| | <-- width --|---> | | |
| | height | | |
| | | | | |
| | v | | |
| +-------------------+ v |
| <--------------- right ----------> |
+--------------------------------------------------+
Parameters: |
|
---|
New in version 0.3.6.
(numbers.Real) The stroke width. It also can be set.
New in version 0.3.3.
Writes a text body into (x, y).
Parameters: |
|
---|
(basestring) The current text alignment setting. It’s a string value from TEXT_ALIGN_TYPES list. It also can be set.
(bool) The boolean value which represents whether antialiasing is used for text rendering. It also can be set to True or False to switch the setting.
(basestring) The text decoration setting, a string from TEXT_DECORATION_TYPES list. It also can be set.
(basestring) The internally used text encoding setting. Although it also can be set, but it’s not encorouged.
(numbers.Real) The setting of the text line spacing. It also can be set.
(numbers.Real) The setting of the word spacing. It also can be set.
(numbers.Real) The setting of the text kerning. It also can be set.
The tuple subtype which consists of font metrics data.
Alias for field number 2
Alias for field number 1
Alias for field number 0
Alias for field number 3
Alias for field number 6
Alias for field number 5
Alias for field number 4
Alias for field number 11
Alias for field number 7
Alias for field number 9
Alias for field number 12
Alias for field number 8
Alias for field number 10