Back to index

lightning-sunbird  0.9+nobinonly
Classes | Defines | Typedefs | Enumerations | Functions
cairo.h File Reference
#include <cairo-features.h>

Go to the source code of this file.

Classes

struct  _cairo_matrix
 cairo_matrix_t: : xx component of the affine transformation : yx component of the affine transformation : xy component of the affine transformation : yy component of the affine transformation : X translation component of the affine transformation : Y translation component of the affine transformation More...
struct  _cairo_user_data_key
 cairo_user_data_key_t: : not used; ignore. More...
struct  cairo_glyph_t
 cairo_glyph_t: : glyph index in the font. More...
struct  cairo_text_extents_t
 cairo_text_extents_t: : the horizontal distance from the origin to the leftmost part of the glyphs as drawn. More...
struct  cairo_font_extents_t
 cairo_font_extents_t: : the distance that the font extends above the baseline. More...
union  _cairo_path_data_t
struct  cairo_path
 cairo_path_t: : the current error status : the elements in the path : the number of elements in the data array More...
struct  _cairo_path_data_t.header
struct  _cairo_path_data_t.point

Defines

#define CAIRO_VERSION_ENCODE(major, minor, micro)
#define CAIRO_VERSION
#define cairo_current_font_extents   cairo_current_font_extents_REPLACED_BY_cairo_font_extents
#define cairo_get_font_extents   cairo_get_font_extents_REPLACED_BY_cairo_font_extents
#define cairo_current_operator   cairo_current_operator_REPLACED_BY_cairo_get_operator
#define cairo_current_tolerance   cairo_current_tolerance_REPLACED_BY_cairo_get_tolerance
#define cairo_current_point   cairo_current_point_REPLACED_BY_cairo_get_current_point
#define cairo_current_fill_rule   cairo_current_fill_rule_REPLACED_BY_cairo_get_fill_rule
#define cairo_current_line_width   cairo_current_line_width_REPLACED_BY_cairo_get_line_width
#define cairo_current_line_cap   cairo_current_line_cap_REPLACED_BY_cairo_get_line_cap
#define cairo_current_line_join   cairo_current_line_join_REPLACED_BY_cairo_get_line_join
#define cairo_current_miter_limit   cairo_current_miter_limit_REPLACED_BY_cairo_get_miter_limit
#define cairo_current_matrix   cairo_current_matrix_REPLACED_BY_cairo_get_matrix
#define cairo_current_target_surface   cairo_current_target_surface_REPLACED_BY_cairo_get_target
#define cairo_get_status   cairo_get_status_REPLACED_BY_cairo_status
#define cairo_concat_matrix   cairo_concat_matrix_REPLACED_BY_cairo_transform
#define cairo_scale_font   cairo_scale_font_REPLACED_BY_cairo_set_font_size
#define cairo_select_font   cairo_select_font_REPLACED_BY_cairo_select_font_face
#define cairo_transform_font   cairo_transform_font_REPLACED_BY_cairo_set_font_matrix
#define cairo_transform_point   cairo_transform_point_REPLACED_BY_cairo_user_to_device
#define cairo_transform_distance   cairo_transform_distance_REPLACED_BY_cairo_user_to_device_distance
#define cairo_inverse_transform_point   cairo_inverse_transform_point_REPLACED_BY_cairo_device_to_user
#define cairo_inverse_transform_distance   cairo_inverse_transform_distance_REPLACED_BY_cairo_device_to_user_distance
#define cairo_init_clip   cairo_init_clip_REPLACED_BY_cairo_reset_clip
#define cairo_surface_create_for_image   cairo_surface_create_for_image_REPLACED_BY_cairo_image_surface_create_for_data
#define cairo_default_matrix   cairo_default_matrix_REPLACED_BY_cairo_identity_matrix
#define cairo_matrix_set_affine   cairo_matrix_set_affine_REPLACED_BY_cairo_matrix_init
#define cairo_matrix_set_identity   cairo_matrix_set_identity_REPLACED_BY_cairo_matrix_init_identity
#define cairo_pattern_add_color_stop   cairo_pattern_add_color_stop_REPLACED_BY_cairo_pattern_add_color_stop_rgba
#define cairo_set_rgb_color   cairo_set_rgb_color_REPLACED_BY_cairo_set_source_rgb
#define cairo_set_pattern   cairo_set_pattern_REPLACED_BY_cairo_set_source
#define cairo_xlib_surface_create_for_pixmap_with_visual   cairo_xlib_surface_create_for_pixmap_with_visual_REPLACED_BY_cairo_xlib_surface_create
#define cairo_xlib_surface_create_for_window_with_visual   cairo_xlib_surface_create_for_window_with_visual_REPLACED_BY_cairo_xlib_surface_create
#define cairo_xcb_surface_create_for_pixmap_with_visual   cairo_xcb_surface_create_for_pixmap_with_visual_REPLACED_BY_cairo_xcb_surface_create
#define cairo_xcb_surface_create_for_window_with_visual   cairo_xcb_surface_create_for_window_with_visual_REPLACED_BY_cairo_xcb_surface_create
#define cairo_current_path   cairo_current_path_DEPRECATED_BY_cairo_copy_path
#define cairo_current_path_flat   cairo_current_path_flat_DEPRECATED_BY_cairo_copy_path_flat
#define cairo_get_path   cairo_get_path_DEPRECATED_BY_cairo_copy_path
#define cairo_get_path_flat   cairo_get_path_flat_DEPRECATED_BY_cairo_get_path_flat
#define cairo_set_alpha   cairo_set_alpha_DEPRECATED_BY_cairo_set_source_rgba_OR_cairo_paint_with_alpha
#define cairo_show_surface   cairo_show_surface_DEPRECATED_BY_cairo_set_source_surface_AND_cairo_paint
#define cairo_copy   cairo_copy_DEPRECATED_BY_cairo_create_AND_MANY_INDIVIDUAL_FUNCTIONS
#define cairo_surface_set_repeat   cairo_surface_set_repeat_DEPRECATED_BY_cairo_pattern_set_extend
#define cairo_surface_set_matrix   cairo_surface_set_matrix_DEPRECATED_BY_cairo_pattern_set_matrix
#define cairo_surface_get_matrix   cairo_surface_get_matrix_DEPRECATED_BY_cairo_pattern_get_matrix
#define cairo_surface_set_filter   cairo_surface_set_filter_DEPRECATED_BY_cairo_pattern_set_filter
#define cairo_surface_get_filter   cairo_surface_get_filter_DEPRECATED_BY_cairo_pattern_get_filter
#define cairo_matrix_create   cairo_matrix_create_DEPRECATED_BY_cairo_matrix_t
#define cairo_matrix_destroy   cairo_matrix_destroy_DEPRECATED_BY_cairo_matrix_t
#define cairo_matrix_copy   cairo_matrix_copy_DEPRECATED_BY_cairo_matrix_t
#define cairo_matrix_get_affine   cairo_matrix_get_affine_DEPRECATED_BY_cairo_matrix_t
#define cairo_set_target_surface   cairo_set_target_surface_DEPRECATED_BY_cairo_create
#define cairo_set_target_glitz   cairo_set_target_glitz_DEPRECATED_BY_cairo_glitz_surface_create
#define cairo_set_target_image   cairo_set_target_image_DEPRECATED_BY_cairo_image_surface_create_for_data
#define cairo_set_target_pdf   cairo_set_target_pdf_DEPRECATED_BY_cairo_pdf_surface_create
#define cairo_set_target_png   cairo_set_target_png_DEPRECATED_BY_cairo_surface_write_to_png
#define cairo_set_target_ps   cairo_set_target_ps_DEPRECATED_BY_cairo_ps_surface_create
#define cairo_set_target_quartz   cairo_set_target_quartz_DEPRECATED_BY_cairo_quartz_surface_create
#define cairo_set_target_win32   cairo_set_target_win32_DEPRECATED_BY_cairo_win32_surface_create
#define cairo_set_target_xcb   cairo_set_target_xcb_DEPRECATED_BY_cairo_xcb_surface_create
#define cairo_set_target_drawable   cairo_set_target_drawable_DEPRECATED_BY_cairo_xlib_surface_create
#define cairo_get_status_string   cairo_get_status_string_DEPRECATED_BY_cairo_status_AND_cairo_status_to_string
#define cairo_status_string   cairo_status_string_DEPRECATED_BY_cairo_status_AND_cairo_status_to_string

Typedefs

typedef int cairo_bool_t
 cairo_bool_t:
typedef struct _cairo
 cairo_t:
typedef struct _cairo_surface
 cairo_surface_t:
typedef struct _cairo_matrix cairo_matrix_t
 cairo_matrix_t: : xx component of the affine transformation : yx component of the affine transformation : xy component of the affine transformation : yy component of the affine transformation : X translation component of the affine transformation : Y translation component of the affine transformation
typedef struct _cairo_pattern
typedef void(* cairo_destroy_func_t )(void *data)
 cairo_destroy_func_t: : The data element being destroyed.
typedef struct _cairo_user_data_key cairo_user_data_key_t
 cairo_user_data_key_t: : not used; ignore.
typedef enum _cairo_status cairo_status_t
 cairo_status_t : no error has occurred : out of memory : cairo_restore without matching cairo_save : no saved group to pop : no current point defined : invalid matrix (not invertible) : invalid value for an input cairo_status_t : NULL pointer : input string not valid UTF-8 : input path data not valid : error while reading from input stream : error while writing to output stream : target surface has been finished : the surface type is not appropriate for the operation : the pattern type is not appropriate for the operation : invalid value for an input cairo_content_t : invalid value for an input cairo_format_t : invalid value for an input Visual* : file not found : invalid value for a dash setting
typedef cairo_status_t(* cairo_write_func_t )(void *closure, const unsigned char *data, unsigned int length)
 cairo_write_func_t: : the output closure : the buffer containing the data to write : the amount of data to write
typedef cairo_status_t(* cairo_read_func_t )(void *closure, unsigned char *data, unsigned int length)
 cairo_read_func_t: : the input closure : the buffer into which to read the data : the amount of data to read
typedef enum _cairo_operator cairo_operator_t
typedef enum _cairo_antialias cairo_antialias_t
 cairo_antialias_t: : Use the default antialiasing for the subsystem and target device : Use a bilevel alpha mask : Perform single-color antialiasing (using shades of gray for black text on a white background, for example).
typedef enum _cairo_fill_rule cairo_fill_rule_t
 cairo_fill_rule_t : If the path crosses the ray from left-to-right, counts +1.
typedef enum _cairo_line_cap cairo_line_cap_t
 cairo_line_cap_t : start(stop) the line exactly at the start(end) point : use a round ending, the center of the circle is the end point : use squared ending, the center of the square is the end point
typedef enum _cairo_line_join cairo_line_join_t
typedef struct _cairo_scaled_font
 cairo_scaled_font_t:
typedef struct _cairo_font_face
 cairo_font_face_t:
typedef enum _cairo_font_slant cairo_font_slant_t
typedef enum _cairo_font_weight cairo_font_weight_t
typedef enum _cairo_subpixel_order cairo_subpixel_order_t
 cairo_subpixel_order_t: : Use the default subpixel order for for the target device : Subpixel elements are arranged horizontally with red at the left : Subpixel elements are arranged horizontally with blue at the left : Subpixel elements are arranged vertically with red at the top : Subpixel elements are arranged vertically with blue at the top
typedef enum _cairo_hint_style cairo_hint_style_t
 cairo_hint_style_t: : Use the default hint style for for font backend and target device : Do not hint outlines : Hint outlines slightly to improve contrast while retaining good fidelity to the original shapes.
typedef enum _cairo_hint_metrics cairo_hint_metrics_t
 cairo_hint_metrics_t: : Hint metrics in the default manner for the font backend and target device : Do not hint font metrics : Hint font metrics
typedef struct _cairo_font_options
typedef enum _cairo_path_data_type cairo_path_data_type_t
typedef union _cairo_path_data_t
 cairo_path_data_t:
typedef struct cairo_path cairo_path_t
 cairo_path_t: : the current error status : the elements in the path : the number of elements in the data array
typedef enum _cairo_content cairo_content_t
 cairo_content_t : The surface will hold color content only.
typedef enum _cairo_format cairo_format_t
 cairo_format_t : each pixel is a 32-bit quantity, with alpha in the upper 8 bits, then red, then green, then blue.
typedef enum _cairo_extend cairo_extend_t
typedef enum _cairo_filter cairo_filter_t

Enumerations

enum  _cairo_status {
  CAIRO_STATUS_SUCCESS = 0, CAIRO_STATUS_NO_MEMORY, CAIRO_STATUS_INVALID_RESTORE, CAIRO_STATUS_INVALID_POP_GROUP,
  CAIRO_STATUS_NO_CURRENT_POINT, CAIRO_STATUS_INVALID_MATRIX, CAIRO_STATUS_INVALID_STATUS, CAIRO_STATUS_NULL_POINTER,
  CAIRO_STATUS_INVALID_STRING, CAIRO_STATUS_INVALID_PATH_DATA, CAIRO_STATUS_READ_ERROR, CAIRO_STATUS_WRITE_ERROR,
  CAIRO_STATUS_SURFACE_FINISHED, CAIRO_STATUS_SURFACE_TYPE_MISMATCH, CAIRO_STATUS_PATTERN_TYPE_MISMATCH, CAIRO_STATUS_INVALID_CONTENT,
  CAIRO_STATUS_INVALID_FORMAT, CAIRO_STATUS_INVALID_VISUAL, CAIRO_STATUS_FILE_NOT_FOUND, CAIRO_STATUS_INVALID_DASH
}
 cairo_status_t : no error has occurred : out of memory : cairo_restore without matching cairo_save : no saved group to pop : no current point defined : invalid matrix (not invertible) : invalid value for an input cairo_status_t : NULL pointer : input string not valid UTF-8 : input path data not valid : error while reading from input stream : error while writing to output stream : target surface has been finished : the surface type is not appropriate for the operation : the pattern type is not appropriate for the operation : invalid value for an input cairo_content_t : invalid value for an input cairo_format_t : invalid value for an input Visual* : file not found : invalid value for a dash setting More...
enum  _cairo_operator {
  CAIRO_OPERATOR_CLEAR, CAIRO_OPERATOR_SOURCE, CAIRO_OPERATOR_OVER, CAIRO_OPERATOR_IN,
  CAIRO_OPERATOR_OUT, CAIRO_OPERATOR_ATOP, CAIRO_OPERATOR_DEST, CAIRO_OPERATOR_DEST_OVER,
  CAIRO_OPERATOR_DEST_IN, CAIRO_OPERATOR_DEST_OUT, CAIRO_OPERATOR_DEST_ATOP, CAIRO_OPERATOR_XOR,
  CAIRO_OPERATOR_ADD, CAIRO_OPERATOR_SATURATE
}
enum  _cairo_antialias { CAIRO_ANTIALIAS_DEFAULT, CAIRO_ANTIALIAS_NONE, CAIRO_ANTIALIAS_GRAY, CAIRO_ANTIALIAS_SUBPIXEL }
 cairo_antialias_t: : Use the default antialiasing for the subsystem and target device : Use a bilevel alpha mask : Perform single-color antialiasing (using shades of gray for black text on a white background, for example). More...
enum  _cairo_fill_rule { CAIRO_FILL_RULE_WINDING, CAIRO_FILL_RULE_EVEN_ODD }
 cairo_fill_rule_t : If the path crosses the ray from left-to-right, counts +1. More...
enum  _cairo_line_cap { CAIRO_LINE_CAP_BUTT, CAIRO_LINE_CAP_ROUND, CAIRO_LINE_CAP_SQUARE }
 cairo_line_cap_t : start(stop) the line exactly at the start(end) point : use a round ending, the center of the circle is the end point : use squared ending, the center of the square is the end point More...
enum  _cairo_line_join { CAIRO_LINE_JOIN_MITER, CAIRO_LINE_JOIN_ROUND, CAIRO_LINE_JOIN_BEVEL }
enum  _cairo_font_slant { CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_SLANT_ITALIC, CAIRO_FONT_SLANT_OBLIQUE }
enum  _cairo_font_weight { CAIRO_FONT_WEIGHT_NORMAL, CAIRO_FONT_WEIGHT_BOLD }
enum  _cairo_subpixel_order {
  CAIRO_SUBPIXEL_ORDER_DEFAULT, CAIRO_SUBPIXEL_ORDER_RGB, CAIRO_SUBPIXEL_ORDER_BGR, CAIRO_SUBPIXEL_ORDER_VRGB,
  CAIRO_SUBPIXEL_ORDER_VBGR
}
 cairo_subpixel_order_t: : Use the default subpixel order for for the target device : Subpixel elements are arranged horizontally with red at the left : Subpixel elements are arranged horizontally with blue at the left : Subpixel elements are arranged vertically with red at the top : Subpixel elements are arranged vertically with blue at the top More...
enum  _cairo_hint_style {
  CAIRO_HINT_STYLE_DEFAULT, CAIRO_HINT_STYLE_NONE, CAIRO_HINT_STYLE_SLIGHT, CAIRO_HINT_STYLE_MEDIUM,
  CAIRO_HINT_STYLE_FULL
}
 cairo_hint_style_t: : Use the default hint style for for font backend and target device : Do not hint outlines : Hint outlines slightly to improve contrast while retaining good fidelity to the original shapes. More...
enum  _cairo_hint_metrics { CAIRO_HINT_METRICS_DEFAULT, CAIRO_HINT_METRICS_OFF, CAIRO_HINT_METRICS_ON }
 cairo_hint_metrics_t: : Hint metrics in the default manner for the font backend and target device : Do not hint font metrics : Hint font metrics More...
enum  _cairo_path_data_type { CAIRO_PATH_MOVE_TO, CAIRO_PATH_LINE_TO, CAIRO_PATH_CURVE_TO, CAIRO_PATH_CLOSE_PATH }
enum  _cairo_content { CAIRO_CONTENT_COLOR = 0x1000, CAIRO_CONTENT_ALPHA = 0x2000, CAIRO_CONTENT_COLOR_ALPHA = 0x3000 }
 cairo_content_t : The surface will hold color content only. More...
enum  _cairo_format { CAIRO_FORMAT_ARGB32, CAIRO_FORMAT_RGB24, CAIRO_FORMAT_A8, CAIRO_FORMAT_A1 }
 cairo_format_t : each pixel is a 32-bit quantity, with alpha in the upper 8 bits, then red, then green, then blue. More...
enum  _cairo_extend { CAIRO_EXTEND_NONE, CAIRO_EXTEND_REPEAT, CAIRO_EXTEND_REFLECT }
enum  _cairo_filter {
  CAIRO_FILTER_FAST, CAIRO_FILTER_GOOD, CAIRO_FILTER_BEST, CAIRO_FILTER_NEAREST,
  CAIRO_FILTER_BILINEAR, CAIRO_FILTER_GAUSSIAN
}

Functions

int cairo_version (void)
 cairo_version:
const char * cairo_version_string (void)
 cairo_version_string:
cairo_t * cairo_create (cairo_surface_t *target)
 cairo_create: : target surface for the context
cairo_t * cairo_reference (cairo_t *cr)
 cairo_reference: : a #cairo_t
void cairo_destroy (cairo_t *cr)
 cairo_destroy: : a #cairo_t
void cairo_save (cairo_t *cr)
 cairo_save: : a #cairo_t
void cairo_restore (cairo_t *cr)
 cairo_restore: : a #cairo_t
void cairo_set_operator (cairo_t *cr, cairo_operator_t op)
 cairo_set_operator: : a #cairo_t : a compositing operator, specified as a cairo_operator_t
void cairo_set_source (cairo_t *cr, cairo_pattern_t *source)
 cairo_set_source : a cairo context : a #cairo_pattern_t to be used as the source for subsequent drawing operations.
void cairo_set_source_rgb (cairo_t *cr, double red, double green, double blue)
 cairo_set_source_rgb : a cairo context : red component of color : green component of color : blue component of color
void cairo_set_source_rgba (cairo_t *cr, double red, double green, double blue, double alpha)
 cairo_set_source_rgba: : a cairo context : red component of color : green component of color : blue component of color : alpha component of color
void cairo_set_source_surface (cairo_t *cr, cairo_surface_t *surface, double x, double y)
 cairo_set_source_surface: : a cairo context : a surface to be used to set the source pattern : User-space X coordinate for surface origin : User-space Y coordinate for surface origin
void cairo_set_tolerance (cairo_t *cr, double tolerance)
 cairo_set_tolerance: : a #cairo_t : the tolerance, in device units (typically pixels)
void cairo_set_antialias (cairo_t *cr, cairo_antialias_t antialias)
 cairo_set_antialias: : a #cairo_t : the new antialiasing mode
void cairo_set_fill_rule (cairo_t *cr, cairo_fill_rule_t fill_rule)
 cairo_set_fill_rule: : a #cairo_t : a fill rule, specified as a cairo_fill_rule_t
void cairo_set_line_width (cairo_t *cr, double width)
 cairo_set_line_width: : a #cairo_t : a line width, as a user-space value
void cairo_set_line_cap (cairo_t *cr, cairo_line_cap_t line_cap)
 cairo_set_line_cap: : a cairo context, as a #cairo_t : a line cap style, as a cairo_line_cap_t
void cairo_set_line_join (cairo_t *cr, cairo_line_join_t line_join)
 cairo_set_line_join: : a cairo context, as a #cairo_t : a line joint style, as a cairo_line_join_t
void cairo_set_dash (cairo_t *cr, double *dashes, int num_dashes, double offset)
 cairo_set_dash: : a cairo context : an array specifying alternate lengths of on and off po : the length of the dashes array : an offset into the dash pattern at which the stroke should start
void cairo_set_miter_limit (cairo_t *cr, double limit)
void cairo_translate (cairo_t *cr, double tx, double ty)
 cairo_translate: : a cairo context : amount to translate in the X direction : amount to translate in the Y direction
void cairo_scale (cairo_t *cr, double sx, double sy)
 cairo_scale: : a cairo context : scale factor for the X dimension : scale factor for the Y dimension
void cairo_rotate (cairo_t *cr, double angle)
 cairo_rotate: : a cairo context : angle (in radians) by which the user-space axes will be rotated
void cairo_transform (cairo_t *cr, const cairo_matrix_t *matrix)
 cairo_transform: : a cairo context : a transformation to be applied to the user-space axes
void cairo_set_matrix (cairo_t *cr, const cairo_matrix_t *matrix)
 cairo_set_matrix: : a cairo context : a transformation matrix from user space to device space
void cairo_identity_matrix (cairo_t *cr)
 cairo_identity_matrix: : a cairo context
void cairo_user_to_device (cairo_t *cr, double *x, double *y)
 cairo_user_to_device: : a cairo context : X value of coordinate (in/out parameter) : Y value of coordinate (in/out parameter)
void cairo_user_to_device_distance (cairo_t *cr, double *dx, double *dy)
 cairo_user_to_device_distance: : a cairo context : X component of a distance vector (in/out parameter) : Y component of a distance vector (in/out parameter)
void cairo_device_to_user (cairo_t *cr, double *x, double *y)
 cairo_device_to_user: : a cairo : X value of coordinate (in/out parameter) : Y value of coordinate (in/out parameter)
void cairo_device_to_user_distance (cairo_t *cr, double *dx, double *dy)
 cairo_device_to_user_distance: : a cairo context : X component of a distance vector (in/out parameter) : Y component of a distance vector (in/out parameter)
void cairo_new_path (cairo_t *cr)
 cairo_new_path: : a cairo context
void cairo_move_to (cairo_t *cr, double x, double y)
 cairo_move_to: : a cairo context : the X coordinate of the new position : the Y coordinate of the new position
void cairo_line_to (cairo_t *cr, double x, double y)
 cairo_line_to: : a cairo context : the X coordinate of the end of the new line : the Y coordinate of the end of the new line
void cairo_curve_to (cairo_t *cr, double x1, double y1, double x2, double y2, double x3, double y3)
 cairo_curve_to: : a cairo context : the X coordinate of the first control point : the Y coordinate of the first control point : the X coordinate of the second control point : the Y coordinate of the second control point : the X coordinate of the end of the curve : the Y coordinate of the end of the curve
void cairo_arc (cairo_t *cr, double xc, double yc, double radius, double angle1, double angle2)
 cairo_arc: : a cairo context : X position of the center of the arc : Y position of the center of the arc : the radius of the arc : the start angle, in radians : the end angle, in radians
void cairo_arc_negative (cairo_t *cr, double xc, double yc, double radius, double angle1, double angle2)
 cairo_arc_negative: : a cairo context : X position of the center of the arc : Y position of the center of the arc : the radius of the arc : the start angle, in radians : the end angle, in radians
