cairo.global

Undocumented in source.

Members

Functions

create
cairo.context.Context create(cairo.surface.Surface target)

Creates a new #cairo_t with all graphics state parameters set to default values and with target as a target surface. The target surface should be constructed with a backend-specific function such as cairo.global.imageSurfaceCreate (or any other <function>cairo_<emphasis>backend</emphasis>_surface_create(<!-- -->)</function> variant).

debugResetStaticData
void debugResetStaticData()

Resets all static data within cairo to its original state, (ie. identical to the state at the time of program invocation). For example, all caches within cairo will be flushed empty.

fontOptionsCreate
cairo.font_options.FontOptions fontOptionsCreate()

Allocates a new font options object with all options initialized to default values.

formatStrideForWidth
int formatStrideForWidth(cairo.types.Format format, int width)

This function 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:

getUserData
void* getUserData(cairo.context.Context cr, cairo.types.UserDataKey key)

Return user data previously attached to cr using the specified key. If no user data has been attached with the given key this function returns null.

glyphAllocate
cairo.glyph.Glyph glyphAllocate(int numGlyphs)

Allocates an array of #cairo_glyph_t's. This function is only useful in implementations of #cairo_user_scaled_font_text_to_glyphs_func_t where the user needs to allocate an array of glyphs that cairo will free. For all other uses, user can use their own allocation method for glyphs.

imageSurfaceCreate
cairo.surface.Surface imageSurfaceCreate(cairo.types.Format format, int width, int height)

Creates an image surface of the specified format and dimensions. Initially the surface contents are set to 0. (Specifically, within each pixel, each color or alpha channel belonging to format will be 0. The contents of bits within a pixel, but not belonging to the given format are undefined).

imageSurfaceCreateFromPng
cairo.surface.Surface imageSurfaceCreateFromPng(string filename)

Creates a new image surface and initializes the contents to the given PNG file.

imageSurfaceCreateFromPngStream
cairo.surface.Surface imageSurfaceCreateFromPngStream(cairo.types.ReadFunc readFunc)

Creates a new image surface from PNG data read incrementally via the read_func function.

imageSurfaceGetData
ubyte* imageSurfaceGetData(cairo.surface.Surface surface)

Get a pointer to the data of the image surface, for direct inspection or modification.

imageSurfaceGetFormat
cairo.types.Format imageSurfaceGetFormat(cairo.surface.Surface surface)

Get the format of the surface.

imageSurfaceGetHeight
int imageSurfaceGetHeight(cairo.surface.Surface surface)

Get the height of the image surface in pixels.

imageSurfaceGetStride
int imageSurfaceGetStride(cairo.surface.Surface surface)

Get the stride of the image surface in bytes

imageSurfaceGetWidth
int imageSurfaceGetWidth(cairo.surface.Surface surface)

Get the width of the image surface in pixels.

meshPatternBeginPatch
void meshPatternBeginPatch(cairo.pattern.Pattern pattern)

Begin a patch in a mesh pattern.

meshPatternCurveTo
void meshPatternCurveTo(cairo.pattern.Pattern pattern, double x1, double y1, double x2, double y2, double x3, double y3)

Adds a cubic Bézier spline to the current patch from the current point to position (x3, y3) in pattern-space coordinates, using (x1, y1) and (x2, y2) as the control points.

meshPatternEndPatch
void meshPatternEndPatch(cairo.pattern.Pattern pattern)

Indicates the end of the current patch in a mesh pattern.

meshPatternGetControlPoint
cairo.types.Status meshPatternGetControlPoint(cairo.pattern.Pattern pattern, uint patchNum, uint pointNum, double x, double y)

Gets the control point point_num of patch patch_num for a mesh pattern.

meshPatternGetCornerColorRgba
cairo.types.Status meshPatternGetCornerColorRgba(cairo.pattern.Pattern pattern, uint patchNum, uint cornerNum, double red, double green, double blue, double alpha)

Gets the color information in corner corner_num of patch patch_num for a mesh pattern.

meshPatternGetPatchCount
cairo.types.Status meshPatternGetPatchCount(cairo.pattern.Pattern pattern, uint count)

Gets the number of patches specified in the given mesh pattern.

meshPatternGetPath
cairo.path.Path meshPatternGetPath(cairo.pattern.Pattern pattern, uint patchNum)

