Cairo

Table of Contents

The Cairo class

Introduction

Simple class with some static helper methods.

Class synopsis

Cairo
class Cairo {
/* Methods */
public static array availableFonts ( void )
public static array availableSurfaces ( void )
public static string statusToString ( int $status )
public static int version ( void )
public static string versionString ( void )
}

The CairoContext class

Introduction

Context is the main object used when drawing with cairo. To draw with cairo, you create a CairoContext, set the target CairoSurface, and drawing options for the CairoContext, create shapes with functions . like CairoContext::moveTo and CairoContext::lineTo, and then draw shapes with CairoContext::stroke or CairoContext::fill. Contexts can be pushed to a stack via CairoContext::save. They may then safely be changed, without loosing the current state. Use CairoContext::restore to restore to the saved state.

Class synopsis

CairoContext
class CairoContext {
/* Methods */
public void appendPath ( CairoPath $path )
public void arc ( float $x , float $y , float $radius , float $angle1 , float $angle2 )
public void arcNegative ( float $x , float $y , float $radius , float $angle1 , float $angle2 )
public void clip ( void )
public array clipExtents ( void )
public void clipPreserve ( void )
public array clipRectangleList ( void )
public void closePath ( void )
public __construct ( CairoSurface $surface )
public void copyPage ( void )
public CairoPath copyPath ( void )
public CairoPath copyPathFlat ( void )
public void curveTo ( float $x1 , float $y1 , float $x2 , float $y2 , float $x3 , float $y3 )
public array deviceToUser ( float $x , float $y )
public array deviceToUserDistance ( float $x , float $y )
public void fill ( void )
public array fillExtents ( void )
public void fillPreserve ( void )
public array fontExtents ( void )
public int getAntialias ( void )
public array getCurrentPoint ( void )
public array getDash ( void )
public int getDashCount ( void )
public int getFillRule ( void )
public void getFontFace ( void )
public void getFontMatrix ( void )
public void getFontOptions ( void )
public void getGroupTarget ( void )
public int getLineCap ( void )
public int getLineJoin ( void )
public float getLineWidth ( void )
public void getMatrix ( void )
public float getMiterLimit ( void )
public int getOperator ( void )
public void getScaledFont ( void )
public void getSource ( void )
public void getTarget ( void )
public float getTolerance ( void )
public void glyphPath ( array $glyphs )
public bool hasCurrentPoint ( void )
public void identityMatrix ( void )
public bool inFill ( string $x , string $y )
public bool inStroke ( string $x , string $y )
public void lineTo ( string $x , string $y )
public void mask ( string $pattern )
public void maskSurface ( string $surface [, string $x [, string $y ]] )
public void moveTo ( string $x , string $y )
public void newPath ( void )
public void newSubPath ( void )
public void paint ( void )
public void paintWithAlpha ( string $alpha )
public array pathExtents ( void )
public void popGroup ( void )
public void popGroupToSource ( void )
public void pushGroup ( void )
public void pushGroupWithContent ( string $content )
public void rectangle ( string $x , string $y , string $width , string $height )
public void relCurveTo ( string $x1 , string $y1 , string $x2 , string $y2 , string $x3 , string $y3 )
public void relLineTo ( string $x , string $y )
public void relMoveTo ( string $x , string $y )
public void resetClip ( void )
public void restore ( void )
public void rotate ( string $angle )
public void save ( void )
public void scale ( string $x , string $y )
public void selectFontFace ( string $family [, string $slant [, string $weight ]] )
public void setAntialias ([ string $antialias ] )
public void setDash ( string $dashes [, string $offset ] )
public void setFillRule ( string $setting )
public void setFontFace ( CairoFontFace $fontface )
public void setFontMatrix ( string $matrix )
public void setFontOptions ( string $fontoptions )
public void setFontSize ( string $size )
public void setLineCap ( string $setting )
public void setLineJoin ( string $setting )
public void setLineWidth ( string $width )
public void setMatrix ( string $matrix )
public void setMiterLimit ( string $limit )
public void setOperator ( string $setting )
public void setScaledFont ( string $scaledfont )
public void setSource ( string $pattern )
public void setSourceRGB ( string $red , string $green , string $blue )
public void setSourceRGBA ( string $red , string $green , string $blue , string $alpha )
public void setSourceSurface ( string $surface [, string $x [, string $y ]] )
public void setTolerance ( string $tolerance )
public void showPage ( void )
public void showText ( string $text )
public int status ( void )
public void stroke ( void )
public array strokeExtents ( void )
public void strokePreserve ( void )
public array textExtents ( string $text )
public void textPath ( string $string )
public void transform ( string $matrix )
public void translate ( string $x , string $y )
public array userToDevice ( string $x , string $y )
public array userToDeviceDistance ( string $x , string $y )
}

The CairoException class

Introduction

Exception class throwed by Cairo functions and methods

Class synopsis

CairoException
class CairoException extends Exception {
/* Inherited properties */
protected string $message ;
protected int $code ;
protected string $file ;
protected int $line ;
/* Inherited methods */
final public string Exception::getMessage ( void )
final public Throwable Exception::getPrevious ( void )
final public mixed Exception::getCode ( void )
final public string Exception::getFile ( void )
final public int Exception::getLine ( void )
final public array Exception::getTrace ( void )
final public string Exception::getTraceAsString ( void )
public string Exception::__toString ( void )
final private void Exception::__clone ( void )
}

