Up: cl-cffi-gtk API documentation
Package cairo
Cairo is a software library used to provide a vector graphics-based,
device-independent API for software developers. It is designed to provide
primitives for 2-dimensional drawing across a number of different backends.
Cairo is designed to use hardware acceleration when available.
This is the API documentation of a Lisp binding to Cairo. At this time only a few types and functions are implemented, which are needed to compile the Lisp bindung to GTK.
This is the API documentation of a Lisp binding to Cairo. At this time only a few types and functions are implemented, which are needed to compile the Lisp bindung to GTK.
About This PackageFonts Surfaces Utilities DrawingThe Cairo drawing context A cairo-t context is the main object used when drawing with Cairo. To draw with Cairo, you create a cairo-t context, set the target surface, and drawing options for the cairo-t context, create shapes with functions like the cairo-move-to and cairo-line-to functions, and then draw shapes with the cairo-stroke or cairo-fill functions. The cairo-t context can be pushed to a stack via the cairo-save function. They may then safely be changed, without losing the current state. Use the cairo-restore function to restore to the saved state.
Specifies the type of antialiasing to do when rendering text or shapes. ... The cairo-fill-rule-t enumeration is used to select how paths are
filled. ...
Specifies how to render the endpoints of the path when stroking. ...
Specifies how to render the junction of two lines when stroking. ... The cairo-operator-t enumeration is used to set the compositing
operator for all Cairo drawing operations. ...
A data structure for holding a rectangle. ...
A data structure for holding a dynamically allocated array of rectangles. ... A cairo-t context contains the current state of the rendering device,
including coordinates of yet to be drawn shapes. ...
Creates a new Cairo context with all graphics state parameters set to default values and with target as a target surface. ... Increases the reference count on cr by one. ... Decreases the reference count on cr by one. ...
Checks whether an error has previously occurred for this Cairo context. ... Makes a copy of the current state of cr and saves it on an internal stack of saved states for cr. ... Restores cr to the state saved by a preceding call to the cairo-save function and removes that state from the stack of saved
states. ...
Gets the target surface for the Cairo context as passed to the cairo-create function. ...
Temporarily redirects drawing to an intermediate surface known as a group. ...
Temporarily redirects drawing to an intermediate surface known as a group. ... Terminates the redirection begun by a call to the cairo-push-group or cairo-push-group-with-content functions and returns a new pattern
containing the results of all drawing operations performed to the group. ... Terminates the redirection begun by a call to the cairo-push-group or cairo-push-group-with-content functions and installs the resulting
pattern as the source pattern in the given Cairo context. ...
Gets the current destination surface for the Cairo context. ... Sets the source pattern within cr to an opaque color. ... Sets the source pattern within cr to a translucent color. ... This is a convenience function for creating a pattern from surface and setting it as the source in cr with the cairo-set-source
function. ... Gets the current source pattern for cr. ...
Set the antialiasing mode of the rasterizer used for drawing shapes. ...
Gets the current shape antialiasing mode, as set by the cairo-set-antialias function. ... Sets the dash pattern to be used by the cairo-stroke function. ... This function returns the length of the dash array in cr, 0 if
dashing is not currently in effect. ...
Gets the current dash list. ...
Set the current fill rule within the Cairo context. ... Gets the current fill rule, as set by the cairo-set-fill-rule
function. ...
Sets the current line cap style within the Cairo context. ... Gets the current line cap style, as set by the cairo-set-line-cap
function. ...
Sets the current line join style within the Cairo context. ... Gets the current line join style, as set by the cairo-set-line-join
function. ...
Sets the current line width within the Cairo context. ...
This function returns the current line width value exactly as set by the cairo-set-line-width function. ...
Sets the current miter limit within the Cairo context. ... Gets the current miter limit, as set by the cairo-set-miter-limit
function. ...
Sets the compositing operator to be used for all drawing operations. ...
Gets the current compositing operator for a Cairo context. ...
Sets the tolerance used when converting paths into trapezoids. ... Gets the current tolerance value, as set by the cairo-set-tolerance
function. ...
Establishes a new clip region by intersecting the current clip region with the current path as it would be filled by the cairo-fill function and according to the current fill rule, see the cairo-set-fill-rule
function. ...
Establishes a new clip region by intersecting the current clip region with the current path as it would be filled by the cairo-fill function and
according to the current fill rule. ...
Computes a bounding box in user coordinates covering the area inside the
current clip. ...
Tests whether the given point is inside the area that would be visible
through the current clip, i.e. the area that would be filled by a call to the cairo-paint function. ...
Reset the current clip region to its original, unrestricted state. ... Unconditionally frees rectangles and all associated references. ...
Gets the current clip region as a list of rectangles in user coordinates. ...
A drawing operator that fills the current path according to the current
fill rule, each sub-path is implicitly closed before being filled. ...
A drawing operator that fills the current path according to the current
fill rule, each sub-path is implicitly closed before being filled. ...
Computes a bounding box in user coordinates covering the area that would be affected, the "inked" area, by a cairo-fill operation given the
current path and fill parameters. ...
Tests whether the given point is inside the area that would be affected by a cairo-fill operation given the current path and filling parameters. ...
A drawing operator that paints the current source using the alpha channel of pattern as a mask. ...
A drawing operator that paints the current source using the alpha channel of surface as a mask. ...
A drawing operator that paints the current source everywhere within the
current clip region. ...
A drawing operator that paints the current source everywhere within the current clip region using a mask of constant alpha value alpha. ...
A drawing operator that strokes the current path according to the current
line width, line join, line cap, and dash settings. ...
A drawing operator that strokes the current path according to the current
line width, line join, line cap, and dash settings. ...
Computes a bounding box in user coordinates covering the area that would be affected, the "inked" area, by a cairo-stroke operation given the
current path and stroke parameters. ...
Tests whether the given point is inside the area that would be affected by a cairo-stroke operation given the current path and stroking
parameters. ...
Emits the current page for backends that support multiple pages, but does
not clear it, so, the contents of the current page will be retained for the
next page too. ...
Emits and clears the current page for backends that support multiple pages. ... Returns the current reference count of cr. ... Paths
Creating paths and manipulating path data. Paths are the most basic drawing tools and are primarily used to implicitly generate simple masks. The cairo-path-data-type-t enumeration is used to describe the type of one portion of a path when represented as a cairo-path-t instance. ... The cairo-path-data-t structure is used to represent the path data inside a cairo-path-t instance. ...
A data structure for holding a path. ...
Creates a copy of the current path and returns it to the user as a cairo-path-t structure. ...
Gets a flattened copy of the current path and returns it to the user as a cairo-path-t structure. ... Immediately releases all memory associated with path. ... Append path onto the current path. ...
Returns whether a current point is defined on the current path. ...
Gets the current point of the current path, which is conceptually the final
point reached by the path so far. ...
Clears the current path. ...
Begin a new sub-path. ...
Adds a line segment to the path from the current point to the beginning of
the current sub-path, the most recent point passed to the cairo-move-to function, and closes this sub-path. ... Adds a circular arc of the given radius to the current path. ... Adds a circular arc of the given radius to the current path. ...
Adds a cubic Bezier spline to the path from the current point to position (x3, y3) in user-space coordinates, using (x1, y1) and (x2, y2) as the control points. ...
Begin a new sub-path. ...
Adds a closed sub-path rectangle of the given size to the current path at position (x, y) in user-space coordinates. ...
Adds closed paths for the glyphs to the current path. ...
Adds closed paths for text to the current path. ... Relative-coordinate version of the cairo-curve-to function. ... Relative-coordinate version of the cairo-line-to function. ...
Begin a new sub-path. ...
Computes a bounding box in user-space coordinates covering the points on
the current path. ... Pattern
Sources for drawing. The cairo-pattern-t structure is the paint with which Cairo draws. The primary use of patterns is as the source for all Cairo drawing operations, although they can also be used as masks, that is, as the brush too. A Cairo pattern is created by using one of the many constructors, of the form cairo-pattern-create-type or implicitly through the cairo-set-source-type functions. A cairo-pattern-t structure represents a source when drawing onto a
surface. ... The cairo-extend-t enumeration is used to describe how pattern
color/alpha will be determined for areas "outside" the pattern's natural
area, for example, outside the surface bounds or outside the gradient
geometry. ... The cairo-filter-t enumeration is used to indicate what filtering
should be applied when reading pixel values from patterns. ... The cairo-pattern-type-t enumeration is used to describe the type of
a given pattern. ...
Adds an opaque color stop to a gradient pattern. ...
Adds a translucent color stop to a gradient pattern. ...
Gets the number of color stops specified in the given gradient pattern. ...
Gets the color and offset information at the given index for a gradient
pattern. ... Creates a new cairo-pattern-t instance corresponding to an opaque
color. ... Creates a new cairo-pattern-t instance corresponding to a
translucent color. ...
Gets the solid color for a solid color pattern. ... Create a new cairo-pattern-t instance for the given surface. ...
Gets the surface of a surface pattern. ... Create a new linear gradient cairo-pattern-t instance along the line defined by (x0, y0) and (x1, y1). ...
Gets the gradient endpoints for a linear gradient. ... Creates a new radial gradient cairo-pattern-t instance between the two circles defined by (x0, y0, radius0) and (x1, y1, radius1). ...
Gets the gradient endpoint circles for a radial gradient, each specified as
a center coordinate and a radius. ...
Create a new mesh pattern. ...
Begin a patch in a mesh pattern. ...
Indicates the end of the current patch in a mesh pattern. ...
Define the first point of the current patch in a mesh pattern. ...
Adds a line to the current patch from the current point to position (x, y) in pattern-space coordinates. ...
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. ...
Set an internal control point of the current patch. ...
Sets the color of a corner of the current patch in a mesh pattern. ...
Sets the color of a corner of the current patch in a mesh pattern. ...
Gets the number of patches specified in the given mesh pattern. ... Gets path defining the patch patch-num for a mesh pattern. ... Increases the reference count on pattern by one. ... Decreases the reference count on pattern by one. ...
Checks whether an error has previously occurred for this pattern. ...
Sets the mode to be used for drawing outside the area of a pattern. ... Gets the current extend mode for a pattern. ...
Sets the filter to be used for resizing when using this pattern. ... Gets the current filter for a pattern. ... Sets the pattern's transformation matrix to matrix. ... Stores the pattern's transformation matrix into matrix. ...
This function returns the type of a pattern. ... Returns the current reference count of pattern. ... Regions
Representing a pixel-aligned area. Regions are a simple graphical data type representing an area of integer-aligned rectangles. They are often used on raster surfaces to track areas of interest, such as change or clip areas.
Used as the return value for the function cairo-region-contains-rectangle. ... A cairo-region-t structure represents a set of integer-aligned
rectangles. ... Allocates a new empty region instance. ... Allocates a new region instance containing rect. ...
Allocates a new region instance containing the union of all given rects. ... Allocates a new region instance copying the area from region. ... Increases the reference count on region by one. ... Destroys a cairo-region-t instance created with the functions cairo-region-create, cairo-region-copy, or cairo-region-create-rectangle. ...
Checks whether an error has previous occurred for this region instance. ... Returns the number of rectangles contained in region. ... Stores the nth rectangle from the region in rectangle. ... Checks whether region is empty. ... Checks whether (x, y) is contained in region. ... Compares whether region-a is equivalent to region-b. NULL as an
argument is equal to itself, but not to any non-NULL region. ... Translates region by (dx, dy). ... Transformations
Manipulating the current transformation matrix. The current transformation matrix, CTM, is a two-dimensional affine transformation that maps all coordinates and other drawing instruments from the user space into the surface's canonical coordinate system, also known as the device space.
Modifies the current transformation matrix (CTM) by translating the user-space origin by (tx, ty). ...
Modifies the current transformation matrix (CTM) by scaling the x and y user-space axes by sx and sy respectively. ...
Modifies the current transformation matrix (CTM) by rotating the user-space axes by angle radians. ... Modifies the current transformation matrix (CTM) by applying matrix
as an additional transformation. ...
Modifies the current transformation matrix (CTM) by setting it equal to matrix. ... Stores the current transformation matrix (CTM) into matrix. ...
Resets the current transformation matrix (CTM) by setting it equal to the
identity matrix. ...
Transform a coordinate from user space to device space by multiplying the
given point by the current transformation matrix (CTM). ...
Transform a distance vector from user space to device space. ...
Transform a coordinate from device space to user space by multiplying the
given point by the inverse of the current transformation matrix (CTM). ...
Transform a distance vector from device space to user space. ... Text
Rendering text and glyphs. The functions with text in their name form Cairo's toy text API. The toy API takes UTF-8 encoded text and is limited in its functionality to rendering simple left-to-right text with no advanced features. That means for example that most complex scripts like Hebrew, Arabic, and Indic scripts are out of question. No kerning or correct positioning of diacritical marks either. The font selection is pretty limited too and does not handle the case that the selected font does not cover the characters in the text. This set of functions are really that, a toy text API, for testing and demonstration purposes. Any serious application should avoid them. The functions with glyphs in their name form Cairo's low-level text API. The low-level API relies on the user to convert text to a set of glyph indexes and positions. This is a very hard problem and is best handled by external libraries, like the pangocairo library that is part of the Pango text layout and rendering library. Pango is available from the Pango library. The cairo-glyph-t structure holds information about a single glyph
when drawing or measuring text. ... Specifies variants of a font face based on their slant. ... Specifies variants of a font face based on their weight. ... The cairo-text-cluster-t structure holds information about a single
text cluster. ... Specifies properties of a text cluster mapping. ...
Selects a family and style of font from a simplified description as a
family name, slant and weight. ... Sets the current font matrix to a scale by a factor of size, replacing any font matrix previously set with the cairo-set-font-size or cairo-set-font-matrix functions. ... Sets the current font matrix to matrix. ... Stores the current font matrix into matrix. ... The cairo-font-options function retrieves font rendering options. ...
Gets the current font face for a Cairo context. ...
Replaces the current font face, font matrix, and font options in the Cairo context with those of the cairo-scaled-font-t instance. ...
Gets the current scaled font for the Cairo context. ...
A drawing operator that generates the shape from a string of UTF-8
characters, rendered according to the current font face, font size
(font matrix), and font options. ...
A drawing operator that generates the shape from a list of glyphs,
rendered according to the current font face, font size (font matrix), and
font options. ... This operation has rendering effects similar to the cairo-show-glyphs
function but, if the target surface supports it, uses the provided text and
cluster mapping to embed the text for the glyphs shown in the output. ...
Gets the font extents for the currently selected font. ...
Gets the extents for a string of text. ...
Gets the extents for a list of glyphs. ...
Creates a font face from a triplet of family, slant, and weight. ...
Gets the familly name of a toy font. ... Gets the slant a toy font. ... Gets the weight a toy font. ... Allocates an array of cairo-glyph-t instances. ... Allocates an array of cairo-text-cluster-t instances. ... Frees an array of cairo-text-cluster-t instances allocated using the cairo-text-cluster-allocate function. ... Raster Source
Supplying arbitrary image data. Tags and Links
Hyperlinks and document structure FontsFont Faces
Base class for font faces. The cairo-font-face-t structure represents a particular font at a particular weight, slant, and other characteristic but no size, transformation, or size. Font faces are created using font-backend-specific constructors, typically of the form cairo-backend-font-face-create, or implicitly using the toy text API by way of the cairo-select-font-face function. The resulting face can be accessed using the cairo-get-font-face function. A cairo-font-face-t structure specifies all aspects of a font other
than the size or font matrix (a font matrix is used to distort a font by
sheering it or scaling it unequally in the two directions). ... The cairo-font-type-t enumeration is used to describe the type of a
given font face or scaled font. ... Increases the reference count on font-face by one. ... Decreases the reference count on font-face by one. ...
Checks whether an error has previously occurred for this font face. ...
This function returns the type of the backend used to create a font face. ... Returns the current reference count of font-face. ... Scaled Fonts
Font face at particular size and options. The cairo-scaled-font-t structure represents a realization of a font face at a particular size and transformation and a certain set of font options. A cairo-scaled-font-t structure is a font scaled to a particular size
and device resolution. ... The cairo-font-extents-t structure stores metric information for a
font. ... The cairo-text-extents-t structure stores the extents of a single
glyph or a string of glyphs in user-space coordinates. ... Creates a cairo-scaled-font-t instance from a font face and
matrices that describe the size of the font and the environment in which it
will be used. ... Increases the reference count on scaled-font by one. ... Decreases the reference count on scaled-font by one. ...
Checks whether an error has previously occurred for this scaled font. ...
Gets the metrics for a scaled font. ...
Gets the extents for a string of text. ... Font Options
How a font should be rendered. The font options specify how fonts should be rendered. Most of the time the font options implied by a surface are just right and do not need any changes, but for pixel-based targets tweaking font options may result in superior output on a particular display.
An opaque structure holding all options that are used when rendering fonts. ...
Allocates a new font options object with all options initialized to default
values. ...
Allocates a new font options object copying the option values from original. ... Destroys a cairo-font-options-t instance created with the cairo-font-options-create or cairo-font-options-copy function. ...
Checks whether an error has previously occurred for this font options
instance. ...
Compute a hash for the font options instance. ...
Compares two font options instances for equality. ... The cairo-font-options-antialias function gets the antialiasing mode
for the font options instance. ...
The subpixel order specifies the order of color elements within each pixel
on the display device when rendering with an antialiasing mode of :subpixel. ... The cairo-font-options-subpixel-order function gets the subpixel order
for the font options instance. ...
Specifies the type of hinting to do on font outlines. ... The cairo-font-options-hint-style function gets the hint style for
font outlines for the font options instance. ...
Specifies whether to hint font metrics. ... The cairo-font-options-hint-metrics function gets the metrics hinting
mode for the font options instance. ... The cairo-font-options-variations function gets the OpenType font
variations for the font options instance. ... FreeType Fonts
Font support for FreeType Win32 Fonts
Font support for Microsoft Windows Quartz Fonts
Font support via CGFont on OS X User Fonts
Font support with font data provided by the user Surfacescairo_device_t
Interface to underlying rendering system. A cairo-device-t structure represents the driver interface for drawing operations to a cairo-surface-t instance. ... The cairo-device-type-t enumeration is used to describe the type of
a given device. ... Increases the reference count on device by one. ... Decreases the reference count on device by one. ...
This function returns the type of the device. ...
Returns the current reference count of the device. ...
Acquires the device for the current thread. ...
Releases a device previously acquired using the function cairo-device-acquire. ... Cairo surfaces
Base class for surfaces. A cairo-surface-t structure is the abstract type representing all different drawing targets that cairo can render to. The actual drawings are performed using a Cairo context. A cairo surface is created by using backend-specific constructors, typically of the form cairo-backend-surface-create. Most surface types allow accessing the surface without using Cairo functions. If you do this, keep in mind that it is mandatory that you call the cairo-surface-flush function before reading from or writing to the surface and that you must use the cairo-surface-mark-dirty function after modifying it. Example 1. Directly modifying an image surface void modify_image_surface (cairo_surface_t *surface) { unsigned char *data; int width, height, stride;Note that for other surface types it might be necessary to acquire the surface's device first. See the cairo-device-acquire function for a discussion of devices. A cairo-surface-t structure represents an image, either as the
destination of a drawing operation or as source when drawing onto another
surface. ... The cairo-content-t enumeration is used to describe the content that
a surface will contain, whether color information, alpha information
(translucence vs. opacity), or both. ... The cairo-surface-type-t enumeration is used to describe the type of
a given surface. ...
Create a new surface that is as compatible as possible with an existing
surface. ...
Create a new image surface that is as compatible as possible for uploading
to and the use in conjunction with an existing surface. ...
Create a new surface that is a rectangle within the target surface. ... Increases the reference count on surface by one. ... Decreases the reference count on surface by one. ...
Checks whether an error has previously occurred for this surface. ...
This function finishes the surface and drops all references to external
resources. ...
Do any pending drawing for the surface and also restore any temporary
modifications Cairo has made to the surface's state. ...
Tells Cairo that drawing has been done to surface using means other than
Cairo, and that Cairo should reread any cached areas. ...
Sets an offset that is added to the device coordinates determined by the
CTM when drawing to surface. ...
This function returns the type of the backend used to create a surface. ... Returns the current reference count of surface. ...
Emits the current page for backends that support multiple pages, but does
not clear it, so that the contents of the current page will be retained for
the next page. ...
Emits and clears the current page for backends that support multiple pages. ... Image Surfaces
Rendering to memory buffers. Image surfaces provide the ability to render to memory buffers either allocated by Cairo or by the calling code. The supported image formats are those defined in the cairo-format-t enumeration. The cairo-format-t enumeration is used to identify the memory format
of image data. ...
This function provides a stride value that will respect all alignment
requirements of the accelerated image-rendering code within Cairo. ...
Creates an image surface of the specified format and dimensions. ...
Creates an image surface for the provided pixel data. ...
Get a pointer to the data of the image surface, for direct inspection or
modification. ...
Get the format of the image surface. ...
Gets the width of the image surface in pixels. ...
Gets the height of the image surface in pixels. ...
Get the stride of the image surface in bytes. ... PDF Surfaces
Rendering PDF documents The cairo-pdf-outline-flags-t flags is used by the function cairo-pdf-surface-add-outline to specify the attributes of an outline
item. ... The cairo-pdf-metadata-t enumeration is used by the function cairo-pdf-surface-set-metadata to specify the metadata to set. ...
Creates a PDF surface of the specified size in points to be written to filename. ... PNG Support
Reading and writing PNG images. The PNG functions allow reading PNG images into image surfaces, and writing any surface to a PNG file. It is a toy API. It only offers very simple support for reading and writing PNG files, which is sufficient for testing and demonstration purposes. Applications which need more control over the generated PNG file should access the pixel data directly, using the cairo-image-surface-data function or a backend-specific access function, and process it with another library, e.g. GdkPixbuf or libpng.
Creates a new image surface and initializes the contents to the given PNG
file. ...
Writes the contents of the image surface to a new file as a PNG image. ... PostScript Surfaces
Rendering PostScript documents Recording Surfaces
Records all drawing operations Win32 Surfaces
Microsoft Windows surface support SVG Surfaces
Rendering SVG documents Quartz Surfaces
Rendering to Quartz surfaces XCB Surfaces
X Window System rendering using the XCB library XLib Surfaces
X Window System rendering using XLib XLib-XRender Backend
X Window System rendering using the X Render extension Script Surfaces
Rendering to replayable scripts UtilitiesGeneric matrix operations
Generic matrix operations. A cairo-matrix-t structure holds an affine transformation, such as a
scale, rotation, shear, or a combination of those. ... Error handling
Decoding Cairo's status. Cairo uses a single status type to represent all kinds of errors. A status value of :success represents no error and has an integer value of zero. All other status values represent an error. Cairo's error handling is designed to be easy to use and safe. All major Cairo objects retain an error status internally which can be queried anytime by the users using cairo*-status calls. In the mean time, it is safe to call all Cairo functions normally even if the underlying object is in an error status. This means that no error handling code is required before or after each individual Cairo function call. The cairo-status-t enumeration is used to indicate errors that can
occur when using Cairo. ...
Provides a human readable description of a Cairo status value. ... Version Information
Cairo provides the ability to examine the version at either compile-time
or run-time and in both a human readable form as well as an encoded form
suitable for direct comparison. Cairo also provides the cairo-version-encode function to perform the encoding.
This function encodes the given Cairo version into an integer. ...
Returns the version of the Cairo library encoded in a single integer. ...
Returns the version of the Cairo library as a human readable string of the
form "x.y.z". ... Types
This section lists generic data types used in the cairo API. no documentation string found
A data structure for holding a rectangle with integer coordinates. ... | Exported Symbol Index |