Module cairo.c.cairo

Cairo C API. Contains stuff from cairo.h and cairo-version.h

This module only contains basic documentation. For more information see http://cairographics.org/manual/

Functions

Name Description
cairo_append_path
cairo_arc Path creation functions
cairo_arc_negative Path creation functions
cairo_clip Clipping
cairo_clip_extents Clipping
cairo_clip_preserve Clipping
cairo_close_path Path creation functions
cairo_copy_clip_rectangle_list
cairo_copy_page Painting functions
cairo_copy_path
cairo_copy_path_flat
cairo_create Functions for manipulating state objects
cairo_curve_to Path creation functions
cairo_debug_reset_static_data Functions to be used while debugging (not intended for use in production code)
cairo_destroy Functions for manipulating state objects
cairo_device_acquire
cairo_device_destroy
cairo_device_finish
cairo_device_flush
cairo_device_get_reference_count
cairo_device_get_type
cairo_device_get_user_data
cairo_device_reference Backend device manipulation
cairo_device_release
cairo_device_set_user_data
cairo_device_status
cairo_device_to_user
cairo_device_to_user_distance
cairo_fill Painting functions
cairo_fill_extents Rectangular extents
cairo_fill_preserve Painting functions
cairo_font_extents
cairo_font_face_destroy
cairo_font_face_get_reference_count
cairo_font_face_get_type
cairo_font_face_get_user_data
cairo_font_face_reference
cairo_font_face_set_user_data
cairo_font_face_status
cairo_font_options_copy
cairo_font_options_create
cairo_font_options_destroy
cairo_font_options_equal
cairo_font_options_get_antialias
cairo_font_options_get_hint_metrics
cairo_font_options_get_hint_style
cairo_font_options_get_subpixel_order
cairo_font_options_hash
cairo_font_options_merge
cairo_font_options_set_antialias
cairo_font_options_set_hint_metrics
cairo_font_options_set_hint_style
cairo_font_options_set_subpixel_order
cairo_font_options_status
cairo_format_stride_for_width
cairo_get_antialias Query functions
cairo_get_current_point Query functions
cairo_get_dash Query functions
cairo_get_dash_count Query functions
cairo_get_fill_rule Query functions
cairo_get_font_face
cairo_get_font_matrix
cairo_get_font_options
cairo_get_group_target Query functions
cairo_get_line_cap Query functions
cairo_get_line_join Query functions
cairo_get_line_width Query functions
cairo_get_matrix Query functions
cairo_get_miter_limit Query functions
cairo_get_operator Query functions
cairo_get_reference_count Functions for manipulating state objects
cairo_get_scaled_font
cairo_get_source Query functions
cairo_get_target Query functions
cairo_get_tolerance Query functions
cairo_get_user_data Functions for manipulating state objects
cairo_glyph_allocate
cairo_glyph_extents
cairo_glyph_free
cairo_glyph_path
cairo_has_current_point Query functions
cairo_identity_matrix
cairo_image_surface_create
cairo_image_surface_create_for_data
cairo_image_surface_create_from_png requires -version=CAIRO_HAS_PNG_FUNCTIONS
cairo_image_surface_create_from_png_stream requires -version=CAIRO_HAS_PNG_FUNCTIONS
cairo_image_surface_get_data
cairo_image_surface_get_format
cairo_image_surface_get_height
cairo_image_surface_get_stride
cairo_image_surface_get_width
cairo_in_clip Insideness testing
cairo_in_fill Insideness testing
cairo_in_stroke Insideness testing
cairo_line_to Path creation functions
cairo_mask Painting functions
cairo_mask_surface Painting functions
cairo_matrix_init Matrix functions
cairo_matrix_init_identity Matrix functions
cairo_matrix_init_rotate Matrix functions
cairo_matrix_init_scale Matrix functions
cairo_matrix_init_translate Matrix functions
cairo_matrix_invert Matrix functions
cairo_matrix_multiply Matrix functions
cairo_matrix_rotate Matrix functions
cairo_matrix_scale Matrix functions
cairo_matrix_transform_distance Matrix functions
cairo_matrix_transform_point Matrix functions
cairo_matrix_translate Matrix functions
cairo_move_to Path creation functions
cairo_new_path Path creation functions
cairo_new_sub_path Path creation functions
cairo_paint Painting functions
cairo_paint_with_alpha Painting functions
cairo_path_destroy
cairo_path_extents Path creation functions
cairo_pattern_add_color_stop_rgb
cairo_pattern_add_color_stop_rgba
cairo_pattern_create_for_surface Pattern creation functions
cairo_pattern_create_linear Pattern creation functions
cairo_pattern_create_radial Pattern creation functions
cairo_pattern_create_rgb Pattern creation functions
cairo_pattern_create_rgba Pattern creation functions
cairo_pattern_destroy Pattern creation functions
cairo_pattern_get_color_stop_count
cairo_pattern_get_color_stop_rgba
cairo_pattern_get_extend
cairo_pattern_get_filter
cairo_pattern_get_linear_points
cairo_pattern_get_matrix
cairo_pattern_get_radial_circles
cairo_pattern_get_reference_count Pattern creation functions
cairo_pattern_get_rgba
cairo_pattern_get_surface
cairo_pattern_get_type
cairo_pattern_get_user_data Pattern creation functions
cairo_pattern_reference Pattern creation functions
cairo_pattern_set_extend
cairo_pattern_set_filter
cairo_pattern_set_matrix
cairo_pattern_set_user_data Pattern creation functions
cairo_pattern_status Pattern creation functions
cairo_pop_group Functions for manipulating state objects
cairo_pop_group_to_source Functions for manipulating state objects
cairo_push_group Functions for manipulating state objects
cairo_push_group_with_content Functions for manipulating state objects
cairo_recording_surface_create Recording-surface functions
cairo_recording_surface_ink_extents Recording-surface functions
cairo_rectangle Path creation functions
cairo_rectangle_list_destroy
cairo_reference Functions for manipulating state objects
cairo_region_contains_point
cairo_region_contains_rectangle
cairo_region_copy
cairo_region_create
cairo_region_create_rectangle
cairo_region_create_rectangles
cairo_region_destroy
cairo_region_equal
cairo_region_get_extents
cairo_region_get_rectangle
cairo_region_intersect
cairo_region_intersect_rectangle
cairo_region_is_empty
cairo_region_num_rectangles
cairo_region_reference
cairo_region_status
cairo_region_subtract
cairo_region_subtract_rectangle
cairo_region_translate
cairo_region_union
cairo_region_union_rectangle
cairo_region_xor
cairo_region_xor_rectangle
cairo_rel_curve_to Path creation functions
cairo_rel_line_to Path creation functions
cairo_rel_move_to Path creation functions
cairo_reset_clip Clipping
cairo_restore Functions for manipulating state objects
cairo_rotate
cairo_save Functions for manipulating state objects
cairo_scale
cairo_scaled_font_create Portable interface to general font features.
cairo_scaled_font_destroy Portable interface to general font features.
cairo_scaled_font_extents Portable interface to general font features.
cairo_scaled_font_get_ctm Portable interface to general font features.
cairo_scaled_font_get_font_face Portable interface to general font features.
cairo_scaled_font_get_font_matrix Portable interface to general font features.
cairo_scaled_font_get_font_options Portable interface to general font features.
cairo_scaled_font_get_reference_count Portable interface to general font features.
cairo_scaled_font_get_scale_matrix Portable interface to general font features.
cairo_scaled_font_get_type Portable interface to general font features.
cairo_scaled_font_get_user_data Portable interface to general font features.
cairo_scaled_font_glyph_extents Portable interface to general font features.
cairo_scaled_font_reference Portable interface to general font features.
cairo_scaled_font_set_user_data Portable interface to general font features.
cairo_scaled_font_status Portable interface to general font features.
cairo_scaled_font_text_extents Portable interface to general font features.
cairo_scaled_font_text_to_glyphs Portable interface to general font features.
cairo_select_font_face
cairo_set_antialias
cairo_set_dash
cairo_set_fill_rule
cairo_set_font_face
cairo_set_font_matrix
cairo_set_font_options
cairo_set_font_size
cairo_set_line_cap
cairo_set_line_join
cairo_set_line_width
cairo_set_matrix
cairo_set_miter_limit
cairo_set_operator Modify state
cairo_set_scaled_font
cairo_set_source Modify state
cairo_set_source_rgb Modify state
cairo_set_source_rgba Modify state
cairo_set_source_surface Modify state
cairo_set_tolerance Modify state
cairo_set_user_data Functions for manipulating state objects
cairo_show_glyphs
cairo_show_page Painting functions
cairo_show_text
cairo_show_text_glyphs
cairo_status Error status queries
cairo_status_to_string Error status queries
cairo_stroke Painting functions
cairo_stroke_extents Rectangular extents
cairo_stroke_preserve Painting functions
cairo_surface_copy_page
cairo_surface_create_for_rectangle Surface manipulation
cairo_surface_create_similar Surface manipulation
cairo_surface_destroy Surface manipulation
cairo_surface_finish Surface manipulation
cairo_surface_flush
cairo_surface_get_content
cairo_surface_get_device Surface manipulation
cairo_surface_get_device_offset
cairo_surface_get_fallback_resolution
cairo_surface_get_font_options
cairo_surface_get_mime_data
cairo_surface_get_reference_count Surface manipulation
cairo_surface_get_type
cairo_surface_get_user_data
cairo_surface_has_show_text_glyphs
cairo_surface_mark_dirty
cairo_surface_mark_dirty_rectangle
cairo_surface_reference Surface manipulation
cairo_surface_set_device_offset
cairo_surface_set_fallback_resolution
cairo_surface_set_mime_data
cairo_surface_set_user_data
cairo_surface_show_page
cairo_surface_status Surface manipulation
cairo_surface_write_to_png requires -version=CAIRO_HAS_PNG_FUNCTIONS
cairo_surface_write_to_png_stream requires -version=CAIRO_HAS_PNG_FUNCTIONS
cairo_text_cluster_allocate
cairo_text_cluster_free
cairo_text_extents
cairo_text_path
cairo_toy_font_face_create Toy fonts
cairo_toy_font_face_get_family Toy fonts
cairo_toy_font_face_get_slant Toy fonts
cairo_toy_font_face_get_weight Toy fonts
cairo_transform
cairo_translate
cairo_user_font_face_create User fonts
cairo_user_font_face_get_init_func User-font method getters
cairo_user_font_face_get_render_glyph_func User-font method getters
cairo_user_font_face_get_text_to_glyphs_func User-font method getters
cairo_user_font_face_get_unicode_to_glyph_func User-font method getters
cairo_user_font_face_set_init_func User-font method setters
cairo_user_font_face_set_render_glyph_func User-font method setters
cairo_user_font_face_set_text_to_glyphs_func User-font method setters
cairo_user_font_face_set_unicode_to_glyph_func User-font method setters
cairo_user_to_device
cairo_user_to_device_distance
cairo_version Encoded library version
CAIRO_VERSION_ENCODE
cairo_version_string Library version string
CAIRO_VERSION_STRINGIZE