The CairoStatus class

Introduction

CairoStatus is used to indicate errors that can occur when using Cairo. In some cases it is returned directly by functions. but when using CairoContext, the last error, if any, is stored in the object and can be retrieved with CairoContext::status or cairo_status. New entries may be added in future versions.

Use Cairo::statusToString or cairo_status_to_string to get a human-readable representation of an error message.

Class synopsis

CairoStatus
class CairoStatus {
/* Constants */
const integer CairoStatus::SUCCESS = 0 ;
const integer CairoStatus::NO_MEMORY = 1 ;
const integer CairoStatus::INVALID_RESTORE = 2 ;
const integer CairoStatus::INVALID_POP_GROUP = 3 ;
const integer CairoStatus::NO_CURRENT_POINT = 4 ;
const integer CairoStatus::INVALID_MATRIX = 5 ;
const integer CairoStatus::INVALID_STATUS = 6 ;
const integer CairoStatus::NULL_POINTER = 7 ;
const integer CairoStatus::INVALID_STRING = 8 ;
const integer CairoStatus::INVALID_PATH_DATA = 9 ;
const integer CairoStatus::READ_ERROR = 10 ;
const integer CairoStatus::WRITE_ERROR = 11 ;
const integer CairoStatus::SURFACE_FINISHED = 12 ;
const integer CairoStatus::SURFACE_TYPE_MISMATCH = 13 ;
const integer CairoStatus::PATTERN_TYPE_MISMATCH = 14 ;
const integer CairoStatus::INVALID_CONTENT = 15 ;
const integer CairoStatus::INVALID_FORMAT = 16 ;
const integer CairoStatus::INVALID_VISUAL = 17 ;
const integer CairoStatus::FILE_NOT_FOUND = 18 ;
const integer CairoStatus::INVALID_DASH = 19 ;
const integer CairoStatus::INVALID_DSC_COMMENT = 20 ;
const integer CairoStatus::INVALID_INDEX = 21 ;
const integer CairoStatus::CLIP_NOT_REPRESENTABLE = 22 ;
const integer CairoStatus::TEMP_FILE_ERROR = 23 ;
const integer CairoStatus::INVALID_STRIDE = 24 ;
}

Predefined Constants

CairoStatus::SUCCESS

No error has occurred

CairoStatus::NO_MEMORY

Out of memory

CairoStatus::INVALID_RESTORE

cairo_restore called without matching cairo_save

CairoStatus::INVALID_POP_GROUP

No saved group to pop

CairoStatus::NO_CURRENT_POINT

No current point defined

CairoStatus::INVALID_MATRIX

Invalid matrix (not invertible)

CairoStatus::INVALID_STATUS

Invalid value for an input CairoStatus>

CairoStatus::NULL_POINTER

Null pointer

CairoStatus::INVALID_STRING

Input string not valid UTF-8 string

CairoStatus::INVALID_PATH_DATA

Input path data not valid

CairoStatus::READ_ERROR

Error while reading from input stream

CairoStatus::WRITE_ERROR

Error while writing to output stream

CairoStatus::SURFACE_FINISHED

Target surface has been finished

CairoStatus::SURFACE_TYPE_MISMATCH

The surface type is not appropriate for the operation

CairoStatus::PATTERN_TYPE_MISMATCH

The pattern type is not appropriate for the operation

CairoStatus::INVALID_CONTENT

Invalid value for an input CairoContent

CairoStatus::INVALID_FORMAT

Invalid value for an input CairoFormat

CairoStatus::INVALID_VISUAL

Invalid value for an input Visual

CairoStatus::FILE_NOT_FOUND

File not found

CairoStatus::INVALID_DASH

Invalid value for a dash setting

CairoStatus::INVALID_DSC_COMMENT

Invalid value for a DSC comment

CairoStatus::INVALID_INDEX

Invalid index passed to getter

CairoStatus::CLIP_NOT_REPRESENTABLE

Clip region not representable in desired format

CairoStatus::TEMP_FILE_ERROR

Error creating or writing to a temporary file

CairoStatus::INVALID_STRIDE

Invalid value for CairoStride

The CairoSurface class

Introduction

This is the base-class for all other Surface types. CairoSurface is the abstract type representing all different drawing targets that cairo can render to. The actual drawings are performed using a CairoContext.

Class synopsis

CairoSurface
class CairoSurface {
/* Methods */
public __construct ( void )
public void copyPage ( void )
public void createSimilar ( CairoSurface $other , int $content , string $width , string $height )
public void finish ( void )
public void flush ( void )
public int getContent ( void )
public array getDeviceOffset ( void )
public void getFontOptions ( void )
public int getType ( void )
public void markDirty ( void )
public void markDirtyRectangle ( string $x , string $y , string $width , string $height )
public void setDeviceOffset ( string $x , string $y )
public void setFallbackResolution ( string $x , string $y )
public void showPage ( void )
public int status ( void )
public void writeToPng ( string $file )
}

