Skip to content

API Reference / @gtkx/cairo

@gtkx/cairo ​

Enumerations ​

EnumerationDescription
AntialiasHow shapes and text are antialiased.
ContentWhat a surface holds: color, alpha coverage, or both.
DeviceTypeThe backend behind a device.
ExtendWhat a pattern draws outside its natural area.
FillRuleWhich areas inside a path a fill covers.
FilterHow a pattern is sampled when it is scaled.
FontSlantThe slant of a toy font face.
FontTypeThe backend behind a font face or scaled font.
FontWeightThe weight of a toy font face.
FormatThe memory layout of the pixels of an image surface.
FtSynthesizeStyles a FreeType font face synthesizes when the font itself lacks them.
HintMetricsWhether font metrics are quantized to integer device units.
HintStyleHow much font outlines are fitted to the pixel grid.
LineCapHow the ends of a stroked line are rendered.
LineJoinHow the corners of a stroked path are rendered.
OperatorHow a drawing operation composites its source onto the destination.
PathDataTypeThe kind of a segment in a copied path.
PatternTypeThe kind of a pattern.
RegionOverlapHow a rectangle relates to a region.
StatusThe result a cairo object or operation reports; anything but SUCCESS marks the object as errored.
SubpixelOrderThe order of color elements within each pixel on a display, for subpixel antialiasing.
SurfaceTypeThe backend behind a surface.
TextClusterFlagsProperties of a text cluster mapping.

Classes ​

ClassDescription
ContextA cairo drawing context (cairo_t): the object every drawing operation goes through, holding the current path, source, transformation, clip and font state for one target surface. GTK hands one to draw callbacks and snapshots, and new Context(surface) creates one for offscreen drawing.
DeviceA cairo device (cairo_device_t): the backend-specific object behind a surface, such as a GL context or an output stream. Instances come from bindings that hand one back.
FontFaceA cairo font face (cairo_font_face_t): a typeface independent of size and transformation. Font faces come from create or a context, and wrap as the concrete class their type reports (instanceof ToyFontFace after selectFontFace).
FontOptionsCairo font options (cairo_font_options_t): the rendering settings applied to text, such as antialiasing, hinting and font variations.
FtFontFaceA FreeType font face returned by Cairo or another native library.
GlyphA cairo_glyph_t: one glyph index and where to draw it.
ImageSurfaceA surface backed by an in-memory pixel buffer, the usual target for offscreen drawing.
LinearPatternA linear gradient pattern, created with new LinearPattern(...) or Pattern.createLinear.
MatrixAn affine transformation (cairo_matrix_t) mapping user space to device space: x' = xx * x + xy * y + x0 and y' = yx * x + yy * y + y0.
MeshPatternA mesh gradient pattern, created with new MeshPattern() or Pattern.createMesh: a set of Coons patches, each described between beginPatch and endPatch by a path of up to four sides and the colors of its corners.
PathA cairo path (cairo_path_t). Context.copyPath() and Context.copyPathFlat() return one, and Context.appendPath and bindings that take one, such as Gsk.PathBuilder.addCairoPath, accept it as is.
PatternA cairo pattern (cairo_pattern_t): the source a context paints with, such as a solid color, a gradient, a mesh or another surface. Patterns come from the create* statics or from a context, and wrap as the concrete class their type reports (instanceof LinearPattern for a linear gradient).
RadialPatternA radial gradient pattern, created with new RadialPattern(...) or Pattern.createRadial.
RecordingSurfaceA surface that records the drawing operations applied to it, for replaying them onto other surfaces.
RectangleA rectangle with double-precision edges, as copyClipRectangleList and recording surfaces report.
RectangleIntA rectangle with integer edges, as Cairo regions use.
RegionA cairo region (cairo_region_t): a set of integer rectangles, as GTK uses for clip and damage areas. Set operations modify the region in place.
ScaledFontA cairo scaled font (cairo_scaled_font_t): a font face frozen at a given font matrix, transformation and set of font options, ready to measure text and positioned glyphs.
SurfaceA cairo surface (cairo_surface_t): the target a context draws onto. Surfaces come from the create* statics, from ImageSurface and RecordingSurface, or from GTK, and wrap as the concrete class their backend reports (instanceof ImageSurface for an image surface).
TextClusterA cairo_text_cluster_t: how many bytes of text map to how many glyphs.
ToyFontFaceA toy font face, created with new ToyFontFace(...), FontFace.create or a context's selectFontFace.

Type Aliases ​

Type AliasDescription
CairoGlyphOne glyph to draw: its index in the font and its position in user space.
CairoTextClusterOne text cluster: how many bytes of text map to how many glyphs.
ClosePathSegmentA path segment closing the current sub-path.
ColorStopA color stop of a gradient pattern: its offset along the gradient and its color.
CurveToSegmentA path segment drawing a cubic Bézier curve through two control points to an end point.
DashPatternA dash pattern as a context reports it: alternating on and off lengths and the offset into them.
DeviceOffsetThe offset a surface adds to device coordinates.
DeviceScaleThe scale a surface applies between user and device units.
DistanceA displacement in user or device space, unaffected by translation.
ExtentsA bounding box given by its two opposite corners in user space.
FallbackResolutionThe resolution a surface falls back to when it rasterizes vector content.
FontExtentsMetrics of a font in user space.
GlyphConstructorPropsInitial field values for a Glyph; a field left out or set to null keeps zero.
InkExtentsThe area a recording surface has been drawn on, in its coordinate space.
LinearPointsThe two end points of a linear gradient in pattern space.
LineToSegmentA path segment drawing a straight line to a point.
MoveToSegmentA path segment starting a new sub-path at a point.
PathDataOne segment of a path copied out of a context or a mesh pattern.
PointA position in user or device space.
RadialCirclesThe two circles of a radial gradient in pattern space.
RectangleConstructorPropsInitial field values for a Rectangle; a field left out or set to null keeps zero.
RectangleDataA rectangle as plain data, for the calls that take or return many at once.
RectangleIntConstructorPropsInitial field values for a RectangleInt; a field left out or set to null keeps zero.
RgbaColorA color with straight (non-premultiplied) components in the 0 to 1 range.
TextClusterConstructorPropsInitial field values for a TextCluster; a field left out or set to null keeps zero.
TextExtentsExtents of a run of text or glyphs in user space.

Functions ​

FunctionDescription
statusToStringReturns a human-readable description of a status code.
versionReturns the version of the cairo library in use, encoded as major * 10000 + minor * 100 + micro.
versionStringReturns the version of the cairo library in use as a string such as "1.18.2".