Module Functions and Constants

Module Functions

cairo.cairo_version()
Returns:the encoded version
Return type:int

Returns the version of the underlying C cairo library, encoded in a single integer.

cairo.cairo_version_string()
Returns:the encoded version
Return type:str

Returns the version of the underlying C cairo library as a human-readable string of the form “X.Y.Z”.

Module Constants

cairo.version

the pycairo version, as a string

cairo.version_info

the pycairo version, as a tuple

cairo.HAS

1 if the feature is present in the underlying C cairo library, 0 otherwise.

cairo.HAS_ATSUI_FONT
cairo.HAS_FT_FONT
cairo.HAS_GLITZ_SURFACE
cairo.HAS_IMAGE_SURFACE
cairo.HAS_PDF_SURFACE
cairo.HAS_PNG_FUNCTIONS
cairo.HAS_PS_SURFACE
cairo.HAS_RECORDING_SURFACE
cairo.HAS_SVG_SURFACE
cairo.HAS_USER_FONT
cairo.HAS_QUARTZ_SURFACE
cairo.HAS_WIN32_FONT
cairo.HAS_WIN32_SURFACE
cairo.HAS_XCB_SURFACE
cairo.HAS_XLIB_SURFACE
cairo.HAS_MIME_SURFACE

New in version 1.12.0.

cairo.HAS_SCRIPT_SURFACE

New in version 1.12.0.

cairo.HAS_TEE_SURFACE

New in version 1.15.3.

cairo.MIME_TYPE

cairo.MIME_TYPE_JP2 = "image/jp2"

The Joint Photographic Experts Group (JPEG) 2000 image coding standard (ISO/IEC 15444-1).

New in version 1.12.0.

cairo.MIME_TYPE_JPEG = "image/jpeg"

The Joint Photographic Experts Group (JPEG) image coding standard (ISO/IEC 10918-1).

New in version 1.12.0.

cairo.MIME_TYPE_PNG = "image/png"

The Portable Network Graphics image file format (ISO/IEC 15948).

New in version 1.12.0.

cairo.MIME_TYPE_URI = "text/x-uri"

URI for an image file (unofficial MIME type).

New in version 1.12.0.

cairo.MIME_TYPE_UNIQUE_ID = "application/x-cairo.uuid"

Unique identifier for a surface (cairo specific MIME type). All surfaces with the same unique identifier will only be embedded once.

New in version 1.12.0.

Other Classes and Functions

class cairo.text

This type only exists for documentation purposes. It represents str/unicode under Python 2 and str under Python 3.

class cairo.pathlike

This type only exists for documentation purposes. It represents everything Python allows as a filesystem path except on Windows where only ANSI paths are supported. To use Unicode paths on Windows most functions take an already open file object which you can create from a Unicode path and then pass to pycairo instead.

New in version 1.15.1: Older versions only supported a subset of str paths