void cairo_rel_move_to (cairo_t *cr, double dx, double dy)
 cairo_rel_move_to: : a cairo context : the X offset : the Y offset
void cairo_rel_line_to (cairo_t *cr, double dx, double dy)
 cairo_rel_line_to: : a cairo context : the X offset to the end of the new line : the Y offset to the end of the new line
void cairo_rel_curve_to (cairo_t *cr, double dx1, double dy1, double dx2, double dy2, double dx3, double dy3)
 cairo_rel_curve_to: : a cairo context : the X offset to the first control point : the Y offset to the first control point : the X offset to the second control point : the Y offset to the second control point : the X offset to the end of the curve : the Y offset to the end of the curve
void cairo_rectangle (cairo_t *cr, double x, double y, double width, double height)
 cairo_rectangle: : a cairo context : the X coordinate of the top left corner of the rectangle : the Y coordinate to the top left corner of the rectangle : the width of the rectangle : the height of the rectangle
void cairo_close_path (cairo_t *cr)
 cairo_close_path: : a cairo context
void cairo_paint (cairo_t *cr)
 cairo_paint: : a cairo context
void cairo_paint_with_alpha (cairo_t *cr, double alpha)
 cairo_paint_with_alpha: : a cairo context : alpha value, between 0 (transparent) and 1 (opaque)
void cairo_mask (cairo_t *cr, cairo_pattern_t *pattern)
 cairo_mask: : a cairo context : a #cairo_pattern_t
void cairo_mask_surface (cairo_t *cr, cairo_surface_t *surface, double surface_x, double surface_y)
 cairo_mask_surface: : a cairo context : a #cairo_surface_t : X coordinate at which to place the origin of : Y coordinate at which to place the origin of
void cairo_stroke (cairo_t *cr)
 cairo_stroke: : a cairo context
void cairo_stroke_preserve (cairo_t *cr)
 cairo_stroke_preserve: : a cairo context
void cairo_fill (cairo_t *cr)
 cairo_fill: : a cairo context
void cairo_fill_preserve (cairo_t *cr)
 cairo_fill_preserve: : a cairo context
void cairo_copy_page (cairo_t *cr)
void cairo_show_page (cairo_t *cr)
cairo_bool_t cairo_in_stroke (cairo_t *cr, double x, double y)
cairo_bool_t cairo_in_fill (cairo_t *cr, double x, double y)
void cairo_stroke_extents (cairo_t *cr, double *x1, double *y1, double *x2, double *y2)
void cairo_fill_extents (cairo_t *cr, double *x1, double *y1, double *x2, double *y2)
void cairo_reset_clip (cairo_t *cr)
 cairo_reset_clip: : a cairo context
void cairo_clip (cairo_t *cr)
 cairo_clip: : a cairo context
void cairo_clip_preserve (cairo_t *cr)
 cairo_clip_preserve: : a cairo context
cairo_font_options_t * cairo_font_options_create (void)
 cairo_font_options_create:
cairo_font_options_t * cairo_font_options_copy (const cairo_font_options_t *original)
 cairo_font_options_copy: : a #cairo_font_options_t
void cairo_font_options_destroy (cairo_font_options_t *options)
 cairo_font_options_destroy: : a #cairo_font_options_t
cairo_status_t cairo_font_options_status (cairo_font_options_t *options)
 cairo_font_options_status: : a #cairo_font_options_t
void cairo_font_options_merge (cairo_font_options_t *options, const cairo_font_options_t *other)
 cairo_font_options_merge: : a #cairo_font_options_t : another #cairo_font_options_t
cairo_bool_t cairo_font_options_equal (const cairo_font_options_t *options, const cairo_font_options_t *other)
 cairo_font_options_equal: : a #cairo_font_options_t : another #cairo_font_options_t
unsigned long cairo_font_options_hash (const cairo_font_options_t *options)
 cairo_font_options_hash: : a #cairo_font_options_t
void cairo_font_options_set_antialias (cairo_font_options_t *options, cairo_antialias_t antialias)
 cairo_font_options_set_antialias: : a #cairo_font_options_t : the new antialiasing mode
cairo_antialias_t cairo_font_options_get_antialias (const cairo_font_options_t *options)
 cairo_font_options_get_antialias: : a #cairo_font_options_t
void cairo_font_options_set_subpixel_order (cairo_font_options_t *options, cairo_subpixel_order_t subpixel_order)
 cairo_font_options_set_subpixel_order: : a #cairo_font_options_t : the new subpixel order
cairo_subpixel_order_t cairo_font_options_get_subpixel_order (const cairo_font_options_t *options)
 cairo_font_options_get_subpixel_order: : a #cairo_font_options_t
void cairo_font_options_set_hint_style (cairo_font_options_t *options, cairo_hint_style_t hint_style)
 cairo_font_options_set_hint_style: : a #cairo_font_options_t : the new hint style
cairo_hint_style_t cairo_font_options_get_hint_style (const cairo_font_options_t *options)
 cairo_font_options_get_hint_style: : a #cairo_font_options_t
void cairo_font_options_set_hint_metrics (cairo_font_options_t *options, cairo_hint_metrics_t hint_metrics)
 cairo_font_options_set_hint_metrics: : a #cairo_font_options_t : the new metrics hinting mode
cairo_hint_metrics_t cairo_font_options_get_hint_metrics (const cairo_font_options_t *options)
 cairo_font_options_get_hint_metrics: : a #cairo_font_options_t
void cairo_select_font_face (cairo_t *cr, const char *family, cairo_font_slant_t slant, cairo_font_weight_t weight)
 cairo_select_font_face: : a #cairo_t : a font family name, encoded in UTF-8 : the slant for the font : the weight for the font
void cairo_set_font_size (cairo_t *cr, double size)
 cairo_set_font_size: : a #cairo_t : the new font size, in user space units
void cairo_set_font_matrix (cairo_t *cr, const cairo_matrix_t *matrix)
 cairo_set_font_matrix : a #cairo_t : a cairo_matrix_t describing a transform to be applied to the current font.
void cairo_get_font_matrix (cairo_t *cr, cairo_matrix_t *matrix)
 cairo_get_font_matrix : a #cairo_t : return value for the matrix
void cairo_set_font_options (cairo_t *cr, const cairo_font_options_t *options)
 cairo_set_font_options: : a #cairo_t : font options to use
void cairo_get_font_options (cairo_t *cr, cairo_font_options_t *options)
 cairo_get_font_options: : a #cairo_t : a #cairo_font_options_t object into which to store the retrieved options.
void cairo_show_text (cairo_t *cr, const char *utf8)
 cairo_show_text: : a cairo context : a string of text encoded in UTF-8
void cairo_show_glyphs (cairo_t *cr, cairo_glyph_t *glyphs, int num_glyphs)
cairo_font_face_t * cairo_get_font_face (cairo_t *cr)
 cairo_get_font_face: : a #cairo_t
void cairo_font_extents (cairo_t *cr, cairo_font_extents_t *extents)
 cairo_font_extents: : a #cairo_t : a cairo_font_extents_t object into which the results will be stored.
void cairo_set_font_face (cairo_t *cr, cairo_font_face_t *font_face)
 cairo_set_font_face: : a #cairo_t : a #cairo_font_face_t, or NULL to restore to the default font
void cairo_text_extents (cairo_t *cr, const char *utf8, cairo_text_extents_t *extents)
 cairo_text_extents: : a #cairo_t : a string of text, encoded in UTF-8 : a cairo_text_extents_t object into which the results will be stored
void cairo_glyph_extents (cairo_t *cr, cairo_glyph_t *glyphs, int num_glyphs, cairo_text_extents_t *extents)
 cairo_glyph_extents: : a #cairo_t : an array of cairo_glyph_t objects : the number of elements in : a cairo_text_extents_t object into which the results will be stored
void cairo_text_path (cairo_t *cr, const char *utf8)
void cairo_glyph_path (cairo_t *cr, cairo_glyph_t *glyphs, int num_glyphs)
cairo_font_face_t * cairo_font_face_reference (cairo_font_face_t *font_face)
 cairo_font_face_reference: : a #cairo_font_face_t, (may be NULL in which case this function does nothing).
void cairo_font_face_destroy (cairo_font_face_t *font_face)
 cairo_font_face_destroy: : a #cairo_font_face_t
cairo_status_t cairo_font_face_status (cairo_font_face_t *font_face)
 cairo_font_face_status: : a #cairo_font_face_t
voidcairo_font_face_get_user_data (cairo_font_face_t *font_face, const cairo_user_data_key_t *key)
 cairo_font_face_get_user_data: : a #cairo_font_face_t : the address of the cairo_user_data_key_t the user data was attached to
cairo_status_t cairo_font_face_set_user_data (cairo_font_face_t *font_face, const cairo_user_data_key_t *key, void *user_data, cairo_destroy_func_t destroy)
 cairo_font_face_set_user_data: : a #cairo_font_face_t : the address of a cairo_user_data_key_t to attach the user data to : the user data to attach to the font face : a cairo_destroy_func_t which will be called when the font face is destroyed or when new user data is attached using the same key.
cairo_scaled_font_t * cairo_scaled_font_create (cairo_font_face_t *font_face, const cairo_matrix_t *font_matrix, const cairo_matrix_t *ctm, const cairo_font_options_t *options)
 cairo_scaled_font_create: : a #cairo_font_face_t : font space to user space transformation matrix for the font.
cairo_scaled_font_t * cairo_scaled_font_reference (cairo_scaled_font_t *scaled_font)
 cairo_scaled_font_reference: : a #cairo_scaled_font_t, (may be NULL in which case this function does nothing)
void cairo_scaled_font_destroy (cairo_scaled_font_t *scaled_font)
 cairo_scaled_font_destroy: : a #cairo_scaled_font_t
cairo_status_t cairo_scaled_font_status (cairo_scaled_font_t *scaled_font)
 cairo_scaled_font_status: : a #cairo_scaled_font_t
void cairo_scaled_font_extents (cairo_scaled_font_t *scaled_font, cairo_font_extents_t *extents)
 cairo_scaled_font_extents: : a #cairo_scaled_font_t : a cairo_font_extents_t which to store the retrieved extents.
void cairo_scaled_font_glyph_extents (cairo_scaled_font_t *scaled_font, cairo_glyph_t *glyphs, int num_glyphs, cairo_text_extents_t *extents)
 cairo_font_glyph_extents: : a #cairo_scaled_font_t : an array of glyph IDs with X and Y offsets.
cairo_operator_t cairo_get_operator (cairo_t *cr)
 cairo_get_operator: : a cairo context
cairo_pattern_t * cairo_get_source (cairo_t *cr)
 cairo_get_source: : a cairo context
double cairo_get_tolerance (cairo_t *cr)
 cairo_get_tolerance: : a cairo context
cairo_antialias_t cairo_get_antialias (cairo_t *cr)
 cairo_get_antialias: : a cairo context
void cairo_get_current_point (cairo_t *cr, double *x, double *y)
 cairo_get_current_point: : a cairo context : return value for X coordinate of the current point : return value for Y coordinate of the current point
cairo_fill_rule_t cairo_get_fill_rule (cairo_t *cr)
 cairo_get_fill_rule: : a cairo context
double cairo_get_line_width (cairo_t *cr)
 cairo_get_line_width: : a cairo context
cairo_line_cap_t cairo_get_line_cap (cairo_t *cr)
 cairo_get_line_cap: : a cairo context
cairo_line_join_t cairo_get_line_join (cairo_t *cr)
 cairo_get_line_join: : a cairo context
double cairo_get_miter_limit (cairo_t *cr)
 cairo_get_miter_limit: : a cairo context
void cairo_get_matrix (cairo_t *cr, cairo_matrix_t *matrix)
 cairo_get_matrix: : a cairo context : return value for the matrix
cairo_surface_t * cairo_get_target (cairo_t *cr)
 cairo_get_target: : a cairo context
cairo_path_tcairo_copy_path (cairo_t *cr)
 cairo_copy_path: : a cairo context
cairo_path_tcairo_copy_path_flat (cairo_t *cr)
 cairo_copy_path_flat: : a cairo context
void cairo_append_path (cairo_t *cr, cairo_path_t *path)
 cairo_append_path: : a cairo context : path to be appended
void cairo_path_destroy (cairo_path_t *path)
 cairo_path_destroy: : a path previously returned by either cairo_copy_path() or cairo_copy_path_flat().
cairo_status_t cairo_status (cairo_t *cr)
 cairo_status: : a cairo context
const char * cairo_status_to_string (cairo_status_t status)
 cairo_status_to_string: : a cairo status
cairo_surface_t * cairo_surface_create_similar (cairo_surface_t *other, cairo_content_t content, int width, int height)
 cairo_surface_create_similar: : an existing surface used to select the backend of the new surface : the content for the new surface : width of the new surface, (in device-space units) : height of the new surface (in device-space units)
cairo_surface_t * cairo_surface_reference (cairo_surface_t *surface)
 cairo_surface_reference: : a #cairo_surface_t
void cairo_surface_destroy (cairo_surface_t *surface)
 cairo_surface_destroy: : a #cairo_t
cairo_status_t cairo_surface_status (cairo_surface_t *surface)
 cairo_surface_status: : a #cairo_surface_t
void cairo_surface_finish (cairo_surface_t *surface)
 cairo_surface_finish: : the #cairo_surface_t to finish
voidcairo_surface_get_user_data (cairo_surface_t *surface, const cairo_user_data_key_t *key)
 cairo_surface_get_user_data: : a #cairo_surface_t : the address of the cairo_user_data_key_t the user data was attached to
cairo_status_t cairo_surface_set_user_data (cairo_surface_t *surface, const cairo_user_data_key_t *key, void *user_data, cairo_destroy_func_t destroy)
 cairo_surface_set_user_data: : a #cairo_surface_t : the address of a cairo_user_data_key_t to attach the user data to : the user data to attach to the surface : a cairo_destroy_func_t which will be called when the surface is destroyed or when new user data is attached using the same key.
void cairo_surface_get_font_options (cairo_surface_t *surface, cairo_font_options_t *options)
 cairo_surface_get_font_options: : a #cairo_surface_t : a #cairo_font_options_t object into which to store the retrieved options.
void cairo_surface_flush (cairo_surface_t *surface)
 cairo_surface_flush: : a #cairo_surface_t
void cairo_surface_mark_dirty (cairo_surface_t *surface)
 cairo_surface_mark_dirty: : a #cairo_surface_t
void cairo_surface_mark_dirty_rectangle (cairo_surface_t *surface, int x, int y, int width, int height)
 cairo_surface_mark_dirty_rectangle: : a #cairo_surface_t : X coordinate of dirty rectangle : Y coordinate of dirty rectangle : width of dirty rectangle : height of dirty rectangle
void cairo_surface_set_device_offset (cairo_surface_t *surface, double x_offset, double y_offset)
 cairo_surface_set_device_offset: : a #cairo_surface_t : the offset in the X direction, in device units : the offset in the Y direction, in device units
cairo_surface_t * cairo_image_surface_create (cairo_format_t format, int width, int height)
 cairo_image_surface_create: : format of pixels in the surface to create : width of the surface, in pixels : height of the surface, in pixels
cairo_surface_t * cairo_image_surface_create_for_data (unsigned char *data, cairo_format_t format, int width, int height, int stride)
 cairo_image_surface_create_for_data: : a pointer to a buffer supplied by the application in which to write contents.
int cairo_image_surface_get_width (cairo_surface_t *surface)
 cairo_image_surface_get_width: : a #cairo_image_surface_t
int cairo_image_surface_get_height (cairo_surface_t *surface)
 cairo_image_surface_get_height: : a #cairo_image_surface_t
cairo_pattern_t * cairo_pattern_create_rgb (double red, double green, double blue)
 cairo_pattern_create_rgb: : red component of the color : green component of the color : blue component of the color
cairo_pattern_t * cairo_pattern_create_rgba (double red, double green, double blue, double alpha)
 cairo_pattern_create_rgba: : red component of the color : green component of the color : blue component of the color : alpha component of the color
cairo_pattern_t * cairo_pattern_create_for_surface (cairo_surface_t *surface)
 cairo_pattern_create_for_surface: : the surface
cairo_pattern_t * cairo_pattern_create_linear (double x0, double y0, double x1, double y1)
 cairo_pattern_create_linear: : x coordinate of the start point : y coordinate of the start point : x coordinate of the end point : y coordinate of the end point
cairo_pattern_t * cairo_pattern_create_radial (double cx0, double cy0, double radius0, double cx1, double cy1, double radius1)
 cairo_pattern_create_radial: : x coordinate for the center of the start circle : y coordinate for the center of the start circle : radius of the start cirle : x coordinate for the center of the end circle : y coordinate for the center of the end circle : radius of the end cirle
cairo_pattern_t * cairo_pattern_reference (cairo_pattern_t *pattern)
 cairo_pattern_reference: : a #cairo_pattern_t
void cairo_pattern_destroy (cairo_pattern_t *pattern)
 cairo_pattern_destroy: : a #cairo_pattern_t
cairo_status_t cairo_pattern_status (cairo_pattern_t *pattern)
 cairo_pattern_status: : a #cairo_pattern_t
void cairo_pattern_add_color_stop_rgb (cairo_pattern_t *pattern, double offset, double red, double green, double blue)
 cairo_pattern_add_color_stop_rgb: : a #cairo_pattern_t : an offset in the range [0.0 .
void cairo_pattern_add_color_stop_rgba (cairo_pattern_t *pattern, double offset, double red, double green, double blue, double alpha)
 cairo_pattern_add_color_stop_rgba: : a #cairo_pattern_t : an offset in the range [0.0 .
void cairo_pattern_set_matrix (cairo_pattern_t *pattern, const cairo_matrix_t *matrix)
 cairo_pattern_set_matrix: : a #cairo_pattern_t : a cairo_matrix_t
void cairo_pattern_get_matrix (cairo_pattern_t *pattern, cairo_matrix_t *matrix)
 cairo_pattern_get_matrix: : a #cairo_pattern_t : return value for the matrix
void cairo_pattern_set_extend (cairo_pattern_t *pattern, cairo_extend_t extend)
cairo_extend_t cairo_pattern_get_extend (cairo_pattern_t *pattern)
void cairo_pattern_set_filter (cairo_pattern_t *pattern, cairo_filter_t filter)
cairo_filter_t cairo_pattern_get_filter (cairo_pattern_t *pattern)
void cairo_matrix_init (cairo_matrix_t *matrix, double xx, double yx, double xy, double yy, double x0, double y0)
 cairo_matrix_init: : a cairo_matrix_t : xx component of the affine transformation : yx component of the affine transformation : xy component of the affine transformation : yy component of the affine transformation : X translation component of the affine transformation : Y translation component of the affine transformation
void cairo_matrix_init_identity (cairo_matrix_t *matrix)
 cairo_matrix_init_identity: : a cairo_matrix_t
void cairo_matrix_init_translate (cairo_matrix_t *matrix, double tx, double ty)
 cairo_matrix_init_translate: : a cairo_matrix_t : amount to translate in the X direction : amount to translate in the Y direction
void cairo_matrix_init_scale (cairo_matrix_t *matrix, double sx, double sy)
 cairo_matrix_init_scale: : a cairo_matrix_t : scale factor in the X direction : scale factor in the Y direction
void cairo_matrix_init_rotate (cairo_matrix_t *matrix, double radians)
 cairo_matrix_init_rotate: : a cairo_matrix_t : angle of rotation, in radians.
void cairo_matrix_translate (cairo_matrix_t *matrix, double tx, double ty)
 cairo_matrix_translate: : a cairo_matrix_t : amount to translate in the X direction : amount to translate in the Y direction
void cairo_matrix_scale (cairo_matrix_t *matrix, double sx, double sy)
 cairo_matrix_scale: : a cairo_matrix_t : scale factor in the X direction : scale factor in the Y direction
void cairo_matrix_rotate (cairo_matrix_t *matrix, double radians)
 cairo_matrix_rotate: : a : angle of rotation, in radians.
cairo_status_t cairo_matrix_invert (cairo_matrix_t *matrix)
 cairo_matrix_invert: : a
void cairo_matrix_multiply (cairo_matrix_t *result, const cairo_matrix_t *a, const cairo_matrix_t *b)
 cairo_matrix_multiply:
void cairo_matrix_transform_distance (const cairo_matrix_t *matrix, double *dx, double *dy)
 cairo_matrix_transform_distance: : a : X component of a distance vector.
void cairo_matrix_transform_point (const cairo_matrix_t *matrix, double *x, double *y)
 cairo_matrix_transform_point: : a : X position.

Class Documentation

struct _cairo_matrix

cairo_matrix_t: : xx component of the affine transformation : yx component of the affine transformation : xy component of the affine transformation : yy component of the affine transformation : X translation component of the affine transformation : Y translation component of the affine transformation

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: <programlisting> x_new = xx * x + xy * y + x0; y_new = yx * x + yy * y + y0; </programlisting>

Definition at line 116 of file cairo.h.

Class Members
double x0
double xx
double xy
double y0
double yx
double yy
struct _cairo_user_data_key

cairo_user_data_key_t: : not used; ignore.

cairo_user_data_key_t is used for attaching user data to cairo

data structures. The actual contents of the struct is never used, and there is no need to initialize the object; only the unique address of a #cairo_data_key_t object is used. Typically, you would just use the address of a static #cairo_data_key_t object.

Definition at line 144 of file cairo.h.

Collaboration diagram for _cairo_user_data_key:
Class Members
int unused
struct cairo_glyph_t

cairo_glyph_t: : glyph index in the font.

The exact interpretation of the glyph index depends on the font technology being used. : the offset in the X direction between the origin used for drawing or measuring the string and the origin of this glyph. : the offset in the Y direction between the origin used for drawing or measuring the string and the origin of this glyph.

The cairo_glyph_t structure holds information about a single glyph when drawing or measuring text. A font is (in simple terms) a collection of shapes used to draw text. A glyph is one of these shapes. There can be multiple glyphs for a single character (alternates to be used in different contexts, for example), or a glyph can be a <firstterm>ligature</firstterm> of multiple characters. Cairo doesn't expose any way of converting input text into glyphs, so in order to use the Cairo interfaces that take arrays of glyphs, you must directly access the appropriate underlying font system.

Note that the offsets given by and are not cumulative. When drawing or measuring text, each glyph is individually positioned with respect to the overall origin

Definition at line 604 of file cairo.h.

Class Members
unsigned long index
double x
double y
struct cairo_text_extents_t

cairo_text_extents_t: : the horizontal distance from the origin to the leftmost part of the glyphs as drawn.

Positive if the glyphs lie entirely to the right of the origin. : the vertical distance from the origin to the topmost part of the glyphs as drawn. Positive only if the glyphs lie completely below the origin; will usually be negative. : width of the glyphs as drawn : height of the glyphs as drawn :distance to advance in the X direction after drawing these glyphs : distance to advance in the Y direction after drawing these glyphs. Will typically be zero except for vertical text layout as found in East-Asian languages.