Svg Surface Backend

Introduction

Svg specific surface class, uses the SVG (standard vector graphics) surface backend.

Class synopsis

CairoSvgSurface
class CairoSvgSurface extends CairoSurface {
/* Methods */
public __construct ( string $file , float $width , float $height )
public static array getVersions ( void )
public void restrictToVersion ( string $version )
public static string versionToString ( int $version )
/* Inherited methods */
public CairoSurface::__construct ( void )
public void CairoSurface::copyPage ( void )
public void CairoSurface::createSimilar ( CairoSurface $other , int $content , string $width , string $height )
public void CairoSurface::finish ( void )
public void CairoSurface::flush ( void )
public int CairoSurface::getContent ( void )
public array CairoSurface::getDeviceOffset ( void )
public void CairoSurface::getFontOptions ( void )
public int CairoSurface::getType ( void )
public void CairoSurface::markDirty ( void )
public void CairoSurface::markDirtyRectangle ( string $x , string $y , string $width , string $height )
public void CairoSurface::setDeviceOffset ( string $x , string $y )
public void CairoSurface::setFallbackResolution ( string $x , string $y )
public void CairoSurface::showPage ( void )
public int CairoSurface::status ( void )
public void CairoSurface::writeToPng ( string $file )
}

The CairoImageSurface class

Introduction

CairoImageSurface 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 CairoFormat.

Class synopsis

CairoImageSurface
class CairoImageSurface extends CairoSurface {
/* Methods */
public __construct ( int $format , int $width , int $height )
public static void createForData ( string $data , int $format , int $width , int $height [, int $stride = -1 ] )
public static CairoImageSurface createFromPng ( string $file )
public string getData ( void )
public int getFormat ( void )
public int getHeight ( void )
public int getStride ( void )
public int getWidth ( void )
/* Inherited methods */
public CairoSurface::__construct ( void )
public void CairoSurface::copyPage ( void )
public void CairoSurface::createSimilar ( CairoSurface $other , int $content , string $width , string $height )
public void CairoSurface::finish ( void )
public void CairoSurface::flush ( void )
public int CairoSurface::getContent ( void )
public array CairoSurface::getDeviceOffset ( void )
public void CairoSurface::getFontOptions ( void )
public int CairoSurface::getType ( void )
public void CairoSurface::markDirty ( void )
public void CairoSurface::markDirtyRectangle ( string $x , string $y , string $width , string $height )
public void CairoSurface::setDeviceOffset ( string $x , string $y )
public void CairoSurface::setFallbackResolution ( string $x , string $y )
public void CairoSurface::showPage ( void )
public int CairoSurface::status ( void )
public void CairoSurface::writeToPng ( string $file )
}

The CairoPdfSurface class

Introduction

Class synopsis

CairoPdfSurface
class CairoPdfSurface extends CairoSurface {
/* Methods */
public __construct ( string $file , float $width , float $height )
public void setSize ( string $width , string $height )
/* Inherited methods */
public CairoSurface::__construct ( void )
public void CairoSurface::copyPage ( void )
public void CairoSurface::createSimilar ( CairoSurface $other , int $content , string $width , string $height )
public void CairoSurface::finish ( void )
public void CairoSurface::flush ( void )
public int CairoSurface::getContent ( void )
public array CairoSurface::getDeviceOffset ( void )
public void CairoSurface::getFontOptions ( void )
public int CairoSurface::getType ( void )
public void CairoSurface::markDirty ( void )
public void CairoSurface::markDirtyRectangle ( string $x , string $y , string $width , string $height )
public void CairoSurface::setDeviceOffset ( string $x , string $y )
public void CairoSurface::setFallbackResolution ( string $x , string $y )
public void CairoSurface::showPage ( void )
public int CairoSurface::status ( void )
public void CairoSurface::writeToPng ( string $file )
}

The CairoPsSurface class

Introduction

Class synopsis

CairoPsSurface
class CairoPsSurface extends CairoSurface {
/* Methods */
public __construct ( string $file , float $width , float $height )
public void dscBeginPageSetup ( void )
public void dscBeginSetup ( void )
public void dscComment ( string $comment )
public bool getEps ( void )
public static array getLevels ( void )
public static string levelToString ( int $level )
public void restrictToLevel ( string $level )
public void setEps ( string $level )
public void setSize ( string $width , string $height )
/* Inherited methods */
public CairoSurface::__construct ( void )
public void CairoSurface::copyPage ( void )
public void CairoSurface::createSimilar ( CairoSurface $other , int $content , string $width , string $height )
public void CairoSurface::finish ( void )
public void CairoSurface::flush ( void )
public int CairoSurface::getContent ( void )
public array CairoSurface::getDeviceOffset ( void )
public void CairoSurface::getFontOptions ( void )
public int CairoSurface::getType ( void )
public void CairoSurface::markDirty ( void )
public void CairoSurface::markDirtyRectangle ( string $x , string $y , string $width , string $height )
public void CairoSurface::setDeviceOffset ( string $x , string $y )
public void CairoSurface::setFallbackResolution ( string $x , string $y )
public void CairoSurface::showPage ( void )
public int CairoSurface::status ( void )
public void CairoSurface::writeToPng ( string $file )
}