Gets path defining the patch patch_num for a mesh pattern.

meshPatternLineTo
void meshPatternLineTo(cairo.pattern.Pattern pattern, double x, double y)

Adds a line to the current patch from the current point to position (x, y) in pattern-space coordinates.

meshPatternMoveTo
void meshPatternMoveTo(cairo.pattern.Pattern pattern, double x, double y)

Define the first point of the current patch in a mesh pattern.

meshPatternSetControlPoint
void meshPatternSetControlPoint(cairo.pattern.Pattern pattern, uint pointNum, double x, double y)

Set an internal control point of the current patch.

meshPatternSetCornerColorRgb
void meshPatternSetCornerColorRgb(cairo.pattern.Pattern pattern, uint cornerNum, double red, double green, double blue)

Sets the color of a corner of the current patch in a mesh pattern.

meshPatternSetCornerColorRgba
void meshPatternSetCornerColorRgba(cairo.pattern.Pattern pattern, uint cornerNum, double red, double green, double blue, double alpha)

Sets the color of a corner of the current patch in a mesh pattern.

patternCreateForSurface
cairo.pattern.Pattern patternCreateForSurface(cairo.surface.Surface surface)

Create a new #cairo_pattern_t for the given surface.

patternCreateLinear
cairo.pattern.Pattern patternCreateLinear(double x0, double y0, double x1, double y1)

Create a new linear gradient #cairo_pattern_t along the line defined by (x0, y0) and (x1, y1). Before using the gradient pattern, a number of color stops should be defined using cairo.pattern.Pattern.addColorStopRgb or cairo.pattern.Pattern.addColorStopRgba.

patternCreateMesh
cairo.pattern.Pattern patternCreateMesh()

Create a new mesh pattern.

patternCreateRadial
cairo.pattern.Pattern patternCreateRadial(double cx0, double cy0, double radius0, double cx1, double cy1, double radius1)

Creates a new radial gradient #cairo_pattern_t between the two circles defined by (cx0, cy0, radius0) and (cx1, cy1, radius1). Before using the gradient pattern, a number of color stops should be defined using cairo.pattern.Pattern.addColorStopRgb or cairo.pattern.Pattern.addColorStopRgba.

patternCreateRasterSource
cairo.pattern.Pattern patternCreateRasterSource(void* userData, cairo.types.Content content, int width, int height)

Creates a new user pattern for providing pixel data.

patternCreateRgb
cairo.pattern.Pattern patternCreateRgb(double red, double green, double blue)

Creates a new #cairo_pattern_t corresponding to an opaque color. The color components are floating point numbers in the range 0 to 1. If the values passed in are outside that range, they will be clamped.

patternCreateRgba
cairo.pattern.Pattern patternCreateRgba(double red, double green, double blue, double alpha)

Creates a new #cairo_pattern_t corresponding to a translucent color. The color components are floating point numbers in the range 0 to 1. If the values passed in are outside that range, they will be clamped.

pdfGetVersions
void pdfGetVersions(cairo.types.PdfVersion[] versions)

Used to retrieve the list of supported versions. See cairo.global.pdfSurfaceRestrictToVersion.

pdfSurfaceAddOutline
int pdfSurfaceAddOutline(cairo.surface.Surface surface, int parentId, string utf8, string linkAttribs, cairo.types.PdfOutlineFlags flags)

Add an item to the document outline hierarchy with the name utf8 that links to the location specified by link_attribs. Link attributes have the same keys and values as the [Link Tag]link, excluding the "rect" attribute. The item will be a child of the item with id parent_id. Use CAIRO_PDF_OUTLINE_ROOT as the parent id of top level items.

pdfSurfaceCreate
cairo.surface.Surface pdfSurfaceCreate(string filename, double widthInPoints, double heightInPoints)

Creates a PDF surface of the specified size in points to be written to filename.

pdfSurfaceCreateForStream
cairo.surface.Surface pdfSurfaceCreateForStream(cairo.types.WriteFunc writeFunc, double widthInPoints, double heightInPoints)

Creates a PDF surface of the specified size in points to be written incrementally to the stream represented by write_func and closure.

pdfSurfaceRestrictToVersion
void pdfSurfaceRestrictToVersion(cairo.surface.Surface surface, cairo.types.PdfVersion version_)