The cairo_text_extents_t structure stores the extents of a single glyph or a string of glyphs in user-space coordinates. Because text extents are in user-space coordinates, they are mostly, but not entirely, independent of the current transformation matrix. If you call <literal>cairo_scale(cr, 2.0, 2.0)</literal>, text will be drawn twice as big, but the reported text extents will not be doubled. They will change slightly due to hinting (so you can't assume that metrics are independent of the transformation matrix), but otherwise will remain unchanged.

Definition at line 637 of file cairo.h.

Class Members
double height
double width
double x_advance
double x_bearing
double y_advance
double y_bearing
struct cairo_font_extents_t

cairo_font_extents_t: : the distance that the font extends above the baseline.

     Note that this is not always exactly equal to the maximum
     of the extents of all the glyphs in the font, but rather
     is picked to express the font designer's intent as to
     how the font should align with elements above it.

: the distance that the font extends below the baseline. This value is positive for typical fonts that include portions below the baseline. Note that this is not always exactly equal to the maximum of the extents of all the glyphs in the font, but rather is picked to express the font designer's intent as to how the the font should align with elements below it. : the recommended vertical distance between baselines when setting consecutive lines of text with the font. This is greater than + by a quantity known as the <firstterm>line spacing</firstterm> or <firstterm>external leading</firstterm>. When space is at a premium, most fonts can be set with only a distance of + between lines. : the maximum distance in the X direction that the the origin is advanced for any glyph in the font. : the maximum distance in the Y direction that the the origin is advanced for any glyph in the font. this will be zero for normal fonts used for horizontal writing. (The scripts of East Asia are sometimes written vertically.)

The cairo_text_extents_t structure stores metric information for a font. Values are given in the current user-space coordinate system.

Because font metrics are in user-space coordinates, they are mostly, but not entirely, independent of the current transformation matrix. If you call <literal>cairo_scale(cr, 2.0, 2.0)</literal>, text will be drawn twice as big, but the reported text extents will not be doubled. They will change slightly due to hinting (so you can't assume that metrics are independent of the transformation matrix), but otherwise will remain unchanged.

Definition at line 687 of file cairo.h.

Class Members
double ascent
double descent
double height
double max_x_advance
double max_y_advance
union _cairo_path_data_t

Definition at line 1043 of file cairo.h.

Class Members
struct _cairo_path_data_t header
struct _cairo_path_data_t point
struct cairo_path

cairo_path_t: : the current error status : the elements in the path : the number of elements in the data array

A data structure for holding a path. This data structure serves as the return value for cairo_copy_path_data() and cairo_copy_path_data_flat() as well the input value for cairo_append_path().

See #cairo_path_data_t for hints on how to iterate over the actual data within the path.

The num_data member gives the number of elements in the data array. This number is larger than the number of independent path portions (defined in cairo_path_data_type_t), since the data includes both headers and coordinates for each portion.

Definition at line 1072 of file cairo.h.

Collaboration diagram for cairo_path:
Class Members
cairo_path_data_t * data
int num_data
cairo_status_t status
struct _cairo_path_data_t.header

Definition at line 1044 of file cairo.h.

Class Members
int length
cairo_path_data_type_t type
struct _cairo_path_data_t.point

Definition at line 1048 of file cairo.h.

Class Members
double x
double y

Define Documentation

#define cairo_concat_matrix   cairo_concat_matrix_REPLACED_BY_cairo_transform

Definition at line 1400 of file cairo.h.

#define cairo_copy   cairo_copy_DEPRECATED_BY_cairo_create_AND_MANY_INDIVIDUAL_FUNCTIONS

Definition at line 1428 of file cairo.h.

#define cairo_current_fill_rule   cairo_current_fill_rule_REPLACED_BY_cairo_get_fill_rule

Definition at line 1392 of file cairo.h.

#define cairo_current_font_extents   cairo_current_font_extents_REPLACED_BY_cairo_font_extents

Definition at line 1387 of file cairo.h.

#define cairo_current_line_cap   cairo_current_line_cap_REPLACED_BY_cairo_get_line_cap

Definition at line 1394 of file cairo.h.

#define cairo_current_line_join   cairo_current_line_join_REPLACED_BY_cairo_get_line_join

Definition at line 1395 of file cairo.h.

#define cairo_current_line_width   cairo_current_line_width_REPLACED_BY_cairo_get_line_width

Definition at line 1393 of file cairo.h.

#define cairo_current_matrix   cairo_current_matrix_REPLACED_BY_cairo_get_matrix

Definition at line 1397 of file cairo.h.

#define cairo_current_miter_limit   cairo_current_miter_limit_REPLACED_BY_cairo_get_miter_limit

Definition at line 1396 of file cairo.h.

#define cairo_current_operator   cairo_current_operator_REPLACED_BY_cairo_get_operator

Definition at line 1389 of file cairo.h.

#define cairo_current_path   cairo_current_path_DEPRECATED_BY_cairo_copy_path

Definition at line 1422 of file cairo.h.

#define cairo_current_path_flat   cairo_current_path_flat_DEPRECATED_BY_cairo_copy_path_flat

Definition at line 1423 of file cairo.h.

#define cairo_current_point   cairo_current_point_REPLACED_BY_cairo_get_current_point

Definition at line 1391 of file cairo.h.

#define cairo_current_target_surface   cairo_current_target_surface_REPLACED_BY_cairo_get_target

Definition at line 1398 of file cairo.h.

#define cairo_current_tolerance   cairo_current_tolerance_REPLACED_BY_cairo_get_tolerance

Definition at line 1390 of file cairo.h.

#define cairo_default_matrix   cairo_default_matrix_REPLACED_BY_cairo_identity_matrix

Definition at line 1410 of file cairo.h.

#define cairo_get_font_extents   cairo_get_font_extents_REPLACED_BY_cairo_font_extents

Definition at line 1388 of file cairo.h.

#define cairo_get_path   cairo_get_path_DEPRECATED_BY_cairo_copy_path

Definition at line 1424 of file cairo.h.

#define cairo_get_path_flat   cairo_get_path_flat_DEPRECATED_BY_cairo_get_path_flat

Definition at line 1425 of file cairo.h.

#define cairo_get_status   cairo_get_status_REPLACED_BY_cairo_status

Definition at line 1399 of file cairo.h.

#define cairo_get_status_string   cairo_get_status_string_DEPRECATED_BY_cairo_status_AND_cairo_status_to_string

Definition at line 1448 of file cairo.h.

#define cairo_init_clip   cairo_init_clip_REPLACED_BY_cairo_reset_clip

Definition at line 1408 of file cairo.h.

#define cairo_inverse_transform_distance   cairo_inverse_transform_distance_REPLACED_BY_cairo_device_to_user_distance

Definition at line 1407 of file cairo.h.

#define cairo_inverse_transform_point   cairo_inverse_transform_point_REPLACED_BY_cairo_device_to_user

Definition at line 1406 of file cairo.h.

#define cairo_matrix_copy   cairo_matrix_copy_DEPRECATED_BY_cairo_matrix_t

Definition at line 1436 of file cairo.h.

#define cairo_matrix_create   cairo_matrix_create_DEPRECATED_BY_cairo_matrix_t

Definition at line 1434 of file cairo.h.

#define cairo_matrix_destroy   cairo_matrix_destroy_DEPRECATED_BY_cairo_matrix_t

Definition at line 1435 of file cairo.h.

#define cairo_matrix_get_affine   cairo_matrix_get_affine_DEPRECATED_BY_cairo_matrix_t

Definition at line 1437 of file cairo.h.

#define cairo_matrix_set_affine   cairo_matrix_set_affine_REPLACED_BY_cairo_matrix_init

Definition at line 1411 of file cairo.h.

#define cairo_matrix_set_identity   cairo_matrix_set_identity_REPLACED_BY_cairo_matrix_init_identity

Definition at line 1412 of file cairo.h.

#define cairo_pattern_add_color_stop   cairo_pattern_add_color_stop_REPLACED_BY_cairo_pattern_add_color_stop_rgba

Definition at line 1413 of file cairo.h.

#define cairo_scale_font   cairo_scale_font_REPLACED_BY_cairo_set_font_size

Definition at line 1401 of file cairo.h.

#define cairo_select_font   cairo_select_font_REPLACED_BY_cairo_select_font_face

Definition at line 1402 of file cairo.h.

#define cairo_set_alpha   cairo_set_alpha_DEPRECATED_BY_cairo_set_source_rgba_OR_cairo_paint_with_alpha

Definition at line 1426 of file cairo.h.

#define cairo_set_pattern   cairo_set_pattern_REPLACED_BY_cairo_set_source

Definition at line 1415 of file cairo.h.

#define cairo_set_rgb_color   cairo_set_rgb_color_REPLACED_BY_cairo_set_source_rgb

Definition at line 1414 of file cairo.h.

#define cairo_set_target_drawable   cairo_set_target_drawable_DEPRECATED_BY_cairo_xlib_surface_create

Definition at line 1447 of file cairo.h.

#define cairo_set_target_glitz   cairo_set_target_glitz_DEPRECATED_BY_cairo_glitz_surface_create

Definition at line 1439 of file cairo.h.

#define cairo_set_target_image   cairo_set_target_image_DEPRECATED_BY_cairo_image_surface_create_for_data

Definition at line 1440 of file cairo.h.

#define cairo_set_target_pdf   cairo_set_target_pdf_DEPRECATED_BY_cairo_pdf_surface_create

Definition at line 1441 of file cairo.h.

#define cairo_set_target_png   cairo_set_target_png_DEPRECATED_BY_cairo_surface_write_to_png

Definition at line 1442 of file cairo.h.

#define cairo_set_target_ps   cairo_set_target_ps_DEPRECATED_BY_cairo_ps_surface_create

Definition at line 1443 of file cairo.h.

#define cairo_set_target_quartz   cairo_set_target_quartz_DEPRECATED_BY_cairo_quartz_surface_create

Definition at line 1444 of file cairo.h.

#define cairo_set_target_surface   cairo_set_target_surface_DEPRECATED_BY_cairo_create

Definition at line 1438 of file cairo.h.

#define cairo_set_target_win32   cairo_set_target_win32_DEPRECATED_BY_cairo_win32_surface_create

Definition at line 1445 of file cairo.h.

#define cairo_set_target_xcb   cairo_set_target_xcb_DEPRECATED_BY_cairo_xcb_surface_create

Definition at line 1446 of file cairo.h.

#define cairo_show_surface   cairo_show_surface_DEPRECATED_BY_cairo_set_source_surface_AND_cairo_paint

Definition at line 1427 of file cairo.h.

#define cairo_status_string   cairo_status_string_DEPRECATED_BY_cairo_status_AND_cairo_status_to_string

Definition at line 1449 of file cairo.h.

#define cairo_surface_create_for_image   cairo_surface_create_for_image_REPLACED_BY_cairo_image_surface_create_for_data

Definition at line 1409 of file cairo.h.

#define cairo_surface_get_filter   cairo_surface_get_filter_DEPRECATED_BY_cairo_pattern_get_filter

Definition at line 1433 of file cairo.h.

#define cairo_surface_get_matrix   cairo_surface_get_matrix_DEPRECATED_BY_cairo_pattern_get_matrix

Definition at line 1431 of file cairo.h.

#define cairo_surface_set_filter   cairo_surface_set_filter_DEPRECATED_BY_cairo_pattern_set_filter

Definition at line 1432 of file cairo.h.

#define cairo_surface_set_matrix   cairo_surface_set_matrix_DEPRECATED_BY_cairo_pattern_set_matrix

Definition at line 1430 of file cairo.h.

#define cairo_surface_set_repeat   cairo_surface_set_repeat_DEPRECATED_BY_cairo_pattern_set_extend

Definition at line 1429 of file cairo.h.

#define cairo_transform_distance   cairo_transform_distance_REPLACED_BY_cairo_user_to_device_distance

Definition at line 1405 of file cairo.h.

#define cairo_transform_font   cairo_transform_font_REPLACED_BY_cairo_set_font_matrix

Definition at line 1403 of file cairo.h.

#define cairo_transform_point   cairo_transform_point_REPLACED_BY_cairo_user_to_device

Definition at line 1404 of file cairo.h.

Value:
CAIRO_VERSION_ENCODE(     \
       CAIRO_VERSION_MAJOR,                    \
       CAIRO_VERSION_MINOR,                    \
       CAIRO_VERSION_MICRO)

Definition at line 50 of file cairo.h.

#define CAIRO_VERSION_ENCODE (   major,
  minor,
  micro 
)
Value:
(     \
         ((major) * 10000)                             \
       + ((minor) *   100)                             \
       + ((micro) *     1))

Definition at line 45 of file cairo.h.

#define cairo_xcb_surface_create_for_pixmap_with_visual   cairo_xcb_surface_create_for_pixmap_with_visual_REPLACED_BY_cairo_xcb_surface_create

Definition at line 1418 of file cairo.h.

#define cairo_xcb_surface_create_for_window_with_visual   cairo_xcb_surface_create_for_window_with_visual_REPLACED_BY_cairo_xcb_surface_create

Definition at line 1419 of file cairo.h.

#define cairo_xlib_surface_create_for_pixmap_with_visual   cairo_xlib_surface_create_for_pixmap_with_visual_REPLACED_BY_cairo_xlib_surface_create

Definition at line 1416 of file cairo.h.

#define cairo_xlib_surface_create_for_window_with_visual   cairo_xlib_surface_create_for_window_with_visual_REPLACED_BY_cairo_xlib_surface_create

Definition at line 1417 of file cairo.h.


Typedef Documentation

typedef struct _cairo

cairo_t:

A #cairo_t contains the current state of the rendering device, including coordinates of yet to be drawn shapes.

Definition at line 83 of file cairo.h.

typedef struct _cairo_font_face

cairo_font_face_t:

A #cairo_font_face_t 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) . A font face can be set on a #cairo_t by using cairo_set_font_face(); the size and font matrix are set with cairo_set_font_size() and cairo_set_font_matrix().

Definition at line 578 of file cairo.h.

typedef struct _cairo_font_options

Definition at line 778 of file cairo.h.

typedef union _cairo_path_data_t

cairo_path_data_t:

cairo_path_data_t is used to represent the path data inside a

cairo_path_t.

The data structure is designed to try to balance the demands of efficiency and ease-of-use. A path is represented as an array of

cairo_path_data_t, which is a union of headers and points.

Each portion of the path is represented by one or more elements in the array, (one header followed by 0 or more points). The length value of the header is the number of array elements for the current portion including the header, (ie. length == 1 + # of points), and where the number of points for each element type must be as follows:

<programlisting> CAIRO_PATH_MOVE_TO: 1 point CAIRO_PATH_LINE_TO: 1 point CAIRO_PATH_CURVE_TO: 3 points CAIRO_PATH_CLOSE_PATH: 0 points </programlisting>

The semantics and ordering of the coordinate values are consistent with cairo_move_to(), cairo_line_to(), cairo_curve_to(), and cairo_close_path().

Here is sample code for iterating through a cairo_path_t:

<informalexample><programlisting> int i; cairo_path_t *path; cairo_path_data_t *data;   path = cairo_copy_path (cr);   for (i=0; i < path->num_data; i += path->data[i].header.length) { data = &path->data[i]; switch (data->header.type) { case CAIRO_PATH_MOVE_TO: do_move_to_things (data[1].point.x, data[1].point.y); break; case CAIRO_PATH_LINE_TO: do_line_to_things (data[1].point.x, data[1].point.y); break; case CAIRO_PATH_CURVE_TO: do_curve_to_things (data[1].point.x, data[1].point.y, data[2].point.x, data[2].point.y, data[3].point.x, data[3].point.y); break; case CAIRO_PATH_CLOSE_PATH: do_close_path_things (); break; } } cairo_path_destroy (path); </programlisting></informalexample>

Definition at line 1042 of file cairo.h.

typedef struct _cairo_pattern

Definition at line 122 of file cairo.h.

typedef struct _cairo_scaled_font

cairo_scaled_font_t:

A #cairo_scaled_font_t is a font scaled to a particular size and device resolution. A cairo_scaled_font_t is most useful for low-level font usage where a library or application wants to cache a reference to a scaled font to speed up the computation of metrics.

Definition at line 566 of file cairo.h.

typedef struct _cairo_surface

cairo_surface_t:

A #cairo_surface_t represents an image, either as the destination of a drawing operation or as source when drawing onto another surface. There are different subtypes of cairo_surface_t for different drawing backends; for example, cairo_image_surface_create() creates a bitmap image in memory.

Memory management of #cairo_surface_t is done with cairo_surface_reference() and cairo_surface_destroy().

Definition at line 97 of file cairo.h.

cairo_antialias_t: : Use the default antialiasing for the subsystem and target device : Use a bilevel alpha mask : Perform single-color antialiasing (using shades of gray for black text on a white background, for example).

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

Specifies the type of antialiasing to do when rendering text or shapes.

typedef int cairo_bool_t

cairo_bool_t:

cairo_bool_t is used for boolean values. Returns of type

cairo_bool_t will always be either 0 or 1, but testing against

these values explicitly is not encouraged; just use the value as a boolean condition.

<informalexample><programlisting> if (cairo_in_stroke (cr, x, y)) { /* do something */ } </programlisting></informalexample>

Definition at line 75 of file cairo.h.

cairo_content_t : The surface will hold color content only.

: The surface will hold alpha content only. : The surface will hold color and alpha content.

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 cairo_content_t values distinct from cairo_format_t values so that the implementation can detect the error if users confuse the two types.

cairo_destroy_func_t: : The data element being destroyed.

cairo_destroy_func_t the type of function which is called when a

data element is destroyed. It is passed the pointer to the data element and should free any memory and resources allocated for it.

Definition at line 132 of file cairo.h.

cairo_fill_rule_t : 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. : 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.

cairo_fill_rule_t 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.)

cairo_format_t : 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.) : 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. : each pixel is a 8-bit quantity holding an alpha value. : 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.

cairo_format_t is used to identify the memory format of

image data.

cairo_hint_metrics_t: : Hint metrics in the default manner for the font backend and target device : Do not hint font metrics : Hint font metrics

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.

cairo_hint_style_t: : Use the default hint style for for font backend and target device : Do not hint outlines : Hint outlines slightly to improve contrast while retaining good fidelity to the original shapes.

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

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.

cairo_line_cap_t : start(stop) the line exactly at the start(end) point : use a round ending, the center of the circle is the end point : use squared ending, the center of the square is the end point

enumeration for style of line-endings

typedef struct _cairo_matrix cairo_matrix_t

cairo_matrix_t: : xx component of the affine transformation : yx component of the affine transformation : xy component of the affine transformation : yy component of the affine transformation : X translation component of the affine transformation : Y translation component of the affine transformation

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: <programlisting> x_new = xx * x + xy * y + x0; y_new = yx * x + yy * y + y0; </programlisting>

typedef struct cairo_path cairo_path_t

cairo_path_t: : the current error status : the elements in the path : the number of elements in the data array

A data structure for holding a path. This data structure serves as the return value for cairo_copy_path_data() and cairo_copy_path_data_flat() as well the input value for cairo_append_path().

See #cairo_path_data_t for hints on how to iterate over the actual data within the path.

The num_data member gives the number of elements in the data array. This number is larger than the number of independent path portions (defined in cairo_path_data_type_t), since the data includes both headers and coordinates for each portion.

typedef cairo_status_t(* cairo_read_func_t)(void *closure, unsigned char *data, unsigned int length)

cairo_read_func_t: : the input closure : the buffer into which to read the data : the amount of data to read

cairo_read_func_t is the type of function which is called when a

backend needs to read data from an intput stream. It is passed the closure which was specified by the user at the time the read function was registered, the buffer to read the data into and the length of the data in bytes. The read function should return CAIRO_STATUS_SUCCESS if all the data was successfully read, CAIRO_STATUS_READ_ERROR otherwise.

Returns: the status code of the read operation

Definition at line 235 of file cairo.h.

cairo_status_t : no error has occurred : out of memory : cairo_restore without matching cairo_save : no saved group to pop : no current point defined : invalid matrix (not invertible) : invalid value for an input cairo_status_t : NULL pointer : input string not valid UTF-8 : input path data not valid : error while reading from input stream : error while writing to output stream : target surface has been finished : the surface type is not appropriate for the operation : the pattern type is not appropriate for the operation : invalid value for an input cairo_content_t : invalid value for an input cairo_format_t : invalid value for an input Visual* : file not found : invalid value for a dash setting

cairo_status_t is used to indicate errors that can occur when

using Cairo. In some cases it is returned directly by functions. but when using #cairo_t, the last error, if any, is stored in the context and can be retrieved with cairo_status().

cairo_subpixel_order_t: : Use the default subpixel order for for the target device : Subpixel elements are arranged horizontally with red at the left : Subpixel elements are arranged horizontally with blue at the left : Subpixel elements are arranged vertically with red at the top : Subpixel elements are arranged vertically with blue at the top

The subpixel order specifies the order of color elements within each pixel on the display device when rendering with an antialiasing mode of CAIRO_ANTIALIAS_SUBPIXEL.

cairo_user_data_key_t: : not used; ignore.

cairo_user_data_key_t is used for attaching user data to cairo

data structures. The actual contents of the struct is never used, and there is no need to initialize the object; only the unique address of a #cairo_data_key_t object is used. Typically, you would just use the address of a static #cairo_data_key_t object.

typedef cairo_status_t(* cairo_write_func_t)(void *closure, const unsigned char *data, unsigned int length)

cairo_write_func_t: : the output closure : the buffer containing the data to write : the amount of data to write

cairo_write_func_t is the type of function which is called when a

backend needs to write data to an output stream. It is passed the closure which was specified by the user at the time the write function was registered, the data to write and the length of the data in bytes. The write function should return CAIRO_STATUS_SUCCESS if all the data was successfully written, CAIRO_STATUS_WRITE_ERROR otherwise.

Returns: the status code of the write operation

Definition at line 215 of file cairo.h.


Enumeration Type Documentation

cairo_antialias_t: : Use the default antialiasing for the subsystem and target device : Use a bilevel alpha mask : Perform single-color antialiasing (using shades of gray for black text on a white background, for example).

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

Specifies the type of antialiasing to do when rendering text or shapes.

Enumerator:
CAIRO_ANTIALIAS_DEFAULT 
CAIRO_ANTIALIAS_NONE 
CAIRO_ANTIALIAS_GRAY 
CAIRO_ANTIALIAS_SUBPIXEL 

Definition at line 321 of file cairo.h.

cairo_content_t : The surface will hold color content only.

: The surface will hold alpha content only. : The surface will hold color and alpha content.

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 cairo_content_t values distinct from cairo_format_t values so that the implementation can detect the error if users confuse the two types.

Enumerator:
CAIRO_CONTENT_COLOR 
CAIRO_CONTENT_ALPHA 
CAIRO_CONTENT_COLOR_ALPHA 

Definition at line 1115 of file cairo.h.

Enumerator:
CAIRO_EXTEND_NONE 
CAIRO_EXTEND_REPEAT 
CAIRO_EXTEND_REFLECT 

Definition at line 1292 of file cairo.h.

cairo_fill_rule_t : 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. : 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.

cairo_fill_rule_t 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.)

Enumerator:
CAIRO_FILL_RULE_WINDING 
CAIRO_FILL_RULE_EVEN_ODD 

Definition at line 352 of file cairo.h.

Enumerator:
CAIRO_FILTER_FAST 
CAIRO_FILTER_GOOD 
CAIRO_FILTER_BEST 
CAIRO_FILTER_NEAREST 
CAIRO_FILTER_BILINEAR 
CAIRO_FILTER_GAUSSIAN 

Definition at line 1304 of file cairo.h.

Enumerator:
CAIRO_FONT_SLANT_NORMAL 
CAIRO_FONT_SLANT_ITALIC 
CAIRO_FONT_SLANT_OBLIQUE 

Definition at line 695 of file cairo.h.

Enumerator:
CAIRO_FONT_WEIGHT_NORMAL 
CAIRO_FONT_WEIGHT_BOLD 

Definition at line 701 of file cairo.h.

cairo_format_t : 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.) : 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. : each pixel is a 8-bit quantity holding an alpha value. : 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.

cairo_format_t is used to identify the memory format of

image data.

Enumerator:
CAIRO_FORMAT_ARGB32 
CAIRO_FORMAT_RGB24 
CAIRO_FORMAT_A8 
CAIRO_FORMAT_A1 

Definition at line 1208 of file cairo.h.

cairo_hint_metrics_t: : Hint metrics in the default manner for the font backend and target device : Do not hint font metrics : Hint font metrics

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.

Enumerator:
CAIRO_HINT_METRICS_DEFAULT 
CAIRO_HINT_METRICS_OFF 
CAIRO_HINT_METRICS_ON 

Definition at line 772 of file cairo.h.

cairo_hint_style_t: : Use the default hint style for for font backend and target device : Do not hint outlines : Hint outlines slightly to improve contrast while retaining good fidelity to the original shapes.

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

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.

Enumerator:
CAIRO_HINT_STYLE_DEFAULT 
CAIRO_HINT_STYLE_NONE 
CAIRO_HINT_STYLE_SLIGHT 
CAIRO_HINT_STYLE_MEDIUM 
CAIRO_HINT_STYLE_FULL 

Definition at line 751 of file cairo.h.

cairo_line_cap_t : start(stop) the line exactly at the start(end) point : use a round ending, the center of the circle is the end point : use squared ending, the center of the square is the end point

enumeration for style of line-endings

Enumerator:
CAIRO_LINE_CAP_BUTT 
CAIRO_LINE_CAP_ROUND 
CAIRO_LINE_CAP_SQUARE 

Definition at line 372 of file cairo.h.

Enumerator:
CAIRO_LINE_JOIN_MITER 
CAIRO_LINE_JOIN_ROUND 
CAIRO_LINE_JOIN_BEVEL 

Definition at line 381 of file cairo.h.

Enumerator:
CAIRO_OPERATOR_CLEAR 
CAIRO_OPERATOR_SOURCE 
CAIRO_OPERATOR_OVER 
CAIRO_OPERATOR_IN 
CAIRO_OPERATOR_OUT 
CAIRO_OPERATOR_ATOP 
CAIRO_OPERATOR_DEST 
CAIRO_OPERATOR_DEST_OVER 
CAIRO_OPERATOR_DEST_IN 
CAIRO_OPERATOR_DEST_OUT 
CAIRO_OPERATOR_DEST_ATOP 
CAIRO_OPERATOR_XOR 
CAIRO_OPERATOR_ADD 
CAIRO_OPERATOR_SATURATE 