Structs

Name Description
cairo_device_t A cairo_device_t represents the driver interface for drawing operations to a cairo_surface_t. There are different subtypes of cairo_device_t for different drawing backends; for example, cairo_xcb_device_create() creates a device that wraps the connection to an X Windows System using the XCB library.
cairo_font_extents_t The cairo_font_extents_t structure stores metric information for a font. Values are given in the current user-space coordinate system.
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().
cairo_font_options_t An opaque structure holding all options that are used when rendering fonts.
cairo_glyph_t 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 ligature 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.
cairo_matrix_t A cairo_matrix_t holds an affine transformation, such as a scale, rotation, shear, or a combination of those. The transformation of a point (x, y) is given by:
cairo_path_data_t cairo_path_data_t is used to represent the path data inside a cairo_path_t.
cairo_path_t A data structure for holding a path. This data structure serves as the return value for cairo_copy_path() and cairo_copy_path_flat() as well the input value for cairo_append_path().
cairo_pattern_t A cairo_pattern_t represents a source when drawing onto a surface. There are different subtypes of cairo_pattern_t, for different types of sources; for example, cairo_pattern_create_rgb() creates a pattern for a solid opaque color.
cairo_rectangle_int_t A data structure for holding a rectangle with integer coordinates.
cairo_rectangle_list_t A data structure for holding a dynamically allocated array of rectangles.
cairo_rectangle_t A data structure for holding a rectangle.
cairo_region_t A cairo_region_t represents a set of integer-aligned rectangles.
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.
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. To draw to a cairo_surface_t, create a cairo context with the surface as the target, using cairo_create().
cairo_t A cairo_t contains the current state of the rendering device, including coordinates of yet to be drawn shapes.
cairo_text_cluster_t The cairo_text_cluster_t structure holds information about a single text cluster. A text cluster is a minimal mapping of some glyphs corresponding to some UTF-8 text.
cairo_text_extents_t 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 cairo_scale(cr, 2.0, 2.0), 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.
cairo_user_data_key_t 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.
PathDataHeader
PathDataPoint