Restricts the generated PDF file to version. See cairo.global.pdfGetVersions for a list of available version values that can be used here.

pdfSurfaceSetCustomMetadata
void pdfSurfaceSetCustomMetadata(cairo.surface.Surface surface, string name, string value)

Set custom document metadata. name may be any string except for the following names reserved by PDF: "Title", "Author", "Subject", "Keywords", "Creator", "Producer", "CreationDate", "ModDate", "Trapped".

pdfSurfaceSetMetadata
void pdfSurfaceSetMetadata(cairo.surface.Surface surface, cairo.types.PdfMetadata metadata, string utf8)

Set document metadata. The CAIRO_PDF_METADATA_CREATE_DATE and CAIRO_PDF_METADATA_MOD_DATE values must be in ISO-8601 format: YYYY-MM-DDThh:mm:ss. An optional timezone of the form "[+/-]hh:mm" or "Z" for UTC time can be appended. All other metadata values can be any UTF-8 string.

pdfSurfaceSetPageLabel
void pdfSurfaceSetPageLabel(cairo.surface.Surface surface, string utf8)

Set page label for the current page.

pdfSurfaceSetSize
void pdfSurfaceSetSize(cairo.surface.Surface surface, double widthInPoints, double heightInPoints)

Changes the size of a PDF surface for the current (and subsequent) pages.

pdfSurfaceSetThumbnailSize
void pdfSurfaceSetThumbnailSize(cairo.surface.Surface surface, int width, int height)

Set the thumbnail image size for the current and all subsequent pages. Setting a width or height of 0 disables thumbnails for the current and subsequent pages.

pdfVersionToString
string pdfVersionToString(cairo.types.PdfVersion version_)

Get the string representation of the given version id. This function will return null if version isn't valid. See cairo.global.pdfGetVersions for a way to get the list of valid version ids.

psGetLevels
void psGetLevels(cairo.types.PsLevel[] levels)

Used to retrieve the list of supported levels. See cairo.global.psSurfaceRestrictToLevel.

psLevelToString
string psLevelToString(cairo.types.PsLevel level)

Get the string representation of the given level id. This function will return null if level id isn't valid. See cairo.global.psGetLevels for a way to get the list of valid level ids.

psSurfaceCreate
cairo.surface.Surface psSurfaceCreate(string filename, double widthInPoints, double heightInPoints)

Creates a PostScript surface of the specified size in points to be written to filename. See cairo.global.psSurfaceCreateForStream for a more flexible mechanism for handling the PostScript output than simply writing it to a named file.

psSurfaceCreateForStream
cairo.surface.Surface psSurfaceCreateForStream(cairo.types.WriteFunc writeFunc, double widthInPoints, double heightInPoints)

Creates a PostScript surface of the specified size in points to be written incrementally to the stream represented by write_func and closure. See cairo.global.psSurfaceCreate for a more convenient way to simply direct the PostScript output to a named file.

psSurfaceDscBeginPageSetup
void psSurfaceDscBeginPageSetup(cairo.surface.Surface surface)

This function indicates that subsequent calls to cairo.global.psSurfaceDscComment should direct comments to the PageSetup section of the PostScript output.

psSurfaceDscBeginSetup
void psSurfaceDscBeginSetup(cairo.surface.Surface surface)

This function indicates that subsequent calls to cairo.global.psSurfaceDscComment should direct comments to the Setup section of the PostScript output.

psSurfaceDscComment
void psSurfaceDscComment(cairo.surface.Surface surface, string comment)

Emit a comment into the PostScript output for the given surface.

psSurfaceGetEps
cairo.types.Bool psSurfaceGetEps(cairo.surface.Surface surface)

Check whether the PostScript surface will output Encapsulated PostScript.

psSurfaceRestrictToLevel
void psSurfaceRestrictToLevel(cairo.surface.Surface surface, cairo.types.PsLevel level)

Restricts the generated PostSript file to level. See cairo.global.psGetLevels for a list of available level values that can be used here.

psSurfaceSetEps
void psSurfaceSetEps(cairo.surface.Surface surface, cairo.types.Bool eps)

If eps is true, the PostScript surface will output Encapsulated PostScript.