The CairoSurfaceType class

Introduction

Class synopsis

CairoSurfaceType
class CairoSurfaceType {
/* Constants */
const integer CairoSurfaceType::IMAGE = 0 ;
const integer CairoSurfaceType::PDF = 1 ;
const integer CairoSurfaceType::PS = 2 ;
const integer CairoSurfaceType::XLIB = 3 ;
const integer CairoSurfaceType::XCB = 4 ;
const integer CairoSurfaceType::GLITZ = 5 ;
const integer CairoSurfaceType::QUARTZ = 6 ;
const integer CairoSurfaceType::WIN32 = 7 ;
const integer CairoSurfaceType::BEOS = 8 ;
const integer CairoSurfaceType::DIRECTFB = 9 ;
const integer CairoSurfaceType::SVG = 10 ;
const integer CairoSurfaceType::OS2 = 11 ;
const integer CairoSurfaceType::WIN32_PRINTING = 12 ;
const integer CairoSurfaceType::QUARTZ_IMAGE = 13 ;
}

Predefined Constants

CairoSurfaceType::IMAGE

Description here...

CairoSurfaceType::PDF

Description here...

CairoSurfaceType::PS

Description here...

CairoSurfaceType::XLIB

Description here...

CairoSurfaceType::XCB

Description here...

CairoSurfaceType::GLITZ

Description here...

CairoSurfaceType::QUARTZ

Description here...

CairoSurfaceType::WIN32

Description here...

CairoSurfaceType::BEOS

Description here...

CairoSurfaceType::DIRECTFB

Description here...

CairoSurfaceType::SVG

Description here...

CairoSurfaceType::OS2

Description here...

CairoSurfaceType::WIN32_PRINTING

Description here...

CairoSurfaceType::QUARTZ_IMAGE

Description here...

The CairoFontFace class

Introduction

CairoFontFace abstract class represents a particular font at a particular weight, slant, and other characteristic but no transformation or size.

Note: This class can not be instantiated directly, it is created by CairoContext::getFontFace or cairo_scaled_font_get_font_face.

Class synopsis

CairoFontFace
class CairoFontFace {
/* Methods */
public __construct ( void )
public int getType ( void )
public int status ( void )
}

The CairoFontOptions class

Introduction

An opaque structure holding all options that are used when rendering fonts.

Individual features of a cairo_font_options_t can be set or accessed using functions named cairo_font_options_set_feature_name and cairo_font_options_get_feature_name, like cairo_font_options_set_antialias() and cairo_font_options_get_antialias().

New features may be added to CairoFontOptions in the future. For this reason CairoFontOptions::copy, CairoFontOptions::equal, CairoFontOptions::merge, CairoFontOptions::hash (cairo_font_options_copy(), cairo_font_options_equal(), cairo_font_options_merge(), and cairo_font_options_hash() in procedural way) should be used to copy, check for equality, merge, or compute a hash value of CairoFontOptions objects.

Class synopsis

CairoFontOptions
class CairoFontOptions {
/* Methods */
public __construct ( void )
public bool equal ( string $other )
public int getAntialias ( void )
public int getHintMetrics ( void )
public int getHintStyle ( void )
public int getSubpixelOrder ( void )
public int hash ( void )
public void merge ( string $other )
public void setAntialias ( string $antialias )
public void setHintMetrics ( string $hint_metrics )
public void setHintStyle ( string $hint_style )
public void setSubpixelOrder ( string $subpixel_order )
public int status ( void )
}

The CairoFontSlant class

Introduction

Specifies variants of a font face based on their slant.

Class synopsis

CairoFontSlant
class CairoFontSlant {
/* Constants */
const integer CairoFontSlant::NORMAL = 0 ;
const integer CairoFontSlant::ITALIC = 1 ;
const integer CairoFontSlant::OBLIQUE = 2 ;
}

Predefined Constants

CairoFontSlant::NORMAL

Upright font style

CairoFontSlant::ITALIC

Italic font style

CairoFontSlant::OBLIQUE

Oblique font style

The CairoFontType class

Introduction

CairoFontType class is an abstract final class that contains constants used to describe the type of a given CairoFontFace or CairoScaledFont. The font types are also known as "font backends" within cairo.

The type of a CairoFontFace is determined by the how it is created, an example would be the CairoToyFontFace::__construct. The CairoFontFace type can be queried with CairoFontFace::getType or cairo_font_face_get_type

The various CairoFontFace functions can be used with a font face of any type.

The type of a CairoScaledFont is determined by the type of the CairoFontFace passed to CairoScaledFont::__construct or cairo_scaled_font_create. The scaled font type can be queried with CairoScaledFont::getType or cairo_scaled_font_get_type.

Class synopsis

CairoFontType
class CairoFontType {
/* Constants */
const integer CairoFontType::TOY = 0 ;
const integer CairoFontType::FT = 1 ;
const integer CairoFontType::WIN32 = 2 ;
const integer CairoFontType::QUARTZ = 3 ;
}

Predefined Constants

CairoFontType::TOY

