📄 cairo.h
字号:
cairo_font_options_set_subpixel_order (cairo_font_options_t *options, cairo_subpixel_order_t subpixel_order);cairo_public cairo_subpixel_order_tcairo_font_options_get_subpixel_order (const cairo_font_options_t *options);cairo_public voidcairo_font_options_set_hint_style (cairo_font_options_t *options, cairo_hint_style_t hint_style);cairo_public cairo_hint_style_tcairo_font_options_get_hint_style (const cairo_font_options_t *options);cairo_public voidcairo_font_options_set_hint_metrics (cairo_font_options_t *options, cairo_hint_metrics_t hint_metrics);cairo_public cairo_hint_metrics_tcairo_font_options_get_hint_metrics (const cairo_font_options_t *options);/* This interface is for dealing with text as text, not caring about the font object inside the the cairo_t. */cairo_public voidcairo_select_font_face (cairo_t *cr, const char *family, cairo_font_slant_t slant, cairo_font_weight_t weight);cairo_public voidcairo_set_font_size (cairo_t *cr, double size);cairo_public voidcairo_set_font_matrix (cairo_t *cr, const cairo_matrix_t *matrix);cairo_public voidcairo_get_font_matrix (cairo_t *cr, cairo_matrix_t *matrix);cairo_public voidcairo_set_font_options (cairo_t *cr, const cairo_font_options_t *options);cairo_public voidcairo_get_font_options (cairo_t *cr, cairo_font_options_t *options);cairo_public voidcairo_set_scaled_font (cairo_t *cr, const cairo_scaled_font_t *scaled_font);cairo_public voidcairo_show_text (cairo_t *cr, const char *utf8);cairo_public voidcairo_show_glyphs (cairo_t *cr, cairo_glyph_t *glyphs, int num_glyphs);cairo_public cairo_font_face_t *cairo_get_font_face (cairo_t *cr);cairo_public voidcairo_font_extents (cairo_t *cr, cairo_font_extents_t *extents);cairo_public voidcairo_set_font_face (cairo_t *cr, cairo_font_face_t *font_face);cairo_public voidcairo_text_extents (cairo_t *cr, const char *utf8, cairo_text_extents_t *extents);cairo_public voidcairo_glyph_extents (cairo_t *cr, cairo_glyph_t *glyphs, int num_glyphs, cairo_text_extents_t *extents);cairo_public voidcairo_text_path (cairo_t *cr, const char *utf8);cairo_public voidcairo_glyph_path (cairo_t *cr, cairo_glyph_t *glyphs, int num_glyphs);/* Generic identifier for a font style */cairo_public cairo_font_face_t *cairo_font_face_reference (cairo_font_face_t *font_face);cairo_public voidcairo_font_face_destroy (cairo_font_face_t *font_face);cairo_public cairo_status_tcairo_font_face_status (cairo_font_face_t *font_face);/** * cairo_font_type_t * @CAIRO_FONT_TYPE_TOY: The font was created using cairo's toy font api * @CAIRO_FONT_TYPE_FT: The font is of type FreeType * @CAIRO_FONT_TYPE_WIN32: The font is of type Win32 * @CAIRO_FONT_TYPE_ATSUI: The font is of type ATSUI * * #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. * * The type of a font face is determined by the function used to * create it, which will generally be of the form * cairo_<emphasis>type</emphasis>_font_face_create. The font face type can be queried * with cairo_font_face_get_type() * * The various cairo_font_face functions can be used with a font face * of any type. * * The type of a scaled font is determined by the type of the font * face passed to cairo_scaled_font_create. The scaled font type can * be queried with cairo_scaled_font_get_type() * * The various cairo_scaled_font functions can be used with scaled * fonts of any type, but some font backends also provide * type-specific functions that must only be called with a scaled font * of the appropriate type. These functions have names that begin with * cairo_<emphasis>type</emphasis>_scaled_font such as cairo_ft_scaled_font_lock_face. * * The behavior of calling a type-specific function with a scaled font * of the wrong type is undefined. * * Since: 1.2 */typedef enum _cairo_font_type { CAIRO_FONT_TYPE_TOY, CAIRO_FONT_TYPE_FT, CAIRO_FONT_TYPE_WIN32, CAIRO_FONT_TYPE_ATSUI} cairo_font_type_t;cairo_public cairo_font_type_tcairo_font_face_get_type (cairo_font_face_t *font_face);cairo_public void *cairo_font_face_get_user_data (cairo_font_face_t *font_face, const cairo_user_data_key_t *key);cairo_public cairo_status_tcairo_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);/* Portable interface to general font features. */cairo_public 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_public cairo_scaled_font_t *cairo_scaled_font_reference (cairo_scaled_font_t *scaled_font);cairo_public voidcairo_scaled_font_destroy (cairo_scaled_font_t *scaled_font);cairo_public cairo_status_tcairo_scaled_font_status (cairo_scaled_font_t *scaled_font);cairo_public cairo_font_type_tcairo_scaled_font_get_type (cairo_scaled_font_t *scaled_font);cairo_public voidcairo_scaled_font_extents (cairo_scaled_font_t *scaled_font, cairo_font_extents_t *extents);cairo_public voidcairo_scaled_font_text_extents (cairo_scaled_font_t *scaled_font, const char *utf8, cairo_text_extents_t *extents);cairo_public voidcairo_scaled_font_glyph_extents (cairo_scaled_font_t *scaled_font, cairo_glyph_t *glyphs, int num_glyphs, cairo_text_extents_t *extents);cairo_public cairo_font_face_t *cairo_scaled_font_get_font_face (cairo_scaled_font_t *scaled_font);cairo_public voidcairo_scaled_font_get_font_matrix (cairo_scaled_font_t *scaled_font, cairo_matrix_t *font_matrix);cairo_public voidcairo_scaled_font_get_ctm (cairo_scaled_font_t *scaled_font, cairo_matrix_t *ctm);cairo_public voidcairo_scaled_font_get_font_options (cairo_scaled_font_t *scaled_font, cairo_font_options_t *options);/* Query functions */cairo_public cairo_operator_tcairo_get_operator (cairo_t *cr);cairo_public cairo_pattern_t *cairo_get_source (cairo_t *cr);cairo_public doublecairo_get_tolerance (cairo_t *cr);cairo_public cairo_antialias_tcairo_get_antialias (cairo_t *cr);cairo_public voidcairo_get_current_point (cairo_t *cr, double *x, double *y);cairo_public cairo_fill_rule_tcairo_get_fill_rule (cairo_t *cr);cairo_public doublecairo_get_line_width (cairo_t *cr);cairo_public cairo_line_cap_tcairo_get_line_cap (cairo_t *cr);cairo_public cairo_line_join_tcairo_get_line_join (cairo_t *cr);cairo_public doublecairo_get_miter_limit (cairo_t *cr);/* XXX: How to do cairo_get_dash??? Do we want to switch to a cairo_dash object? */cairo_public voidcairo_get_matrix (cairo_t *cr, cairo_matrix_t *matrix);cairo_public cairo_surface_t *cairo_get_target (cairo_t *cr);cairo_public cairo_surface_t *cairo_get_group_target (cairo_t *cr);typedef enum _cairo_path_data_type { CAIRO_PATH_MOVE_TO, CAIRO_PATH_LINE_TO, CAIRO_PATH_CURVE_TO, CAIRO_PATH_CLOSE_PATH} cairo_path_data_type_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> **/typedef union _cairo_path_data_t cairo_path_data_t;union _cairo_path_data_t { struct { cairo_path_data_type_t type; int length; } header; struct { double x, y; } point;};/** * cairo_path_t: * @status: the current error status * @data: the elements in the path * @num_data: 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 struct cairo_path { cairo_status_t status; cairo_path_data_t *data; int num_data;} cairo_path_t;cairo_public cairo_path_t *cairo_copy_path (cairo_t *cr);cairo_public cairo_path_t *cairo_copy_path_flat (cairo_t *cr);cairo_public voidcairo_append_path (cairo_t *cr, cairo_path_t *path);cairo_public voidcairo_path_destroy (cairo_path_t *path);/* Error status queries */cairo_public cairo_status_tcairo_status (cairo_t *cr);cairo_public const char *cairo_status_to_string (cairo_status_t status);/* Surface manipulation */cairo_public cairo_surface_t *cairo_surface_create_similar (cairo_surface_t *other, cairo_content_t content, int width, int height);cairo_public cairo_surface_t *cairo_surface_reference (cairo_surface_t *surface);cairo_public voidcairo_surface_finish (cairo_surface_t *surface);cairo_public voidcairo_surface_destroy (cairo_surface_t *surface);cairo_public cairo_status_tcairo_surface_status (cairo_surface_t *surface);/** * cairo_surface_type_t * @CAIRO_SURFACE_TYPE_IMAGE: The surface is of type image * @CAIRO_SURFACE_TYPE_PDF: The surface is of type pdf * @CAIRO_SURFACE_TYPE_PS: The surface is of type ps * @CAIRO_SURFACE_TYPE_XLIB: The surface is of type xlib * @CAIRO_SURFACE_TYPE_XCB: The surface is of type xcb * @CAIRO_SURFACE_TYPE_GLITZ: The surface is of type glitz * @CAIRO_SURFACE_TYPE_QUARTZ: The surface is of type quartz * @CAIRO_SURFACE_TYPE_WIN32: The surface is of type win32 * @CAIRO_SURFACE_TYPE_BEOS: The surface is of type beos * @CAIRO_SURFACE_TYPE_DIRECTFB: The surface is of type directfb * @CAIRO_SURFACE_TYPE_SVG: The surface is of type svg * * #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. * * The type of a surface is determined by the function used to create * it, which will generally be of the form cairo_<emphasis>type</emphasis>_surface_create, * (though see cairo_surface_create_similar as well). * * The surface type can be queried with cairo_surface_get_type() * * The various cairo_surface functions can be used with surfaces of * any type, but some backends also provide type-specific functions * that must only be called with a surface of the appropriate * type. These functions have names that begin with * cairo_<emphasis>type</emphasis>_surface such as cairo_image_surface_get_width(). * * The behavior of calling a type-specific function with a surface of * the wrong type is undefined. * * Since: 1.2 */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -