cairo.global
Global functions for cairo1 library
fn create debugResetStaticData fontOptionsCreate formatStrideForWidth getUserData glyphAllocate imageSurfaceCreate imageSurfaceCreateFromPng imageSurfaceCreateFromPngStream imageSurfaceGetData imageSurfaceGetFormat imageSurfaceGetHeight imageSurfaceGetStride imageSurfaceGetWidth meshPatternBeginPatch meshPatternCurveTo meshPatternEndPatch meshPatternGetControlPoint meshPatternGetCornerColorRgba meshPatternGetPatchCount meshPatternGetPath meshPatternLineTo meshPatternMoveTo meshPatternSetControlPoint meshPatternSetCornerColorRgb meshPatternSetCornerColorRgba patternCreateForSurface patternCreateLinear patternCreateMesh patternCreateRadial patternCreateRasterSource patternCreateRgb patternCreateRgba pdfGetVersions pdfSurfaceAddOutline pdfSurfaceCreate pdfSurfaceCreateForStream pdfSurfaceRestrictToVersion pdfSurfaceSetCustomMetadata pdfSurfaceSetMetadata pdfSurfaceSetPageLabel pdfSurfaceSetSize pdfSurfaceSetThumbnailSize pdfVersionToString psGetLevels psLevelToString psSurfaceCreate psSurfaceCreateForStream psSurfaceDscBeginPageSetup psSurfaceDscBeginSetup psSurfaceDscComment psSurfaceGetEps psSurfaceRestrictToLevel psSurfaceSetEps psSurfaceSetSize rasterSourcePatternGetCallbackData rasterSourcePatternSetCallbackData recordingSurfaceCreate recordingSurfaceGetExtents recordingSurfaceInkExtents regionCreate regionCreateRectangle regionCreateRectangles scaledFontCreate scriptCreate scriptCreateForStream scriptFromRecordingSurface scriptGetMode scriptSetMode scriptSurfaceCreate scriptSurfaceCreateForTarget scriptWriteComment statusToString svgGetVersions svgSurfaceCreate svgSurfaceCreateForStream svgSurfaceGetDocumentUnit svgSurfaceRestrictToVersion svgSurfaceSetDocumentUnit svgVersionToString teeSurfaceAdd teeSurfaceCreate teeSurfaceIndex teeSurfaceRemove textClusterAllocate toyFontFaceCreate toyFontFaceGetFamily toyFontFaceGetSlant toyFontFaceGetWeight userFontFaceCreate userScaledFontGetForegroundMarker userScaledFontGetForegroundSource version_ versionString
Functions 94
fn
cairo.context.Context create(cairo.surface.Surface target)Creates a new #cairot 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...fn
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.fn
cairo.font_options.FontOptions fontOptionsCreate()Allocates a new font options object with all options initialized to default values. Returns: a newly allocated #cairofontoptionst. Free with [cairo.fontoptions.FontOptions.destroy]. This function a...fn
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:fn
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.fn
cairo.glyph.Glyph glyphAllocate(int numGlyphs)Allocates an array of #cairoglypht's. This function is only useful in implementations of #cairouserscaledfonttexttoglyphsfunct where the user needs to allocate an array of glyphs that cairo will fr...fn
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 ...fn
cairo.surface.Surface imageSurfaceCreateFromPng(string filename)Creates a new image surface and initializes the contents to the given PNG file.fn
cairo.surface.Surface imageSurfaceCreateFromPngStream(cairo.types.ReadFunc readFunc)Creates a new image surface from PNG data read incrementally via the read_func function.fn
ubyte * imageSurfaceGetData(cairo.surface.Surface surface)Get a pointer to the data of the image surface, for direct inspection or modification.fn
cairo.types.Format imageSurfaceGetFormat(cairo.surface.Surface surface)Get the format of the surface.fn
int imageSurfaceGetHeight(cairo.surface.Surface surface)Get the height of the image surface in pixels.fn
int imageSurfaceGetStride(cairo.surface.Surface surface)Get the stride of the image surface in bytesfn
int imageSurfaceGetWidth(cairo.surface.Surface surface)Get the width of the image surface in pixels.fn
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.fn
void meshPatternEndPatch(cairo.pattern.Pattern pattern)Indicates the end of the current patch in a mesh pattern.fn
cairo.types.Status meshPatternGetControlPoint(cairo.pattern.Pattern pattern, uint patchNum, uint pointNum, out double x, out double y)Gets the control point pointnum of patch patchnum for a mesh pattern.fn
cairo.types.Status meshPatternGetCornerColorRgba(cairo.pattern.Pattern pattern, uint patchNum, uint cornerNum, out double red, out double green, out double blue, out double alpha)Gets the color information in corner cornernum of patch patchnum for a mesh pattern.fn
cairo.types.Status meshPatternGetPatchCount(cairo.pattern.Pattern pattern, out uint count)Gets the number of patches specified in the given mesh pattern.fn
cairo.path.Path meshPatternGetPath(cairo.pattern.Pattern pattern, uint patchNum)Gets path defining the patch patch_num for a mesh pattern.fn
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.fn
void meshPatternMoveTo(cairo.pattern.Pattern pattern, double x, double y)Define the first point of the current patch in a mesh pattern.fn
void meshPatternSetControlPoint(cairo.pattern.Pattern pattern, uint pointNum, double x, double y)Set an internal control point of the current patch.fn
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.fn
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.fn
cairo.pattern.Pattern patternCreateForSurface(cairo.surface.Surface surface)Create a new #cairopatternt for the given surface.fn
cairo.pattern.Pattern patternCreateLinear(double x0, double y0, double x1, double y1)Create a new linear gradient #cairopatternt 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.Patte...fn
cairo.pattern.Pattern patternCreateRadial(double cx0, double cy0, double radius0, double cx1, double cy1, double radius1)Creates a new radial gradient #cairopatternt 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 de...fn
cairo.pattern.Pattern patternCreateRasterSource(void * userData, cairo.types.Content content, int width, int height)Creates a new user pattern for providing pixel data.fn
cairo.pattern.Pattern patternCreateRgb(double red, double green, double blue)Creates a new #cairopatternt 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 cla...fn
cairo.pattern.Pattern patternCreateRgba(double red, double green, double blue, double alpha)Creates a new #cairopatternt 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...fn
void pdfGetVersions(out cairo.types.PdfVersion[] versions)Used to retrieve the list of supported versions. See [cairo.global.pdfSurfaceRestrictToVersion].fn
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 linkattribs. Link attributes have the same keys and values as the [Link Tag][link], excludin...fn
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.fn
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.fn
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.fn
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", "Tra...fn
void pdfSurfaceSetMetadata(cairo.surface.Surface surface, cairo.types.PdfMetadata metadata, string utf8)Set document metadata. The `CAIROPDFMETADATACREATEDATE` and `CAIROPDFMETADATAMODDATE` values must be in ISO-8601 format: YYYY-MM-DDThh:mm:ss. An optional timezone of the form "[+/-]hh:mm" or "Z" fo...fn
void pdfSurfaceSetPageLabel(cairo.surface.Surface surface, string utf8)Set page label for the current page.fn
void pdfSurfaceSetSize(cairo.surface.Surface surface, double widthInPoints, double heightInPoints)Changes the size of a PDF surface for the current (and subsequent) pages.fn
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.fn
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.fn
void psGetLevels(out cairo.types.PsLevel[] levels)Used to retrieve the list of supported levels. See [cairo.global.psSurfaceRestrictToLevel].fn
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.fn
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 ...fn
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 convenien...fn
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.fn
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.fn
void psSurfaceDscComment(cairo.surface.Surface surface, string comment)Emit a comment into the PostScript output for the given surface.fn
cairo.types.Bool psSurfaceGetEps(cairo.surface.Surface surface)Check whether the PostScript surface will output Encapsulated PostScript.fn
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.fn
void psSurfaceSetEps(cairo.surface.Surface surface, cairo.types.Bool eps)If eps is true, the PostScript surface will output Encapsulated PostScript.fn
void psSurfaceSetSize(cairo.surface.Surface surface, double widthInPoints, double heightInPoints)Changes the size of a PostScript surface for the current (and subsequent) pages.fn
void * rasterSourcePatternGetCallbackData(cairo.pattern.Pattern pattern)Queries the current user data.fn
void rasterSourcePatternSetCallbackData(cairo.pattern.Pattern pattern, void * data = null)Updates the user data that is provided to all callbacks.fn
cairo.surface.Surface recordingSurfaceCreate(cairo.types.Content content, cairo.types.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 showtextglyphs). The recording surface can t...fn
cairo.types.Bool recordingSurfaceGetExtents(cairo.surface.Surface surface, out cairo.types.Rectangle extents)Get the extents of the recording-surface.fn
void recordingSurfaceInkExtents(cairo.surface.Surface surface, out double x0, out double y0, out double width, out 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...fn
cairo.region.Region regionCreate()Allocates a new empty region object. Returns: A newly allocated #cairoregiont. Free with [cairo.region.Region.destroy]. This function always returns a valid pointer; if memory cannot be allocated, ...fn
cairo.region.Region regionCreateRectangle(cairo.types.RectangleInt rectangle)Allocates a new region object containing rectangle.fn
cairo.region.Region regionCreateRectangles(cairo.types.RectangleInt rects, int count)Allocates a new region object containing the union of all given rects.fn
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 #cairoscaledfont_t object from a font face and matrices that describe the size of the font and the environment in which it will be used.fn
cairo.device.Device scriptCreate(string filename)Creates a output device for emitting the script, used when creating the individual surfaces.fn
cairo.device.Device scriptCreateForStream(cairo.types.WriteFunc writeFunc)Creates a output device for emitting the script, used when creating the individual surfaces.fn
cairo.types.Status scriptFromRecordingSurface(cairo.device.Device script, cairo.surface.Surface recordingSurface)Converts the record operations in recording_surface into a script.fn
cairo.types.ScriptMode scriptGetMode(cairo.device.Device script)Queries the script for its current output mode.fn
void scriptSetMode(cairo.device.Device script, cairo.types.ScriptMode mode)Change the output mode of the scriptfn
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 scriptfn
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.fn
void scriptWriteComment(cairo.device.Device script, string comment)Emit a string verbatim into the script.fn
string statusToString(cairo.types.Status status)Provides a human-readable description of a #cairostatust.fn
void svgGetVersions(out cairo.types.SvgVersion[] versions)Used to retrieve the list of supported versions. See [cairo.global.svgSurfaceRestrictToVersion].fn
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.fn
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.fn
cairo.types.SvgUnit svgSurfaceGetDocumentUnit(cairo.surface.Surface surface)Get the unit of the SVG surface.fn
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.fn
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 #cairosvgunit_t for a list of available unit values that can be used here.fn
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.fn
void teeSurfaceAdd(cairo.surface.Surface abstractSurface, cairo.surface.Surface target)Adds a new target surface to the list of replicas of a tee surface.fn
cairo.surface.Surface teeSurfaceIndex(cairo.surface.Surface abstractSurface, uint index)Retrieves the replica surface at the given index.fn
void teeSurfaceRemove(cairo.surface.Surface abstractSurface, cairo.surface.Surface target)Removes the given surface from the list of replicas of a tee surface.fn
cairo.text_cluster.TextCluster textClusterAllocate(int numClusters)Allocates an array of #cairotextclustert's. This function is only useful in implementations of #cairouserscaledfonttexttoglyphsfunc_t where the user needs to allocate an array of text clusters that...fn
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.fn
cairo.types.FontSlant toyFontFaceGetSlant(cairo.font_face.FontFace fontFace)Gets the slant a toy font.fn
cairo.types.FontWeight toyFontFaceGetWeight(cairo.font_face.FontFace fontFace)Gets the weight a toy font.fn
cairo.pattern.Pattern userScaledFontGetForegroundMarker(cairo.scaled_font.ScaledFont scaledFont)Gets the foreground pattern of the glyph currently being rendered. A #cairouserscaledfontrenderglyphfunc_t function that has been set with [cairo.global.userFontFaceSetRenderColorGlyphFunc] may cal...fn
cairo.pattern.Pattern userScaledFontGetForegroundSource(cairo.scaled_font.ScaledFont scaledFont)Gets the foreground pattern of the glyph currently being rendered. A #cairouserscaledfontrenderglyphfunc_t function that has been set with [cairo.global.userFontFaceSetRenderColorGlyphFunc] may cal...fn
int version_()Returns the version of the cairo library encoded in a single integer as per `CAIROVERSIONENCODE`. The encoding ensures that later versions compare greater than earlier versions.fn
string versionString()Returns the version of the cairo library as a human-readable string of the form "X.Y.Z".