Enums

Name Description
cairo_antialias_t Specifies the type of antialiasing to do when rendering text or shapes.
cairo_content_t cairo_content_t is used to describe the content that a surface will contain, whether color information, alpha information (translucence vs. opacity), or both.
cairo_device_type_t cairo_device_type_t is used to describe the type of a given device. The devices types are also known as "backends" within cairo.
cairo_extend_t cairo_extend_t is used to describe how pattern color/alpha will be determined for areas "outside" the pattern's natural area, (for example, outside the surface bounds or outside the gradient geometry).
cairo_fill_rule_t 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_filter_t cairo_filter_t is used to indicate what filtering should be applied when reading pixel values from patterns. See cairo_pattern_set_source() for indicating the desired filter to be used with a particular pattern.
cairo_font_slant_t Specifies variants of a font face based on their slant.
cairo_font_type_t cairo_font_type_t is used to describe the type of a given font face or scaled font. The font types are also known as "font backends" within cairo.
cairo_font_weight_t Specifies variants of a font face based on their weight.
cairo_format_t cairo_format_t is used to identify the memory format of image data.
cairo_hint_metrics_t 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 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 Specifies how to render the endpoints of the path when stroking.
cairo_line_join_t Specifies how to render the junction of two lines when stroking.
cairo_operator_t cairo_operator_t is used to set the compositing operator for all cairo drawing operations.
cairo_path_data_type_t cairo_path_data_t is used to describe the type of one portion of a path when represented as a cairo_path_t. See cairo_path_data_t for details.
cairo_pattern_type_t cairo_pattern_type_t is used to describe the type of a given pattern.
cairo_region_overlap_t
cairo_status_t 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 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_surface_type_t cairo_surface_type_t is used to describe the type of a given surface. The surface types are also known as "backends" or "surface backends" within cairo.
cairo_text_cluster_flags_t Specifies properties of a text cluster mapping.

