Up: cl-cffi-gtk4 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.
About This PackageFonts Surfaces Utilities DrawingThe Cairo drawing context The cairo:context-t structure is the main object used when
drawing with Cairo. To draw with Cairo, you create a cairo:context-t instance, set the target surface, and drawing options for the cairo:context-t instance, 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:context-t instance 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. Types and functions for Cairo drawing The cairo:antialias-t enumeration 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. ... The cairo:line-cap-t enumeration specifies how to render the
endpoints of the path when stroking. ... The cairo:line-join-t enumeration 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. ... The cairo:context-t structure contains the current state of the
rendering device, including coordinates of yet to be drawn shapes. ... The cairo:with-context macro allocates a new cairo:context-t instance for the given target and executes
the body that uses the Cairo context. ...
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 the Cairo context by one. ...
Returns the current reference count of the Cairo context. ...
Decreases the reference count on the Cairo context by one. ...
Checks whether an error has previously occurred for the 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 function 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 function 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 the Cairo context to an opaque color. ...
Sets the source pattern within the Cairo context 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:source
function. ... The cairo:antialias function gets the current shape antialiasing
mode of the rasterizer used for drawing shapes. ... This function returns the length of the dash list in cr, 0 if
dashing is not currently in effect. ... The cairo:fill-rule function gets the current fill rule within the
Cairo context. ... The cairo:line-cap function gets the current line cap style within
the Cairo context. ... The cairo:line-join funcion gets the current line join style within
the Cairo context. ... The cairo:line-width function returns the current line width value
within the Cairo context. ... The cairo:hairline function returns whether or not hairline mode is
set within the Cairo context. ... The cairo:miter-limit function gets the current miter limit within
the Cairo context. ... The cairo:operator function gets the current compositing operator
for a Cairo context to be used for all drawing operations. ... The cairo:tolerance function gets the current tolerance value used
when converting paths into trapezoids. ...
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: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, that is, the area that would be filled by a call to the cairo:paint function. ...
Reset the current clip region to its original, unrestricted state. ...
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. ... Paths 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. ...
The data structure for holding a path. ...
Creates a copy of the current path and returns it to the user as a cairo:path-t instance. ...
Gets a flattened copy of the current path and returns it to the user as a cairo:path-t instance. ... Immediately releases all memory associated with path. ... Creates a list with the path information from a cairo:path-t
instance. ... 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. ...
Computes a bounding box in user-space coordinates covering the points on
the current path. ...
Begin a new sub-path. ...
Begin a new sub-path. ... Adds a line to the path from the current point to position (x,y) in
user-space coordinates. ... Relative-coordinate version of the cairo:line-to function. ...
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. ... Relative-coordinate version of the cairo:curve-to function. ...
Adds a closed sub-path rectangle of the given size to the current path at position (x,y) in user-space coordinates. ... 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 closed paths for the glyphs to the current path. ...
Adds closed paths for text to the current path. ... Introduction to pattern 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. Types and functions for pattern The cairo:extend-t enumeration is used to describe how pattern
color/alpha will be determined for areas "outside" the natural area, of
the pattern 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. ... The cairo:pattern-t structure represents a source when drawing onto
a surface. ... Increases the reference count on pattern by one. ... Returns the current reference count of pattern. ... Decreases the reference count on pattern by one. ...
Checks whether an error has previously occurred for this pattern. ...
This function returns the type of a pattern. ... The cairo:pattern-extend function gets the current extend mode for a
pattern. ... The cairo:pattern-matrix function gets the transformation matrix of
the 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 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,r0) and (x1,y1,r1). ...
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 the path defining the patch patch-num for a mesh pattern. ... Indroduction to Regions
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. Types and functions for Regions Used as the return value for the cairo:region-contains-rectangle
function. ... The cairo:region-t structure represents a set of integer aligned
rectangles. ...
Allocates a new empty region instance. ... Allocates a new cairo:region-t instance containing the given
rectangle. ... Allocates a new cairo:region-t instance containing the union of
all given rectangles. ... Allocates a new region instance copying the area from region. ... Increases the reference count on region by one. ... Destroys a cairo:region-t instance. ...
Checks whether an error has previous occurred for this region instance. ... Gets the bounding rectangle of region as a list of the coordinates. ... Returns the number of rectangles contained in region. ... Returns the nth rectangle from the region as a list with the
coordinates of the rectangle. ... Checks whether region is empty. ...
Checks whether the given rectangle is inside, outside or partially contained in region. ... Translates the region by (dx, dy). ... Introduction to Transformations
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. Functions for Transformations
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. ... The cairo:matrix function gets the current transformation matrix
(CTM). ...
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. ... Introduction to Text
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. Types and functions for TextSpecifies variants of a font face based on their slant. ... Specifies variants of a font face based on their weight. ... The cairo:glyph-t structure holds information about a single glyph
when drawing or measuring text. ...
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:font-matrix functions. ... The cairo:font-matrix function stores the current font matrix into matrix and returns the cairo:matrix-t instance. ... The cairo:font-options function retrieves font rendering options for
the Cairo context. ... The cairo:font-face function gets the current font face for a Cairo
context. ... The cairo:scaled-font function 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. ...
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. ... The cairo:with-toy-font-face macro allocates a new cairo:font-face-t instance and executes the body that uses the
toy font face. ...
Creates a font face from a triplet of family, slant, and weight. ...
Gets the family name of a toy font face. ... Gets the slant of a toy font face. ... Gets the weight of a toy font face. ... FontsIndroduction to Font 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:font-face function. Type and functions for Font Faces The cairo:font-type-t enumeration is used to describe the type of
a given font face or scaled font. ... The cairo:font-face-t structure specifies all aspects of a font
other than the size or font matrix. ... Increases the reference count on face by one. ...
Returns the current reference count of the font face. ... Decreases the reference count on 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. ... Indroduction to Scaled Fonts 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. Types and functions for Scaled Fonts 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. ... The cairo:scaled-font-t structure is a font scaled to a particular
size and device resolution. ... The cairo:with-scaled-font macro allocates a new cairo:scaled-font-t instance for the given arguments and executes
the body that uses the Cairo context. ... 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 font by one. ... Returns the current reference count of font. ... Decreases the reference count on font by one. ...
Checks whether an error has previously occurred for this scaled font. ...
This function returns the type of the backend used to create a scaled font. ...
Gets the font face that this scaled font uses. ...
Gets the metrics for a scaled font. ...
Gets the extents for a string of text. ... Gets the extents for glyphs. ...
Converts UTF8 text to a list of glyphs. ... Introduction to Font Options
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. Types and functions for Font Options
The subpixel order specifies the order of color elements within each pixel
on the display device when rendering with an antialiasing mode of :subpixel. ...
Specifies the type of hinting to do on font outlines. ...
Specifies whether to hint font metrics. ...
Specifies if color fonts are to be rendered using the color glyphs or
outline glyphs. ... The cairo:font-options-t structure is an opaque structure holding
all options that are used when rendering fonts. ...
Allocates a new font options instance 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 cairo:font-options-subpixel-order function gets the subpixel order
for the font options instance. ... The cairo:font-options-hint-style function gets the hint style for
font outlines for the font options instance. ... 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. ... The cairo:font-options-color-mode function gets the color mode for
the font options instance. ... The cairo:font-options-color-palette function gets the current
OpenType color font palette for the font options instance. ... The cairo:font-options-custom-palette-color function gets the custom
palette color for the color index for the font options instance. ... SurfacesIntroduction to Cairo Devices
Devices are the abstraction Cairo employs for the rendering system used by a cairo:surface-t instance. You can get the device of a surface using the cairo:surface-device function. Devices are created using custom functions specific to the rendering system you want to use. See the documentation for the surface types for those functions. An important function that devices fulfill is sharing access to the rendering system between Cairo and your application. If you want to access a device directly that you used to draw to with Cairo, you must first call the cairo:device-flush function to ensure that Cairo finishes all operations on the device and resets it to a clean state. Cairo also provides the cairo:device-acquire and cairo:device-release functions to synchronize access to the rendering system in a multithreaded environment. This is done internally, but can also be used by applications. Putting this all together, a function that works with devices should look something like this: (defun my-device-modifying-function (device) (let (status) ;; Ensure the device is properly reset (cairo:device-flush device) ;; Try to aquire the device (unless (eq :success (setf status (cairo:device-aquire device))) (warn "Failed to aquire the device: ~a" (cairo:status-to-string status)) (return-from my-device-modifying-function))Note: Please refer to the documentation of each backend for additional usage requirements, guarantees provided, and interactions with existing surface API of the device functions for surfaces of that type. Types and functions for Cairo Devices The cairo:device-type-t enumeration is used to describe the type
of a given device. ... The cairo:device-t structure represents the driver interface for drawing operations to a cairo:surface-t instance. ... Increases the reference count on device by one. ...
Returns the current reference count of the device. ... Decreases the reference count on device by one. ...
Checks whether an error has previously occurred for this device. ...
This function returns the type of the device. ...
This function finishes the device and drops all references to external
resources. ...
Finish any pending operations for the device and also restore any temporary
modifications Cairo has made to the state of the device. ...
Acquires the device for the current thread. ... Releases a device previously acquired using the cairo:device-acquire
function. ... Introduction to Cairo Surfaces The 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. Directly modifying an image surface (defun modify-image-surface (surface) (let ((data (cairo:image-surface-data surface)) (width (cairo:image-surface-width surface)) (height (cairo:image-surface-height surface)) (stride (cairo:image-surface-stride surface)))Note that for other surface types it might be necessary to acquire the device of the surface first. See the cairo:device-acquire function for a discussion of devices. Functions and types for Cairo Surfaces 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. ... The 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:with-surface macro allocates a new cairo:surface-t
instance, initializes the Cairo surface with the given values and executes
the body that uses the Cairo surface. ... The cairo:with-context-for-surface macro allocates a new cairo:context-t instance for a surface, initializes the
Cairo context with the given values and executes the body that uses the
Cairo context. ...
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. ... Returns the current reference count of surface. ... Decreases the reference count on surface by one. ...
Checks whether an error has previously occurred for this surface. ...
This function returns the type of the backend used to create the 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 state of the surface. ...
This function returns the device for a surface. ...
Retrieves the default font rendering options for the surface. ... This function returns the content type of surface which indicates
whether the surface contains color and/or alpha information. ... Tells Cairo that drawing has been done to surface using means other
than Cairo, and that Cairo should reread any cached areas. ... Like the cairo:surface-mark-dirty function, but drawing has been done
only to the specified rectangle, so that Cairo can retain cached contents
for other parts of the surface. ... The cairo:surface-device-offset functions returns the device offset. ... The cairo:surface-device-scale function returns the device scale. ... The cairo:surface-fallback-resolution function returns the fallback
resolution, or default fallback resolution if never set. ...
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. ... Introduction to Image Surfaces
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. Types and functions for Image Surfaces The cairo:format-t enumeration is used to identify the memory
format of image data. ... The cairo:with-image-surface macro allocates a new cairo:surface-t instance, initializes the Cairo surface with the format, width, and height values and executes the body
that uses the Cairo surface. ... The cairo:with-context-for-image-surface macro allocates a new cairo:context-t instance for an image surface, initializes the Cairo context with the format, width, and height values
and executes the body that uses the Cairo context. ...
Creates an image surface of the specified format and dimensions. ...
Creates an image surface for the provided pixel data. ...
Get the 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. ...
This function provides a stride value that will respect all Cairo alignment
requirements of the accelerated image-rendering code within Cairo. ... Introduction to PDF Surfaces
The PDF surface is used to render Cairo graphics to Adobe PDF files and
is a multi-page vector surface backend. The following mime types are supported: CAIRO_MIME_TYPE_JPEG, CAIRO_MIME_TYPE_JP2, CAIRO_MIME_TYPE_UNIQUE_ID, CAIRO_MIME_TYPE_JBIG2, CAIRO_MIME_TYPE_JBIG2_GLOBAL, CAIRO_MIME_TYPE_JBIG2_GLOBAL_ID, CAIRO_MIME_TYPE_CCITT_FAX, CAIRO_MIME_TYPE_CCITT_FAX_PARAMS. JBIG2 ImagesJBIG2 data in PDF must be in the embedded format as described in ISO/IEC 11544. Image specific JBIG2 data must be in CAIRO_MIME_TYPE_JBIG2. Any global segments in the JBIG2 data (segments with page association field set to 0) must be in CAIRO_MIME_TYPE_JBIG2_GLOBAL. The global data may be shared by multiple images. All images sharing the same global data must set CAIRO_MIME_TYPE_JBIG2_GLOBAL_ID to a unique identifier. At least one of the images must provide the global data using CAIRO_MIME_TYPE_JBIG2_GLOBAL. The global data will only be embedded once and shared by all JBIG2 images with the same CAIRO_MIME_TYPE_JBIG2_GLOBAL_ID.CCITT Fax ImagesThe CAIRO_MIME_TYPE_CCITT_FAX mime data requires a number of decoding parameters These parameters are specified using CAIRO_MIME_TYPE_CCITT_FAX_PARAMS. CAIRO_MIME_TYPE_CCITT_FAX_PARAMS mime data must contain a string of the form "param1=value1 param2=value2 ...".
These parameters are the same as the CCITTFaxDecode parameters in the PostScript Language Reference and Portable Document Format (PDF). Refer to these documents for further details. An example CAIRO_MIME_TYPE_CCITT_FAX_PARAMS string is: "Columns=10230 Rows=40000 K=1 EndOfLine=true EncodedByteAlign=1 BlackIs1=false" Types and functions for PDF surfaces The cairo:pdf-outline-flags-t flags is used by the cairo:pdf-surface-add-outline function to specify the attributes of
an outline item. ... The cairo:pdf-metadata-t enumeration is used by the cairo:pdf-surface-set-metadata function to specify the metadata to
set. ... The cairo:pdf-version-t enumeration is used to describe the version
number of the PDF specification that a generated PDF file will conform to. ... The cairo:with-pdf-surface macro allocates a new PDF cairo:surface-t instance for the given path, width, and height values and executes the body that uses the PDF surface. ... The cairo:with-context-for-pdf-surface macro allocates a new cairo:context-t instance for a PDF surface, initializes the Cairo context with the path, width, and height values
and executes the body that uses the Cairo context. ...
Creates a PDF surface of the specified size in points to be written to filename. ... Restricts the generated PDF file to the given version. ...
Used to retrieve the list of supported versions. ...
Gets the string representation of the given version ID. ...
Changes the size of a PDF surface for the current (and subsequent) pages. ... Add an item to the document outline hierarchy with the name utf8 that links to the location specified by link. ...
Set document metadata. ...
Set custom document metadata. ...
Sets the page label for the current page. ...
Set the thumbnail image size for the current and all subsequent pages. ... Introduction to PNG Support
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, for example GdkPixbuf or libpng. Functions for PNG supportIndroduction to PostScript Surfaces
The PostScript surface is used to render Cairo graphics to Adobe
PostScript files and is a multi-page vector surface backend. The following mime types are supported: CAIRO_MIME_TYPE_JPEG, CAIRO_MIME_TYPE_UNIQUE_ID, CAIRO_MIME_TYPE_CCITT_FAX, CAIRO_MIME_TYPE_CCITT_FAX_PARAMS, CAIRO_MIME_TYPE_CCITT_FAX, CAIRO_MIME_TYPE_CCITT_FAX_PARAMS, CAIRO_MIME_TYPE_EPS, CAIRO_MIME_TYPE_EPS_PARAMS. Source surfaces used by the PostScript surface that have a CAIRO_MIME_TYPE_UNIQUE_ID mime type will be stored in PostScript printer memory for the duration of the print job. The CAIRO_MIME_TYPE_UNIQUE_ID mime type should only be used for small frequently used sources. The CAIRO_MIME_TYPE_CCITT_FAX and CAIRO_MIME_TYPE_CCITT_FAX_PARAMS mime types are documented in CCITT Fax Images. Embedding EPS filesEncapsulated PostScript files can be embedded in the PS output by setting the CAIRO_MIME_TYPE_EPS mime data on a surface to the EPS data and painting the surface. The EPS will be scaled and translated to the extents of the surface the EPS data is attached to.The CAIRO_MIME_TYPE_EPS mime type requires the CAIRO_MIME_TYPE_EPS_PARAMS mime data to also be provided in order to specify the embeddding parameters. CAIRO_MIME_TYPE_EPS_PARAMS mime data must contain a string of the form "bbox=[llx lly urx ury]" that specifies the bounding box (in PS coordinates) of the EPS graphics. The parameters are: lower left x, lower left y, upper right x, upper right y. Normally the bbox data is identical to the %%BoundingBox data in the EPS file. Type and functions for PostScript Surfaces The cairo:ps-level-t enumeration is used to describe the language
level of the PostScript Language Reference that a generated PostScript file
will conform to. ... The cairo:with-ps-surface macro allocates a new PostScript cairo:surface-t instance for the given path, width, and height values and executes the body that uses the PostScript
surface. ...
Creates a PostScript surface of the specified size in points to be written to path. ... Restricts the generated PostSript file to level. ...
Used to retrieve the list of supported levels. ...
Get the string representation of the given level ID. ... The cairo:ps-surface-eps function checks whether the PostScript
surface will output Encapsulated PostScript. ...
Changes the size of a PostScript surface for the current and subsequent
pages. ...
This function indicates that subsequent calls to the cairo:ps-surface-dsc-comment function should direct comments to the
Setup section of the PostScript output. ...
This function indicates that subsequent calls to the cairo:ps-surface-dsc-comment function should direct comments to the
PageSetup section of the PostScript output. ...
Emit a comment into the PostScript output for the given surface. ... Indroduction to Recording Surfaces
A recording surface is a surface that records all drawing operations at
the highest level of the surface backend interface, that is, the level
of paint, mask, stroke, fill, and text glyphs. The recording surface can
then be "replayed" against any target surface by using it as a source
surface. If you want to replay a surface so that the results in target will be identical to the results that would have been obtained if the original operations applied to the recording surface had instead been applied to the target surface, you can use code like this: (cairo:with-context (context target) (cairo:set-source-surface context recording-surface 0.0 0.0) (cairo:paint context) ...)A recording surface is logically unbounded, that is, it has no implicit constraint on the size of the drawing surface. However, in practice this is rarely useful as you wish to replay against a particular target surface with known bounds. For this case, it is more efficient to specify the target extents to the recording surface upon creation. The recording phase of the recording surface is careful to snapshot all necessary objects, paths, patterns, etc., in order to achieve accurate replay. Functions for Recording Surfaces The cairo:with-recording-surface macro allocates a new cairo:surface-t instance and executes the body that uses the Cairo
surface. ... The cairo:with-context-for-recording-surface macro allocates a new cairo:context-t instance, initializes the Cairo context with the
given values and executes the body that uses the Cairo context. ...
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 text glyphs. ...
Measures the extents of the operations stored within the recording surface. ...
Get the extents of the recording surface. ... Introduction to SVG Surfaces
The SVG surface is used to render Cairo graphics to SVG files and is a
multi-page vector surface backend. Types and functions for SVG surfaces The cairo:svg-version-t enumeration is used to describe the version
number of the SVG specification that a generated SVG file will conform to. ... The cairo:svg-unit-t enumeration is used to describe the units
valid for coordinates and lengths in the SVG specification. ...
Creates a SVG surface of the specified size in points to be written to path. ... The cairo:svg-surface-document-unit function gets the unit of the SVG
surface. ... Restricts the generated SVG file to version. ...
Used to retrieve the list of supported versions. ...
Gets the string representation of the given version ID. ... Indroduction to Script Surfaces
The script surface provides the ability to render to a native script that
matches the Cairo drawing model. The scripts can be replayed using tools under the util/cairo-script directory, or with the cairo-perf-trace utility. Types and functions for Script SurfacesA set of script output variants. ... The cairo:with-script-surface macro allocates a new cairo:surface-t instance for a newly created cairo:device-t instance of :script type and executes the
body that uses the Cairo script surface. ...
Creates an output device for emitting the script, used when creating the
individual surfaces. ... Converts the recorded operations in surface into a script. ... The cairo:script-mode function queries the script for its current
output mode. ... Creates a new surface that will emit its rendering through script. ... Emit a string verbatim into the script. ... UtilitiesGeneric matrix operations The cairo:matrix-t structure holds an affine transformation, such
as a scale, rotation, shear, or a combination of those. ... The cairo:with-matrix macro allocates a new cairo:matrix-t
instance, initializes the matrix with the given values and executes the
body that uses the matrix. ... The cairo:with-matrices macro creates new variable bindings and
executes the body that use these bindings. ...
Modifies the matrix to be an identity transformation. ... Initializes the matrix to a transformation that translates by tx and ty in the x and y dimensions, respectively. ... Initializes the matrix to a transformation that scales by sx and sy in the x and y dimensions, respectively. ... Initializes the matrix to a transformation that rotates by angle. ...
Converts the matrix to a list of double floats. ... Applies rotation by angle to the transformation in the matrix. ...
Changes the matrix to be the inverse of its original value. ... Introduction to Error handling
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. Types and functions for Error handling 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. ... Introduction to 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. | Exported Symbol Index |