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

fncairo.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...
fnvoid 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.
fncairo.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...
fnint 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:
fnvoid * 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.
fncairo.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...
fncairo.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 ...
fncairo.surface.Surface imageSurfaceCreateFromPng(string filename)Creates a new image surface and initializes the contents to the given PNG file.
fncairo.surface.Surface imageSurfaceCreateFromPngStream(cairo.types.ReadFunc readFunc)Creates a new image surface from PNG data read incrementally via the read_func function.
fnubyte * imageSurfaceGetData(cairo.surface.Surface surface)Get a pointer to the data of the image surface, for direct inspection or modification.
fncairo.types.Format imageSurfaceGetFormat(cairo.surface.Surface surface)Get the format of the surface.
fnint imageSurfaceGetHeight(cairo.surface.Surface surface)Get the height of the image surface in pixels.
fnint imageSurfaceGetStride(cairo.surface.Surface surface)Get the stride of the image surface in bytes
fnint imageSurfaceGetWidth(cairo.surface.Surface surface)Get the width of the image surface in pixels.
fnvoid meshPatternBeginPatch(cairo.pattern.Pattern pattern)Begin a patch in a mesh pattern.
fnvoid 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.
fnvoid meshPatternEndPatch(cairo.pattern.Pattern pattern)Indicates the end of the current patch in a mesh pattern.
fncairo.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.
fncairo.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.
fncairo.types.Status meshPatternGetPatchCount(cairo.pattern.Pattern pattern, out uint count)Gets the number of patches specified in the given mesh pattern.
fncairo.path.Path meshPatternGetPath(cairo.pattern.Pattern pattern, uint patchNum)Gets path defining the patch patch_num for a mesh pattern.
fnvoid 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.
fnvoid meshPatternMoveTo(cairo.pattern.Pattern pattern, double x, double y)Define the first point of the current patch in a mesh pattern.
fnvoid meshPatternSetControlPoint(cairo.pattern.Pattern pattern, uint pointNum, double x, double y)Set an internal control point of the current patch.
fnvoid 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.
fnvoid 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.
fncairo.pattern.Pattern patternCreateForSurface(cairo.surface.Surface surface)Create a new #cairopatternt for the given surface.
fncairo.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...
fncairo.pattern.Pattern patternCreateMesh()Create a new mesh pattern.
fncairo.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...
fncairo.pattern.Pattern patternCreateRasterSource(void * userData, cairo.types.Content content, int width, int height)Creates a new user pattern for providing pixel data.
fncairo.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...
fncairo.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...
fnvoid pdfGetVersions(out cairo.types.PdfVersion[] versions)Used to retrieve the list of supported versions. See [cairo.global.pdfSurfaceRestrictToVersion].
fnint 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...
fncairo.surface.Surface pdfSurfaceCreate(string filename, double widthInPoints, double heightInPoints)Creates a PDF surface of the specified size in points to be written to filename.
fncairo.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.
fnvoid 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.
fnvoid 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...
fnvoid 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...
fnvoid pdfSurfaceSetPageLabel(cairo.surface.Surface surface, string utf8)Set page label for the current page.
fnvoid pdfSurfaceSetSize(cairo.surface.Surface surface, double widthInPoints, double heightInPoints)Changes the size of a PDF surface for the current (and subsequent) pages.
fnvoid 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.
fnstring 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.
fnvoid psGetLevels(out cairo.types.PsLevel[] levels)Used to retrieve the list of supported levels. See [cairo.global.psSurfaceRestrictToLevel].
fnstring 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.
fncairo.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 ...
fncairo.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...
fnvoid 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.
fnvoid 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.
fnvoid psSurfaceDscComment(cairo.surface.Surface surface, string comment)Emit a comment into the PostScript output for the given surface.
fncairo.types.Bool psSurfaceGetEps(cairo.surface.Surface surface)Check whether the PostScript surface will output Encapsulated PostScript.
fnvoid 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.
fnvoid psSurfaceSetEps(cairo.surface.Surface surface, cairo.types.Bool eps)If eps is true, the PostScript surface will output Encapsulated PostScript.
fnvoid psSurfaceSetSize(cairo.surface.Surface surface, double widthInPoints, double heightInPoints)Changes the size of a PostScript surface for the current (and subsequent) pages.
fnvoid * rasterSourcePatternGetCallbackData(cairo.pattern.Pattern pattern)Queries the current user data.
fnvoid rasterSourcePatternSetCallbackData(cairo.pattern.Pattern pattern, void * data = null)Updates the user data that is provided to all callbacks.
fncairo.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...
fncairo.types.Bool recordingSurfaceGetExtents(cairo.surface.Surface surface, out cairo.types.Rectangle extents)Get the extents of the recording-surface.
fnvoid 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...
fncairo.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, ...
fncairo.region.Region regionCreateRectangle(cairo.types.RectangleInt rectangle)Allocates a new region object containing rectangle.
fncairo.region.Region regionCreateRectangles(cairo.types.RectangleInt rects, int count)Allocates a new region object containing the union of all given rects.
fncairo.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.
fncairo.device.Device scriptCreate(string filename)Creates a output device for emitting the script, used when creating the individual surfaces.
fncairo.device.Device scriptCreateForStream(cairo.types.WriteFunc writeFunc)Creates a output device for emitting the script, used when creating the individual surfaces.
fncairo.types.Status scriptFromRecordingSurface(cairo.device.Device script, cairo.surface.Surface recordingSurface)Converts the record operations in recording_surface into a script.
fncairo.types.ScriptMode scriptGetMode(cairo.device.Device script)Queries the script for its current output mode.
fnvoid scriptSetMode(cairo.device.Device script, cairo.types.ScriptMode mode)Change the output mode of the script
fncairo.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
fncairo.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.
fnvoid scriptWriteComment(cairo.device.Device script, string comment)Emit a string verbatim into the script.
fnstring statusToString(cairo.types.Status status)Provides a human-readable description of a #cairostatust.
fnvoid svgGetVersions(out cairo.types.SvgVersion[] versions)Used to retrieve the list of supported versions. See [cairo.global.svgSurfaceRestrictToVersion].
fncairo.surface.Surface svgSurfaceCreate(string filename, double widthInPoints, double heightInPoints)Creates a SVG surface of the specified size in points to be written to filename.
fncairo.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.
fncairo.types.SvgUnit svgSurfaceGetDocumentUnit(cairo.surface.Surface surface)Get the unit of the SVG surface.
fnvoid 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.
fnvoid 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.
fnstring 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.
fnvoid teeSurfaceAdd(cairo.surface.Surface abstractSurface, cairo.surface.Surface target)Adds a new target surface to the list of replicas of a tee surface.
fncairo.surface.Surface teeSurfaceCreate(cairo.surface.Surface primary)Creates a new "tee" surface.
fncairo.surface.Surface teeSurfaceIndex(cairo.surface.Surface abstractSurface, uint index)Retrieves the replica surface at the given index.
fnvoid teeSurfaceRemove(cairo.surface.Surface abstractSurface, cairo.surface.Surface target)Removes the given surface from the list of replicas of a tee surface.
fncairo.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...
fncairo.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.
fnstring toyFontFaceGetFamily(cairo.font_face.FontFace fontFace)Gets the family name of a toy font.
fncairo.font_face.FontFace userFontFaceCreate()Creates a new user font-face.
fncairo.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...
fncairo.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...
fnint 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.
fnstring versionString()Returns the version of the cairo library as a human-readable string of the form "X.Y.Z".