The font was created using CairoToyFont api

CairoFontType::FT

The font is of type CairoFreeType

CairoFontType::WIN32

The font is of type Win32

CairoFontType::QUARTZ

The font is of type Quartz

CairoFontType::USER

The font was create using cairo's user font api

The CairoFontWeight class

Introduction

Specifies variants of a font face based on their weight.

Class synopsis

CairoFontWeight
class CairoFontWeight {
/* Constants */
const integer CairoFontWeight::NORMAL = 0 ;
const integer CairoFontWeight::BOLD = 1 ;
}

Predefined Constants

CairoFontWeight::NORMAL

Normal font weight

CairoFontWeight::BOLD

Bold font weight

The CairoScaledFont class

Introduction

Class synopsis

CairoScaledFont
class CairoScaledFont {
/* Methods */
public __construct ( CairoFontFace $font_face , CairoMatrix $matrix , CairoMatrix $ctm , CairoFontOptions $options )
public array extents ( void )
public CairoMatrix getCtm ( void )
public void getFontFace ( void )
public void getFontMatrix ( void )
public void getFontOptions ( void )
public void getScaleMatrix ( void )
public int getType ( void )
public array glyphExtents ( string $glyphs )
public int status ( void )
public array textExtents ( string $text )
}

The CairoToyFontFace class

Introduction

The CairoToyFontFace class can be used instead of CairoContext::selectFontFace to create a toy font independently of a context.

Class synopsis

CairoToyFontFace
class CairoToyFontFace extends CairoFontFace {
/* Inherited methods */
}

The CairoPatternType class

Introduction

CairoPatternType is used to describe the type of a given pattern.

The type of a pattern is determined by the function used to create it. The cairo_pattern_create_rgb and cairo_pattern_create_rgba functions create CairoPatternType::SOLID patterns. The remaining cairo_pattern_create_* functions map to pattern types in obvious ways.

Class synopsis

CairoPatternType
class CairoPatternType {
/* Constants */
const integer CairoPatternType::SOLID = 0 ;
const integer CairoPatternType::SURFACE = 1 ;
const integer CairoPatternType::LINEAR = 2 ;
const integer CairoPatternType::RADIAL = 3 ;
}

Predefined Constants

CairoPatternType::SOLID

The pattern is a solid (uniform) color. It may be opaque or translucent.

CairoPatternType::SURFACE

The pattern is a based on a surface (an image).

CairoPatternType::LINEAR

The pattern is a linear gradient.

CairoPatternType::RADIAL

The pattern is a radial gradient.

The CairoPattern class

Introduction

CairoPattern is the abstract base class from which all the other pattern classes derive. It cannot be instantiated directly

Class synopsis

CairoPattern
class CairoPattern {
/* Methods */
public __construct ( void )
public void getMatrix ( void )
public int getType ( void )
public void setMatrix ( string $matrix )
public int status ( void )
}

The CairoGradientPattern class

Introduction

CairoGradientPattern is an abstract base class from which other Pattern classes derive. It cannot be instantiated directly.

Class synopsis

CairoGradientPattern
class CairoGradientPattern extends CairoPattern {
/* Methods */
public void addColorStopRgb ( string $offset , string $red , string $green , string $blue )
public void addColorStopRgba ( string $offset , string $red , string $green , string $blue , string $alpha )
public int getColorStopCount ( void )
public array getColorStopRgba ( string $index )
public int getExtend ( void )
public void setExtend ( int $extend )
/* Inherited methods */
public CairoPattern::__construct ( void )
public void CairoPattern::getMatrix ( void )
public int CairoPattern::getType ( void )
public void CairoPattern::setMatrix ( string $matrix )
public int CairoPattern::status ( void )
}

The CairoSolidPattern class

Introduction

Class synopsis

CairoSolidPattern
class CairoSolidPattern extends CairoPattern {
/* Methods */
public __construct ( float $red , float $green , float $blue [, float $alpha = 0 ] )
public array getRgba ( void )
/* Inherited methods */
public CairoPattern::__construct ( void )
public void CairoPattern::getMatrix ( void )
public int CairoPattern::getType ( void )
public void CairoPattern::setMatrix ( string $matrix )
public int CairoPattern::status ( void )
}

The CairoSurfacePattern class

Introduction

Class synopsis

CairoSurfacePattern
class CairoSurfacePattern extends CairoPattern {
/* Methods */
public __construct ( CairoSurface $surface )
public int getExtend ( void )
public int getFilter ( void )
public void getSurface ( void )
public void setExtend ( int $extend )
public void setFilter ( string $filter )
/* Inherited methods */
public CairoPattern::__construct ( void )
public void CairoPattern::getMatrix ( void )
public int CairoPattern::getType ( void )
public void CairoPattern::setMatrix ( string $matrix )
public int CairoPattern::status ( void )
}

The CairoLinearGradient class

Introduction

Create a new CairoLinearGradient along the line defined

Class synopsis

