cairo.cairo

This module contains wrappers for most of cairo's fuctionality. Additional wrappers for subsets of cairo are available in the cairo.* modules.

Note: Most cairoD functions could throw an OutOfMemoryError. This is therefore not explicitly stated in the functions' api documenation.

Members

Aliases

AntiAlias
alias AntiAlias = cairo_antialias_t
Undocumented in source.
Content
alias Content = cairo_content_t

Aliases for simple cairo enums and structs. Theses aliases provide D-like names when using the cairoD API.

DeviceType
alias DeviceType = cairo_device_type_t
Undocumented in source.
Extend
alias Extend = cairo_extend_t
Undocumented in source.
FillRule
alias FillRule = cairo_fill_rule_t
Undocumented in source.
Filter
alias Filter = cairo_filter_t
Undocumented in source.
FontExtents
alias FontExtents = cairo_font_extents_t
Undocumented in source.
FontSlant
alias FontSlant = cairo_font_slant_t
Undocumented in source.
FontType
alias FontType = cairo_font_type_t
Undocumented in source.
FontWeight
alias FontWeight = cairo_font_weight_t
Undocumented in source.
Format
alias Format = cairo_format_t
Undocumented in source.
Glyph
alias Glyph = cairo_glyph_t
Undocumented in source.
HintMetrics
alias HintMetrics = cairo_hint_metrics_t
Undocumented in source.
HintStyle
alias HintStyle = cairo_hint_style_t
Undocumented in source.
LineCap
alias LineCap = cairo_line_cap_t
Undocumented in source.
LineJoin
alias LineJoin = cairo_line_join_t
Undocumented in source.
Operator
alias Operator = cairo_operator_t
Undocumented in source.
PathElementType
alias PathElementType = cairo_path_data_type_t
Undocumented in source.
PatternType
alias PatternType = cairo_pattern_type_t
Undocumented in source.
RegionOverlap
alias RegionOverlap = cairo_region_overlap_t
Undocumented in source.
SubpixelOrder
alias SubpixelOrder = cairo_subpixel_order_t
Undocumented in source.
SurfaceType
alias SurfaceType = cairo_surface_type_t
Undocumented in source.
TextCluster
alias TextCluster = cairo_text_cluster_t
Undocumented in source.
TextClusterFlags
alias TextClusterFlags = cairo_text_cluster_flags_t
Undocumented in source.
TextExtents
alias TextExtents = cairo_text_extents_t
Undocumented in source.

Classes

CairoException
class CairoException

Exception thrown by cairoD if an error occurs.

Device
class Device

* Devices are the abstraction Cairo employs for the rendering system used * by a Surface. You can get the device of a surface using * Surface.getDevice(). * * 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 Device.flush() to ensure that Cairo finishes all operations * on the device and resets it to a clean state. * * Cairo also provides the functions Device.acquire() and * Device.release() to synchronize access to the rendering system * in a multithreaded environment. This is done internally, but can also * be used by applications. * * 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. * * Examples: * ------------------------- * void my_device_modifying_function(Device device) * { * // Ensure the device is properly reset * device.flush(); * try * { * // Try to acquire the device * device.acquire(); * } * catch(CairoException e) * { * writeln(""); * } * * // Release the device when done. * scope(exit) * device.release(); * * // Do the custom operations on the device here. * // But do not call any Cairo functions that might acquire devices. * * } * -------------------------

FontFace
class FontFace

Base class for font faces

Gradient
class Gradient

Base class for LinearGradient and RadialGradient.

ImageSurface
class ImageSurface

Image Surfaces — Rendering to memory buffers

LinearGradient
class LinearGradient

A linear gradient.

Pattern
class Pattern

A Pattern represents a source when drawing onto a Surface. There are different subtypes of Pattern, for different types of sources; for example, SolidPattern.fromRGB creates a pattern for a solid opaque color.

RadialGradient
class RadialGradient

A radial gradient.

ScaledFont
class ScaledFont

Font face at particular size and options

SolidPattern
class SolidPattern

A solid pattern.

Surface
class Surface

Surface is the abstract type representing all different drawing targets that cairo can render to. The actual drawings are performed using a cairo context.

SurfacePattern
class SurfacePattern

A surface pattern.

ToyFontFace
class ToyFontFace

Cairo toy font api's FontFace

Functions

formatStrideForWidth
int formatStrideForWidth(Format format, int width)

This function provides a stride value that will respect all alignment requirements of the accelerated image-rendering code within cairo.

point
auto point(T x, T y)

Convenience function to create a Point!int or Point!double.

rectangle
auto rectangle(T x, T y, T width, T height)
auto rectangle(Point!T point, T width, T height)

Convenience function to create a Rectangle!int or Rectangle!double.

size
auto size(T width, T height)

Convenience function to create a Size!int or Size!double.

throwError
void throwError(cairo_status_t status, string file, int line)

Mainly used internally by cairoD. If status is CAIRO_STATUS_NO_MEMORY a OutOfMemoryError is thrown. If status is CAIRO_STATUS_SUCCESS nothing happens. For all other statuses, this functions throws a CairoException with the status value.

Structs

Box
struct Box

A simple struct representing a box. Used for Extents.

ClipRange
struct ClipRange

RandomAccessRange to iterate or index into Clips of a Cairo Region. This range keeps a reference to its Region object, so it can be passed around without thinking about memory management.

Context
struct Context

The cairo drawing context

FontOptions
struct FontOptions

FontOptions - How a font should be rendered

Matrix
struct Matrix

Wrapper for cairo's cairo_matrix_t. A cairo_matrix_t holds an affine transformation, such as a scale, rotation, shear, or a combination of those. The transformation of a point (x, y) is given by:

Path
struct Path

Reference counted wrapper around cairo_path_t. This struct can only be obtained from cairoD. It cannot be created manually.

PathElement
struct PathElement

An element of a cairo Path and the objects iterated by a PathRange.

PathRange
struct PathRange

ForwardRange to iterate a cairo path. This range keeps a reference to its Path object, so it can be passed around without thinking about memory management.

Point
struct Point(T)

A simple struct to store the coordinates of a point as doubles or integers.

RGB
struct RGB

Struct representing a RGB color

RGBA
struct RGBA

Struct representing a RGBA color

Rectangle
struct Rectangle(T)

A simple struct representing a rectangle with int or double values

Region
struct Region
Undocumented in source.
Resolution
struct Resolution

A simple struct representing a resolution

Size
struct Size(T)

A simple struct representing a size with only int or double values

TextGlyph
struct TextGlyph

The mapping between utf8 and glyphs is provided by an array of clusters. Each cluster covers a number of text bytes and glyphs, and neighboring clusters cover neighboring areas of utf8 and glyphs. The clusters should collectively cover utf8 and glyphs in entirety.

Version
struct Version

Cairo version information

See Also

Meta

Authors

Johannes PfaucairoD
Andrej MitroviccairoD
_cairo team_cairo