psSurfaceSetSize
void psSurfaceSetSize(cairo.surface.Surface surface, double widthInPoints, double heightInPoints)

Changes the size of a PostScript surface for the current (and subsequent) pages.

rasterSourcePatternGetCallbackData
void* rasterSourcePatternGetCallbackData(cairo.pattern.Pattern pattern)

Queries the current user data.

rasterSourcePatternSetCallbackData
void rasterSourcePatternSetCallbackData(cairo.pattern.Pattern pattern, void* data)

Updates the user data that is provided to all callbacks.

recordingSurfaceCreate
cairo.surface.Surface recordingSurfaceCreate(cairo.types.Content content, cairo.rectangle.Rectangle extents)

Creates a recording-surface which can be used to record all drawing operations at the highest level (that is, the level of paint, mask, stroke, fill and show_text_glyphs). The recording surface can then be "replayed" against any target surface by using it as a source to drawing operations.

recordingSurfaceGetExtents
cairo.types.Bool recordingSurfaceGetExtents(cairo.surface.Surface surface, cairo.rectangle.Rectangle extents)

Get the extents of the recording-surface.

recordingSurfaceInkExtents
void recordingSurfaceInkExtents(cairo.surface.Surface surface, double x0, double y0, double width, double height)

Measures the extents of the operations stored within the recording-surface. This is useful to compute the required size of an image surface (or equivalent) into which to replay the full sequence of drawing operations.

regionCreate
cairo.region.Region regionCreate()

Allocates a new empty region object.

regionCreateRectangle
cairo.region.Region regionCreateRectangle(cairo.rectangle_int.RectangleInt rectangle)

Allocates a new region object containing rectangle.

regionCreateRectangles
cairo.region.Region regionCreateRectangles(cairo.rectangle_int.RectangleInt rects, int count)

Allocates a new region object containing the union of all given rects.

scaledFontCreate
cairo.scaled_font.ScaledFont scaledFontCreate(cairo.font_face.FontFace fontFace, cairo.matrix.Matrix fontMatrix, cairo.matrix.Matrix ctm, cairo.font_options.FontOptions options)

Creates a #cairo_scaled_font_t object from a font face and matrices that describe the size of the font and the environment in which it will be used.

scriptCreate
cairo.device.Device scriptCreate(string filename)

Creates a output device for emitting the script, used when creating the individual surfaces.

scriptCreateForStream
cairo.device.Device scriptCreateForStream(cairo.types.WriteFunc writeFunc)

Creates a output device for emitting the script, used when creating the individual surfaces.

scriptFromRecordingSurface
cairo.types.Status scriptFromRecordingSurface(cairo.device.Device script, cairo.surface.Surface recordingSurface)

Converts the record operations in recording_surface into a script.

scriptGetMode
cairo.types.ScriptMode scriptGetMode(cairo.device.Device script)

Queries the script for its current output mode.

scriptSetMode
void scriptSetMode(cairo.device.Device script, cairo.types.ScriptMode mode)

Change the output mode of the script

scriptSurfaceCreate
cairo.surface.Surface scriptSurfaceCreate(cairo.device.Device script, cairo.types.Content content, double width, double height)

Create a new surface that will emit its rendering through script

scriptSurfaceCreateForTarget
cairo.surface.Surface scriptSurfaceCreateForTarget(cairo.device.Device script, cairo.surface.Surface target)

Create a pxoy surface that will render to target and record the operations to device.

scriptWriteComment
void scriptWriteComment(cairo.device.Device script, string comment)

Emit a string verbatim into the script.

statusToString
string statusToString(cairo.types.Status status)

Provides a human-readable description of a #cairo_status_t.

svgGetVersions
void svgGetVersions(cairo.types.SvgVersion[] versions)

Used to retrieve the list of supported versions. See cairo.global.svgSurfaceRestrictToVersion.

svgSurfaceCreate
cairo.surface.Surface svgSurfaceCreate(string filename, double widthInPoints, double heightInPoints)

Creates a SVG surface of the specified size in points to be written to filename.

svgSurfaceCreateForStream
cairo.surface.Surface svgSurfaceCreateForStream(cairo.types.WriteFunc writeFunc, double widthInPoints, double heightInPoints)

Creates a SVG surface of the specified size in points to be written incrementally to the stream represented by write_func and closure.