CairoLinearGradient
class CairoLinearGradient extends CairoGradientPattern {
/* Methods */
public __construct ( float $x0 , float $y0 , float $x1 , float $y1 )
public array getPoints ( void )
/* Inherited methods */
public void CairoGradientPattern::addColorStopRgb ( string $offset , string $red , string $green , string $blue )
public void CairoGradientPattern::addColorStopRgba ( string $offset , string $red , string $green , string $blue , string $alpha )
public int CairoGradientPattern::getColorStopCount ( void )
public array CairoGradientPattern::getColorStopRgba ( string $index )
public int CairoGradientPattern::getExtend ( void )
public void CairoGradientPattern::setExtend ( int $extend )
}

The CairoRadialGradient class

Introduction

Class synopsis

CairoRadialGradient
class CairoRadialGradient extends CairoGradientPattern {
/* Methods */
public __construct ( float $x0 , float $y0 , float $r0 , float $x1 , float $y1 , float $r1 )
public array getCircles ( void )
/* Inherited methods */
public void CairoGradientPattern::addColorStopRgb ( string $offset , string $red , string $green , string $blue )
public void CairoGradientPattern::addColorStopRgba ( string $offset , string $red , string $green , string $blue , string $alpha )
public int CairoGradientPattern::getColorStopCount ( void )
public array CairoGradientPattern::getColorStopRgba ( string $index )
public int CairoGradientPattern::getExtend ( void )
public void CairoGradientPattern::setExtend ( int $extend )
}

The CairoAntialias class

Introduction

Enum class that specifies the type of antialiasing to do when rendering text or shapes.

Class synopsis

CairoAntialias
class CairoAntialias {
/* Constants */
const integer CairoAntialias::MODE_DEFAULT = 0 ;
const integer CairoAntialias::MODE_NONE = 1 ;
const integer CairoAntialias::MODE_GRAY = 2 ;
const integer CairoAntialias::MODE_SUBPIXEL = 3 ;
}

Predefined Constants

CairoAntialias::MODE_DEFAULT

Use the default antialiasing for the subsystem and target device

CairoAntialias::MODE_NONE

Use a bilevel alpha mask

CairoAntialias::MODE_GRAY

Perform single-color antialiasing (using shades of gray for black text on a white background, for example).

CairoAntialias::MODE_SUBPIXEL

Perform antialiasing by taking advantage of the order of subpixel elements on devices such as LCD panels.

The CairoContent class

Introduction

CairoContent is used to describe the content that a surface will contain, whether color information, alpha information (translucence vs. opacity), or both.

Note: The large values here are designed to keep CairoContent values distinct from CairoContent values so that the implementation can detect the error if users confuse the two types.

Class synopsis

CairoContent
class CairoContent {
/* Constants */
const integer CairoContent::COLOR = 4096 ;
const integer CairoContent::ALPHA = 8192 ;
const integer CairoContent::COLOR_ALPHA = 12288 ;
}

Predefined Constants

CairoContent::COLOR

The surface will hold color content only.

CairoContent::ALPHA

The surface will hold alpha content only.

CairoContent::COLOR_ALPHA

The surface will hold color and alpha content.

The CairoExtend class

Introduction

Class synopsis

CairoExtend
class CairoExtend {
/* Constants */
const integer CairoExtend::NONE = 0 ;
const integer CairoExtend::REPEAT = 1 ;
const integer CairoExtend::REFLECT = 2 ;
const integer CairoExtend::PAD = 3 ;
}

Predefined Constants

CairoExtend::NONE

Description here...

CairoExtend::REPEAT

Description here...

CairoExtend::REFLECT

Description here...

CairoExtend::PAD

Description here...

The CairoFormat class

Introduction

CairoFormat enums are used to identify the memory format of the image data.

Class synopsis

CairoFormat
class CairoFormat {
/* Constants */
const integer CairoFormat::ARGB32 = 0 ;
const integer CairoFormat::RGB24 = 1 ;
const integer CairoFormat::A8 = 2 ;
const integer CairoFormat::A1 = 3 ;
/* Methods */
public static int strideForWidth ( int $format , int $width )
}

Predefined Constants

CairoFormat::ARGB32

Each pixel is a 32-bit quantity, with alpha in the upper 8 bits, then red, then green, then blue. The 32-bit quantities are stored native-endian. Pre-multiplied alpha is used. (That is, 50% transparent red is 0x80800000, not 0x80ff0000.)

CairoFormat::RGB24

Each pixel is a 32-bit quantity, with the upper 8 bits unused. Red, Green, and Blue are stored in the remaining 24 bits in that order.

CairoFormat::A8

Each pixel is a 8-bit quantity holding an alpha value.

CairoFormat::A1

Each pixel is a 1-bit quantity holding an alpha value. Pixels are packed together into 32-bit quantities. The ordering of the bits matches the endianess of the platform. On a big-endian machine, the first pixel is in the uppermost bit, on a little-endian machine the first pixel is in the least-significant bit.

The CairoFillRule class

Introduction

A CairoFillRule is used to select how paths are filled. For both fill rules, whether or not a point is included in the fill is determined by taking a ray from that point to infinity and looking at intersections with the path. The ray can be in any direction, as long as it doesn't pass through the end point of a segment or have a tricky intersection such as intersecting tangent to the path. (Note that filling is not actually implemented in this way. This is just a description of the rule that is applied.)

