📄 cairo.h
字号:
double offset);cairo_public voidcairo_set_miter_limit (cairo_t *cr, double limit);cairo_public voidcairo_translate (cairo_t *cr, double tx, double ty);cairo_public voidcairo_scale (cairo_t *cr, double sx, double sy);cairo_public voidcairo_rotate (cairo_t *cr, double angle);cairo_public voidcairo_transform (cairo_t *cr, const cairo_matrix_t *matrix);cairo_public voidcairo_set_matrix (cairo_t *cr, const cairo_matrix_t *matrix);cairo_public voidcairo_identity_matrix (cairo_t *cr);cairo_public voidcairo_user_to_device (cairo_t *cr, double *x, double *y);cairo_public voidcairo_user_to_device_distance (cairo_t *cr, double *dx, double *dy);cairo_public voidcairo_device_to_user (cairo_t *cr, double *x, double *y);cairo_public voidcairo_device_to_user_distance (cairo_t *cr, double *dx, double *dy);/* Path creation functions */cairo_public voidcairo_new_path (cairo_t *cr);cairo_public voidcairo_move_to (cairo_t *cr, double x, double y);cairo_public voidcairo_new_sub_path (cairo_t *cr);cairo_public voidcairo_line_to (cairo_t *cr, double x, double y);cairo_public voidcairo_curve_to (cairo_t *cr, double x1, double y1, double x2, double y2, double x3, double y3);cairo_public voidcairo_arc (cairo_t *cr, double xc, double yc, double radius, double angle1, double angle2);cairo_public voidcairo_arc_negative (cairo_t *cr, double xc, double yc, double radius, double angle1, double angle2);/* XXX: NYIcairo_public voidcairo_arc_to (cairo_t *cr, double x1, double y1, double x2, double y2, double radius);*/cairo_public voidcairo_rel_move_to (cairo_t *cr, double dx, double dy);cairo_public voidcairo_rel_line_to (cairo_t *cr, double dx, double dy);cairo_public voidcairo_rel_curve_to (cairo_t *cr, double dx1, double dy1, double dx2, double dy2, double dx3, double dy3);cairo_public voidcairo_rectangle (cairo_t *cr, double x, double y, double width, double height);/* XXX: NYIcairo_public voidcairo_stroke_to_path (cairo_t *cr);*/cairo_public voidcairo_close_path (cairo_t *cr);/* Painting functions */cairo_public voidcairo_paint (cairo_t *cr);cairo_public voidcairo_paint_with_alpha (cairo_t *cr, double alpha);cairo_public voidcairo_mask (cairo_t *cr, cairo_pattern_t *pattern);cairo_public voidcairo_mask_surface (cairo_t *cr, cairo_surface_t *surface, double surface_x, double surface_y);cairo_public voidcairo_stroke (cairo_t *cr);cairo_public voidcairo_stroke_preserve (cairo_t *cr);cairo_public voidcairo_fill (cairo_t *cr);cairo_public voidcairo_fill_preserve (cairo_t *cr);cairo_public voidcairo_copy_page (cairo_t *cr);cairo_public voidcairo_show_page (cairo_t *cr);/* Insideness testing */cairo_public cairo_bool_tcairo_in_stroke (cairo_t *cr, double x, double y);cairo_public cairo_bool_tcairo_in_fill (cairo_t *cr, double x, double y);/* Rectangular extents */cairo_public voidcairo_stroke_extents (cairo_t *cr, double *x1, double *y1, double *x2, double *y2);cairo_public voidcairo_fill_extents (cairo_t *cr, double *x1, double *y1, double *x2, double *y2);/* Clipping */cairo_public voidcairo_reset_clip (cairo_t *cr);cairo_public voidcairo_clip (cairo_t *cr);cairo_public voidcairo_clip_preserve (cairo_t *cr);/* Font/Text functions *//** * 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. */typedef struct _cairo_scaled_font cairo_scaled_font_t;/** * 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(). */typedef struct _cairo_font_face cairo_font_face_t;/** * cairo_glyph_t: * @index: glyph index in the font. The exact interpretation of the * glyph index depends on the font technology being used. * @x: the offset in the X direction between the origin used for * drawing or measuring the string and the origin of this glyph. * @y: 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 @x and @y are not cumulative. When * drawing or measuring text, each glyph is individually positioned * with respect to the overall origin **/typedef struct { unsigned long index; double x; double y;} cairo_glyph_t;/** * cairo_text_extents_t: * @x_bearing: 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. * @y_bearing: 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: width of the glyphs as drawn * @height: height of the glyphs as drawn * @x_advance:distance to advance in the X direction * after drawing these glyphs * @y_advance: 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. */typedef struct { double x_bearing; double y_bearing; double width; double height; double x_advance; double y_advance;} cairo_text_extents_t;/** * cairo_font_extents_t: * @ascent: 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. * @descent: 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. * @height: the recommended vertical distance between baselines when * setting consecutive lines of text with the font. This * is greater than @ascent+@descent 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 @ascent+@descent between lines. * @max_x_advance: the maximum distance in the X direction that * the the origin is advanced for any glyph in the font. * @max_y_advance: 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. */typedef struct { double ascent; double descent; double height; double max_x_advance; double max_y_advance;} cairo_font_extents_t;typedef enum _cairo_font_slant { CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_SLANT_ITALIC, CAIRO_FONT_SLANT_OBLIQUE} cairo_font_slant_t;typedef enum _cairo_font_weight { CAIRO_FONT_WEIGHT_NORMAL, CAIRO_FONT_WEIGHT_BOLD} cairo_font_weight_t;/** * cairo_subpixel_order_t: * @CAIRO_SUBPIXEL_ORDER_DEFAULT: Use the default subpixel order for * for the target device * @CAIRO_SUBPIXEL_ORDER_RGB: Subpixel elements are arranged horizontally * with red at the left * @CAIRO_SUBPIXEL_ORDER_BGR: Subpixel elements are arranged horizontally * with blue at the left * @CAIRO_SUBPIXEL_ORDER_VRGB: Subpixel elements are arranged vertically * with red at the top * @CAIRO_SUBPIXEL_ORDER_VBGR: 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. **/typedef 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;/** * cairo_hint_style_t: * @CAIRO_HINT_STYLE_DEFAULT: Use the default hint style for * for font backend and target device * @CAIRO_HINT_STYLE_NONE: Do not hint outlines * @CAIRO_HINT_STYLE_SLIGHT: Hint outlines slightly to improve * contrast while retaining good fidelity to the original * shapes. * @CAIRO_HINT_STYLE_MEDIUM: Hint outlines with medium strength * giving a compromise between fidelity to the original shapes * and contrast * @CAIRO_HINT_STYLE_FULL: 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. */typedef 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;/** * cairo_hint_metrics_t: * @CAIRO_HINT_METRICS_DEFAULT: Hint metrics in the default * manner for the font backend and target device * @CAIRO_HINT_METRICS_OFF: Do not hint font metrics * @CAIRO_HINT_METRICS_ON: 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. */typedef enum _cairo_hint_metrics { CAIRO_HINT_METRICS_DEFAULT, CAIRO_HINT_METRICS_OFF, CAIRO_HINT_METRICS_ON} cairo_hint_metrics_t;typedef struct _cairo_font_options cairo_font_options_t;cairo_public cairo_font_options_t *cairo_font_options_create (void);cairo_public cairo_font_options_t *cairo_font_options_copy (const cairo_font_options_t *original);cairo_public voidcairo_font_options_destroy (cairo_font_options_t *options);cairo_public cairo_status_tcairo_font_options_status (cairo_font_options_t *options);cairo_public voidcairo_font_options_merge (cairo_font_options_t *options, const cairo_font_options_t *other);cairo_public cairo_bool_tcairo_font_options_equal (const cairo_font_options_t *options, const cairo_font_options_t *other);cairo_public unsigned longcairo_font_options_hash (const cairo_font_options_t *options);cairo_public voidcairo_font_options_set_antialias (cairo_font_options_t *options, cairo_antialias_t antialias);cairo_public cairo_antialias_tcairo_font_options_get_antialias (const cairo_font_options_t *options);cairo_public void
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -