Enums
Before Pycairo 1.13 most of the enum values defined here where only available as constants on the module level. See Legacy Constants.
- class cairo.Antialias(value: int)
Specifies the type of antialiasing to do when rendering text or shapes.
New in version 1.13.
- BEST: cairo.Antialias = Ellipsis
Hint that the backend should render at the highest quality, sacrificing speed if necessary.
- DEFAULT: cairo.Antialias = Ellipsis
Use the default antialiasing for the subsystem and target device
- FAST: cairo.Antialias = Ellipsis
Hint that the backend should perform some antialiasing but prefer speed over quality.
- GOOD: cairo.Antialias = Ellipsis
The backend should balance quality against performance.
- GRAY: cairo.Antialias = Ellipsis
Perform single-color antialiasing (using shades of gray for black text on a white background, for example).
- NONE: cairo.Antialias = Ellipsis
Use a bilevel alpha mask
- SUBPIXEL: cairo.Antialias = Ellipsis
Perform antialiasing by taking advantage of the order of subpixel elements on devices such as LCD panels.
- class cairo.Content(value: int)
These constants are used to describe the content that a
Surface
will contain, whether color information, alpha information (translucence vs. opacity), or both.New in version 1.13.
- ALPHA: cairo.Content = Ellipsis
The surface will hold alpha content only.
- COLOR: cairo.Content = Ellipsis
The surface will hold color content only.
- COLOR_ALPHA: cairo.Content = Ellipsis
The surface will hold color and alpha content.
- class cairo.Extend(value: int)
These constants are used to describe how
Pattern
color/alpha will be determined for areas “outside” the pattern’s natural area, (for example, outside the surface bounds or outside the gradient geometry).The default extend mode is
NONE
forSurfacePattern
andPAD
forGradient
patterns.New in version 1.13.
- NONE: cairo.Extend = Ellipsis
pixels outside of the source pattern are fully transparent
- PAD: cairo.Extend = Ellipsis
pixels outside of the pattern copy the closest pixel from the source (Since 1.2; but only implemented for surface patterns since 1.6)
- REFLECT: cairo.Extend = Ellipsis
the pattern is tiled by reflecting at the edges (Implemented for surface patterns since 1.6)
- REPEAT: cairo.Extend = Ellipsis
the pattern is tiled by repeating
- class cairo.FillRule(value: int)
These constants are used to select how paths are filled. For both fill rules, whether or not a point is included in the fill is determined by taking a ray from that point to infinity and looking at intersections with the path. The ray can be in any direction, as long as it doesn’t pass through the end point of a segment or have a tricky intersection such as intersecting tangent to the path. (Note that filling is not actually implemented in this way. This is just a description of the rule that is applied.)
The default fill rule is
WINDING
.New in version 1.13.
- EVEN_ODD: cairo.FillRule = Ellipsis
Counts the total number of intersections, without regard to the orientation of the contour. If the total number of intersections is odd, the point will be filled.
- WINDING: cairo.FillRule = Ellipsis
If the path crosses the ray from left-to-right, counts +1. If the path crosses the ray from right to left, counts -1. (Left and right are determined from the perspective of looking along the ray from the starting point.) If the total count is non-zero, the point will be filled.
- class cairo.Filter(value: int)
These constants are used to indicate what filtering should be applied when reading pixel values from patterns. See
Pattern.set_filter()
for indicating the desired filter to be used with a particular pattern.New in version 1.13.
- BEST: cairo.Filter = Ellipsis
The highest-quality available, performance may not be suitable for interactive use.
- BILINEAR: cairo.Filter = Ellipsis
Linear interpolation in two dimensions
- FAST: cairo.Filter = Ellipsis
A high-performance filter, with quality similar FILTER_NEAREST
- GAUSSIAN: cairo.Filter = Ellipsis
This filter value is currently unimplemented, and should not be used in current code.
- GOOD: cairo.Filter = Ellipsis
A reasonable-performance filter, with quality similar to FILTER_BILINEAR
- NEAREST: cairo.Filter = Ellipsis
Nearest-neighbor filtering
- class cairo.FontSlant(value: int)
These constants specify variants of a
FontFace
based on their slant.New in version 1.13.
- ITALIC: cairo.FontSlant = Ellipsis
Italic font style
- NORMAL: cairo.FontSlant = Ellipsis
Upright font style
- OBLIQUE: cairo.FontSlant = Ellipsis
Oblique font style
- class cairo.FontWeight(value: int)
These constants specify variants of a
FontFace
based on their weight.New in version 1.13.
- BOLD: cairo.FontWeight = Ellipsis
Bold font weight
- NORMAL: cairo.FontWeight = Ellipsis
Normal font weight
- class cairo.Format(value: int)
These constants are used to identify the memory format of
ImageSurface
data.New entries may be added in future versions.
New in version 1.13.
- stride_for_width(width: int) int
- Parameters
width – the desired width of an
ImageSurface
to be created.- Returns
the appropriate stride to use given the desired format and width, or -1 if either the format is invalid or the width too large.
This method provides a stride value that will respect all alignment requirements of the accelerated image-rendering code within cairo. Typical usage will be of the form:
format = cairo.Format.RGB24 stride = format.stride_for_width(width) surface = cairo.ImageSurface.create_for_data( data, format, width, height, stride)
Also available under
cairo.ImageSurface.format_stride_for_width()
.New in version 1.14.
- A1: cairo.Format = Ellipsis
each pixel is a 1-bit quantity holding an alpha value. Pixels are packed together into 32-bit quantities. The ordering of the bits matches the endianess of the platform. On a big-endian machine, the first pixel is in the uppermost bit, on a little-endian machine the first pixel is in the least-significant bit.
- A8: cairo.Format = Ellipsis
each pixel is a 8-bit quantity holding an alpha value.
- ARGB32: cairo.Format = Ellipsis
each pixel is a 32-bit quantity, with alpha in the upper 8 bits, then red, then green, then blue. The 32-bit quantities are stored native-endian. Pre-multiplied alpha is used. (That is, 50% transparent red is 0x80800000, not 0x80ff0000.)
- INVALID: cairo.Format = Ellipsis
no such format exists or is supported.
- RGB16_565: cairo.Format = Ellipsis
each pixel is a 16-bit quantity with red in the upper 5 bits, then green in the middle 6 bits, and blue in the lower 5 bits.
- RGB24: cairo.Format = Ellipsis
each pixel is a 32-bit quantity, with the upper 8 bits unused. 1 Red, Green, and Blue are stored in the remaining 24 bits in that order.
- 1
Cairo operators (for example CLEAR and SRC) may overwrite unused bytes as an implementation side-effect, their values should be considered undefined.
- RGB30: cairo.Format = Ellipsis
like
RGB24
but with 10bpc.
- RGB96F: cairo.Format = Ellipsis
3 floats, R, G, B.
New in version 1.23: Only available with cairo 1.17.2+
- RGBA128F: cairo.Format = Ellipsis
4 floats, R, G, B, A.
New in version 1.23: Only available with cairo 1.17.2+
- class cairo.HintMetrics(value: int)
These constants specify whether to hint font metrics; hinting font metrics means quantizing them so that they are integer values in device space. Doing this improves the consistency of letter and line spacing, however it also means that text will be laid out differently at different zoom factors.
New in version 1.13.
- DEFAULT: cairo.HintMetrics = Ellipsis
Hint metrics in the default manner for the font backend and target device
- OFF: cairo.HintMetrics = Ellipsis
“Do not hint font metrics
- ON: cairo.HintMetrics = Ellipsis
Hint font metrics
- class cairo.HintStyle(value: int)
These constants specify the type of hinting to do on font outlines. Hinting is the process of fitting outlines to the pixel grid in order to improve the appearance of the result. Since hinting outlines involves distorting them, it also reduces the faithfulness to the original outline shapes. Not all of the outline hinting styles are supported by all font backends.
New entries may be added in future versions.
New in version 1.13.
- DEFAULT: cairo.HintStyle = Ellipsis
Use the default hint style for font backend and target device
- FULL: cairo.HintStyle = Ellipsis
Hint outlines to maximize contrast
- MEDIUM: cairo.HintStyle = Ellipsis
Hint outlines with medium strength giving a compromise between fidelity to the original shapes and contrast
- NONE: cairo.HintStyle = Ellipsis
Do not hint outlines
- SLIGHT: cairo.HintStyle = Ellipsis
Hint outlines slightly to improve contrast while retaining good fidelity to the original shapes.
- class cairo.LineCap(value: int)
These constants specify how to render the endpoints of the path when stroking.
The default line cap style is
BUTT
New in version 1.13.
- BUTT: cairo.LineCap = Ellipsis
start(stop) the line exactly at the start(end) point
- ROUND: cairo.LineCap = Ellipsis
use a round ending, the center of the circle is the end point
- SQUARE: cairo.LineCap = Ellipsis
use squared ending, the center of the square is the end point
- class cairo.LineJoin(value: int)
These constants specify how to render the junction of two lines when stroking.
The default line join style is
MITER
New in version 1.13.
- BEVEL: cairo.LineJoin = Ellipsis
use a cut-off join, the join is cut off at half the line width from the joint point
- MITER: cairo.LineJoin = Ellipsis
use a sharp (angled) corner, see
Context.set_miter_limit()
- ROUND: cairo.LineJoin = Ellipsis
use a rounded join, the center of the circle is the joint point
- class cairo.Operator(value: int)
These constants are used to set the compositing operator for all cairo drawing operations.
The default operator is
OVER
.The operators marked as unbounded modify their destination even outside of the mask layer (that is, their effect is not bound by the mask layer). However, their effect can still be limited by way of clipping.
To keep things simple, the operator descriptions here document the behavior for when both source and destination are either fully transparent or fully opaque. The actual implementation works for translucent layers too.
For a more detailed explanation of the effects of each operator, including the mathematical definitions, see https://cairographics.org/operators.
New in version 1.13.
- ADD: cairo.Operator = Ellipsis
source and destination layers are accumulated
- ATOP: cairo.Operator = Ellipsis
draw source on top of destination content and only there
- CLEAR: cairo.Operator = Ellipsis
clear destination layer (bounded)
- COLOR_BURN: cairo.Operator = Ellipsis
darkens the destination color to reflect the source color.
- COLOR_DODGE: cairo.Operator = Ellipsis
brightens the destination color to reflect the source color.
- DARKEN: cairo.Operator = Ellipsis
replaces the destination with the source if it is darker, otherwise keeps the source.
- DEST: cairo.Operator = Ellipsis
ignore the source
- DEST_ATOP: cairo.Operator = Ellipsis
leave destination on top of source content and only there (unbounded)
- DEST_IN: cairo.Operator = Ellipsis
leave destination only where there was source content (unbounded)
- DEST_OUT: cairo.Operator = Ellipsis
leave destination only where there was no source content
- DEST_OVER: cairo.Operator = Ellipsis
draw destination on top of source
- DIFFERENCE: cairo.Operator = Ellipsis
Takes the difference of the source and destination color.
- EXCLUSION: cairo.Operator = Ellipsis
Produces an effect similar to difference, but with lower contrast.
- HARD_LIGHT: cairo.Operator = Ellipsis
Multiplies or screens, dependent on source color.
- HSL_COLOR: cairo.Operator = Ellipsis
Creates a color with the hue and saturation of the source and the luminosity of the target. This preserves the gray levels of the target and is useful for coloring monochrome images or tinting color images.
- HSL_HUE: cairo.Operator = Ellipsis
Creates a color with the hue of the source and the saturation and luminosity of the target.
- HSL_LUMINOSITY: cairo.Operator = Ellipsis
Creates a color with the luminosity of the source and the hue and saturation of the target. This produces an inverse effect to
HSL_COLOR
- HSL_SATURATION: cairo.Operator = Ellipsis
Creates a color with the saturation of the source and the hue and luminosity of the target. Painting with this mode onto a gray area produces no change.
- IN: cairo.Operator = Ellipsis
draw source where there was destination content (unbounded)
- LIGHTEN: cairo.Operator = Ellipsis
replaces the destination with the source if it is lighter, otherwise keeps the source.
- MULTIPLY: cairo.Operator = Ellipsis
source and destination layers are multiplied. This causes the result to be at least as dark as the darker inputs.
- OUT: cairo.Operator = Ellipsis
draw source where there was no destination content (unbounded)
- OVER: cairo.Operator = Ellipsis
draw source layer on top of destination layer (bounded)
- OVERLAY: cairo.Operator = Ellipsis
multiplies or screens, depending on the lightness of the destination color.
- SATURATE: cairo.Operator = Ellipsis
like over, but assuming source and dest are disjoint geometries
- SCREEN: cairo.Operator = Ellipsis
source and destination are complemented and multiplied. This causes the result to be at least as light as the lighter inputs.
- SOFT_LIGHT: cairo.Operator = Ellipsis
Darkens or lightens, dependent on source color.
- SOURCE: cairo.Operator = Ellipsis
replace destination layer (bounded)
- XOR: cairo.Operator = Ellipsis
source and destination are shown where there is only one of them
- class cairo.PathDataType(value: int)
These constants are used to describe the type of one portion of a path when represented as a
Path
.New in version 1.13.
- CLOSE_PATH: cairo.PathDataType = Ellipsis
A close-path operation
- CURVE_TO: cairo.PathDataType = Ellipsis
A curve-to operation
- LINE_TO: cairo.PathDataType = Ellipsis
A line-to operation
- MOVE_TO: cairo.PathDataType = Ellipsis
A move-to operation
- class cairo.PSLevel(value: int)
These constants are used to describe the language level of the PostScript Language Reference that a generated PostScript file will conform to. Note: the constants are only defined when cairo has been compiled with PS support enabled.
New in version 1.13.
- LEVEL_2: cairo.PSLevel = Ellipsis
The language level 2 of the PostScript specification.
- LEVEL_3: cairo.PSLevel = Ellipsis
The language level 3 of the PostScript specification.
- class cairo.PDFVersion(value: int)
These constants are used to describe the version number of the PDF specification that a generated PDF file will conform to.
New in version 1.13.
- VERSION_1_4: cairo.PDFVersion = Ellipsis
The version 1.4 of the PDF specification.
- VERSION_1_5: cairo.PDFVersion = Ellipsis
The version 1.5 of the PDF specification.
- VERSION_1_6: cairo.PDFVersion = Ellipsis
The version 1.6 of the PDF specification.
New in version 1.23.0: Only available with cairo 1.17.6+
- VERSION_1_7: cairo.PDFVersion = Ellipsis
The version 1.7 of the PDF specification.
New in version 1.23.0: Only available with cairo 1.17.6+
- class cairo.SVGVersion(value: int)
These constants are used to describe the version number of the SVG specification that a generated SVG file will conform to.
New in version 1.13.
- VERSION_1_1: cairo.SVGVersion = Ellipsis
The version 1.1 of the SVG specification.
- VERSION_1_2: cairo.SVGVersion = Ellipsis
The version 1.2 of the SVG specification.
- class cairo.SubpixelOrder(value: int)
The subpixel order specifies the order of color elements within each pixel on the display device when rendering with an antialiasing mode of
Antialias.SUBPIXEL
.New in version 1.13.
- BGR: cairo.SubpixelOrder = Ellipsis
Subpixel elements are arranged horizontally with blue at the left
- DEFAULT: cairo.SubpixelOrder = Ellipsis
Use the default subpixel order for for the target device
- RGB: cairo.SubpixelOrder = Ellipsis
Subpixel elements are arranged horizontally with red at the left
- VBGR: cairo.SubpixelOrder = Ellipsis
Subpixel elements are arranged vertically with blue at the top
- VRGB: cairo.SubpixelOrder = Ellipsis
Subpixel elements are arranged vertically with red at the top
- class cairo.RegionOverlap(value: int)
New in version 1.13.
- IN: cairo.RegionOverlap = Ellipsis
The contents are entirely inside the region.
- OUT: cairo.RegionOverlap = Ellipsis
The contents are entirely outside the region.
- PART: cairo.RegionOverlap = Ellipsis
The contents are partially inside and partially outside the region.
- class cairo.Status(value: int)
New in version 1.13.
- CLIP_NOT_REPRESENTABLE: cairo.Status = Ellipsis
- DEVICE_ERROR: cairo.Status = Ellipsis
- DEVICE_FINISHED: cairo.Status = Ellipsis
- DEVICE_TYPE_MISMATCH: cairo.Status = Ellipsis
- FILE_NOT_FOUND: cairo.Status = Ellipsis
- FONT_TYPE_MISMATCH: cairo.Status = Ellipsis
- INVALID_CLUSTERS: cairo.Status = Ellipsis
- INVALID_CONTENT: cairo.Status = Ellipsis
- INVALID_DASH: cairo.Status = Ellipsis
- INVALID_DSC_COMMENT: cairo.Status = Ellipsis
- INVALID_FORMAT: cairo.Status = Ellipsis
- INVALID_INDEX: cairo.Status = Ellipsis
- INVALID_MATRIX: cairo.Status = Ellipsis
- INVALID_MESH_CONSTRUCTION: cairo.Status = Ellipsis
- INVALID_PATH_DATA: cairo.Status = Ellipsis
- INVALID_POP_GROUP: cairo.Status = Ellipsis
- INVALID_RESTORE: cairo.Status = Ellipsis
- INVALID_SIZE: cairo.Status = Ellipsis
- INVALID_SLANT: cairo.Status = Ellipsis
- INVALID_STATUS: cairo.Status = Ellipsis
- INVALID_STRIDE: cairo.Status = Ellipsis
- INVALID_STRING: cairo.Status = Ellipsis
- INVALID_VISUAL: cairo.Status = Ellipsis
- INVALID_WEIGHT: cairo.Status = Ellipsis
- JBIG2_GLOBAL_MISSING: cairo.Status = Ellipsis
New in version 1.14.
- LAST_STATUS: cairo.Status = Ellipsis
- NEGATIVE_COUNT: cairo.Status = Ellipsis
- NO_CURRENT_POINT: cairo.Status = Ellipsis
- NO_MEMORY: cairo.Status = Ellipsis
- NULL_POINTER: cairo.Status = Ellipsis
- PATTERN_TYPE_MISMATCH: cairo.Status = Ellipsis
- READ_ERROR: cairo.Status = Ellipsis
- SUCCESS: cairo.Status = Ellipsis
- SURFACE_FINISHED: cairo.Status = Ellipsis
- SURFACE_TYPE_MISMATCH: cairo.Status = Ellipsis
- TEMP_FILE_ERROR: cairo.Status = Ellipsis
- USER_FONT_ERROR: cairo.Status = Ellipsis
- USER_FONT_IMMUTABLE: cairo.Status = Ellipsis
- USER_FONT_NOT_IMPLEMENTED: cairo.Status = Ellipsis
- WRITE_ERROR: cairo.Status = Ellipsis
- TAG_ERROR: cairo.Status = Ellipsis
New in version 1.18.0: Only available with cairo 1.15.10+
- FREETYPE_ERROR: cairo.Status = Ellipsis
New in version 1.18.0: Only available with cairo 1.15.10+
- PNG_ERROR: cairo.Status = Ellipsis
New in version 1.18.0: Only available with cairo 1.15.10+
- WIN32_GDI_ERROR: cairo.Status = Ellipsis
New in version 1.18.0: Only available with cairo 1.15.10+
- DWRITE_ERROR: cairo.Status = Ellipsis
New in version 1.23.0: Only available with cairo 1.17.6+
- class cairo.ScriptMode(value: int)
A set of script output variants.
New in version 1.14.
- ASCII: cairo.ScriptMode = Ellipsis
the output will be in readable text (default)
- BINARY: cairo.ScriptMode = Ellipsis
the output will use byte codes.
- class cairo.TextClusterFlags(value: int)
Specifies properties of a text cluster mapping.
New in version 1.14.
- BACKWARD: cairo.TextClusterFlags = Ellipsis
The clusters in the cluster array map to glyphs in the glyph array from end to start.
- class cairo.SurfaceObserverMode(value: int)
Whether operations should be recorded.
New in version 1.14.
- NORMAL: cairo.SurfaceObserverMode = Ellipsis
no recording is done
- RECORD_OPERATIONS: cairo.SurfaceObserverMode = Ellipsis
operations are recorded
- class cairo.PDFOutlineFlags(value: int)
PDFOutlineFlags
is used by thePDFSurface.add_outline()
method to specify the attributes of an outline item. These flags may be bitwise-or’d to produce any combination of flags.New in version 1.18.0: Only available with cairo 1.15.10+
- OPEN: cairo.PDFOutlineFlags = Ellipsis
The outline item defaults to open in the PDF viewer
- BOLD: cairo.PDFOutlineFlags = Ellipsis
The outline item is displayed by the viewer in bold text
- ITALIC: cairo.PDFOutlineFlags = Ellipsis
The outline item is displayed by the viewer in italic text
- class cairo.SVGUnit(value: int)
SVGUnit
is used to describe the units valid for coordinates and lengths in the SVG specification.See also:
New in version 1.18.0: Only available with cairo 1.15.10+
- USER: cairo.SVGUnit = Ellipsis
User unit, a value in the current coordinate system. If used in the root element for the initial coordinate systems it corresponds to pixels.
- EM: cairo.SVGUnit = Ellipsis
The size of the element’s font.
- EX: cairo.SVGUnit = Ellipsis
The x-height of the element’s font.
- PX: cairo.SVGUnit = Ellipsis
Pixels (1px = 1/96th of 1in).
- IN: cairo.SVGUnit = Ellipsis
Inches (1in = 2.54cm = 96px)
- CM: cairo.SVGUnit = Ellipsis
Centimeters (1cm = 96px/2.54).
- MM: cairo.SVGUnit = Ellipsis
Millimeters (1mm = 1/10th of 1cm).
- PT: cairo.SVGUnit = Ellipsis
Points (1pt = 1/72th of 1in).
- PC: cairo.SVGUnit = Ellipsis
Picas (1pc = 1/6th of 1in).
- PERCENT: cairo.SVGUnit = Ellipsis
Percent, a value that is some fraction of another reference value.
- class cairo.PDFMetadata(value: int)
PDFMetadata
is used by thePDFSurface.set_metadata()
method to specify the metadata to set.New in version 1.18.0: Only available with cairo 1.15.10+
- TITLE: cairo.PDFMetadata = Ellipsis
The document title
- AUTHOR: cairo.PDFMetadata = Ellipsis
The document author
- SUBJECT: cairo.PDFMetadata = Ellipsis
The document subject
- KEYWORDS: cairo.PDFMetadata = Ellipsis
The document keywords
- CREATOR: cairo.PDFMetadata = Ellipsis
The document creator
- CREATE_DATE: cairo.PDFMetadata = Ellipsis
The document creation date
- MOD_DATE: cairo.PDFMetadata = Ellipsis
The document modification date