The default fill rule is CairoFillRule::WINDING.

Class synopsis

CairoFillRule
class CairoFillRule {
/* Constants */
const integer CairoFillRule::WINDING = 0 ;
const integer CairoFillRule::EVEN_ODD = 1 ;
}

Predefined Constants

CairoFillRule::WINDING

If the path crosses the ray from left-to-right, counts +1. If the path crosses the ray from right to left, counts -1. (Left and right are determined from the perspective of looking along the ray from the starting point.) If the total count is non-zero, the point will be filled.

CairoFillRule::EVEN_ODD

Counts the total number of intersections, without regard to the orientation of the contour. If the total number of intersections is odd, the point will be filled.

The CairoFilter class

Introduction

A CairoFilter is used to indicate what filtering should be applied when reading pixel values from patterns. See CairoPattern::setSource or cairo_pattern_set_source for indicating the desired filter to be used with a particular pattern.

Class synopsis

CairoFilter
class CairoFilter {
/* Constants */
const integer CairoFilter::FAST = 0 ;
const integer CairoFilter::GOOD = 1 ;
const integer CairoFilter::BEST = 2 ;
const integer CairoFilter::NEAREST = 3 ;
const integer CairoFilter::BILINEAR = 4 ;
const integer CairoFilter::GAUSSIAN = 5 ;
}

Predefined Constants

CairoFilter::FAST

A high-performance filter, with quality similar to CairoFilter::NEAREST

CairoFilter::GOOD

A reasonable-performance filter, with quality similar to CairoFilter::BILINEAR

CairoFilter::BEST

The highest-quality available, performance may not be suitable for interactive use.

CairoFilter::NEAREST

Nearest-neighbor filtering

CairoFilter::BILINEAR

Linear interpolation in two dimensions

CairoFilter::GAUSSIAN

This filter value is currently unimplemented, and should not be used in current code.

The CairoHintMetrics class

Introduction

Specifies whether to hint font metrics; hinting font metrics means quantizing them so that they are integer values in device space. Doing this improves the consistency of letter and line spacing, however it also means that text will be laid out differently at different zoom factors.

Class synopsis

CairoHintMetrics
class CairoHintMetrics {
/* Constants */
const integer CairoHintMetrics::METRICS_DEFAULT = 0 ;
const integer CairoHintMetrics::METRICS_OFF = 1 ;
const integer CairoHintMetrics::METRICS_ON = 2 ;
}

Predefined Constants

CairoHintMetrics::METRICS_DEFAULT

Hint metrics in the default manner for the font backend and target device

CairoHintMetrics::METRICS_OFF

Do not hint font metrics

CairoHintMetrics::METRICS_ON

Hint font metrics

The CairoHintStyle class

Introduction

Specifies the type of hinting to do on font outlines. Hinting is the process of fitting outlines to the pixel grid in order to improve the appearance of the result. Since hinting outlines involves distorting them, it also reduces the faithfulness to the original outline shapes. Not all of the outline hinting styles are supported by all font backends.

Class synopsis

CairoHintStyle
class CairoHintStyle {
/* Constants */
const integer CairoHintStyle::STYLE_DEFAULT = 0 ;
const integer CairoHintStyle::STYLE_NONE = 1 ;
const integer CairoHintStyle::STYLE_SLIGHT = 2 ;
const integer CairoHintStyle::STYLE_MEDIUM = 3 ;
const integer CairoHintStyle::STYLE_FULL = 4 ;
}

Predefined Constants

CairoHintStyle::STYLE_DEFAULT

Use the default hint style for font backend and target device

CairoHintStyle::STYLE_NONE

Do not hint outlines

CairoHintStyle::STYLE_SLIGHT

Hint outlines slightly to improve contrast while retaining good fidelity to the original shapes.

CairoHintStyle::STYLE_MEDIUM

Hint outlines with medium strength giving a compromise between fidelity to the original shapes and contrast

CairoHintStyle::STYLE_FULL

Hint outlines to maximize contrast

The CairoLineCap class

Introduction

Specifies how to render the endpoints of the path when stroking.

The default line cap style is CairoLineCap::BUTT.

Class synopsis

CairoLineCap
class CairoLineCap {
/* Constants */
const integer CairoLineCap::BUTT = 0 ;
const integer CairoLineCap::ROUND = 1 ;
const integer CairoLineCap::SQUARE = 2 ;
}

Predefined Constants

CairoLineCap::BUTT

Start(stop) the line exactly at the start(end) point

CairoLineCap::ROUND

Use a round ending, the center of the circle is the end point

CairoLineCap::SQUARE

Use squared ending, the center of the square is the end point

The CairoLineJoin class

Introduction

Class synopsis

CairoLineJoin
class CairoLineJoin {
/* Constants */
const integer CairoLineJoin::MITER = 0 ;
const integer CairoLineJoin::ROUND = 1 ;
const integer CairoLineJoin::BEVEL = 2 ;
}

Predefined Constants

CairoLineJoin::MITER

Description here...

CairoLineJoin::ROUND

Description here...

CairoLineJoin::BEVEL

Description here...

The CairoMatrix class

Introduction

Matrices are used throughout cairo to convert between different coordinate spaces.

