wand.drawing
— Drawings¶
The module provides some vector drawing functions.
New in version 0.3.0.
- wand.drawing.CLIP_PATH_UNITS = ('undefined_path_units', 'user_space', 'user_space_on_use', 'object_bounding_box')¶
(
collections.abc.Sequence
) The list of clip path units'undefined_path_units'
'user_space'
'user_space_on_use'
'object_bounding_box'
- class wand.drawing.Drawing(drawing=None)¶
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. useclone()
method rather than this parameter
New in version 0.3.0.
- affine(matrix)¶
Adjusts the current affine transformation matrix with the specified affine transformation matrix. Note that the current affine transform is adjusted rather than replaced.
| sx rx 0 | | x', y', 1 | = | x, y, 1 | * | ry sy 0 | | tx ty 1 |
- Parameters:
matrix (
collections.abc.Sequence
) – a list ofReal
to define affine matrix[sx, rx, ry, sy, tx, ty]
New in version 0.4.0.
- alpha(x=None, y=None, paint_method='undefined')¶
Paints on the image’s opacity channel in order to set effected pixels to transparent.
To influence the opacity of pixels. The available methods are:
'undefined'
'point'
'replace'
'floodfill'
'filltoborder'
'reset'
Note
This method replaces
matte()
in ImageMagick version 7. AnAttributeError
will be raised if attempting to call on a library withoutDrawAlpha
support.New in version 0.5.0.
- arc(start, end, degree)¶
Draws a arc using the current
stroke_color
,stroke_width
, andfill_color
.- Parameters:
start (
Sequence
) – (Real
,numbers.Real
) pair which represents starting x and y of the arcend (
Sequence
) – (Real
,numbers.Real
) pair which represents ending x and y of the arcdegree (
Sequence
) – (Real
,numbers.Real
) pair which represents starting degree, and ending degree
New in version 0.4.0.
- bezier(points=None)¶
Draws a bezier curve through a set of points on the image, using the specified array of coordinates.
At least four points should be given to complete a bezier path. The first & forth point being the start & end point, and the second & third point controlling the direction & curve.
Example bezier on
image
with Drawing() as draw: points = [(40,10), # Start point (20,50), # First control (90,10), # Second control (70,40)] # End point draw.stroke_color = Color('#000') draw.fill_color = Color('#fff') draw.bezier(points) draw.draw(image)
- Parameters:
points (
list
) – list of x,y tuples
New in version 0.4.0.
- property border_color¶
(
Color
) the current border color. It also can be set. This attribute controls the behavior ofcolor()
during'filltoborder'
operation.New in version 0.4.0.
- c_clear_exception = <_FuncPtr object>¶
(
ctypes.CFUNCTYPE
) Thectypes
function that clears an exception of theresource
.Note
It is an abstract attribute that has to be implemented in the subclass.
- c_destroy_resource = <_FuncPtr object>¶
(
ctypes.CFUNCTYPE
) Thectypes
function that destroys theresource
.Note
It is an abstract attribute that has to be implemented in the subclass.
- c_get_exception = <_FuncPtr object>¶
(
ctypes.CFUNCTYPE
) Thectypes
function that gets an exception from theresource
.Note
It is an abstract attribute that has to be implemented in the subclass.
- c_is_resource = <_FuncPtr object>¶
(
ctypes.CFUNCTYPE
) Thectypes
predicate function that returns whether the given pointer (that contains a resource data usually) is a valid resource.Note
It is an abstract attribute that has to be implemented in the subclass.
- circle(origin, perimeter)¶
Draws a circle from
origin
toperimeter
- Parameters:
origin (
collections.abc.Sequence
) – (Real
,numbers.Real
) pair which represents origin x and y of circleperimeter (
collections.abc.Sequence
) – (Real
,numbers.Real
) pair which represents perimeter x and y of circle
New in version 0.4.0.
- property clip_path¶
(
basestring
) The current clip path. It also can be set.New in version 0.4.0.
- property clip_rule¶
(
basestring
) The current clip rule. It also can be set. It’s a string value fromFILL_RULE_TYPES
list.New in version 0.4.0.
- property clip_units¶
(
basestring
) The current clip units. It also can be set. It’s a string value fromCLIP_PATH_UNITS
list.New in version 0.4.0.
- color(x=0.0, y=0.0, paint_method='undefined')¶
Draws a color on the image using current fill color, starting at specified position & method.
Available methods in
wand.drawing.PAINT_METHOD_TYPES
:'undefined'
'point'
'replace'
'floodfill'
'filltoborder'
'reset'
New in version 0.4.0.
- comment(message=None)¶
Adds a comment to the vector stream.
- Parameters:
message (
basestring
) – the comment to set.
New in version 0.4.0.
- composite(operator, left, top, width, height, image)¶
Composites an image onto the current image, using the specified composition operator, specified position, and at the specified size.
- Parameters:
operator – the operator that affects how the composite is applied to the image. available values can be found in the
COMPOSITE_OPERATORS
listtype –
COMPOSITE_OPERATORS
left (
numbers.Real
) – the column offset of the composited drawing sourcetop (
numbers.Real
) – the row offset of the composited drawing sourcewidth (
numbers.Real
) – the total columns to include in the composited sourceheight (
numbers.Real
) – the total rows to include in the composited source
New in version 0.4.0.
- draw(image)¶
Renders the current drawing into the
image
. You can simply callDrawing
instance rather than calling this method. That means the following code which callsDrawing
object itself:drawing(image)
is equivalent to the following code which calls
draw()
method:drawing.draw(image)
- Parameters:
image (
BaseImage
) – the image to be drawn
- ellipse(origin, radius, rotation=None)¶
Draws a ellipse at
origin
with independent x & yradius
. Ellipse can be partial by setting start & endrotation
.- Parameters:
origin (
collections.abc.Sequence
) – (Real
,numbers.Real
) pair which represents origin x and y of circleradius (
collections.abc.Sequence
) – (Real
,numbers.Real
) pair which represents radius x and radius y of circlerotation (
collections.abc.Sequence
) – (Real
,numbers.Real
) pair which represents start and end of ellipse. Default (0,360)
New in version 0.4.0.
- property fill_rule¶
(
basestring
) The current fill rule. It can also be set. It’s a string value fromFILL_RULE_TYPES
list.New in version 0.4.0.
- property font¶
(
basestring
) The current font name. It also can be set.
- property font_family¶
(
basestring
) The current font family. It also can be set.New in version 0.4.0.
- property font_resolution¶
(
Sequence
) The current font resolution. It also can be set.New in version 0.4.0.
- property font_size¶
(
numbers.Real
) The font size. It also can be set.
- property font_stretch¶
(
basestring
) The current font stretch variation. It also can be set, but will only apply if the font-family or encoder supports the stretch type.New in version 0.4.0.
- property font_style¶
(
basestring
) The current font style. It also can be set, but will only apply if the font-family supports the style.New in version 0.4.0.
- get_font_metrics(image, text, multiline=False)¶
Queries font metrics by cloning the
image
, and rendering thetext
with the font properties defined onDrawing
.This is useful for determining the size of the rendered text. Set
multiline
toTrue
if the giventext
contains line-breaks.The return value is an instance of
FontMetrics
which has the attributes of the text’s rendered size, max horizontal advance, and distance of ascent & descent from the baseline.- Parameters:
image (
BaseImage
) – the image to be drawntext (
basestring
) – the text string for get font metrics.multiline (boolean) – text is multiline or not
- Returns:
New in version 0.3.0.
- property gravity¶
(
basestring
) The text placement gravity used when annotating with text. It’s a string fromGRAVITY_TYPES
list. It also can be set.
- line(start, end)¶
Draws a line
start
toend
.- Parameters:
start (
collections.abc.Sequence
) – (Integral
,numbers.Integral
) pair which represents starting x and y of the lineend (
collections.abc.Sequence
) – (Integral
,numbers.Integral
) pair which represents ending x and y of the line
- matte(x=0.0, y=0.0, paint_method='undefined')¶
Paints on the image’s opacity channel in order to set effected pixels to transparent.
To influence the opacity of pixels. The available methods are:
'undefined'
'point'
'replace'
'floodfill'
'filltoborder'
'reset'
Note
This method has been replace by
alpha()
in ImageMagick version 7. AnAttributeError
will be raised if attempting to call on a library withoutDrawMatte
support.New in version 0.4.0.
- property opacity¶
(
Real
) returns the opacity used when drawing with the fill or stroke color or texture. Fully opaque is 1.0. This method only affects vector graphics, and is experimental. To set the opacity of a drawing, useDrawing.fill_opacity
&Drawing.stroke_opacity
New in version 0.4.0.
- path_close()¶
Adds a path element to the current path which closes the current subpath by drawing a straight line from the current point to the current subpath’s most recent starting point.
New in version 0.4.0.
- path_curve(to=None, controls=None, smooth=False, relative=False)¶
Draws a cubic Bezier curve from the current point to given
to
(x,y) coordinate usingcontrols
points at the beginning and the end of the curve. Ifsmooth
is set to True, only onecontrols
is expected and the previous control is used, else two pair of coordinates are expected to define the control points. Theto
coordinate then becomes the new current point.- Parameters:
to (
collections.abc.Sequence
) – (Real
,numbers.Real
) pair which represents coordinates to draw tocontrols (
collections.abc.Sequence
) – (Real
,numbers.Real
) coordinate to used to influence curverelative (
bool
) – treat given coordinates as relative to current point
New in version 0.4.0.
- path_curve_to_quadratic_bezier(to=None, control=None, smooth=False, relative=False)¶
Draws a quadratic Bezier curve from the current point to given
to
coordinate. The control point is assumed to be the reflection of the control point on the previous command ifsmooth
is True, else a pair ofcontrol
coordinates must be given. Each coordinates can be relative, or absolute, to the current point by setting therelative
flag. Theto
coordinate then becomes the new current point, and thecontrol
coordinate will be assumed when called again whensmooth
is set to true.- Parameters:
to (
collections.abc.Sequence
) – (Real
,numbers.Real
) pair which represents coordinates to draw tocontrol (
collections.abc.Sequence
) – (Real
,numbers.Real
) coordinate to used to influence curvesmooth (
bool
) – assume last defined control coordinaterelative (
bool
) – treat given coordinates as relative to current point
New in version 0.4.0.
- path_elliptic_arc(to=None, radius=None, rotation=0.0, large_arc=False, clockwise=False, relative=False)¶
Draws an elliptical arc from the current point to given
to
coordinates. Theto
coordinates can be relative, or absolute, to the current point by setting therelative
flag. The size and orientation of the ellipse are defined by two radii (rx, ry) inradius
and anrotation
parameters, which indicates how the ellipse as a whole is rotated relative to the current coordinate system. The center of the ellipse is calculated automagically to satisfy the constraints imposed by the other parameters.large_arc
andclockwise
contribute to the automatic calculations and help determine how the arc is drawn. Iflarge_arc
is True then draw the larger of the available arcs. Ifclockwise
is true, then draw the arc matching a clock-wise rotation.- Parameters:
to (
collections.abc.Sequence
) – (Real
,numbers.Real
) pair which represents coordinates to draw toradius (
collections.abc.Sequence
) – (Real
,numbers.Real
) pair which represents the radii of the ellipse to drawrotate (
Real
) – degree to rotate ellipse on x-axislarge_arc (
bool
) – draw largest available arcclockwise (
bool
) – draw arc path clockwise from start to targetrelative (
bool
) – treat given coordinates as relative to current point
New in version 0.4.0.
- path_finish()¶
Terminates the current path.
New in version 0.4.0.
- path_horizontal_line(x=None, relative=False)¶
Draws a horizontal line path from the current point to the target point. Given
x
parameter can be relative, or absolute, to the current point by setting therelative
flag. The target point then becomes the new current point.- Parameters:
New in version 0.4.0.
- path_line(to=None, relative=False)¶
Draws a line path from the current point to the given
to
coordinate. Theto
coordinates can be relative, or absolute, to the current point by setting therelative
flag. The coordinate then becomes the new current point.- Parameters:
to (
collections.abc.Sequence
) – (Real
,numbers.Real
) pair which represents coordinates to draw to.relative (
bool
) –bool
treat given coordinates as relative to current point
New in version 0.4.0.
- path_move(to=None, relative=False)¶
Starts a new sub-path at the given coordinates. Given
to
parameter can be relative, or absolute, by setting therelative
flag.- Parameters:
to (
collections.abc.Sequence
) – (Real
,numbers.Real
) pair which represents coordinates to draw to.relative (
bool
) –bool
treat given coordinates as relative to current point
New in version 0.4.0.
- path_start()¶
Declares the start of a path drawing list which is terminated by a matching
path_finish()
command. All other path_* commands must be enclosed between apath_start()
and apath_finish()
command. This is because path drawing commands are subordinate commands and they do not function by themselves.New in version 0.4.0.
- path_vertical_line(y=None, relative=False)¶
Draws a vertical line path from the current point to the target point. Given
y
parameter can be relative, or absolute, to the current point by setting therelative
flag. The target point then becomes the new current point.- Parameters:
New in version 0.4.0.
- point(x, y)¶
Draws a point at given
x
andy
New in version 0.4.0.
- polygon(points=None)¶
Draws a polygon using the current
stroke_color
,stroke_width
, andfill_color
, using the specified array of coordinates.Example polygon on
image
with Drawing() as draw: points = [(40,10), (20,50), (90,10), (70,40)] draw.polygon(points) draw.draw(image)
- Parameters:
points (
list
) – list of x,y tuples
New in version 0.4.0.
- polyline(points=None)¶
Draws a polyline using the current
stroke_color
,stroke_width
, andfill_color
, using the specified array of coordinates.Identical to
polygon
, but without closed stroke line.- Parameters:
points (
list
) – list of x,y tuples
New in version 0.4.0.
- pop()¶
Pop destroys the current tip of the drawing context stack, and restores the parent style context. See
push()
method for an example.Note
Popping the graphical context stack will not erase, or alter, any previously executed drawing commands.
- Returns:
success of pop operation.
- Return type:
New in version 0.4.0.
- pop_clip_path()¶
Terminates a clip path definition.
New in version 0.4.0.
- pop_defs()¶
Terminates a definition list.
New in version 0.4.0.
- pop_pattern()¶
Terminates a pattern definition.
New in version 0.4.0.
- push()¶
Grows the current drawing context stack by one, and inherits the previous style attributes. Use
Drawing.pop
to return to restore previous style attributes.This is useful for drawing shapes with different styles without repeatedly setting the similar
fill_color
&stroke_color
properties.For example:
with Drawing() as ctx: ctx.fill_color = Color('GREEN') ctx.stroke_color = Color('ORANGE') ctx.push() ctx.fill_color = Color('RED') ctx.text(x1, y1, 'this is RED with ORANGE outline') ctx.push() ctx.stroke_color = Color('BLACK') ctx.text(x2, y2, 'this is RED with BLACK outline') ctx.pop() ctx.pop() ctx.text(x3, y3, 'this is GREEN with ORANGE outline')
Which translate to the following MVG:
push graphic-context fill "GREEN" stroke "ORANGE" push graphic-context fill "RED" text x1,y1 "this is RED with ORANGE outline" push graphic-context stroke "BLACK" text x2,y2 "this is RED with BLACK outline" pop graphic-context pop graphic-context text x3,y3 "this is GREEN with ORANGE outline" pop graphic-context
Note
Pushing graphical context does not reset any previously drawn artifacts.
- Returns:
success of push operation.
- Return type:
New in version 0.4.0.
- push_clip_path(clip_mask_id)¶
Starts a clip path definition which is comprised of any number of drawing commands and terminated by a
Drawing.pop_clip_path
command.- Parameters:
clip_mask_id (
basestring
) – string identifier to associate with the clip path.
New in version 0.4.0.
- push_defs()¶
Indicates that commands up to a terminating
Drawing.pop_defs
command create named elements (e.g. clip-paths, textures, etc.) which may safely be processed earlier for the sake of efficiency.New in version 0.4.0.
- push_pattern(pattern_id, left, top, width, height)¶
Indicates that subsequent commands up to a
Drawing.pop_pattern
command comprise the definition of a named pattern. The pattern space is assigned top left corner coordinates, a width and height, and becomes its own drawing space. Anything which can be drawn may be used in a pattern definition. Named patterns may be used as stroke or brush definitions.- Parameters:
pattern_id (
basestring
) – a unique identifier for the pattern.left (
numbers.Real
) – x ordinate of top left corner.top (
numbers.Real
) – y ordinate of top left corner.width (
numbers.Real
) – width of pattern space.height (
numbers.Real
) – height of pattern space.
- Returns:
success of push operation
- Return type:
New in version 0.4.0.
- rectangle(left=None, top=None, right=None, bottom=None, width=None, height=None, radius=None, xradius=None, yradius=None)¶
Draws a rectangle using the current
stroke_color
,stroke_width
, andfill_color
.+--------------------------------------------------+ | ^ ^ | | | | | | top | | | | | | | v | | | <-- left --> +-------------------+ bottom | | | ^ | | | | | <-- width --|---> | | | | | height | | | | | | | | | | | v | | | | +-------------------+ v | | <--------------- right ----------> | +--------------------------------------------------+
- Parameters:
left (
numbers.Real
) – x-offset of the rectangle to drawtop (
numbers.Real
) – y-offset of the rectangle to drawright (
numbers.Real
) – second x-offset of the rectangle to draw. this parameter andwidth
parameter are exclusive each otherbottom (
numbers.Real
) – second y-offset of the rectangle to draw. this parameter andheight
parameter are exclusive each otherwidth (
numbers.Real
) – thewidth
of the rectangle to draw. this parameter andright
parameter are exclusive each otherheight (
numbers.Real
) – theheight
of the rectangle to draw. this parameter andbottom
parameter are exclusive each otherradius (
numbers.Real
) – the corner rounding. this is a short-cut for setting bothxradius
, andyradius
xradius (
numbers.Real
) – thexradius
corner in horizontal direction.yradius (
numbers.Real
) – theyradius
corner in vertical direction.
New in version 0.3.6.
Changed in version 0.4.0: Radius keywords added to create rounded rectangle.
- rotate(degree=0.0)¶
Applies the specified rotation to the current coordinate space.
- Parameters:
degree (
Real
) – degree to rotate
New in version 0.4.0.
- scale(x=1.0, y=1.0)¶
Adjusts the scaling factor to apply in the horizontal and vertical directions to the current coordinate space.
- Parameters:
New in version 0.4.0.
- set_fill_pattern_url(url)¶
Sets the URL to use as a fill pattern for filling objects. Only local URLs (“#identifier”) are supported at this time. These local URLs are normally created by defining a named fill pattern with Drawing.push_pattern & Drawing.pop_pattern.
- Parameters:
url (
basestring
) – URL to use to obtain fill pattern.
New in version 0.4.0.
- set_stroke_pattern_url(url)¶
Sets the pattern used for stroking object outlines. Only local URLs (“#identifier”) are supported at this time. These local URLs are normally created by defining a named stroke pattern with Drawing.push_pattern & Drawing.pop_pattern.
- Parameters:
url (
basestring
) – URL to use to obtain stroke pattern.
New in version 0.4.0.
- skew(x=None, y=None)¶
Skews the current coordinate system in the horizontal direction if
x
is given, and vertical direction ify
is given.New in version 0.4.0.
- property stroke_antialias¶
(
bool
) Controls whether stroked outlines are antialiased. Stroked outlines are antialiased by default. When antialiasing is disabled stroked pixels are thresholded to determine if the stroke color or underlying canvas color should be used.It also can be set.
New in version 0.4.0.
- property stroke_color¶
(
Color
) The current color of stroke. It also can be set.New in version 0.3.3.
- property stroke_dash_array¶
(
Sequence
) - (numbers.Real
) An array representing the pattern of dashes & gaps used to stroke paths. It also can be set.New in version 0.4.0.
- property stroke_dash_offset¶
(
numbers.Real
) The stroke dash offset. It also can be set.New in version 0.4.0.
- property stroke_line_cap¶
(
basestring
) The stroke line cap. It also can be set.New in version 0.4.0.
- property stroke_line_join¶
(
basestring
) The stroke line join. It also can be set.New in version 0.4.0.
- property stroke_miter_limit¶
(
Integral
) The current miter limit. It also can be set.New in version 0.4.0.
- property stroke_opacity¶
(
Real
) The current stroke opacity. It also can be set.New in version 0.4.0.
- property stroke_width¶
(
numbers.Real
) The stroke width. It also can be set.New in version 0.3.3.
- text(x, y, body)¶
Writes a text
body
into (x
,y
).- Parameters:
x (
numbers.Integral
) – the left offset where to start writing a texty (
numbers.Integral
) – the baseline where to start writing textbody (
basestring
) – the body string to write
- property text_alignment¶
(
basestring
) The current text alignment setting. It’s a string value fromTEXT_ALIGN_TYPES
list. It also can be set.
- property text_antialias¶
(
bool
) The boolean value which represents whether antialiasing is used for text rendering. It also can be set toTrue
orFalse
to switch the setting.
- property text_decoration¶
(
basestring
) The text decoration setting, a string fromTEXT_DECORATION_TYPES
list. It also can be set.
- property text_direction¶
(
basestring
) The text direction setting. a string fromTEXT_DIRECTION_TYPES
list. It also can be set.
- property text_encoding¶
(
basestring
) The internally used text encoding setting. Although it also can be set, but it’s not encouraged.
- property text_interline_spacing¶
(
numbers.Real
) The setting of the text line spacing. It also can be set.
- property text_interword_spacing¶
(
numbers.Real
) The setting of the word spacing. It also can be set.
- property text_kerning¶
(
numbers.Real
) The setting of the text kerning. It also can be set.
- property text_under_color¶
(
Color
) The color of a background rectangle to place under text annotations. It also can be set.
- translate(x=0.0, y=0.0)¶
Applies a translation to the current coordinate system which moves the coordinate system origin to the specified coordinate.
New in version 0.4.0.
- property vector_graphics¶
(
basestring
) The XML text of the Vector Graphics. It also can be set. The drawing-wand XML is experimental, and subject to change.Setting this property to None will reset all vector graphic properties to the default state.
New in version 0.4.0.
- viewbox(left, top, right, bottom)¶
Viewbox sets the overall canvas size to be recorded with the drawing vector data. Usually this will be specified using the same size as the canvas image. When the vector data is saved to SVG or MVG formats, the viewbox is use to specify the size of the canvas image that a viewer will render the vector data on.
- Parameters:
New in version 0.4.0.
- wand.drawing.FILL_RULE_TYPES = ('undefined', 'evenodd', 'nonzero')¶
(
collections.abc.Sequence
) The list of fill-rule types.'undefined'
'evenodd'
'nonzero'
- wand.drawing.FONT_METRICS_ATTRIBUTES = ('character_width', 'character_height', 'ascender', 'descender', 'text_width', 'text_height', 'maximum_horizontal_advance', 'x1', 'y1', 'x2', 'y2', 'x', 'y')¶
(
collections.abc.Sequence
) The attribute names of font metrics.
- class wand.drawing.FontMetrics(character_width, character_height, ascender, descender, text_width, text_height, maximum_horizontal_advance, x1, y1, x2, y2, x, y)¶
The tuple subtype which consists of font metrics data.
Pixel values can be converted to points by the following:
\[points = \frac{pixels \ast 72}{resolution}\]- character_width¶
(
numbers.Real
) The horizontal value of thex
in pixels.
- character_height¶
(
numbers.Real
) The vertical value of thex
in pixels.
- ascender¶
(
numbers.Real
) The largest distance from the text baseline to the highest point above the x-height. This value should always be positive.
- descender¶
(
numbers.Real
) The farthest distance from the text baseline to the lowest point below the x-height. This value should always be negative.
- text_width¶
(
numbers.Real
) The full width of the text.
- text_height¶
(
numbers.Real
) The full height of the text.
- maximum_horizontal_advance¶
(
numbers.Real
) The largest distance from the start of one character to the start of the following character.
- x1¶
(
numbers.Real
) The horizontal value of the bounding box’s starting corner.
- y1¶
(
numbers.Real
) The vertical value of the bounding box’s starting corner.
- x2¶
(
numbers.Real
) The horizontal value of the bounding box’s ending corner.
- y2¶
(
numbers.Real
) The vertical value of the bounding box’s ending corner.
- x¶
(
numbers.Real
) The horizontal value of the origin.
- y¶
(
numbers.Real
) The vertical value of the origin.
Note
When using
get_font_metrics()
, the returned attributesx1
,y1
,x2
,y2
,x
andy
can be ignored as they are used for internal FreeType rendering, and have no meaningful context.New in version 0.3.0.
Changed in version 0.6.8: Created sub-class of the namedtuple to improve auto-documentation.
- size()¶
Short-cut method for the width & height of the rendered text.
- Returns:
(width, height)
New in version 0.6.8.
- wand.drawing.GRAVITY_TYPES = ('forget', 'north_west', 'north', 'north_east', 'west', 'center', 'east', 'south_west', 'south', 'south_east', 'static')¶
(
collections.abc.Sequence
) The list of text gravity types.'forget'
'north_west'
'north'
'north_east'
'west'
'center'
'east'
'south_west'
'south'
'south_east'
'static'
- wand.drawing.LINE_CAP_TYPES = ('undefined', 'butt', 'round', 'square')¶
(
collections.abc.Sequence
) The list of LineCap types'undefined;
'butt'
'round'
'square'
- wand.drawing.LINE_JOIN_TYPES = ('undefined', 'miter', 'round', 'bevel')¶
(
collections.abc.Sequence
) The list of LineJoin types'undefined'
'miter'
'round'
'bevel'
- wand.drawing.PAINT_METHOD_TYPES = ('undefined', 'point', 'replace', 'floodfill', 'filltoborder', 'reset')¶
(
collections.abc.Sequence
) The list of paint method types.'undefined'
'point'
'replace'
'floodfill'
'filltoborder'
'reset'
- wand.drawing.STRETCH_TYPES = ('undefined', 'normal', 'ultra_condensed', 'extra_condensed', 'condensed', 'semi_condensed', 'semi_expanded', 'expanded', 'extra_expanded', 'ultra_expanded', 'any')¶
(
collections.abc.Sequence
) The list of stretch types for fonts'undefined;
'normal'
'ultra_condensed'
'extra_condensed'
'condensed'
'semi_condensed'
'semi_expanded'
'expanded'
'extra_expanded'
'ultra_expanded'
'any'
- wand.drawing.STYLE_TYPES = ('undefined', 'normal', 'italic', 'oblique', 'any')¶
(
collections.abc.Sequence
) The list of style types for fonts'undefined;
'normal'
'italic'
'oblique'
'any'
- wand.drawing.TEXT_ALIGN_TYPES = ('undefined', 'left', 'center', 'right')¶
(
collections.abc.Sequence
) The list of text align types.'undefined'
'left'
'center'
'right'
- wand.drawing.TEXT_DECORATION_TYPES = ('undefined', 'no', 'underline', 'overline', 'line_through')¶
(
collections.abc.Sequence
) The list of text decoration types.'undefined'
'no'
'underline'
'overline'
'line_through'
- wand.drawing.TEXT_DIRECTION_TYPES = ('undefined', 'right_to_left', 'left_to_right')¶
(
collections.abc.Sequence
) The list of text direction types.'undefined'
'right_to_left'
'left_to_right'