Definition at line 265 of file cairo.h.

Enumerator:
CAIRO_PATH_MOVE_TO 
CAIRO_PATH_LINE_TO 
CAIRO_PATH_CURVE_TO 
CAIRO_PATH_CLOSE_PATH 

Definition at line 976 of file cairo.h.

cairo_status_t : no error has occurred : out of memory : cairo_restore without matching cairo_save : no saved group to pop : no current point defined : invalid matrix (not invertible) : invalid value for an input cairo_status_t : NULL pointer : input string not valid UTF-8 : input path data not valid : error while reading from input stream : error while writing to output stream : target surface has been finished : the surface type is not appropriate for the operation : the pattern type is not appropriate for the operation : invalid value for an input cairo_content_t : invalid value for an input cairo_format_t : invalid value for an input Visual* : file not found : invalid value for a dash setting

cairo_status_t is used to indicate errors that can occur when

using Cairo. In some cases it is returned directly by functions. but when using #cairo_t, the last error, if any, is stored in the context and can be retrieved with cairo_status().

Enumerator:
CAIRO_STATUS_SUCCESS 
CAIRO_STATUS_NO_MEMORY 
CAIRO_STATUS_INVALID_RESTORE 
CAIRO_STATUS_INVALID_POP_GROUP 
CAIRO_STATUS_NO_CURRENT_POINT 
CAIRO_STATUS_INVALID_MATRIX 
CAIRO_STATUS_INVALID_STATUS 
CAIRO_STATUS_NULL_POINTER 
CAIRO_STATUS_INVALID_STRING 
CAIRO_STATUS_INVALID_PATH_DATA 
CAIRO_STATUS_READ_ERROR 
CAIRO_STATUS_WRITE_ERROR 
CAIRO_STATUS_SURFACE_FINISHED 
CAIRO_STATUS_SURFACE_TYPE_MISMATCH 
CAIRO_STATUS_PATTERN_TYPE_MISMATCH 
CAIRO_STATUS_INVALID_CONTENT 
CAIRO_STATUS_INVALID_FORMAT 
CAIRO_STATUS_INVALID_VISUAL 
CAIRO_STATUS_FILE_NOT_FOUND 
CAIRO_STATUS_INVALID_DASH 

Definition at line 176 of file cairo.h.

cairo_subpixel_order_t: : Use the default subpixel order for for the target device : Subpixel elements are arranged horizontally with red at the left : Subpixel elements are arranged horizontally with blue at the left : Subpixel elements are arranged vertically with red at the top : Subpixel elements are arranged vertically with blue at the top

The subpixel order specifies the order of color elements within each pixel on the display device when rendering with an antialiasing mode of CAIRO_ANTIALIAS_SUBPIXEL.

Enumerator:
CAIRO_SUBPIXEL_ORDER_DEFAULT 
CAIRO_SUBPIXEL_ORDER_RGB 
CAIRO_SUBPIXEL_ORDER_BGR 
CAIRO_SUBPIXEL_ORDER_VRGB 
CAIRO_SUBPIXEL_ORDER_VBGR 

Definition at line 723 of file cairo.h.


Function Documentation

void cairo_append_path ( cairo_t *  cr,
cairo_path_t path 
)

cairo_append_path: : a cairo context : path to be appended

Append the onto the current path. The may be either the return value from one of cairo_copy_path() or cairo_copy_path_flat() or it may be constructed manually. See

cairo_path_t for details on how the path data structure should be

initialized, and note that <literal>path->status</literal> must be initialized to CAIRO_STATUS_SUCCESS.

Definition at line 2498 of file cairo.c.