svgSurfaceGetDocumentUnit
cairo.types.SvgUnit svgSurfaceGetDocumentUnit(cairo.surface.Surface surface)

Get the unit of the SVG surface.

svgSurfaceRestrictToVersion
void svgSurfaceRestrictToVersion(cairo.surface.Surface surface, cairo.types.SvgVersion version_)

Restricts the generated SVG file to version. See cairo.global.svgGetVersions for a list of available version values that can be used here.

svgSurfaceSetDocumentUnit
void svgSurfaceSetDocumentUnit(cairo.surface.Surface surface, cairo.types.SvgUnit unit)

Use the specified unit for the width and height of the generated SVG file. See #cairo_svg_unit_t for a list of available unit values that can be used here.

svgVersionToString
string svgVersionToString(cairo.types.SvgVersion version_)

Get the string representation of the given version id. This function will return null if version isn't valid. See cairo.global.svgGetVersions for a way to get the list of valid version ids.

teeSurfaceAdd
void teeSurfaceAdd(cairo.surface.Surface abstractSurface, cairo.surface.Surface target)

Adds a new target surface to the list of replicas of a tee surface.

teeSurfaceCreate
cairo.surface.Surface teeSurfaceCreate(cairo.surface.Surface primary)

Creates a new "tee" surface.

teeSurfaceIndex
cairo.surface.Surface teeSurfaceIndex(cairo.surface.Surface abstractSurface, uint index)

Retrieves the replica surface at the given index.

teeSurfaceRemove
void teeSurfaceRemove(cairo.surface.Surface abstractSurface, cairo.surface.Surface target)

Removes the given surface from the list of replicas of a tee surface.

textClusterAllocate
cairo.text_cluster.TextCluster textClusterAllocate(int numClusters)

Allocates an array of #cairo_text_cluster_t's. This function is only useful in implementations of #cairo_user_scaled_font_text_to_glyphs_func_t where the user needs to allocate an array of text clusters that cairo will free. For all other uses, user can use their own allocation method for text clusters.

toyFontFaceCreate
cairo.font_face.FontFace toyFontFaceCreate(string family, cairo.types.FontSlant slant, cairo.types.FontWeight weight)

Creates a font face from a triplet of family, slant, and weight. These font faces are used in implementation of the #cairo_t "toy" font API.

toyFontFaceGetFamily
string toyFontFaceGetFamily(cairo.font_face.FontFace fontFace)

Gets the family name of a toy font.

toyFontFaceGetSlant
cairo.types.FontSlant toyFontFaceGetSlant(cairo.font_face.FontFace fontFace)

Gets the slant a toy font.

toyFontFaceGetWeight
cairo.types.FontWeight toyFontFaceGetWeight(cairo.font_face.FontFace fontFace)

Gets the weight a toy font.

userFontFaceCreate
cairo.font_face.FontFace userFontFaceCreate()

Creates a new user font-face.

userScaledFontGetForegroundMarker
cairo.pattern.Pattern userScaledFontGetForegroundMarker(cairo.scaled_font.ScaledFont scaledFont)

Gets the foreground pattern of the glyph currently being rendered. A #cairo_user_scaled_font_render_glyph_func_t function that has been set with cairo.global.userFontFaceSetRenderColorGlyphFunc may call this function to retrieve the current foreground pattern for the glyph being rendered. The function should not be called outside of a cairo.global.userFontFaceSetRenderColorGlyphFunc callback.

userScaledFontGetForegroundSource
cairo.pattern.Pattern userScaledFontGetForegroundSource(cairo.scaled_font.ScaledFont scaledFont)

Gets the foreground pattern of the glyph currently being rendered. A #cairo_user_scaled_font_render_glyph_func_t function that has been set with cairo.global.userFontFaceSetRenderColorGlyphFunc may call this function to retrieve the current foreground pattern for the glyph being rendered. The function should not be called outside of a cairo.global.userFontFaceSetRenderColorGlyphFunc callback.

versionString
string versionString()

Returns the version of the cairo library as a human-readable string of the form "X.Y.Z".

version_
int version_()

Returns the version of the cairo library encoded in a single integer as per CAIRO_VERSION_ENCODE. The encoding ensures that later versions compare greater than earlier versions.