Enum values

Name Type Description
CAIRO_MIME_TYPE_JP2
CAIRO_MIME_TYPE_JPEG
CAIRO_MIME_TYPE_PNG
CAIRO_MIME_TYPE_URI
CAIRO_VERSION Encoded cairo binding version
CAIRO_VERSION_MAJOR Cairo binding version. Use the cairo_version() function to get version information about the cairo library.
CAIRO_VERSION_MICRO Cairo binding version. Use the cairo_version() function to get version information about the cairo library.
CAIRO_VERSION_MINOR Cairo binding version. Use the cairo_version() function to get version information about the cairo library.

Global variables

Name Type Description
CAIRO_VERSION_STRING string Cairo binding version string

Aliases

Name Type Description
cairo_bool_t int 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.
cairo_destroy_func_t extern(C) void function(void*) 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.
cairo_read_func_t extern(C) cairo_status_t function(void*, ubyte*, uint) cairo_read_func_t is the type of function which is called when a backend needs to read data from an input 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.
cairo_user_scaled_font_init_func_t extern(C) cairo_status_t function(cairo_scaled_font_t*, cairo_t*, cairo_font_extents_t*) cairo_user_scaled_font_init_func_t is the type of function which is called when a scaled-font needs to be created for a user font-face.
cairo_user_scaled_font_render_glyph_func_t extern(C) cairo_status_t function(cairo_scaled_font_t*, ulong, cairo_t*, cairo_text_extents_t*) cairo_user_scaled_font_render_glyph_func_t is the type of function which is called when a user scaled-font needs to render a glyph.
cairo_user_scaled_font_text_to_glyphs_func_t extern(C) cairo_status_t function(cairo_scaled_font_t*, const(char*), int, cairo_glyph_t**, int*, cairo_text_cluster_t**, int*, cairo_text_cluster_flags_t*) cairo_user_scaled_font_text_to_glyphs_func_t is the type of function which is called to convert input text to an array of glyphs. This is used by the cairo_show_text() operation.
cairo_user_scaled_font_unicode_to_glyph_func_t extern(C) cairo_status_t function(cairo_scaled_font_t*, ulong, ulong*) cairo_user_scaled_font_unicode_to_glyph_func_t is the type of function which is called to convert an input Unicode character to a single glyph. This is used by the cairo_show_text() operation.
cairo_write_func_t extern(C) cairo_status_t function(void*, const(ubyte*), uint) 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.

Authors

Johannes Pfau cairoD
cairo team cairo

Copyright

License

cairoD wrapper/bindings Boost License 1.0
cairo LGPL 2.1 / MPL 1.1