Class synopsis

CairoMatrix
class CairoMatrix {
/* Methods */
public __construct ([ float $xx = 1.0 [, float $yx = 0.0 [, float $xy = 0.0 [, float $yy = 1.0 [, float $x0 = 0.0 [, float $y0 = 0.0 ]]]]]] )
public static void initIdentity ( void )
public static void initRotate ( float $radians )
public static void initScale ( float $sx , float $sy )
public static void initTranslate ( float $tx , float $ty )
public void invert ( void )
public static CairoMatrix multiply ( CairoMatrix $matrix1 , CairoMatrix $matrix2 )
public void rotate ( string $sx , string $sy )
public void scale ( float $sx , float $sy )
public array transformDistance ( string $dx , string $dy )
public array transformPoint ( string $dx , string $dy )
public void translate ( string $tx , string $ty )
}

The CairoOperator class

Introduction

This is used to set the compositing operator for all cairo drawing operations.

The default operator is CairoOperator::OVER

The operators marked as unbounded modify their destination even outside of the mask layer (that is, their effect is not bound by the mask layer). However, their effect can still be limited by way of clipping.

To keep things simple, the operator descriptions here document the behavior for when both source and destination are either fully transparent or fully opaque. The actual implementation works for translucent layers too. For a more detailed explanation of the effects of each operator, including the mathematical definitions, see http://cairographics.org/operators/.

Class synopsis

CairoOperator
class CairoOperator {
/* Constants */
const integer CairoOperator::CLEAR = 0 ;
const integer CairoOperator::SOURCE = 1 ;
const integer CairoOperator::OVER = 2 ;
const integer CairoOperator::IN = 3 ;
const integer CairoOperator::OUT = 4 ;
const integer CairoOperator::ATOP = 5 ;
const integer CairoOperator::DEST = 6 ;
const integer CairoOperator::DEST_OVER = 7 ;
const integer CairoOperator::DEST_IN = 8 ;
const integer CairoOperator::DEST_OUT = 9 ;
const integer CairoOperator::DEST_ATOP = 10 ;
const integer CairoOperator::XOR = 11 ;
const integer CairoOperator::ADD = 12 ;
const integer CairoOperator::SATURATE = 13 ;
}

Predefined Constants

CairoOperator::CLEAR

Clear destination layer (bounded)

CairoOperator::SOURCE

Replace destination layer (bounded)

CairoOperator::OVER

Draw source layer on top of destination layer (bounded)

CairoOperator::IN

Draw source where there was destination content (unbounded)

CairoOperator::OUT

Draw source where there was no destination content (unbounded)

CairoOperator::ATOP

Draw source on top of destination content and only there

CairoOperator::DEST

Ignore the source

CairoOperator::DEST_OVER

Draw destination on top of source

CairoOperator::DEST_IN

Leave destination only where there was source content (unbounded)

CairoOperator::DEST_OUT

Leave destination only where there was no source content

CairoOperator::DEST_ATOP

Leave destination on top of source content and only there (unbounded)

CairoOperator::XOR

Source and destination are shown where there is only one of them

CairoOperator::ADD

Source and destination layers are accumulated

CairoOperator::SATURATE

Like CairoOperator::OVER, but assuming source and dest are disjoint geometries

The CairoPath class

Introduction

Note: CairoPath class cannot be instantiated directly, doing so will result in Fatal Error if used or passed

Class synopsis

CairoPath
class CairoPath {
}

The CairoPsLevel class

Introduction

Class synopsis

CairoPsLevel
class CairoPsLevel {
/* Constants */
const integer CairoPsLevel::LEVEL_2 = 0 ;
const integer CairoPsLevel::LEVEL_3 = 1 ;
}

Predefined Constants

CairoPsLevel::LEVEL_2

Description here...

CairoPsLevel::LEVEL_3

Description here...

The CairoSubpixelOrder class

Introduction

Class synopsis

CairoSubpixelOrder
class CairoSubpixelOrder {
/* Constants */
const integer CairoSubpixelOrder::ORDER_DEFAULT = 0 ;
const integer CairoSubpixelOrder::ORDER_RGB = 1 ;
const integer CairoSubpixelOrder::ORDER_BGR = 2 ;
const integer CairoSubpixelOrder::ORDER_VRGB = 3 ;
const integer CairoSubpixelOrder::ORDER_VBGR = 4 ;
}

Predefined Constants

CairoSubpixelOrder::ORDER_DEFAULT

Description here...

CairoSubpixelOrder::ORDER_RGB

Description here...

CairoSubpixelOrder::ORDER_BGR

Description here...

CairoSubpixelOrder::ORDER_VRGB

Description here...

CairoSubpixelOrder::ORDER_VBGR

Description here...

The CairoSvgVersion class

Introduction

Class synopsis

CairoSvgVersion
class CairoSvgVersion {
/* Constants */
const integer CairoSvgVersion::VERSION_1_1 = 0 ;
const integer CairoSvgVersion::VERSION_1_2 = 1 ;
}

Predefined Constants

CairoSvgVersion::VERSION_1_1

Description here...

CairoSvgVersion::VERSION_1_2

Description here...