{
    if (cr->status)
       return;

    if (path == NULL) {
       _cairo_set_error (cr, CAIRO_STATUS_NULL_POINTER);
       return;
    }

    if (path->status) {
       if (path->status <= CAIRO_STATUS_LAST_STATUS)
           _cairo_set_error (cr, path->status);
       else
           _cairo_set_error (cr, CAIRO_STATUS_INVALID_STATUS);
       return;
    }

    if (path->data == NULL) {
       _cairo_set_error (cr, CAIRO_STATUS_NULL_POINTER);
       return;
    }

    cr->status = _cairo_path_data_append_to_context (path, cr);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_arc ( cairo_t *  cr,
double  xc,
double  yc,
double  radius,
double  angle1,
double  angle2 
)

cairo_arc: : a cairo context : X position of the center of the arc : Y position of the center of the arc : the radius of the arc : the start angle, in radians : the end angle, in radians

Adds a circular arc of the given to the current path. The arc is centered at (, ), begins at and proceeds in the direction of increasing angles to end at . If is less than it will be progressively increased by 2*M_PI until it is greater than .

If there is a current point, an initial line segment will be added to the path to connect the current point to the beginning of the arc.

Angles are measured in radians. An angle of 0 is in the direction of the positive X axis (in user-space). An angle of M_PI radians (90 degrees) is in the direction of the positive Y axis (in user-space). Angles increase in the direction from the positive X axis toward the positive Y axis. So with the default transformation matrix, angles increase in a clockwise direction.

(To convert from degrees to radians, use <literal>degrees * (M_PI / 180.)</literal>.)

This function gives the arc in the direction of increasing angles; see cairo_arc_negative() to get the arc in the direction of decreasing angles.

The arc is circular in user-space. To achieve an elliptical arc, you can scale the current transformation matrix by different amounts in the X and Y directions. For example, to draw an ellipse in the box given by , , , :

<informalexample><programlisting> cairo_save (cr); cairo_translate (x + width / 2., y + height / 2.); cairo_scale (1. / (height / 2.), 1. / (width / 2.)); cairo_arc (cr, 0., 0., 1., 0., 2 * M_PI); cairo_restore (cr); </programlisting></informalexample>

Definition at line 1123 of file cairo.c.

{
    if (cr->status)
       return;

    /* Do nothing, successfully, if radius is <= 0 */
    if (radius <= 0.0)
       return;

    while (angle2 < angle1)
       angle2 += 2 * M_PI;

    cairo_line_to (cr,
                 xc + radius * cos (angle1),
                 yc + radius * sin (angle1));

    _cairo_arc_path (cr, xc, yc, radius,
                   angle1, angle2);
}

Here is the call graph for this function:

void cairo_arc_negative ( cairo_t *  cr,
double  xc,
double  yc,
double  radius,
double  angle1,
double  angle2 
)

cairo_arc_negative: : a cairo context : X position of the center of the arc : Y position of the center of the arc : the radius of the arc : the start angle, in radians : the end angle, in radians

Adds a circular arc of the given to the current path. The arc is centered at (, ), begins at and proceeds in the direction of decreasing angles to end at . If is greater than it will be progressively decreased by 2*M_PI until it is greater than .

See cairo_arc() for more details. This function differs only in the direction of the arc between the two angles.

Definition at line 1165 of file cairo.c.

{
    if (cr->status)
       return;

    /* Do nothing, successfully, if radius is <= 0 */
    if (radius <= 0.0)
       return;

    while (angle2 > angle1)
       angle2 -= 2 * M_PI;

    cairo_line_to (cr,
                 xc + radius * cos (angle1),
                 yc + radius * sin (angle1));

     _cairo_arc_path_negative (cr, xc, yc, radius,
                            angle1, angle2);
}

Here is the call graph for this function:

void cairo_clip ( cairo_t *  cr)

cairo_clip: : a cairo context

Establishes a new clip region by intersecting the current clip region with the current path as it would be filled by cairo_fill() and according to the current fill rule (see cairo_set_fill_rule()).

After cairo_clip, the current path will be cleared from the cairo context.

The current clip region affects all drawing operations by effectively masking out any changes to the surface that are outside the current clip region.

Calling cairo_clip() can only make the clip region smaller, never larger. But the current clip is part of the graphics state, so a temporary restriction of the clip region can be achieved by calling cairo_clip() within a cairo_save()/cairo_restore() pair. The only other means of increasing the size of the clip region is cairo_reset_clip().

Definition at line 1713 of file cairo.c.

void cairo_clip_preserve ( cairo_t *  cr)

cairo_clip_preserve: : a cairo context

Establishes a new clip region by intersecting the current clip region with the current path as it would be filled by cairo_fill() and according to the current fill rule (see cairo_set_fill_rule()).

Unlike cairo_clip(), cairo_clip_preserve preserves the path within the cairo context.

The current clip region affects all drawing operations by effectively masking out any changes to the surface that are outside the current clip region.

Calling cairo_clip() can only make the clip region smaller, never larger. But the current clip is part of the graphics state, so a temporary restriction of the clip region can be achieved by calling cairo_clip() within a cairo_save()/cairo_restore() pair. The only other means of increasing the size of the clip region is cairo_reset_clip().

Definition at line 1743 of file cairo.c.

{
    if (cr->status)
       return;

    cr->status = _cairo_gstate_clip (cr->gstate, &cr->path);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_close_path ( cairo_t *  cr)

cairo_close_path: : a cairo context

Adds a line segment to the path from the current point to the beginning of the current subpath, (the most recent point passed to cairo_move_to()), and closes this subpath.

The behavior of cairo_close_path() is distinct from simply calling cairo_line_to() with the equivalent coordinate in the case of stroking. When a closed subpath is stroked, there are no caps on the ends of the subpath. Instead, their is a line join connecting the final and initial segments of the subpath.

Definition at line 1385 of file cairo.c.

{
    if (cr->status)
       return;

    cr->status = _cairo_path_fixed_close_path (&cr->path);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_copy_page ( cairo_t *  cr)

Definition at line 1605 of file cairo.c.

{
    if (cr->status)
       return;

    cr->status = _cairo_gstate_copy_page (cr->gstate);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

cairo_path_t* cairo_copy_path ( cairo_t *  cr)

cairo_copy_path: : a cairo context

Creates a copy of the current path and returns it to the user as a

cairo_path_t. See #cairo_path_data_t for hints on how to iterate

over the returned data structure.

Return value: the copy of the current path. The caller owns the returned object and should call cairo_path_destroy() when finished with it.

This function will always return a valid pointer, but the result will have no data (<literal>data==NULL</literal> and <literal>num_data==0</literal>), if either of the following conditions hold:

<orderedlist> <listitem>If there is insufficient memory to copy the path.</listitem> <listitem>If is already in an error state.</listitem> </orderedlist>

In either case, <literal>path->status</literal> will be set to CAIRO_STATUS_NO_MEMORY (regardless of what the error status in might have been).

Return value: the copy of the current path. The caller owns the returned object and should call cairo_path_destroy() when finished with it.

Definition at line 2435 of file cairo.c.

{
    if (cr->status)
       return (cairo_path_t*) &_cairo_path_nil;

    return _cairo_path_data_create (&cr->path, cr->gstate);
}

Here is the call graph for this function:

cairo_path_t* cairo_copy_path_flat ( cairo_t *  cr)

cairo_copy_path_flat: : a cairo context

Gets a flattened copy of the current path and returns it to the user as a cairo_path_t. See #cairo_path_data_t for hints on how to iterate over the returned data structure.

This function is like cairo_copy_path() except that any curves in the path will be approximated with piecewise-linear approximations, (accurate to within the current tolerance value). That is, the result is guaranteed to not have any elements of type CAIRO_PATH_CURVE_TO which will instead be replaced by a series of CAIRO_PATH_LINE_TO elements.

This function will always return a valid pointer, but the result will have no data (<literal>data==NULL</literal> and <literal>num_data==0</literal>), if either of the following conditions hold:

<orderedlist> <listitem>If there is insufficient memory to copy the path. In this case <literal>path->status</literal> will be set to CAIRO_STATUS_NO_MEMORY.</listitem> <listitem>If is already in an error state. In this case <literal>path->status</literal> will contain the same status that would be returned by cairo_status().</listitem> </orderedlist>

Return value: the copy of the current path. The caller owns the returned object and should call cairo_path_destroy() when finished with it.

Definition at line 2477 of file cairo.c.

{
    if (cr->status)
       return (cairo_path_t*) &_cairo_path_nil;
    else
       return _cairo_path_data_create_flat (&cr->path, cr->gstate);
}

Here is the call graph for this function:

cairo_t* cairo_create ( cairo_surface_t *  target)

cairo_create: : target surface for the context

Creates a new #cairo_t with all graphics state parameters set to default values and with as a target surface. The target surface should be constructed with a backend-specific function such as cairo_image_surface_create() (or any other <literal>cairo_<backend>_surface_create</literal> variant).

This function references , so you can immediately call cairo_surface_destroy() on it if you don't need to maintain a separate reference to it.

Return value: a newly allocated #cairo_t with a reference count of 1. The initial reference count should be released with cairo_destroy() when you are done using the #cairo_t. This function never returns NULL. If memory cannot be allocated, a special #cairo_t object will be returned on which cairo_status() returns CAIRO_STATUS_NO_MEMORY. You can use this object normally, but no drawing will be done.

Definition at line 183 of file cairo.c.

{
    cairo_t *cr;

    cr = malloc (sizeof (cairo_t));
    if (cr == NULL)
       return (cairo_t *) &cairo_nil;

    cr->ref_count = 1;

    cr->status = CAIRO_STATUS_SUCCESS;

    _cairo_path_fixed_init (&cr->path);

    if (target == NULL) {
       cr->gstate = NULL;
       _cairo_set_error (cr, CAIRO_STATUS_NULL_POINTER);
       return cr;
    }

    cr->gstate = _cairo_gstate_create (target);
    if (cr->gstate == NULL)
       _cairo_set_error (cr, CAIRO_STATUS_NO_MEMORY);

    return cr;
}

Here is the call graph for this function:

void cairo_curve_to ( cairo_t *  cr,
double  x1,
double  y1,
double  x2,
double  y2,
double  x3,
double  y3 
)

cairo_curve_to: : a cairo context : the X coordinate of the first control point : the Y coordinate of the first control point : the X coordinate of the second control point : the Y coordinate of the second control point : the X coordinate of the end of the curve : the Y coordinate of the end of the curve

Adds a cubic Bézier spline to the path from the current point to position (, ) in user-space coordinates, using (, ) and (, ) as the control points. After this call the current point will be (, ).

Definition at line 1043 of file cairo.c.

{
    cairo_fixed_t x1_fixed, y1_fixed;
    cairo_fixed_t x2_fixed, y2_fixed;
    cairo_fixed_t x3_fixed, y3_fixed;
       
    if (cr->status)
       return;

    _cairo_gstate_user_to_backend (cr->gstate, &x1, &y1);
    _cairo_gstate_user_to_backend (cr->gstate, &x2, &y2);
    _cairo_gstate_user_to_backend (cr->gstate, &x3, &y3);

    x1_fixed = _cairo_fixed_from_double (x1);
    y1_fixed = _cairo_fixed_from_double (y1);

    x2_fixed = _cairo_fixed_from_double (x2);
    y2_fixed = _cairo_fixed_from_double (y2);

    x3_fixed = _cairo_fixed_from_double (x3);
    y3_fixed = _cairo_fixed_from_double (y3);

    cr->status = _cairo_path_fixed_curve_to (&cr->path,
                                        x1_fixed, y1_fixed,
                                        x2_fixed, y2_fixed,
                                        x3_fixed, y3_fixed);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_destroy ( cairo_t *  cr)

cairo_destroy: : a #cairo_t

Decreases the reference count on by one. If the result is zero, then and all associated resources are freed. See cairo_reference().

Definition at line 242 of file cairo.c.

{
    if (cr->ref_count == (unsigned int)-1)
       return;

    assert (cr->ref_count > 0);
    
    cr->ref_count--;
    if (cr->ref_count)
       return;

    while (cr->gstate) {
       cairo_gstate_t *tmp = cr->gstate;
       cr->gstate = tmp->next;

       _cairo_gstate_destroy (tmp);
    }

    _cairo_path_fixed_fini (&cr->path);

    free (cr);
}

Here is the call graph for this function:

void cairo_device_to_user ( cairo_t *  cr,
double *  x,
double *  y 
)

cairo_device_to_user: : a cairo : X value of coordinate (in/out parameter) : Y value of coordinate (in/out parameter)

Transform a coordinate from device space to user space by multiplying the given point by the inverse of the current transformation matrix (CTM).

Definition at line 924 of file cairo.c.

{
    if (cr->status)
       return;

    cr->status = _cairo_gstate_device_to_user (cr->gstate, x, y);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_device_to_user_distance ( cairo_t *  cr,
double *  dx,
double *  dy 
)

cairo_device_to_user_distance: : a cairo context : X component of a distance vector (in/out parameter) : Y component of a distance vector (in/out parameter)

Transform a distance vector from device space to user space. This function is similar to cairo_device_to_user() except that the translation components of the inverse CTM will be ignored when transforming (,).

Definition at line 946 of file cairo.c.

{
    if (cr->status)
       return;

    cr->status = _cairo_gstate_device_to_user_distance (cr->gstate, dx, dy);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_fill ( cairo_t *  cr)

cairo_fill: : a cairo context

A drawing operator that fills the current path according to the current fill rule, (each sub-path is implicitly closed before being filled). After cairo_fill, the current path will be cleared from the cairo context. See cairo_set_fill_rule() and cairo_fill_preserve().

Definition at line 1574 of file cairo.c.

void cairo_fill_extents ( cairo_t *  cr,
double *  x1,
double *  y1,
double *  x2,
double *  y2 
)

Definition at line 1677 of file cairo.c.

{
    if (cr->status)
       return;
    
    cr->status = _cairo_gstate_fill_extents (cr->gstate,
                                        &cr->path,
                                        x1, y1, x2, y2);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_fill_preserve ( cairo_t *  cr)

cairo_fill_preserve: : a cairo context

A drawing operator that fills the current path according to the current fill rule, (each sub-path is implicitly closed before being filled). Unlike cairo_fill(), cairo_fill_preserve preserves the path within the cairo context.

See cairo_set_fill_rule() and cairo_fill().

Definition at line 1593 of file cairo.c.

{
    if (cr->status)
       return;

    cr->status = _cairo_gstate_fill (cr->gstate, &cr->path);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_font_extents ( cairo_t *  cr,
cairo_font_extents_t extents 
)

cairo_font_extents: : a #cairo_t : a cairo_font_extents_t object into which the results will be stored.

Gets the font extents for the currently selected font.

Definition at line 1847 of file cairo.c.

{
    if (cr->status)
       return;

    cr->status = _cairo_gstate_get_font_extents (cr->gstate, extents);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_font_face_destroy ( cairo_font_face_t *  font_face)

cairo_font_face_destroy: : a #cairo_font_face_t

Decreases the reference count on by one. If the result is zero, then and all associated resources are freed. See cairo_font_face_reference().

Definition at line 106 of file cairo-font.c.

{
    if (font_face == NULL)
       return;

    if (font_face->ref_count == (unsigned int)-1)
       return;

    assert (font_face->ref_count > 0);

    if (--(font_face->ref_count) > 0)
       return;

    font_face->backend->destroy (font_face);

    /* We allow resurrection to deal with some memory management for the
     * FreeType backend where cairo_ft_font_face_t and cairo_ft_unscaled_font_t
     * need to effectively mutually reference each other
     */
    if (font_face->ref_count > 0)
       return;

    _cairo_user_data_array_fini (&font_face->user_data);

    free (font_face);
}

Here is the call graph for this function:

void* cairo_font_face_get_user_data ( cairo_font_face_t *  font_face,
const cairo_user_data_key_t key 
)

cairo_font_face_get_user_data: : a #cairo_font_face_t : the address of the cairo_user_data_key_t the user data was attached to

Return user data previously attached to using the specified key. If no user data has been attached with the given key this function returns NULL.

Return value: the user data previously attached or NULL.

Definition at line 162 of file cairo-font.c.

{
    return _cairo_user_data_array_get_data (&font_face->user_data,
                                       key);
}

Here is the call graph for this function:

cairo_font_face_t* cairo_font_face_reference ( cairo_font_face_t *  font_face)

cairo_font_face_reference: : a #cairo_font_face_t, (may be NULL in which case this function does nothing).

Increases the reference count on by one. This prevents from being destroyed until a matching call to cairo_font_face_destroy() is made.

Return value: the referenced #cairo_font_face_t.

Definition at line 80 of file cairo-font.c.

{
    if (font_face == NULL)
       return NULL;

    if (font_face->ref_count == (unsigned int)-1)
       return font_face;

    /* We would normally assert (font_face->ref_count >0) here but we
     * can't get away with that due to the zombie case as documented
     * in _cairo_ft_font_face_destroy. */

    font_face->ref_count++;

    return font_face;
}
cairo_status_t cairo_font_face_set_user_data ( cairo_font_face_t *  font_face,
const cairo_user_data_key_t key,
void user_data,
cairo_destroy_func_t  destroy 
)

cairo_font_face_set_user_data: : a #cairo_font_face_t : the address of a cairo_user_data_key_t to attach the user data to : the user data to attach to the font face : a cairo_destroy_func_t which will be called when the font face is destroyed or when new user data is attached using the same key.

Attach user data to . To remove user data from a font face, call this function with the key that was used to set it and NULL for .

Return value: CAIRO_STATUS_SUCCESS or CAIRO_STATUS_NO_MEMORY if a slot could not be allocated for the user data.

Definition at line 186 of file cairo-font.c.

{
    if (font_face->ref_count == -1)
       return CAIRO_STATUS_NO_MEMORY;
    
    return _cairo_user_data_array_set_data (&font_face->user_data,
                                       key, user_data, destroy);
}

Here is the call graph for this function:

cairo_status_t cairo_font_face_status ( cairo_font_face_t *  font_face)

cairo_font_face_status: : a #cairo_font_face_t

Checks whether an error has previously occurred for this font face

Return value: CAIRO_STATUS_SUCCESS or another error such as CAIRO_STATUS_NO_MEMORY.

Definition at line 144 of file cairo-font.c.

{
    return font_face->status;
}
cairo_font_options_t* cairo_font_options_copy ( const cairo_font_options_t *  original)

cairo_font_options_copy: : a #cairo_font_options_t

Allocates a new font options object copying the option values from .

Return value: a newly allocated #cairo_font_options_t. Free with cairo_font_options_destroy(). This function always returns a valid pointer; if memory cannot be allocated, then a special error object is returned where all operations on the object do nothing. You can check for this with cairo_font_options_status().

Definition at line 103 of file cairo-font-options.c.

{
    cairo_font_options_t *options = malloc (sizeof (cairo_font_options_t));

    if (!options)
       return (cairo_font_options_t *)&cairo_font_options_nil;

    *options = *original;

    return options;
}
cairo_font_options_t* cairo_font_options_create ( void  )

cairo_font_options_create:

Allocates a new font options object with all options initialized to default values.

Return value: a newly allocated #cairo_font_options_t. Free with cairo_font_options_destroy(). This function always returns a valid pointer; if memory cannot be allocated, then a special error object is returned where all operations on the object do nothing. You can check for this with cairo_font_options_status().

Definition at line 77 of file cairo-font-options.c.

{
    cairo_font_options_t *options = malloc (sizeof (cairo_font_options_t));

    if (!options)
       return (cairo_font_options_t *)&cairo_font_options_nil;

    _cairo_font_options_init_default (options);

    return options;
}

Here is the call graph for this function:

void cairo_font_options_destroy ( cairo_font_options_t *  options)

cairo_font_options_destroy: : a #cairo_font_options_t

Destroys a #cairo_font_options_t object created with with cairo_font_options_create() or cairo_font_options_copy().

Definition at line 123 of file cairo-font-options.c.

{
    if (options == (cairo_font_options_t *)&cairo_font_options_nil)
       return;

    free (options);
}
cairo_bool_t cairo_font_options_equal ( const cairo_font_options_t *  options,
const cairo_font_options_t *  other 
)

cairo_font_options_equal: : a #cairo_font_options_t : another #cairo_font_options_t

Compares two font options objects for equality.

Return value: TRUE if all fields of the two font options objects match

Definition at line 186 of file cairo-font-options.c.

{
    return (options->antialias == other->antialias &&
           options->subpixel_order == other->subpixel_order &&
           options->hint_style == other->hint_style &&
           options->hint_metrics == other->hint_metrics);
}
cairo_antialias_t cairo_font_options_get_antialias ( const cairo_font_options_t *  options)

cairo_font_options_get_antialias: : a #cairo_font_options_t

Gets the antialising mode for the font options object.

Return value: the antialiasing mode

Definition at line 243 of file cairo-font-options.c.

{
    return options->antialias;
}
cairo_hint_metrics_t cairo_font_options_get_hint_metrics ( const cairo_font_options_t *  options)

cairo_font_options_get_hint_metrics: : a #cairo_font_options_t

Gets the metrics hinting mode for the font options object. See the documentation for cairo_hint_metrics_t for full details.

Return value: the metrics hinting mode for the font options object

Definition at line 349 of file cairo-font-options.c.

{
    return options->hint_metrics;
}
cairo_hint_style_t cairo_font_options_get_hint_style ( const cairo_font_options_t *  options)

cairo_font_options_get_hint_style: : a #cairo_font_options_t

Gets the hint style for font outlines for the font options object. See the documentation for cairo_hint_style_t for full details.

Return value: the hint style for the font options object

Definition at line 314 of file cairo-font-options.c.

{
    return options->hint_style;
}

cairo_font_options_get_subpixel_order: : a #cairo_font_options_t

Gets the subpixel order for the font options object. See the documentation for cairo_subpixel_order_t for full details.

Return value: the subpixel order for the font options object

Definition at line 279 of file cairo-font-options.c.

{
    return options->subpixel_order;
}
unsigned long cairo_font_options_hash ( const cairo_font_options_t *  options)

cairo_font_options_hash: : a #cairo_font_options_t

Compute a hash for the font options object; this value will be useful when storing an object containing a cairo_font_options_t in a hash table.

Return value: the hash value for the font options object. The return value can be cast to a 32-bit type if a 32-bit hash value is needed.

Definition at line 208 of file cairo-font-options.c.

{
    return ((options->antialias) |
           (options->subpixel_order << 4) |
           (options->hint_style << 8) | 
           (options->hint_metrics << 16));
}
void cairo_font_options_merge ( cairo_font_options_t *  options,
const cairo_font_options_t *  other 
)

cairo_font_options_merge: : a #cairo_font_options_t : another #cairo_font_options_t

Merges non-default options from into , replacing existing values. This operation can be thought of as somewhat similar to compositing onto with the operation of CAIRO_OPERATION_OVER.

Definition at line 160 of file cairo-font-options.c.

{
    if (options == (cairo_font_options_t *)&cairo_font_options_nil)
       return;

    if (other->antialias != CAIRO_ANTIALIAS_DEFAULT)
       options->antialias = other->antialias;
    if (other->subpixel_order != CAIRO_SUBPIXEL_ORDER_DEFAULT)
       options->subpixel_order = other->subpixel_order;
    if (other->hint_style != CAIRO_HINT_STYLE_DEFAULT)
       options->hint_style = other->hint_style;
    if (other->hint_metrics != CAIRO_HINT_METRICS_DEFAULT)
       options->hint_metrics = other->hint_metrics;
}
void cairo_font_options_set_antialias ( cairo_font_options_t *  options,
cairo_antialias_t  antialias 
)

cairo_font_options_set_antialias: : a #cairo_font_options_t : the new antialiasing mode

Sets the antiliasing mode for the font options object. This specifies the type of antialiasing to do when rendering text.

Definition at line 225 of file cairo-font-options.c.

{
    if (options == (cairo_font_options_t *)&cairo_font_options_nil)
       return;
    
    options->antialias = antialias;
}
void cairo_font_options_set_hint_metrics ( cairo_font_options_t *  options,
cairo_hint_metrics_t  hint_metrics 
)

cairo_font_options_set_hint_metrics: : a #cairo_font_options_t : the new metrics hinting mode

Sets the metrics hinting mode for the font options object. This controls whether metrics are quantized to integer values in device units. See the documentation for cairo_hint_metrics_t for full details.

Definition at line 330 of file cairo-font-options.c.

{
    if (options == (cairo_font_options_t *)&cairo_font_options_nil)
       return;

    options->hint_metrics = hint_metrics;
}
void cairo_font_options_set_hint_style ( cairo_font_options_t *  options,
cairo_hint_style_t  hint_style 
)

cairo_font_options_set_hint_style: : a #cairo_font_options_t : the new hint style

Sets the hint style for font outlines for the font options object. This controls whether to fit font outlines to the pixel grid, and if so, whether to optimize for fidelity or contrast. See the documentation for cairo_hint_style_t for full details.

Definition at line 295 of file cairo-font-options.c.

{
    if (options == (cairo_font_options_t *)&cairo_font_options_nil)
       return;
    
    options->hint_style = hint_style;
}
void cairo_font_options_set_subpixel_order ( cairo_font_options_t *  options,
cairo_subpixel_order_t  subpixel_order 
)

cairo_font_options_set_subpixel_order: : a #cairo_font_options_t : the new subpixel order

Sets the subpixel order for the font options object. The subpixel order specifies the order of color elements within each pixel on the display device when rendering with an antialiasing mode of CAIRO_ANTIALIAS_SUBPIXEL. See the documentation for

cairo_subpixel_order_t for full details.

Definition at line 260 of file cairo-font-options.c.

{
    if (options == (cairo_font_options_t *)&cairo_font_options_nil)
       return;
    
    options->subpixel_order = subpixel_order;
}
cairo_status_t cairo_font_options_status ( cairo_font_options_t *  options)

cairo_font_options_status: : a #cairo_font_options_t

Checks whether an error has previously occurred for this font options object

Return value: CAIRO_STATUS_SUCCESS or CAIRO_STATUS_NO_MEMORY

Definition at line 141 of file cairo-font-options.c.

{
    if (options == (cairo_font_options_t *)&cairo_font_options_nil)
       return CAIRO_STATUS_NO_MEMORY;
    else
       return CAIRO_STATUS_SUCCESS;
}      

cairo_get_antialias: : a cairo context

Gets the current shape antialiasing mode, as set by cairo_set_shape_antialias().

Return value: the current shape antialiasing mode.

Definition at line 2246 of file cairo.c.

{
    return _cairo_gstate_get_antialias (cr->gstate);
}

Here is the call graph for this function:

void cairo_get_current_point ( cairo_t *  cr,
double *  x_ret,
double *  y_ret 
)

cairo_get_current_point: : a cairo context : return value for X coordinate of the current point : return value for Y coordinate of the current point

Gets the current point of the current path, which is conceptually the final point reached by the path so far.

The current point is returned in the user-space coordinate system. If there is no defined current point then and will both be set to 0.0.

Most path construction functions alter the current point. See the following for details on how they affect the current point:

cairo_new_path(), cairo_move_to(), cairo_line_to(), cairo_curve_to(), cairo_arc(), cairo_rel_move_to(), cairo_rel_line_to(), cairo_rel_curve_to(), cairo_arc(), cairo_text_path(), cairo_stroke_to_path()

Definition at line 2273 of file cairo.c.

{
    cairo_status_t status;
    cairo_fixed_t x_fixed, y_fixed;
    double x, y;

    status = _cairo_path_fixed_get_current_point (&cr->path, &x_fixed, &y_fixed);
    if (status == CAIRO_STATUS_NO_CURRENT_POINT) {
       x = 0.0;
       y = 0.0;
    } else {
       x = _cairo_fixed_to_double (x_fixed);
       y = _cairo_fixed_to_double (y_fixed);
       _cairo_gstate_backend_to_user (cr->gstate, &x, &y);
    }

    if (x_ret)
       *x_ret = x;
    if (y_ret)
       *y_ret = y;
}

Here is the call graph for this function:

cairo_get_fill_rule: : a cairo context

Gets the current fill rule, as set by cairo_set_fill_rule().

Return value: the current fill rule.

Definition at line 2305 of file cairo.c.

{
    return _cairo_gstate_get_fill_rule (cr->gstate);
}

Here is the call graph for this function:

cairo_font_face_t* cairo_get_font_face ( cairo_t *  cr)

cairo_get_font_face: : a #cairo_t

Gets the current font face for a #cairo_t.

Return value: the current font object. Can return NULL on out-of-memory or if the context is already in an error state. This object is owned by cairo. To keep a reference to it, you must call cairo_font_face_reference().

Definition at line 1822 of file cairo.c.

{
    cairo_font_face_t *font_face;

    if (cr->status)
       return (cairo_font_face_t*) &_cairo_font_face_nil;

    cr->status = _cairo_gstate_get_font_face (cr->gstate, &font_face);
    if (cr->status) {
       _cairo_set_error (cr, cr->status);
       return (cairo_font_face_t*) &_cairo_font_face_nil;
    }

    return font_face;
}

Here is the call graph for this function:

void cairo_get_font_matrix ( cairo_t *  cr,
cairo_matrix_t matrix 
)

cairo_get_font_matrix : a #cairo_t : return value for the matrix

Stores the current font matrix into . See cairo_set_font_matrix().

Definition at line 1935 of file cairo.c.

{
    _cairo_gstate_get_font_matrix (cr->gstate, matrix);
}

Here is the call graph for this function:

void cairo_get_font_options ( cairo_t *  cr,
cairo_font_options_t *  options 
)

cairo_get_font_options: : a #cairo_t : a #cairo_font_options_t object into which to store the retrieved options.

All existing values are overwritten

Retrieves font rendering options set via cairo_set_font_options. Note that the returned options do not include any options derived from the underlying surface; they are literally the options passed to cairo_set_font_options().

Definition at line 1975 of file cairo.c.

Here is the call graph for this function:

cairo_get_line_cap: : a cairo context

Gets the current line cap style, as set by cairo_set_line_cap().

Return value: the current line cap style.

Definition at line 2333 of file cairo.c.

{
    return _cairo_gstate_get_line_cap (cr->gstate);
}

Here is the call graph for this function:

cairo_get_line_join: : a cairo context

Gets the current line join style, as set by cairo_set_line_join().

Return value: the current line join style.

Definition at line 2347 of file cairo.c.

{
    return _cairo_gstate_get_line_join (cr->gstate);
}

Here is the call graph for this function:

double cairo_get_line_width ( cairo_t *  cr)

cairo_get_line_width: : a cairo context

Gets the current line width, as set by cairo_set_line_width().

Return value: the current line width, in user-space units.

Definition at line 2319 of file cairo.c.

{
    return _cairo_gstate_get_line_width (cr->gstate);
}

Here is the call graph for this function:

void cairo_get_matrix ( cairo_t *  cr,
cairo_matrix_t matrix 
)

cairo_get_matrix: : a cairo context : return value for the matrix

Stores the current transformation matrix (CTM) into .

Definition at line 2374 of file cairo.c.

{
    _cairo_gstate_get_matrix (cr->gstate, matrix);
}

Here is the call graph for this function:

double cairo_get_miter_limit ( cairo_t *  cr)

cairo_get_miter_limit: : a cairo context

Gets the current miter limit, as set by cairo_set_miter_limit().

Return value: the current miter limit.

Definition at line 2361 of file cairo.c.

{
    return _cairo_gstate_get_miter_limit (cr->gstate);
}

Here is the call graph for this function:

cairo_get_operator: : a cairo context

Gets the current compositing operator for a cairo context.

Return value: the current compositing operator.

Definition at line 2218 of file cairo.c.

{
    return _cairo_gstate_get_operator (cr->gstate);
}

Here is the call graph for this function:

cairo_pattern_t* cairo_get_source ( cairo_t *  cr)

cairo_get_source: : a cairo context

Gets the current source pattern for .

Return value: the current source pattern. This object is owned by cairo. To keep a reference to it, you must call cairo_pattern_reference().

Definition at line 533 of file cairo.c.

{
    if (cr->status)
       return (cairo_pattern_t*) &cairo_pattern_nil.base;

    return _cairo_gstate_get_source (cr->gstate);
}

Here is the call graph for this function:

cairo_surface_t* cairo_get_target ( cairo_t *  cr)

cairo_get_target: : a cairo context

Gets the target surface for the cairo context as passed to cairo_create().

This function will always return a valid pointer, but the result can be a "nil" surface if is already in an error state, (ie. cairo_status() <literal>!=</literal> CAIRO_STATUS_SUCCESS). A nil surface is indicated by cairo_surface_status() <literal>!=</literal> CAIRO_STATUS_SUCCESS.

Return value: the target surface. This object is owned by cairo. To keep a reference to it, you must call cairo_surface_reference().

Definition at line 2396 of file cairo.c.

{
    if (cr->status)
       return (cairo_surface_t*) &_cairo_surface_nil;

    return _cairo_gstate_get_target (cr->gstate);
}

Here is the call graph for this function:

double cairo_get_tolerance ( cairo_t *  cr)

cairo_get_tolerance: : a cairo context

Gets the current tolerance value, as set by cairo_set_tolerance().

Return value: the current tolerance value.

Definition at line 2232 of file cairo.c.

{
    return _cairo_gstate_get_tolerance (cr->gstate);
}

Here is the call graph for this function:

void cairo_glyph_extents ( cairo_t *  cr,
cairo_glyph_t glyphs,
int  num_glyphs,
cairo_text_extents_t extents 
)

cairo_glyph_extents: : a #cairo_t : an array of cairo_glyph_t objects : the number of elements in : a cairo_text_extents_t object into which the results will be stored

Gets the extents for an array of glyphs. The extents describe a user-space rectangle that encloses the "inked" portion of the glyphs, (as they would be drawn by cairo_show_glyphs()). Additionally, the x_advance and y_advance values indicate the amount by which the current point would be advanced by cairo_show_glyphs.

Note that whitespace glyphs do not contribute to the size of the rectangle (extents.width and extents.height).

Definition at line 2063 of file cairo.c.

{
    if (cr->status)
       return;

    cr->status = _cairo_gstate_glyph_extents (cr->gstate, glyphs, num_glyphs,
                                         extents);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_glyph_path ( cairo_t *  cr,
cairo_glyph_t glyphs,
int  num_glyphs 
)

Definition at line 2197 of file cairo.c.

{
    if (cr->status)
       return;

    cr->status = _cairo_gstate_glyph_path (cr->gstate,
                                      glyphs, num_glyphs,
                                      &cr->path);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_identity_matrix ( cairo_t *  cr)

cairo_identity_matrix: : a cairo context

Resets the current transformation matrix (CTM) by setting it equal to the identity matrix. That is, the user-space and device-space axes will be aligned and one user-space unit will transform to one device-space unit.

Definition at line 860 of file cairo.c.

{
    if (cr->status)
       return;

    cr->status = _cairo_gstate_identity_matrix (cr->gstate);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

cairo_surface_t* cairo_image_surface_create ( cairo_format_t  format,
int  width,
int  height 
)

cairo_image_surface_create: : format of pixels in the surface to create : width of the surface, in pixels : height of the surface, in pixels

Creates an image surface of the specified format and dimensions. The initial contents of the surface is undefined; you must explicitely clear the buffer, using, for example, cairo_rectangle() and cairo_fill() if you want it cleared.

Return value: a pointer to the newly created surface. The caller owns the surface and should call cairo_surface_destroy when done with it.

This function always returns a valid pointer, but it will return a pointer to a "nil" surface if an error such as out of memory occurs. You can use cairo_surface_status() to check for this.

Definition at line 161 of file cairo-image-surface.c.

{
    cairo_surface_t *surface;
    pixman_format_t *pixman_format;
    pixman_image_t *pixman_image;

    if (! CAIRO_FORMAT_VALID (format))
       return (cairo_surface_t*) &_cairo_surface_nil;

    pixman_format = _create_pixman_format (format);
    if (pixman_format == NULL) {
       _cairo_error (CAIRO_STATUS_NO_MEMORY);
       return (cairo_surface_t*) &_cairo_surface_nil;
    }

    pixman_image = pixman_image_create (pixman_format, width, height);

    pixman_format_destroy (pixman_format);

    if (pixman_image == NULL) {
       _cairo_error (CAIRO_STATUS_NO_MEMORY);
       return (cairo_surface_t*) &_cairo_surface_nil;
    }

    surface = _cairo_image_surface_create_for_pixman_image (pixman_image, format);

    return surface;
}

Here is the call graph for this function:

cairo_surface_t* cairo_image_surface_create_for_data ( unsigned char *  data,
cairo_format_t  format,
int  width,
int  height,
int  stride 
)

cairo_image_surface_create_for_data: : a pointer to a buffer supplied by the application in which to write contents.

: the format of pixels in the buffer : the width of the image to be stored in the buffer : the height of the image to be stored in the buffer : the number of bytes between the start of rows in the buffer. Having this be specified separate from allows for padding at the end of rows, or for writing to a subportion of a larger image.

Creates an image surface for the provided pixel data. The output buffer must be kept around until the #cairo_surface_t is destroyed or cairo_surface_finish() is called on the surface. The initial contents of will be used as the inital image contents; you must explicitely clear the buffer, using, for example, cairo_rectangle() and cairo_fill() if you want it cleared.

Return value: a pointer to the newly created surface. The caller owns the surface and should call cairo_surface_destroy when done with it.

This function always returns a valid pointer, but it will return a pointer to a "nil" surface if an error such as out of memory occurs. You can use cairo_surface_status() to check for this.

Definition at line 220 of file cairo-image-surface.c.

{
    cairo_surface_t *surface;
    pixman_format_t *pixman_format;
    pixman_image_t *pixman_image;

    if (! CAIRO_FORMAT_VALID (format))
       return (cairo_surface_t*) &_cairo_surface_nil;

    pixman_format = _create_pixman_format (format);
    if (pixman_format == NULL) {
       _cairo_error (CAIRO_STATUS_NO_MEMORY);
       return (cairo_surface_t*) &_cairo_surface_nil;
    }
    
    pixman_image = pixman_image_create_for_data ((pixman_bits_t *) data, pixman_format,
                                           width, height,
                                           _cairo_format_bpp (format),
                                           stride);

    pixman_format_destroy (pixman_format);

    if (pixman_image == NULL) {
       _cairo_error (CAIRO_STATUS_NO_MEMORY);
       return (cairo_surface_t*) &_cairo_surface_nil;
    }

    surface = _cairo_image_surface_create_for_pixman_image (pixman_image, format);

    return surface;
}

Here is the call graph for this function:

int cairo_image_surface_get_height ( cairo_surface_t *  surface)

cairo_image_surface_get_height: : a #cairo_image_surface_t

Get the height of the image surface in pixels.

Return value: the height of the surface in pixels.

Definition at line 286 of file cairo-image-surface.c.

{
    cairo_image_surface_t *image_surface = (cairo_image_surface_t *) surface;

    if (!_cairo_surface_is_image (surface)) {
       _cairo_error (CAIRO_STATUS_SURFACE_TYPE_MISMATCH);
       return 0;
    }

    return image_surface->height;
}

Here is the call graph for this function:

int cairo_image_surface_get_width ( cairo_surface_t *  surface)

cairo_image_surface_get_width: : a #cairo_image_surface_t

Get the width of the image surface in pixels.

Return value: the width of the surface in pixels.

Definition at line 265 of file cairo-image-surface.c.

{
    cairo_image_surface_t *image_surface = (cairo_image_surface_t *) surface;

    if (!_cairo_surface_is_image (surface)) {
       _cairo_error (CAIRO_STATUS_SURFACE_TYPE_MISMATCH);
       return 0;
    }

    return image_surface->width;
}

Here is the call graph for this function:

cairo_bool_t cairo_in_fill ( cairo_t *  cr,
double  x,
double  y 
)

Definition at line 1644 of file cairo.c.

{
    int inside;

    if (cr->status)
       return 0;

    cr->status = _cairo_gstate_in_fill (cr->gstate,
                                   &cr->path,
                                   x, y, &inside);
    if (cr->status) {
       _cairo_set_error (cr, cr->status);
       return 0;
    }

    return inside;
}

Here is the call graph for this function:

cairo_bool_t cairo_in_stroke ( cairo_t *  cr,
double  x,
double  y 
)

Definition at line 1627 of file cairo.c.

{
    int inside;

    if (cr->status)
       return 0;

    cr->status = _cairo_gstate_in_stroke (cr->gstate,
                                     &cr->path,
                                     x, y, &inside);
    if (cr->status)
       return 0;

    return inside;
}

Here is the call graph for this function:

void cairo_line_to ( cairo_t *  cr,
double  x,
double  y 
)

cairo_line_to: : a cairo context : the X coordinate of the end of the new line : the Y coordinate of the end of the new line

Adds a line to the path from the current point to position (, ) in user-space coordinates. After this call the current point will be (, ).

Definition at line 1011 of file cairo.c.

{
    cairo_fixed_t x_fixed, y_fixed;

    if (cr->status)
       return;

    _cairo_gstate_user_to_backend (cr->gstate, &x, &y);
    x_fixed = _cairo_fixed_from_double (x);
    y_fixed = _cairo_fixed_from_double (y);

    cr->status = _cairo_path_fixed_line_to (&cr->path, x_fixed, y_fixed);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_mask ( cairo_t *  cr,
cairo_pattern_t *  pattern 
)

cairo_mask: : a cairo context : a #cairo_pattern_t

A drawing operator that paints the current source using the alpha channel of as a mask. (Opaque areas of are painted with the source, transparent areas are not painted.)

Definition at line 1464 of file cairo.c.

{
    if (cr->status)
       return;

    if (pattern == NULL) {
       _cairo_set_error (cr, CAIRO_STATUS_NULL_POINTER);
       return;
    }
    
    if (pattern->status) {
       _cairo_set_error (cr, pattern->status);
       return;
    }

    cr->status = _cairo_gstate_mask (cr->gstate, pattern);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_mask_surface ( cairo_t *  cr,
cairo_surface_t *  surface,
double  surface_x,
double  surface_y 
)

cairo_mask_surface: : a cairo context : a #cairo_surface_t : X coordinate at which to place the origin of : Y coordinate at which to place the origin of

A drawing operator that paints the current source using the alpha channel of as a mask. (Opaque areas of are painted with the source, transparent areas are not painted.)

Definition at line 1498 of file cairo.c.

{
    cairo_pattern_t *pattern;
    cairo_matrix_t matrix;

    if (cr->status)
       return;

    pattern = cairo_pattern_create_for_surface (surface);

    cairo_matrix_init_translate (&matrix, - surface_x, - surface_y);
    cairo_pattern_set_matrix (pattern, &matrix);

    cairo_mask (cr, pattern);
    
    cairo_pattern_destroy (pattern);
}
void cairo_matrix_init ( cairo_matrix_t matrix,
double  xx,
double  yx,
double  xy,
double  yy,
double  x0,
double  y0 
)

cairo_matrix_init: : a cairo_matrix_t : xx component of the affine transformation : yx component of the affine transformation : xy component of the affine transformation : yy component of the affine transformation : X translation component of the affine transformation : Y translation component of the affine transformation

Sets to be the affine transformation given by , , , , , . The transformation is given by: <programlisting> x_new = xx * x + xy * y + x0; y_new = yx * x + yy * y + y0; </programlisting>

Definition at line 83 of file cairo-matrix.c.

{
    matrix->xx = xx; matrix->yx = yx;
    matrix->xy = xy; matrix->yy = yy;
    matrix->x0 = x0; matrix->y0 = y0;
}

Here is the call graph for this function:

cairo_matrix_init_identity: : a cairo_matrix_t

Modifies to be an identity transformation.

Definition at line 55 of file cairo-matrix.c.

{
    cairo_matrix_init (matrix,
                     1, 0,
                     0, 1,
                     0, 0);
}
void cairo_matrix_init_rotate ( cairo_matrix_t matrix,
double  radians 
)

cairo_matrix_init_rotate: : a cairo_matrix_t : angle of rotation, in radians.

The direction of rotation is defined such that positive angles rotate in the direction from the positive X axis toward the positive Y axis. With the default axis orientation of cairo, positive angles rotate in a clockwise direction.

Initialized to a transformation that rotates by .

Definition at line 227 of file cairo-matrix.c.

{
    double  s;
    double  c;

    s = sin (radians);
    c = cos (radians);

    cairo_matrix_init (matrix,
                     c, s,
                     -s, c,
                     0, 0);
}
void cairo_matrix_init_scale ( cairo_matrix_t matrix,
double  sx,
double  sy 
)

cairo_matrix_init_scale: : a cairo_matrix_t : scale factor in the X direction : scale factor in the Y direction

Initializes to a transformation that scales by and in the X and Y dimensions, respectively.

Definition at line 184 of file cairo-matrix.c.

{
    cairo_matrix_init (matrix,
                     sx,  0,
                     0, sy,
                     0, 0);
}
void cairo_matrix_init_translate ( cairo_matrix_t matrix,
double  tx,
double  ty 
)

cairo_matrix_init_translate: : a cairo_matrix_t : amount to translate in the X direction : amount to translate in the Y direction

Initializes to a transformation that translates by and in the X and Y dimensions, respectively.

Definition at line 143 of file cairo-matrix.c.

{
    cairo_matrix_init (matrix,
                     1, 0,
                     0, 1,
                     tx, ty);
}

cairo_matrix_invert: : a

Changes to be the inverse of it's original value. Not all transformation matrices have inverses; if the matrix collapses points together (it is <firstterm>degenerate</firstterm>), then it has no inverse and this function will fail.

Returns: If has an inverse, modifies to be the inverse matrix and returns CAIRO_STATUS_SUCCESS. Otherwise, returns CAIRO_STATUS_INVALID_MATRIX.

Definition at line 457 of file cairo-matrix.c.

{
    /* inv (A) = 1/det (A) * adj (A) */
    double det;

    _cairo_matrix_compute_determinant (matrix, &det);
    
    if (det == 0)
       return CAIRO_STATUS_INVALID_MATRIX;

    _cairo_matrix_compute_adjoint (matrix);
    _cairo_matrix_scalar_multiply (matrix, 1 / det);

    return CAIRO_STATUS_SUCCESS;
}

Here is the call graph for this function:

cairo_matrix_multiply:

Returns:
: a in which to store the result : a : a

Multiplies the affine transformations in and together and stores the result in

Returns:
. The effect of the resulting transformation is to first apply the transformation in to the coordinates and then apply the transformation in to the coordinates.

It is allowable for

Returns:
to be identical to either or .

Definition at line 288 of file cairo-matrix.c.

{
    cairo_matrix_t r;

    r.xx = a->xx * b->xx + a->yx * b->xy;
    r.yx = a->xx * b->yx + a->yx * b->yy;

    r.xy = a->xy * b->xx + a->yy * b->xy;
    r.yy = a->xy * b->yx + a->yy * b->yy;

    r.x0 = a->x0 * b->xx + a->y0 * b->xy + b->x0;
    r.y0 = a->x0 * b->yx + a->y0 * b->yy + b->y0;

    *result = r;
}
void cairo_matrix_rotate ( cairo_matrix_t matrix,
double  radians 
)

cairo_matrix_rotate: : a : angle of rotation, in radians.

The direction of rotation is defined such that positive angles rotate in the direction from the positive X axis toward the positive Y axis. With the default axis orientation of cairo, positive angles rotate in a clockwise direction.

Applies rotation by to the transformation in . The effect of the new transformation is to first rotate the coordinates by , then apply the original transformation to the coordinates.

Definition at line 258 of file cairo-matrix.c.

{
    cairo_matrix_t tmp;

    cairo_matrix_init_rotate (&tmp, radians);

    cairo_matrix_multiply (matrix, &tmp, matrix);
}
void cairo_matrix_scale ( cairo_matrix_t matrix,
double  sx,
double  sy 
)

cairo_matrix_scale: : a cairo_matrix_t : scale factor in the X direction : scale factor in the Y direction

Applies scaling by , to the transformation in . The effect of the new transformation is to first scale the coordinates by and , then apply the original transformation to the coordinates.

Definition at line 205 of file cairo-matrix.c.

{
    cairo_matrix_t tmp;

    cairo_matrix_init_scale (&tmp, sx, sy);

    cairo_matrix_multiply (matrix, &tmp, matrix);
}
void cairo_matrix_transform_distance ( const cairo_matrix_t matrix,
double *  dx,
double *  dy 
)

cairo_matrix_transform_distance: : a : X component of a distance vector.

An in/out parameter : Y component of a distance vector. An in/out parameter

Transforms the distance vector (,) by . This is similar to cairo_matrix_transform() except that the translation components of the transformation are ignored. The calculation of the returned vector is as follows:

<programlisting> dx2 = dx1 * a + dy1 * c; dy2 = dx1 * b + dy1 * d; </programlisting>

Affine transformations are position invariant, so the same vector always transforms to the same vector. If (,) transforms to (,) then (+,+) will transform to (+,+) for all values of and .

Definition at line 327 of file cairo-matrix.c.

{
    double new_x, new_y;

    new_x = (matrix->xx * *dx + matrix->xy * *dy);
    new_y = (matrix->yx * *dx + matrix->yy * *dy);

    *dx = new_x;
    *dy = new_y;
}
void cairo_matrix_transform_point ( const cairo_matrix_t matrix,
double *  x,
double *  y 
)

cairo_matrix_transform_point: : a : X position.

An in/out parameter : Y position. An in/out parameter

Transforms the point (, ) by .

Definition at line 348 of file cairo-matrix.c.

{
    cairo_matrix_transform_distance (matrix, x, y);

    *x += matrix->x0;
    *y += matrix->y0;
}
void cairo_matrix_translate ( cairo_matrix_t matrix,
double  tx,
double  ty 
)

cairo_matrix_translate: : a cairo_matrix_t : amount to translate in the X direction : amount to translate in the Y direction

Applies a translation by , to the transformation in . The effect of the new transformation is to first translate the coordinates by and , then apply the original transformation to the coordinates.

Definition at line 165 of file cairo-matrix.c.

{
    cairo_matrix_t tmp;

    cairo_matrix_init_translate (&tmp, tx, ty);

    cairo_matrix_multiply (matrix, &tmp, matrix);
}
void cairo_move_to ( cairo_t *  cr,
double  x,
double  y 
)

cairo_move_to: : a cairo context : the X coordinate of the new position : the Y coordinate of the new position

If the current subpath is not empty, begin a new subpath. After this call the current point will be (, ).

Definition at line 983 of file cairo.c.

{
    cairo_fixed_t x_fixed, y_fixed;

    if (cr->status)
       return;

    _cairo_gstate_user_to_backend (cr->gstate, &x, &y);
    x_fixed = _cairo_fixed_from_double (x);
    y_fixed = _cairo_fixed_from_double (y);

    cr->status = _cairo_path_fixed_move_to (&cr->path, x_fixed, y_fixed);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_new_path ( cairo_t *  cr)

cairo_new_path: : a cairo context

Clears the current path. After this call there will be no current point.

Definition at line 964 of file cairo.c.

{
    if (cr->status)
       return;

    _cairo_path_fixed_fini (&cr->path);
}

Here is the call graph for this function:

void cairo_paint ( cairo_t *  cr)

cairo_paint: : a cairo context

A drawing operator that paints the current source everywhere within the current clip region.

Definition at line 1404 of file cairo.c.

{
    if (cr->status)
       return;

    cr->status = _cairo_gstate_paint (cr->gstate);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_paint_with_alpha ( cairo_t *  cr,
double  alpha 
)

cairo_paint_with_alpha: : a cairo context : alpha value, between 0 (transparent) and 1 (opaque)

A drawing operator that paints the current source everywhere within the current clip region using a mask of constant alpha value . The effect is similar to cairo_paint(), but the drawing is faded out using the alpha value.

Definition at line 1425 of file cairo.c.

{
    cairo_color_t color;
    cairo_pattern_union_t pattern;
  
    if (cr->status)
       return;

    if (CAIRO_ALPHA_IS_OPAQUE (alpha)) {
       cairo_paint (cr);
       return;
    }

    if (CAIRO_ALPHA_IS_ZERO (alpha)) {
       return;
    }

    _cairo_color_init_rgba (&color, 1., 1., 1., alpha);
    _cairo_pattern_init_solid (&pattern.solid, &color);

    cr->status = _cairo_gstate_mask (cr->gstate, &pattern.base);
    if (cr->status)
       _cairo_set_error (cr, cr->status);

    _cairo_pattern_fini (&pattern.base);
}

Here is the call graph for this function:

cairo_path_destroy: : a path previously returned by either cairo_copy_path() or cairo_copy_path_flat().

Immediately releases all memory associated with . After a call to cairo_path_destroy() the pointer is no longer valid and should not be used further.

NOTE: cairo_path_destroy function should only be called with a pointer to a cairo_path_t returned by a cairo function. Any path that is created manually (ie. outside of cairo) should be destroyed manually as well.

Definition at line 383 of file cairo-path-data.c.

{
    if (path == NULL || path == &_cairo_path_nil)
       return;

    free (path->data);
    path->num_data = 0;
    free (path);
}
void cairo_pattern_add_color_stop_rgb ( cairo_pattern_t *  pattern,
double  offset,
double  red,
double  green,
double  blue 
)

cairo_pattern_add_color_stop_rgb: : a #cairo_pattern_t : an offset in the range [0.0 .

. 1.0] : red component of color : green component of color : blue component of color

Adds an opaque color stop to a gradient pattern. The offset specifies the location along the gradient's control vector. For example, a linear gradient's control vector is from (x0,y0) to (x1,y1) while a radial gradient's control vector is from any point on the start circle to the corresponding point on the end circle.

The color is specified in the same way as in cairo_set_source_rgb().

Note: If the pattern is not a gradient pattern, (eg. a linear or radial pattern), then the pattern will be put into an error status with a status of CAIRO_STATUS_PATTERN_TYPE_MISMATCH.

Definition at line 624 of file cairo-pattern.c.

{
    cairo_color_t color;

    if (pattern->status)
       return;

    if (pattern->type != CAIRO_PATTERN_LINEAR &&
       pattern->type != CAIRO_PATTERN_RADIAL)
    {
       _cairo_pattern_set_error (pattern, CAIRO_STATUS_PATTERN_TYPE_MISMATCH);
       return;
    }

    _cairo_restrict_value (&offset, 0.0, 1.0);
    _cairo_restrict_value (&red,    0.0, 1.0);
    _cairo_restrict_value (&green,  0.0, 1.0);
    _cairo_restrict_value (&blue,   0.0, 1.0);

    _cairo_color_init_rgb (&color, red, green, blue);
    _cairo_pattern_add_color_stop ((cairo_gradient_pattern_t *) pattern,
                               offset,
                               &color);
}

Here is the call graph for this function:

void cairo_pattern_add_color_stop_rgba ( cairo_pattern_t *  pattern,
double  offset,
double  red,
double  green,
double  blue,
double  alpha 
)

cairo_pattern_add_color_stop_rgba: : a #cairo_pattern_t : an offset in the range [0.0 .

. 1.0] : red component of color : green component of color : blue component of color : alpha component of color

Adds a translucent color stop to a gradient pattern. The offset specifies the location along the gradient's control vector. For example, a linear gradient's control vector is from (x0,y0) to (x1,y1) while a radial gradient's control vector is from any point on the start circle to the corresponding point on the end circle.

The color is specified in the same way as in cairo_set_source_rgba().

Note: If the pattern is not a gradient pattern, (eg. a linear or radial pattern), then the pattern will be put into an error status with a status of CAIRO_STATUS_PATTERN_TYPE_MISMATCH.

Definition at line 675 of file cairo-pattern.c.

{
    cairo_color_t color;

    if (pattern->status)
       return;

    if (pattern->type != CAIRO_PATTERN_LINEAR &&
       pattern->type != CAIRO_PATTERN_RADIAL)
    {
       _cairo_pattern_set_error (pattern, CAIRO_STATUS_PATTERN_TYPE_MISMATCH);
       return;
    }

    _cairo_restrict_value (&offset, 0.0, 1.0);
    _cairo_restrict_value (&red,    0.0, 1.0);
    _cairo_restrict_value (&green,  0.0, 1.0);
    _cairo_restrict_value (&blue,   0.0, 1.0);
    _cairo_restrict_value (&alpha,  0.0, 1.0);

    _cairo_color_init_rgba (&color, red, green, blue, alpha);
    _cairo_pattern_add_color_stop ((cairo_gradient_pattern_t *) pattern,
                               offset,
                               &color);
}

Here is the call graph for this function:

cairo_pattern_t* cairo_pattern_create_for_surface ( cairo_surface_t *  surface)

cairo_pattern_create_for_surface: : the surface

Create a new cairo_pattern_t for the given surface.

Return value: the newly created #cairo_pattern_t if succesful, or an error pattern in case of no memory. The caller owns the returned object and should call cairo_pattern_destroy() when finished with it.

This function will always return a valid pointer, but if an error occurred the pattern status will be set to an error. To inspect the status of a pattern use cairo_pattern_status().

Definition at line 402 of file cairo-pattern.c.

{
    cairo_surface_pattern_t *pattern;

    if (surface == NULL)
       return (cairo_pattern_t*) _cairo_pattern_nil_for_status (CAIRO_STATUS_NULL_POINTER);

    if (surface->status)
       return (cairo_pattern_t*) _cairo_pattern_nil_for_status (surface->status);

    pattern = malloc (sizeof (cairo_surface_pattern_t));
    if (pattern == NULL) {
       _cairo_error (CAIRO_STATUS_NO_MEMORY);
       return (cairo_pattern_t *)&cairo_pattern_nil.base;
    }

    _cairo_pattern_init_for_surface (pattern, surface);

    return &pattern->base;
}

Here is the call graph for this function:

cairo_pattern_t* cairo_pattern_create_linear ( double  x0,
double  y0,
double  x1,
double  y1 
)

cairo_pattern_create_linear: : x coordinate of the start point : y coordinate of the start point : x coordinate of the end point : y coordinate of the end point

Create a new linear gradient cairo_pattern_t along the line defined by (x0, y0) and (x1, y1). Before using the gradient pattern, a number of color stops should be defined using cairo_pattern_add_color_stop_rgb() or cairo_pattern_add_color_stop_rgba().

Note: The coordinates here are in pattern space. For a new pattern, pattern space is identical to user space, but the relationship between the spaces can be changed with cairo_pattern_set_matrix().

Return value: the newly created #cairo_pattern_t if succesful, or an error pattern in case of no memory. The caller owns the returned object and should call cairo_pattern_destroy() when finished with it.

This function will always return a valid pointer, but if an error occurred the pattern status will be set to an error. To inspect the status of a pattern use cairo_pattern_status().

Definition at line 450 of file cairo-pattern.c.

{
    cairo_linear_pattern_t *pattern;

    pattern = malloc (sizeof (cairo_linear_pattern_t));
    if (pattern == NULL) {
       _cairo_error (CAIRO_STATUS_NO_MEMORY);
       return (cairo_pattern_t *) &cairo_pattern_nil.base;
    }

    _cairo_pattern_init_linear (pattern, x0, y0, x1, y1);

    return &pattern->base.base;
}

Here is the call graph for this function:

cairo_pattern_t* cairo_pattern_create_radial ( double  cx0,
double  cy0,
double  radius0,
double  cx1,
double  cy1,
double  radius1 
)

cairo_pattern_create_radial: : x coordinate for the center of the start circle : y coordinate for the center of the start circle : radius of the start cirle : x coordinate for the center of the end circle : y coordinate for the center of the end circle : radius of the end cirle

Creates a new radial gradient cairo_pattern_t between the two circles defined by (x0, y0, c0) and (x1, y1, c0). Before using the gradient pattern, a number of color stops should be defined using cairo_pattern_add_color_stop_rgb() or cairo_pattern_add_color_stop_rgba().

Note: The coordinates here are in pattern space. For a new pattern, pattern space is identical to user space, but the relationship between the spaces can be changed with cairo_pattern_set_matrix().

Return value: the newly created #cairo_pattern_t if succesful, or an error pattern in case of no memory. The caller owns the returned object and should call cairo_pattern_destroy() when finished with it.

This function will always return a valid pointer, but if an error occurred the pattern status will be set to an error. To inspect the status of a pattern use cairo_pattern_status().

Definition at line 494 of file cairo-pattern.c.

{
    cairo_radial_pattern_t *pattern;
    
    pattern = malloc (sizeof (cairo_radial_pattern_t));
    if (pattern == NULL) {
       _cairo_error (CAIRO_STATUS_NO_MEMORY);
       return (cairo_pattern_t *) &cairo_pattern_nil.base;
    }

    _cairo_pattern_init_radial (pattern, cx0, cy0, radius0, cx1, cy1, radius1);

    return &pattern->base.base;
}

Here is the call graph for this function:

cairo_pattern_t* cairo_pattern_create_rgb ( double  red,
double  green,
double  blue 
)

cairo_pattern_create_rgb: : red component of the color : green component of the color : blue component of the color

Creates a new cairo_pattern_t corresponding to an opaque color. The color components are floating point numbers in the range 0 to 1. If the values passed in are outside that range, they will be clamped.

Return value: the newly created #cairo_pattern_t if succesful, or an error pattern in case of no memory. The caller owns the returned object and should call cairo_pattern_destroy() when finished with it.

This function will always return a valid pointer, but if an error occurred the pattern status will be set to an error. To inspect the status of a pattern use cairo_pattern_status().

Definition at line 326 of file cairo-pattern.c.

{
    cairo_pattern_t *pattern;
    cairo_color_t color;

    _cairo_restrict_value (&red,   0.0, 1.0);
    _cairo_restrict_value (&green, 0.0, 1.0);
    _cairo_restrict_value (&blue,  0.0, 1.0);

    _cairo_color_init_rgb (&color, red, green, blue);

    pattern = _cairo_pattern_create_solid (&color);
    if (pattern->status)
       _cairo_error (pattern->status);

    return pattern;
}

Here is the call graph for this function:

cairo_pattern_t* cairo_pattern_create_rgba ( double  red,
double  green,
double  blue,
double  alpha 
)

cairo_pattern_create_rgba: : red component of the color : green component of the color : blue component of the color : alpha component of the color

Creates a new cairo_pattern_t corresponding to a translucent color. The color components are floating point numbers in the range 0 to

  1. If the values passed in are outside that range, they will be clamped.

Return value: the newly created #cairo_pattern_t if succesful, or an error pattern in case of no memory. The caller owns the returned object and should call cairo_pattern_destroy() when finished with it.

This function will always return a valid pointer, but if an error occurred the pattern status will be set to an error. To inspect the status of a pattern use cairo_pattern_status().

Definition at line 366 of file cairo-pattern.c.

{
    cairo_pattern_t *pattern;
    cairo_color_t color;

    _cairo_restrict_value (&red,   0.0, 1.0);
    _cairo_restrict_value (&green, 0.0, 1.0);
    _cairo_restrict_value (&blue,  0.0, 1.0);
    _cairo_restrict_value (&alpha, 0.0, 1.0);

    _cairo_color_init_rgba (&color, red, green, blue, alpha);

    pattern = _cairo_pattern_create_solid (&color);
    if (pattern->status)
       _cairo_error (pattern->status);

    return pattern;
}

Here is the call graph for this function:

void cairo_pattern_destroy ( cairo_pattern_t *  pattern)

cairo_pattern_destroy: : a #cairo_pattern_t

Decreases the reference count on by one. If the result is zero, then and all associated resources are freed. See cairo_pattern_reference().

Definition at line 561 of file cairo-pattern.c.

{
    if (pattern == NULL)
       return;

    if (pattern->ref_count == (unsigned int)-1)
       return;

    assert (pattern->ref_count > 0);

    pattern->ref_count--;
    if (pattern->ref_count)
       return;

    _cairo_pattern_fini (pattern);
    free (pattern);
}

Here is the call graph for this function:

cairo_extend_t cairo_pattern_get_extend ( cairo_pattern_t *  pattern)

Definition at line 786 of file cairo-pattern.c.

{
    return pattern->extend;
}
cairo_filter_t cairo_pattern_get_filter ( cairo_pattern_t *  pattern)

Definition at line 771 of file cairo-pattern.c.

{
    return pattern->filter;
}
void cairo_pattern_get_matrix ( cairo_pattern_t *  pattern,
cairo_matrix_t matrix 
)

cairo_pattern_get_matrix: : a #cairo_pattern_t : return value for the matrix

Stores the pattern's transformation matrix into .

Definition at line 756 of file cairo-pattern.c.

{
    *matrix = pattern->matrix;
}
cairo_pattern_t* cairo_pattern_reference ( cairo_pattern_t *  pattern)

cairo_pattern_reference: : a #cairo_pattern_t

Increases the reference count on by one. This prevents from being destroyed until a matching call to cairo_pattern_destroy() is made.

Return value: the referenced #cairo_pattern_t.

Definition at line 521 of file cairo-pattern.c.

{
    if (pattern == NULL)
       return NULL;

    if (pattern->ref_count == (unsigned int)-1)
       return pattern;

    assert (pattern->ref_count > 0);

    pattern->ref_count++;

    return pattern;
}
void cairo_pattern_set_extend ( cairo_pattern_t *  pattern,
cairo_extend_t  extend 
)

Definition at line 777 of file cairo-pattern.c.

{
    if (pattern->status)
       return;

    pattern->extend = extend;
}
void cairo_pattern_set_filter ( cairo_pattern_t *  pattern,
cairo_filter_t  filter 
)

Definition at line 762 of file cairo-pattern.c.

{
    if (pattern->status)
       return;

    pattern->filter = filter;
}
void cairo_pattern_set_matrix ( cairo_pattern_t *  pattern,
const cairo_matrix_t matrix 
)

cairo_pattern_set_matrix: : a #cairo_pattern_t : a cairo_matrix_t

Sets the pattern's transformation matrix to . This matrix is a transformation from user space to pattern space.

When a pattern is first created it always has the identity matrix for its transformation matrix, which means that pattern space is initially identical to user space.

Important: Please note that the direction of this transformation matrix is from user space to pattern space. This means that if you imagine the flow from a pattern to user space (and on to device space), then coordinates in that flow will be transformed by the inverse of the pattern matrix.

For example, if you want to make a pattern appear twice as large as it does by default the correct code to use is:

<informalexample><programlisting> cairo_matrix_init_scale (&matrix, 0.5, 0.5); cairo_pattern_set_matrix (pattern, &matrix); </programlisting></informalexample>

Meanwhile, using values of 2.0 rather than 0.5 in the code above would cause the pattern to appear at half of its default size.

Also, please note the discussion of the user-space locking semantics of cairo_set_source().

Definition at line 739 of file cairo-pattern.c.

{
    if (pattern->status)
       return;

    pattern->matrix = *matrix;
}
cairo_status_t cairo_pattern_status ( cairo_pattern_t *  pattern)

cairo_pattern_status: : a #cairo_pattern_t

Checks whether an error has previously occurred for this pattern.

Return value: CAIRO_STATUS_SUCCESS, CAIRO_STATUS_NO_MEMORY, or CAIRO_STATUS_PATTERN_TYPE_MISMATCH.

Definition at line 547 of file cairo-pattern.c.

{
    return pattern->status;
}
void cairo_rectangle ( cairo_t *  cr,
double  x,
double  y,
double  width,
double  height 
)

cairo_rectangle: : a cairo context : the X coordinate of the top left corner of the rectangle : the Y coordinate to the top left corner of the rectangle : the width of the rectangle : the height of the rectangle

Adds a closed-subpath rectangle of the given size to the current path at position (, ) in user-space coordinates.

This function is logically equivalent to: <informalexample><programlisting> cairo_move_to (cr, x, y); cairo_rel_line_to (cr, width, 0); cairo_rel_line_to (cr, 0, height); cairo_rel_line_to (cr, -width, 0); cairo_close_path (cr); </programlisting></informalexample>

Definition at line 1343 of file cairo.c.

cairo_t* cairo_reference ( cairo_t *  cr)

cairo_reference: : a #cairo_t

Increases the reference count on by one. This prevents from being destroyed until a matching call to cairo_destroy() is made.

Return value: the referenced #cairo_t.

Definition at line 221 of file cairo.c.

{
    if (cr->ref_count == (unsigned int)-1)
       return cr;

    assert (cr->ref_count > 0);
    
    cr->ref_count++;

    return cr;
}

Here is the call graph for this function:

void cairo_rel_curve_to ( cairo_t *  cr,
double  dx1,
double  dy1,
double  dx2,
double  dy2,
double  dx3,
double  dy3 
)

cairo_rel_curve_to: : a cairo context : the X offset to the first control point : the Y offset to the first control point : the X offset to the second control point : the Y offset to the second control point : the X offset to the end of the curve : the Y offset to the end of the curve

Relative-coordinate version of cairo_curve_to(). All offsets are relative to the current point. Adds a cubic Bézier spline to the path from the current point to a point offset from the current point by (, ), using points offset by (, ) and (, ) as the control points. After this call the current point will be offset by (, ).

Given a current point of (x, y), cairo_rel_curve_to (, , , , , , ) is logically equivalent to cairo_curve_to (, x + , y + , x + , y + , x + , y + ).

Definition at line 1289 of file cairo.c.

{
    cairo_fixed_t dx1_fixed, dy1_fixed;
    cairo_fixed_t dx2_fixed, dy2_fixed;
    cairo_fixed_t dx3_fixed, dy3_fixed;

    if (cr->status)
       return;

    _cairo_gstate_user_to_device_distance (cr->gstate, &dx1, &dy1);
    _cairo_gstate_user_to_device_distance (cr->gstate, &dx2, &dy2);
    _cairo_gstate_user_to_device_distance (cr->gstate, &dx3, &dy3);

    dx1_fixed = _cairo_fixed_from_double (dx1);
    dy1_fixed = _cairo_fixed_from_double (dy1);

    dx2_fixed = _cairo_fixed_from_double (dx2);
    dy2_fixed = _cairo_fixed_from_double (dy2);

    dx3_fixed = _cairo_fixed_from_double (dx3);
    dy3_fixed = _cairo_fixed_from_double (dy3);

    cr->status = _cairo_path_fixed_rel_curve_to (&cr->path,
                                           dx1_fixed, dy1_fixed,
                                           dx2_fixed, dy2_fixed,
                                           dx3_fixed, dy3_fixed);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_rel_line_to ( cairo_t *  cr,
double  dx,
double  dy 
)

cairo_rel_line_to: : a cairo context : the X offset to the end of the new line : the Y offset to the end of the new line

Relative-coordinate version of cairo_line_to(). Adds a line to the path from the current point to a point that is offset from the current point by (, ) in user space. After this call the current point will be offset by (, ).

Given a current point of (x, y), cairo_rel_line_to(, , ) is logically equivalent to cairo_line_to (, x + , y + ).

Definition at line 1249 of file cairo.c.

{
    cairo_fixed_t dx_fixed, dy_fixed;

    if (cr->status)
       return;

    _cairo_gstate_user_to_device_distance (cr->gstate, &dx, &dy);
    dx_fixed = _cairo_fixed_from_double (dx);
    dy_fixed = _cairo_fixed_from_double (dy);

    cr->status = _cairo_path_fixed_rel_line_to (&cr->path, dx_fixed, dy_fixed);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_rel_move_to ( cairo_t *  cr,
double  dx,
double  dy 
)

cairo_rel_move_to: : a cairo context : the X offset : the Y offset

If the current subpath is not empty, begin a new subpath. After this call the current point will offset by (, ).

Given a current point of (x, y), cairo_rel_move_to(, , ) is logically equivalent to cairo_move_to (, x + , y + ).

Definition at line 1218 of file cairo.c.

{
    cairo_fixed_t dx_fixed, dy_fixed;

    if (cr->status) 
       return;

    _cairo_gstate_user_to_device_distance (cr->gstate, &dx, &dy);
    dx_fixed = _cairo_fixed_from_double (dx);
    dy_fixed = _cairo_fixed_from_double (dy);

    cr->status = _cairo_path_fixed_rel_move_to (&cr->path, dx_fixed, dy_fixed);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_reset_clip ( cairo_t *  cr)

cairo_reset_clip: : a cairo context

Reset the current clip region to its original, unrestricted state. That is, set the clip region to an infinitely large shape containing the target surface. Equivalently, if infinity is too hard to grasp, one can imagine the clip region being reset to the exact bounds of the target surface.

Note that code meant to be reusable should not call cairo_reset_clip() as it will cause results unexpected by higher-level code which calls cairo_clip(). Consider using cairo_save() and cairo_restore() around cairo_clip() as a more robust means of temporarily restricting the clip region.

Definition at line 1771 of file cairo.c.

{
    if (cr->status)
       return;

    cr->status = _cairo_gstate_reset_clip (cr->gstate);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_restore ( cairo_t *  cr)

cairo_restore: : a #cairo_t

Restores to the state saved by a preceding call to cairo_save() and removes that state from the stack of saved states.

Definition at line 310 of file cairo.c.

{
    cairo_gstate_t *top;

    if (cr->status)
       return;

    top = cr->gstate;
    cr->gstate = top->next;

    _cairo_gstate_destroy (top);

    if (cr->gstate == NULL)
       _cairo_set_error (cr, CAIRO_STATUS_INVALID_RESTORE);
}

Here is the call graph for this function:

void cairo_rotate ( cairo_t *  cr,
double  angle 
)

cairo_rotate: : a cairo context : angle (in radians) by which the user-space axes will be rotated

Modifies the current transformation matrix (CTM) by rotating the user-space axes by radians. The rotation of the axes takes places after any existing transformation of user space. The rotation direction for positive angles is from the positive X axis toward the positive Y axis.

Definition at line 799 of file cairo.c.

{
    if (cr->status)
       return;

    cr->status = _cairo_gstate_rotate (cr->gstate, angle);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_save ( cairo_t *  cr)

cairo_save: : a #cairo_t

Makes a copy of the current state of and saves it on an internal stack of saved states for . When cairo_restore() is called, will be restored to the saved state. Multiple calls to cairo_save() and cairo_restore() can be nested; each call to cairo_restore() restores the state from the matching paired cairo_save().

It isn't necessary to clear all saved states before a #cairo_t is freed. If the reference count of a #cairo_t drops to zero in response to a call to cairo_destroy(), any saved states will be freed along with the #cairo_t.

Definition at line 282 of file cairo.c.

{
    cairo_gstate_t *top;

    if (cr->status)
       return;

    top = _cairo_gstate_clone (cr->gstate);

    if (top == NULL) {
       _cairo_set_error (cr, CAIRO_STATUS_NO_MEMORY);
       return;
    }

    top->next = cr->gstate;
    cr->gstate = top;
}

Here is the call graph for this function:

void cairo_scale ( cairo_t *  cr,
double  sx,
double  sy 
)

cairo_scale: : a cairo context : scale factor for the X dimension : scale factor for the Y dimension

Modifies the current transformation matrix (CTM) by scaling the X and Y user-space axes by and respectively. The scaling of the axes takes place after any existing transformation of user space.

Definition at line 775 of file cairo.c.

{
    if (cr->status)
       return;

    cr->status = _cairo_gstate_scale (cr->gstate, sx, sy);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

cairo_scaled_font_t* cairo_scaled_font_create ( cairo_font_face_t *  font_face,
const cairo_matrix_t font_matrix,
const cairo_matrix_t ctm,
const cairo_font_options_t *  options 
)

cairo_scaled_font_create: : a #cairo_font_face_t : font space to user space transformation matrix for the font.

In the simplest case of a N point font, this matrix is just a scale by N, but it can also be used to shear the font or stretch it unequally along the two axes. See cairo_set_font_matrix(). : user to device transformation matrix with which the font will be used. : options to use when getting metrics for the font and rendering with it.

Creates a #cairo_scaled_font_t object from a font face and matrices that describe the size of the font and the environment in which it will be used.

Return value: a newly created #cairo_scaled_font_t. Destroy with cairo_scaled_font_destroy()

Definition at line 700 of file cairo-font.c.

{
    cairo_status_t status;
    cairo_scaled_font_map_t *font_map;
    cairo_scaled_font_t key, *scaled_font = NULL;

    font_map = _cairo_scaled_font_map_lock ();
    if (font_map == NULL)
       goto UNWIND;
    
    _cairo_scaled_font_init_key (&key, font_face,
                             font_matrix, ctm, options);

    /* Return existing scaled_font if it exists in the hash table. */
    if (_cairo_hash_table_lookup (font_map->hash_table, &key.hash_entry,
                              (cairo_hash_entry_t**) &scaled_font))
    {
       _cairo_scaled_font_map_unlock ();
       return cairo_scaled_font_reference (scaled_font);
    }

    /* Otherwise create it and insert it into the hash table. */
    status = font_face->backend->scaled_font_create (font_face, font_matrix,
                                               ctm, options, &scaled_font);
    if (status)
       goto UNWIND_FONT_MAP_LOCK;

    status = _cairo_hash_table_insert (font_map->hash_table,
                                   &scaled_font->hash_entry);
    if (status)
       goto UNWIND_SCALED_FONT_CREATE;

    _cairo_scaled_font_map_unlock ();

    return scaled_font;

UNWIND_SCALED_FONT_CREATE:
    /* We can't call _cairo_scaled_font_destroy here since it expects
     * that the font has already been successfully inserted into the
     * hash table. */
    _cairo_scaled_font_fini (scaled_font);
    free (scaled_font);
UNWIND_FONT_MAP_LOCK:
    _cairo_scaled_font_map_unlock ();
UNWIND:
    return NULL;
}

Here is the call graph for this function:

void cairo_scaled_font_destroy ( cairo_scaled_font_t *  scaled_font)

cairo_scaled_font_destroy: : a #cairo_scaled_font_t

Decreases the reference count on by one. If the result is zero, then and all associated resources are freed. See cairo_scaled_font_reference().

Definition at line 818 of file cairo-font.c.

{
    cairo_scaled_font_map_t *font_map;

    if (scaled_font == NULL)
       return;

    if (scaled_font->ref_count == (unsigned int)-1)
       return;

    /* cairo_scaled_font_t objects are cached and shared between
     * threads. This works because these objects are immutable. Except
     * that the reference count is mutable, so we have to do locking
     * around any modification of the reference count. */
    font_map = _cairo_scaled_font_map_lock ();
    {
       assert (font_map != NULL);

       assert (scaled_font->ref_count > 0);

       if (--(scaled_font->ref_count) == 0)
       {
           /* Rather than immediately destroying this object, we put it into
            * the font_map->holdovers array in case it will get used again
            * soon. To make room for it, we do actually destroy the
            * least-recently-used holdover.
            */
           if (font_map->num_holdovers == CAIRO_SCALED_FONT_MAX_HOLDOVERS) {
              cairo_scaled_font_t *lru;

              lru = font_map->holdovers[0];
              assert (lru->ref_count == 0);
       
              _cairo_hash_table_remove (font_map->hash_table, &lru->hash_entry);

              _cairo_scaled_font_fini (lru);
              free (lru);
       
              font_map->num_holdovers--;
              memmove (&font_map->holdovers[0],
                      &font_map->holdovers[1],
                      font_map->num_holdovers * sizeof (cairo_scaled_font_t*));
           }

           font_map->holdovers[font_map->num_holdovers] = scaled_font;
           font_map->num_holdovers++;
       }
    }
    _cairo_scaled_font_map_unlock ();
}

Here is the call graph for this function:

void cairo_scaled_font_extents ( cairo_scaled_font_t *  scaled_font,
cairo_font_extents_t extents 
)

cairo_scaled_font_extents: : a #cairo_scaled_font_t : a cairo_font_extents_t which to store the retrieved extents.

Gets the metrics for a #cairo_scaled_font_t.

Definition at line 1025 of file cairo-font.c.

{
    cairo_int_status_t status;
    double  font_scale_x, font_scale_y;
    
    if (scaled_font->status)
       return;

    status = _cairo_scaled_font_font_extents (scaled_font, extents);
    if (status) {
       _cairo_scaled_font_set_error (scaled_font, status);
       return;
    }
    
    _cairo_matrix_compute_scale_factors (&scaled_font->font_matrix,
                                    &font_scale_x, &font_scale_y,
                                    /* XXX */ 1);
    
    /* 
     * The font responded in unscaled units, scale by the font
     * matrix scale factors to get to user space
     */
    
    extents->ascent *= font_scale_y;
    extents->descent *= font_scale_y;
    extents->height *= font_scale_y;
    extents->max_x_advance *= font_scale_x;
    extents->max_y_advance *= font_scale_y;
}

Here is the call graph for this function:

void cairo_scaled_font_glyph_extents ( cairo_scaled_font_t *  scaled_font,
cairo_glyph_t glyphs,
int  num_glyphs,
cairo_text_extents_t extents 
)

cairo_font_glyph_extents: : a #cairo_scaled_font_t : an array of glyph IDs with X and Y offsets.

: the number of glyphs in the array : a cairo_text_extents_t which to store the retrieved extents.

cairo_font_glyph_extents() gets the overall metrics for a string of glyphs. The X and Y offsets in are taken from an origin of 0,0.

Definition at line 1067 of file cairo-font.c.

{
    cairo_status_t status = CAIRO_STATUS_SUCCESS;
    cairo_glyph_t origin_glyph;
    cairo_text_extents_t origin_extents;
    int i;
    double min_x = 0.0, min_y = 0.0, max_x = 0.0, max_y = 0.0;
    double x_pos = 0.0, y_pos = 0.0;
    int set = 0;

    if (scaled_font->status)
       return;

    if (!num_glyphs)
    {
       extents->x_bearing = 0.0;
       extents->y_bearing = 0.0;
       extents->width = 0.0;
       extents->height = 0.0;
       extents->x_advance = 0.0;
       extents->y_advance = 0.0;
       
       return;
    }

    for (i = 0; i < num_glyphs; i++)
    {
       double        x, y;
       double        wm, hm;
       
       origin_glyph = glyphs[i];
       origin_glyph.x = 0.0;
       origin_glyph.y = 0.0;
       status = _cairo_scaled_font_glyph_extents (scaled_font,
                                             &origin_glyph, 1,
                                             &origin_extents);
       
       /*
        * Transform font space metrics into user space metrics
        * by running the corners through the font matrix and
        * expanding the bounding box as necessary
        */
       x = origin_extents.x_bearing;
       y = origin_extents.y_bearing;
       cairo_matrix_transform_point (&scaled_font->font_matrix,
                                  &x, &y);

       for (hm = 0.0; hm <= 1.0; hm += 1.0)
           for (wm = 0.0; wm <= 1.0; wm += 1.0)
           {
              x = origin_extents.x_bearing + origin_extents.width * wm;
              y = origin_extents.y_bearing + origin_extents.height * hm;
              cairo_matrix_transform_point (&scaled_font->font_matrix,
                                         &x, &y);
              x += glyphs[i].x;
              y += glyphs[i].y;
              if (!set)
              {
                  min_x = max_x = x;
                  min_y = max_y = y;
                  set = 1;
              }
              else
              {
                  if (x < min_x) min_x = x;
                  if (x > max_x) max_x = x;
                  if (y < min_y) min_y = y;
                  if (y > max_y) max_y = y;
              }
           }

       x = origin_extents.x_advance;
       y = origin_extents.y_advance;
       cairo_matrix_transform_point (&scaled_font->font_matrix,
                                  &x, &y);
       x_pos = glyphs[i].x + x;
       y_pos = glyphs[i].y + y;
    }

    extents->x_bearing = min_x - glyphs[0].x;
    extents->y_bearing = min_y - glyphs[0].y;
    extents->width = max_x - min_x;
    extents->height = max_y - min_y;
    extents->x_advance = x_pos - glyphs[0].x;
    extents->y_advance = y_pos - glyphs[0].y;
}

Here is the call graph for this function:

cairo_scaled_font_t* cairo_scaled_font_reference ( cairo_scaled_font_t *  scaled_font)

cairo_scaled_font_reference: : a #cairo_scaled_font_t, (may be NULL in which case this function does nothing)

Increases the reference count on by one. This prevents from being destroyed until a matching call to cairo_scaled_font_destroy() is made.

Returns: the referenced #cairo_scaled_font_t

Definition at line 763 of file cairo-font.c.

{
    cairo_scaled_font_map_t *font_map;

    if (scaled_font == NULL)
       return NULL;

    if (scaled_font->ref_count == (unsigned int)-1)
       return scaled_font;

    /* We would normally assert (scaled_font->ref_count > 0) here, but
     * we are using ref_count == 0 as a legitimate case for the
     * holdovers array. See below. */

    /* cairo_scaled_font_t objects are cached and shared between
     * threads. This works because these objects are immutable. Except
     * that the reference count is mutable, so we have to do locking
     * around any modification of the reference count. */
    font_map = _cairo_scaled_font_map_lock ();
    {
       /* If the original reference count is 0, then this font must have
        * been found in font_map->holdovers, (which means this caching is
        * actually working). So now we remove it from the holdovers
        * array. */
       if (scaled_font->ref_count == 0) {
           int i;

           for (i = 0; i < font_map->num_holdovers; i++)
              if (font_map->holdovers[i] == scaled_font)
                  break;
           assert (i < font_map->num_holdovers);

           font_map->num_holdovers--;
           memmove (&font_map->holdovers[i],
                   &font_map->holdovers[i+1],
                   (font_map->num_holdovers - i) * sizeof (cairo_scaled_font_t*));
       }

       scaled_font->ref_count++;

    }
    _cairo_scaled_font_map_unlock ();

    return scaled_font;
}

Here is the call graph for this function:

cairo_status_t cairo_scaled_font_status ( cairo_scaled_font_t *  scaled_font)

cairo_scaled_font_status: : a #cairo_scaled_font_t

Checks whether an error has previously occurred for this scaled_font.

Return value: CAIRO_STATUS_SUCCESS or another error such as CAIRO_STATUS_NO_MEMORY.

Definition at line 473 of file cairo-font.c.

{
    return scaled_font->status;
}
void cairo_select_font_face ( cairo_t *  cr,
const char *  family,
cairo_font_slant_t  slant,
cairo_font_weight_t  weight 
)

cairo_select_font_face: : a #cairo_t : a font family name, encoded in UTF-8 : the slant for the font : the weight for the font

Selects a family and style of font from a simplified description as a family name, slant and weight. This function is meant to be used only for applications with simple font needs: Cairo doesn't provide for operations such as listing all available fonts on the system, and it is expected that most applications will need to use a more comprehensive font handling and text layout library in addition to cairo.

Definition at line 1797 of file cairo.c.

{
    if (cr->status)
       return;

    cr->status = _cairo_gstate_select_font_face (cr->gstate, family, slant, weight);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_set_antialias ( cairo_t *  cr,
cairo_antialias_t  antialias 
)

cairo_set_antialias: : a #cairo_t : the new antialiasing mode

Set the antialiasing mode of the rasterizer used for drawing shapes. This value is a hint, and a particular backend may or may not support a particular value. At the current time, no backend supports CAIRO_ANTIALIAS_SUBPIXEL when drawing shapes.

Note that this option does not affect text rendering, instead see cairo_font_options_set_antialias().

Definition at line 581 of file cairo.c.

{
    if (cr->status) 
       return;

    cr->status = _cairo_gstate_set_antialias (cr->gstate, antialias);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_set_dash ( cairo_t *  cr,
double *  dashes,
int  num_dashes,
double  offset 
)

cairo_set_dash: : a cairo context : an array specifying alternate lengths of on and off po : the length of the dashes array : an offset into the dash pattern at which the stroke should start

Sets the dash pattern to be used by cairo_stroke(). A dash pattern is specified by , an array of positive values. Each value provides the user-space length of altenate "on" and "off" portions of the stroke. The specifies an offset into the pattern at which the stroke begins.

If is 0 dashing is disabled.

If is 1 a symmetric pattern is assumed with alternating on and off portions of the size specified by the single value in .

If any value in is negative, or if all values are 0, then will be put into an error state with a status of

CAIRO_STATUS_INVALID_DASH.

Definition at line 714 of file cairo.c.

{
    if (cr->status)
       return;

    cr->status = _cairo_gstate_set_dash (cr->gstate,
                                    dashes, num_dashes, offset);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_set_fill_rule ( cairo_t *  cr,
cairo_fill_rule_t  fill_rule 
)

cairo_set_fill_rule: : a #cairo_t : a fill rule, specified as a cairo_fill_rule_t

Set the current fill rule within the cairo context. The fill rule is used to determine which regions are inside or outside a complex (potentially self-intersecting) path. The current fill rule affects both cairo_fill and cairo_clip. See cairo_fill_rule_t for details on the semantics of each available fill rule.

Definition at line 603 of file cairo.c.

{
    if (cr->status)
       return;

    cr->status = _cairo_gstate_set_fill_rule (cr->gstate, fill_rule);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_set_font_face ( cairo_t *  cr,
cairo_font_face_t *  font_face 
)

cairo_set_font_face: : a #cairo_t : a #cairo_font_face_t, or NULL to restore to the default font

Replaces the current #cairo_font_face_t object in the #cairo_t with . The replaced font face in the #cairo_t will be destroyed if there are no other references to it.

Definition at line 1868 of file cairo.c.

{
    if (cr->status)
       return;

    cr->status = _cairo_gstate_set_font_face (cr->gstate, font_face);  
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_set_font_matrix ( cairo_t *  cr,
const cairo_matrix_t matrix 
)

cairo_set_font_matrix : a #cairo_t : a cairo_matrix_t describing a transform to be applied to the current font.

Sets the current font matrix to . The font matrix gives a transformation from the design space of the font (in this space, the em-square is 1 unit by 1 unit) to user space. Normally, a simple scale is used (see cairo_set_font_size()), but a more complex font matrix can be used to shear the font or stretch it unequally along the two axes

Definition at line 1915 of file cairo.c.

{
    if (cr->status)
       return;

    cr->status = _cairo_gstate_set_font_matrix (cr->gstate, matrix);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_set_font_options ( cairo_t *  cr,
const cairo_font_options_t *  options 
)

cairo_set_font_options: : a #cairo_t : font options to use

Sets a set of custom font rendering options for the #cairo_t. Rendering options are derived by merging these options with the options derived from underlying surface; if the value in has a default value (like CAIRO_ANTIALIAS_DEFAULT), then the value from the surface is used.

Definition at line 1952 of file cairo.c.

{
    if (cr->status)
       return;

    cr->status = _cairo_gstate_set_font_options (cr->gstate, options);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_set_font_size ( cairo_t *  cr,
double  size 
)

cairo_set_font_size: : a #cairo_t : the new font size, in user space units

Sets the current font matrix to a scale by a factor of , replacing any font matrix previously set with cairo_set_font_size() or cairo_set_font_matrix(). This results in a font size of user space units. (More precisely, this matrix will result in the font's em-square being a by square in user space.)

Definition at line 1891 of file cairo.c.

{
    if (cr->status)
       return;

    cr->status = _cairo_gstate_set_font_size (cr->gstate, size);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_set_line_cap ( cairo_t *  cr,
cairo_line_cap_t  line_cap 
)

cairo_set_line_cap: : a cairo context, as a #cairo_t : a line cap style, as a cairo_line_cap_t

Sets the current line cap style within the cairo context. See

cairo_line_cap_t for details about how the available line cap

styles are drawn.

As with the other stroke parameters, the current line cap style is examined by cairo_stroke(), cairo_stroke_extents(), and cairo_stroke_to_path(), but does not have any effect during path construction.

Definition at line 655 of file cairo.c.

{
    if (cr->status)
       return;

    cr->status = _cairo_gstate_set_line_cap (cr->gstate, line_cap);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_set_line_join ( cairo_t *  cr,
cairo_line_join_t  line_join 
)

cairo_set_line_join: : a cairo context, as a #cairo_t : a line joint style, as a cairo_line_join_t

Sets the current line join style within the cairo context. See

cairo_line_join_t for details about how the available line join

styles are drawn.

As with the other stroke parameters, the current line join style is examined by cairo_stroke(), cairo_stroke_extents(), and cairo_stroke_to_path(), but does not have any effect during path construction.

Definition at line 680 of file cairo.c.

{
    if (cr->status)
       return;

    cr->status = _cairo_gstate_set_line_join (cr->gstate, line_join);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_set_line_width ( cairo_t *  cr,
double  width 
)

cairo_set_line_width: : a #cairo_t : a line width, as a user-space value

Sets the current line width within the cairo context. The line width specifies the diameter of a pen that is circular in user-space.

As with the other stroke parameters, the current line cap style is examined by cairo_stroke(), cairo_stroke_extents(), and cairo_stroke_to_path(), but does not have any effect during path construction.

Definition at line 628 of file cairo.c.

{
    if (cr->status)
       return;

    _cairo_restrict_value (&width, 0.0, width);

    cr->status = _cairo_gstate_set_line_width (cr->gstate, width);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_set_matrix ( cairo_t *  cr,
const cairo_matrix_t matrix 
)

cairo_set_matrix: : a cairo context : a transformation matrix from user space to device space

Modifies the current transformation matrix (CTM) by setting it equal to .

Definition at line 839 of file cairo.c.

{
    if (cr->status)
       return;

    cr->status = _cairo_gstate_set_matrix (cr->gstate, matrix);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_set_miter_limit ( cairo_t *  cr,
double  limit 
)

Definition at line 729 of file cairo.c.

{
    if (cr->status)
       return;

    cr->status = _cairo_gstate_set_miter_limit (cr->gstate, limit);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_set_operator ( cairo_t *  cr,
cairo_operator_t  op 
)

cairo_set_operator: : a #cairo_t : a compositing operator, specified as a cairo_operator_t

Sets the compositing operator to be used for all drawing operations. See cairo_operator_t for details on the semantics of each available compositing operator.

XXX: I'd also like to direct the reader's attention to some (not-yet-written) section on cairo's imaging model. How would I do that if such a section existed? (cworth).

Definition at line 369 of file cairo.c.

{
    if (cr->status)
       return;

    cr->status = _cairo_gstate_set_operator (cr->gstate, op);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_set_source ( cairo_t *  cr,
cairo_pattern_t *  source 
)

cairo_set_source : a cairo context : a #cairo_pattern_t to be used as the source for subsequent drawing operations.

Sets the source pattern within to . This pattern will then be used for any subsequent drawing operation until a new source pattern is set.

Note: The pattern's transformation matrix will be locked to the user space in effect at the time of cairo_set_source(). This means that further modifications of the current transformation matrix will not affect the source pattern. See cairo_pattern_set_matrix().

XXX: I'd also like to direct the reader's attention to some (not-yet-written) section on cairo's imaging model. How would I do that if such a section existed? (cworth).

Definition at line 502 of file cairo.c.

{
    if (cr->status)
       return;

    if (source == NULL) {
       _cairo_set_error (cr, CAIRO_STATUS_NULL_POINTER);
       return;
    }

    if (source->status) {
       _cairo_set_error (cr, source->status);
       return;
    }

    cr->status = _cairo_gstate_set_source (cr->gstate, source);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_set_source_rgb ( cairo_t *  cr,
double  red,
double  green,
double  blue 
)

cairo_set_source_rgb : a cairo context : red component of color : green component of color : blue component of color

Sets the source pattern within to an opaque color. This opaque color will then be used for any subsequent drawing operation until a new source pattern is set.

The color components are floating point numbers in the range 0 to

  1. If the values passed in are outside that range, they will be clamped.

Definition at line 395 of file cairo.c.

{
    cairo_pattern_t *pattern;

    if (cr->status)
       return;

    pattern = cairo_pattern_create_rgb (red, green, blue);
    cairo_set_source (cr, pattern);
    cairo_pattern_destroy (pattern);
}
void cairo_set_source_rgba ( cairo_t *  cr,
double  red,
double  green,
double  blue,
double  alpha 
)

cairo_set_source_rgba: : a cairo context : red component of color : green component of color : blue component of color : alpha component of color

Sets the source pattern within to a translucent color. This color will then be used for any subsequent drawing operation until a new source pattern is set.

The color and alpha components are floating point numbers in the range 0 to 1. If the values passed in are outside that range, they will be clamped.

Definition at line 424 of file cairo.c.

{
    cairo_pattern_t *pattern;

    if (cr->status)
       return;

    pattern = cairo_pattern_create_rgba (red, green, blue, alpha);
    cairo_set_source (cr, pattern);
    cairo_pattern_destroy (pattern);
}
void cairo_set_source_surface ( cairo_t *  cr,
cairo_surface_t *  surface,
double  x,
double  y 
)

cairo_set_source_surface: : a cairo context : a surface to be used to set the source pattern : User-space X coordinate for surface origin : User-space Y coordinate for surface origin

This is a convenience function for creating a pattern from and setting it as the source in with cairo_set_source().

The and parameters give the user-space coordinate at which the surface origin should appear. (The surface origin is its upper-left corner before any transformation has been applied.) The and patterns are negated and then set as translation values in the pattern matrix.

Other than the initial translation pattern matrix, as described above, all other pattern attributes, (such as its extend mode), are set to the default values as in cairo_pattern_create_for_surface(). The resulting pattern can be queried with cairo_get_source() so that these attributes can be modified if desired, (eg. to create a repeating pattern with cairo_pattern_set_extend()).

Definition at line 462 of file cairo.c.

{
    cairo_pattern_t *pattern;
    cairo_matrix_t matrix;

    if (cr->status)
       return;

    pattern = cairo_pattern_create_for_surface (surface);

    cairo_matrix_init_translate (&matrix, -x, -y);
    cairo_pattern_set_matrix (pattern, &matrix);

    cairo_set_source (cr, pattern);
    cairo_pattern_destroy (pattern);
}
void cairo_set_tolerance ( cairo_t *  cr,
double  tolerance 
)

cairo_set_tolerance: : a #cairo_t : the tolerance, in device units (typically pixels)

Sets the tolerance used when converting paths into trapezoids. Curved segments of the path will be subdivided until the maximum deviation between the original path and the polygonal approximation is less than . The default value is 0.1. A larger value will give better performance, a smaller value, better appearance. (Reducing the value from the default value of 0.1 is unlikely to improve appearance significantly.)

Definition at line 555 of file cairo.c.

{
    if (cr->status)
       return;

    _cairo_restrict_value (&tolerance, CAIRO_TOLERANCE_MINIMUM, tolerance);

    cr->status = _cairo_gstate_set_tolerance (cr->gstate, tolerance);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_show_glyphs ( cairo_t *  cr,
cairo_glyph_t glyphs,
int  num_glyphs 
)

Definition at line 2153 of file cairo.c.

{
    if (cr->status)
       return;

    cr->status = _cairo_gstate_show_glyphs (cr->gstate, glyphs, num_glyphs);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_show_page ( cairo_t *  cr)

Definition at line 1616 of file cairo.c.

{
    if (cr->status)
       return;

    cr->status = _cairo_gstate_show_page (cr->gstate);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_show_text ( cairo_t *  cr,
const char *  utf8 
)

cairo_show_text: : a cairo context : a string of text encoded in UTF-8

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.

This function first computes a set of glyphs for the string of text. The first glyph is placed so that its origin is at the current point. The origin of each subsequent glyph is offset from that of the previous glyph by the advance values of the previous glyph.

After this call the current point is moved to the origin of where the next glyph would be placed in this same progression. That is, the current point will be at the origin of the final glyph offset by its advance values. This allows for easy display of a single logical string with multiple calls to cairo_show_text().

NOTE: The cairo_show_text() function call is part of what the cairo designers call the "toy" text API. It is convenient for short demos and simple programs, but it is not expected to be adequate for the most serious of text-using applications. See cairo_show_glyphs() for the "real" text display API in cairo.

Definition at line 2105 of file cairo.c.

{
    cairo_text_extents_t extents;
    cairo_glyph_t *glyphs = NULL, *last_glyph;
    int num_glyphs;
    double x, y;

    if (cr->status)
       return;

    if (utf8 == NULL)
       return;

    cairo_get_current_point (cr, &x, &y);

    cr->status = _cairo_gstate_text_to_glyphs (cr->gstate, utf8,
                                          x, y,
                                          &glyphs, &num_glyphs);
    if (cr->status)
       goto BAIL;

    if (num_glyphs == 0)
       return;

    cr->status = _cairo_gstate_show_glyphs (cr->gstate, glyphs, num_glyphs);
    if (cr->status)
       goto BAIL;

    last_glyph = &glyphs[num_glyphs - 1];
    cr->status = _cairo_gstate_glyph_extents (cr->gstate,
                                         last_glyph, 1,
                                         &extents);
    if (cr->status)
       goto BAIL;

    x = last_glyph->x + extents.x_advance;
    y = last_glyph->y + extents.y_advance;
    cairo_move_to (cr, x, y);

 BAIL:
    if (glyphs)
       free (glyphs);

    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

cairo_status_t cairo_status ( cairo_t *  cr)

cairo_status: : a cairo context

Checks whether an error has previously occurred for this context.

Returns the current status of this context, see cairo_status_t

Definition at line 2536 of file cairo.c.

{
    return cr->status;
}

cairo_status_to_string: : a cairo status

Provides a human-readable description of a cairo_status_t.

Returns a string representation of the status

Definition at line 2550 of file cairo.c.

{
    switch (status) {
    case CAIRO_STATUS_SUCCESS:
       return "success";
    case CAIRO_STATUS_NO_MEMORY:
       return "out of memory";
    case CAIRO_STATUS_INVALID_RESTORE:
       return "cairo_restore without matching cairo_save";
    case CAIRO_STATUS_INVALID_POP_GROUP:
       return "cairo_pop_group without matching cairo_push_group";
    case CAIRO_STATUS_NO_CURRENT_POINT:
       return "no current point defined";
    case CAIRO_STATUS_INVALID_MATRIX:
       return "invalid matrix (not invertible)";
    case CAIRO_STATUS_INVALID_STATUS:
       return "invalid value for an input cairo_status_t";
    case CAIRO_STATUS_NULL_POINTER:
       return "NULL pointer";
    case CAIRO_STATUS_INVALID_STRING:
       return "input string not valid UTF-8";
    case CAIRO_STATUS_INVALID_PATH_DATA:
       return "input path data not valid";
    case CAIRO_STATUS_READ_ERROR:
       return "error while reading from input stream";
    case CAIRO_STATUS_WRITE_ERROR:
       return "error while writing to output stream";
    case CAIRO_STATUS_SURFACE_FINISHED:
       return "the target surface has been finished";
    case CAIRO_STATUS_SURFACE_TYPE_MISMATCH:
       return "the surface type is not appropriate for the operation";
    case CAIRO_STATUS_PATTERN_TYPE_MISMATCH:
       return "the pattern type is not appropriate for the operation";
    case CAIRO_STATUS_INVALID_CONTENT:
       return "invalid value for an input cairo_content_t";
    case CAIRO_STATUS_INVALID_FORMAT:
       return "invalid value for an input cairo_format_t";
    case CAIRO_STATUS_INVALID_VISUAL:
       return "invalid value for an input Visual*";
    case CAIRO_STATUS_FILE_NOT_FOUND:
       return "file not found";
    case CAIRO_STATUS_INVALID_DASH:
       return "invalid value for a dash setting";
    }

    return "<unknown error status>";
}
void cairo_stroke ( cairo_t *  cr)

cairo_stroke: : a cairo context

A drawing operator that strokes the current path according to the current line width, line join, line cap, and dash settings. After cairo_stroke, the current path will be cleared from the cairo context. See cairo_set_line_width(), cairo_set_line_join(), cairo_set_line_cap(), cairo_set_dash(), and cairo_stroke_preserve().

Definition at line 1531 of file cairo.c.

void cairo_stroke_extents ( cairo_t *  cr,
double *  x1,
double *  y1,
double *  x2,
double *  y2 
)

Definition at line 1663 of file cairo.c.

{
    if (cr->status)
       return;
    
    cr->status = _cairo_gstate_stroke_extents (cr->gstate,
                                          &cr->path,
                                          x1, y1, x2, y2);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_stroke_preserve ( cairo_t *  cr)

cairo_stroke_preserve: : a cairo context

A drawing operator that strokes the current path according to the current line width, line join, line cap, and dash settings. Unlike cairo_stroke(), cairo_stroke_preserve preserves the path within the cairo context.

See cairo_set_line_width(), cairo_set_line_join(), cairo_set_line_cap(), cairo_set_dash(), and cairo_stroke_preserve().

Definition at line 1552 of file cairo.c.

{
    if (cr->status)
       return;

    cr->status = _cairo_gstate_stroke (cr->gstate, &cr->path);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

cairo_surface_t* cairo_surface_create_similar ( cairo_surface_t *  other,
cairo_content_t  content,
int  width,
int  height 
)

cairo_surface_create_similar: : an existing surface used to select the backend of the new surface : the content for the new surface : width of the new surface, (in device-space units) : height of the new surface (in device-space units)

Create a new surface that is as compatible as possible with an existing surface. The new surface will use the same backend as unless that is not possible for some reason.

Return value: a pointer to the newly allocated surface. The caller owns the surface and should call cairo_surface_destroy when done with it.

This function always returns a valid pointer, but it will return a pointer to a "nil" surface if is already in an error state or any other error occurs.

Definition at line 196 of file cairo-surface.c.

{
    if (other->status)
       return (cairo_surface_t*) &_cairo_surface_nil;

    if (! CAIRO_CONTENT_VALID (content)) {
       _cairo_error (CAIRO_STATUS_INVALID_CONTENT);
       return (cairo_surface_t*) &_cairo_surface_nil;
    }

    return _cairo_surface_create_similar_solid (other, content,
                                          width, height,
                                          CAIRO_COLOR_TRANSPARENT);
}

Here is the call graph for this function:

void cairo_surface_destroy ( cairo_surface_t *  surface)

cairo_surface_destroy: : a #cairo_t

Decreases the reference count on by one. If the result is zero, then and all associated resources are freed. See cairo_surface_reference().

Definition at line 289 of file cairo-surface.c.

{
    if (surface == NULL)
       return;

    if (surface->ref_count == (unsigned int)-1)
       return;

    assert (surface->ref_count > 0);

    surface->ref_count--;
    if (surface->ref_count)
       return;

    cairo_surface_finish (surface);

    _cairo_user_data_array_fini (&surface->user_data);

    free (surface);
}

Here is the call graph for this function:

void cairo_surface_finish ( cairo_surface_t *  surface)

cairo_surface_finish: : the #cairo_surface_t to finish

This function finishes the surface and drops all references to external resources. For example, for the Xlib backend it means that cairo will no longer access the drawable, which can be freed. After calling cairo_surface_finish() the only valid operations on a surface are getting and setting user data and referencing and destroying it. Further drawing to the surface will not affect the surface but will instead trigger a CAIRO_STATUS_SURFACE_FINISHED error.

When the last call to cairo_surface_destroy() decreases the reference count to zero, cairo will call cairo_surface_finish() if it hasn't been called already, before freeing the resources associated with the surface.

Definition at line 330 of file cairo-surface.c.

{
    cairo_status_t status;

    if (surface->finished) {
       _cairo_surface_set_error (surface, CAIRO_STATUS_SURFACE_FINISHED);
       return;
    }

    if (surface->backend->finish == NULL) {
       surface->finished = TRUE;
       return;
    }

    if (!surface->status && surface->backend->flush) {
       status = surface->backend->flush (surface);
       if (status) {
           _cairo_surface_set_error (surface, status);
           return;
       }
    }

    status = surface->backend->finish (surface);
    if (status) {
       _cairo_surface_set_error (surface, status);
       return;
    }

    surface->finished = TRUE;
}

Here is the call graph for this function:

void cairo_surface_flush ( cairo_surface_t *  surface)

cairo_surface_flush: : a #cairo_surface_t

Do any pending drawing for the surface and also restore any temporary modification's cairo has made to the surface's state. This function must be called before switching from drawing on the surface with cairo to drawing on it directly with native APIs. If the surface doesn't support direct access, then this function does nothing.

Definition at line 445 of file cairo-surface.c.

{
    if (surface->status)
       return;

    if (surface->finished) {
       _cairo_surface_set_error (surface, CAIRO_STATUS_SURFACE_FINISHED);
       return;
    }

    if (surface->backend->flush) {
       cairo_status_t status;

       status = surface->backend->flush (surface);
       
       if (status)
           _cairo_surface_set_error (surface, status);
    }
}

Here is the call graph for this function:

void cairo_surface_get_font_options ( cairo_surface_t *  surface,
cairo_font_options_t *  options 
)

cairo_surface_get_font_options: : a #cairo_surface_t : a #cairo_font_options_t object into which to store the retrieved options.

All existing values are overwritten

Retrieves the default font rendering options for the surface. This allows display surfaces to report the correct subpixel order for rendering on them, print surfaces to disable hinting of metrics and so forth. The result can then be used with cairo_scaled_font_create().

Definition at line 423 of file cairo-surface.c.

{
    if (!surface->finished && surface->backend->get_font_options) {
       surface->backend->get_font_options (surface, options);
    } else {
       _cairo_font_options_init_default (options);
    }
}

Here is the call graph for this function:

void* cairo_surface_get_user_data ( cairo_surface_t *  surface,
const cairo_user_data_key_t key 
)

cairo_surface_get_user_data: : a #cairo_surface_t : the address of the cairo_user_data_key_t the user data was attached to

Return user data previously attached to using the specified key. If no user data has been attached with the given key this function returns NULL.

Return value: the user data previously attached or NULL.

Definition at line 374 of file cairo-surface.c.

{
    return _cairo_user_data_array_get_data (&surface->user_data,
                                       key);
}

Here is the call graph for this function:

void cairo_surface_mark_dirty ( cairo_surface_t *  surface)

cairo_surface_mark_dirty: : a #cairo_surface_t

Tells cairo that drawing has been done to surface using means other than cairo, and that cairo should reread any cached areas. Note that you must call cairo_surface_flush() before doing such drawing.

Definition at line 474 of file cairo-surface.c.

{
    cairo_surface_mark_dirty_rectangle (surface, 0, 0, -1, -1);
}
void cairo_surface_mark_dirty_rectangle ( cairo_surface_t *  surface,
int  x,
int  y,
int  width,
int  height 
)

cairo_surface_mark_dirty_rectangle: : a #cairo_surface_t : X coordinate of dirty rectangle : Y coordinate of dirty rectangle : width of dirty rectangle : height of dirty rectangle

Like cairo_surface_mark_dirty(), but drawing has been done only to the specified rectangle, so that cairo can retain cached contents for other parts of the surface.

Definition at line 492 of file cairo-surface.c.

{
    if (surface->status)
       return;

    if (surface->finished) {
       _cairo_surface_set_error (surface, CAIRO_STATUS_SURFACE_FINISHED);
       return;
    }

    if (surface->backend->mark_dirty_rectangle) {
       cairo_status_t status;
       
       status = surface->backend->mark_dirty_rectangle (surface, x, y, width, height);
       
       if (status)
           _cairo_surface_set_error (surface, status);
    }
}

Here is the call graph for this function:

cairo_surface_t* cairo_surface_reference ( cairo_surface_t *  surface)

cairo_surface_reference: : a #cairo_surface_t

Increases the reference count on by one. This prevents from being destroyed until a matching call to cairo_surface_destroy() is made.

Return value: the referenced #cairo_surface_t.

Definition at line 265 of file cairo-surface.c.

{
    if (surface == NULL)
       return NULL;

    if (surface->ref_count == (unsigned int)-1)
       return surface;

    assert (surface->ref_count > 0);

    surface->ref_count++;

    return surface;
}
void cairo_surface_set_device_offset ( cairo_surface_t *  surface,
double  x_offset,
double  y_offset 
)

cairo_surface_set_device_offset: : a #cairo_surface_t : the offset in the X direction, in device units : the offset in the Y direction, in device units

Sets an offset that is added to the device coordinates determined by the CTM when drawing to . One use case for this function is when we want to create a #cairo_surface_t that redirects drawing for a portion of an onscreen surface to an offscreen surface in a way that is completely invisible to the user of the cairo API. Setting a transformation via cairo_translate() isn't sufficient to do this, since functions like cairo_device_to_user() will expose the hidden offset.

Note that the offset only affects drawing to the surface, not using the surface in a surface pattern.

Definition at line 535 of file cairo-surface.c.

{
    if (surface->status)
       return;

    if (surface->finished) {
       _cairo_surface_set_error (surface, CAIRO_STATUS_SURFACE_FINISHED);
       return;
    }

    surface->device_x_offset = x_offset * surface->device_x_scale;
    surface->device_y_offset = y_offset * surface->device_y_scale;
}

Here is the call graph for this function:

cairo_status_t cairo_surface_set_user_data ( cairo_surface_t *  surface,
const cairo_user_data_key_t key,
void user_data,
cairo_destroy_func_t  destroy 
)

cairo_surface_set_user_data: : a #cairo_surface_t : the address of a cairo_user_data_key_t to attach the user data to : the user data to attach to the surface : a cairo_destroy_func_t which will be called when the surface is destroyed or when new user data is attached using the same key.

Attach user data to . To remove user data from a surface, call this function with the key that was used to set it and NULL for .

Return value: CAIRO_STATUS_SUCCESS or CAIRO_STATUS_NO_MEMORY if a slot could not be allocated for the user data.

Definition at line 398 of file cairo-surface.c.

{
    if (surface->ref_count == -1)
       return CAIRO_STATUS_NO_MEMORY;
    
    return _cairo_user_data_array_set_data (&surface->user_data,
                                       key, user_data, destroy);
}

Here is the call graph for this function:

cairo_status_t cairo_surface_status ( cairo_surface_t *  surface)

cairo_surface_status: : a #cairo_surface_t

Checks whether an error has previously occurred for this surface.

Return value: CAIRO_STATUS_SUCCESS, CAIRO_STATUS_NULL_POINTER, CAIRO_STATUS_NO_MEMORY, CAIRO_STATUS_READ_ERROR, CAIRO_STATUS_INVALID_CONTENT, CAIRO_STATUS_INVALUE_FORMAT, or CAIRO_STATUS_INVALID_VISUAL.

Definition at line 133 of file cairo-surface.c.

{
    return surface->status;
}
void cairo_text_extents ( cairo_t *  cr,
const char *  utf8,
cairo_text_extents_t extents 
)

cairo_text_extents: : a #cairo_t : a string of text, encoded in UTF-8 : a cairo_text_extents_t object into which the results will be stored

Gets the extents for a string of text. The extents describe a user-space rectangle that encloses the "inked" portion of the text, (as it would be drawn by cairo_show_text()). Additionally, the x_advance and y_advance values indicate the amount by which the current point would be advanced by cairo_show_text().

Note that whitespace characters do not directly contribute to the size of the rectangle (extents.width and extents.height). They do contribute indirectly by changing the position of non-whitespace characters. In particular, trailing whitespace characters are likely to not affect the size of the rectangle, though they will affect the x_advance and y_advance values.

Definition at line 2002 of file cairo.c.

{
    cairo_glyph_t *glyphs = NULL;
    int num_glyphs;
    double x, y;

    if (cr->status)
       return;

    if (utf8 == NULL) {
       extents->x_bearing = 0.0;
       extents->y_bearing = 0.0;
       extents->width = 0.0;
       extents->height = 0.0;
       extents->x_advance = 0.0;
       extents->y_advance = 0.0;
       return;
    }

    cairo_get_current_point (cr, &x, &y);

    cr->status = _cairo_gstate_text_to_glyphs (cr->gstate, utf8,
                                          x, y,
                                          &glyphs, &num_glyphs);

    if (cr->status) {
       if (glyphs)
           free (glyphs);
       _cairo_set_error (cr, cr->status);
       return;
    }
       
    cr->status = _cairo_gstate_glyph_extents (cr->gstate, glyphs, num_glyphs, extents);
    if (glyphs)
       free (glyphs);

    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_text_path ( cairo_t *  cr,
const char *  utf8 
)

Definition at line 2164 of file cairo.c.

{
    cairo_glyph_t *glyphs = NULL;
    int num_glyphs;
    double x, y;

    if (cr->status)
       return;

    cairo_get_current_point (cr, &x, &y);

    cr->status = _cairo_gstate_text_to_glyphs (cr->gstate, utf8,
                                          x, y,
                                          &glyphs, &num_glyphs);

    if (cr->status) {
       if (glyphs)
           free (glyphs);
       _cairo_set_error (cr, cr->status);
       return;
    }

    cr->status = _cairo_gstate_glyph_path (cr->gstate,
                                      glyphs, num_glyphs,
                                      &cr->path);
    if (glyphs)
       free (glyphs);

    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void cairo_transform ( cairo_t *  cr,
const cairo_matrix_t matrix 
)

cairo_transform: : a cairo context : a transformation to be applied to the user-space axes

Modifies the current transformation matrix (CTM) by applying as an additional transformation. The new transformation of user space takes place after any existing transformation.

Definition at line 819 of file cairo.c.

{
    if (cr->status)
       return;

    cr->status = _cairo_gstate_transform (cr->gstate, matrix);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_translate ( cairo_t *  cr,
double  tx,
double  ty 
)

cairo_translate: : a cairo context : amount to translate in the X direction : amount to translate in the Y direction

Modifies the current transformation matrix (CTM) by translating the user-space origin by (, ). This offset is interpreted as a user-space coordinate according to the CTM in place before the new call to cairo_translate. In other words, the translation of the user-space origin takes place after any existing transformation.

Definition at line 753 of file cairo.c.

{
    if (cr->status)
       return;

    cr->status = _cairo_gstate_translate (cr->gstate, tx, ty);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_user_to_device ( cairo_t *  cr,
double *  x,
double *  y 
)

cairo_user_to_device: : a cairo context : X value of coordinate (in/out parameter) : Y value of coordinate (in/out parameter)

Transform a coordinate from user space to device space by multiplying the given point by the current transformation matrix (CTM).

Definition at line 881 of file cairo.c.

{
    if (cr->status)
       return;

    cr->status = _cairo_gstate_user_to_device (cr->gstate, x, y);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_user_to_device_distance ( cairo_t *  cr,
double *  dx,
double *  dy 
)

cairo_user_to_device_distance: : a cairo context : X component of a distance vector (in/out parameter) : Y component of a distance vector (in/out parameter)

Transform a distance vector from user space to device space. This function is similar to cairo_user_to_device() except that the translation components of the CTM will be ignored when transforming (,).

Definition at line 903 of file cairo.c.

{
    if (cr->status)
       return;

    cr->status = _cairo_gstate_user_to_device_distance (cr->gstate, dx, dy);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

cairo_version:

Returns the version of the cairo library encoded in a single integer as per CAIRO_VERSION_ENCODE. The encoding ensures that later versions compare greater than earlier versions.

A run-time comparison to check that cairo's version is greater than or equal to version X.Y.Z could be performed as follows:

<informalexample><programlisting> if (cairo_version() >= CAIRO_VERSION_ENCODE(X,Y,Z)) {...} </programlisting></informalexample>

See also cairo_version_string() as well as the compile-time equivalents CAIRO_VERSION and CAIRO_VERSION_STRING.

Return value: the encoded version.

Definition at line 137 of file cairo.c.

{
    return CAIRO_VERSION;
}

cairo_version_string:

Returns the version of the cairo library as a human-readable string of the form "X.Y.Z".

See also cairo_version() as well as the compile-time equivalents CAIRO_VERSION_STRING and CAIRO_VERSION.

Return value: a string containing the version.

Definition at line 154 of file cairo.c.

{
    return CAIRO_VERSION_STRING;
}