mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-05 05:18:01 +02:00
Add get_type functions: cairo_surface_get_type,
cairo_pattern_get_type, cairo_font_face_get_type, and cairo_scaled_font_get_type.
This commit is contained in:
parent
d0e02a948e
commit
9287d60d60
2 changed files with 134 additions and 3 deletions
|
|
@ -186,7 +186,8 @@ _cairo_surface_create_similar_scratch (cairo_surface_t *other,
|
|||
*
|
||||
* Create a new surface that is as compatible as possible with an
|
||||
* existing surface. The new surface will use the same backend as
|
||||
* @other unless that is not possible for some reason.
|
||||
* @other unless that is not possible for some reason. The type of the
|
||||
* returned surface may be examined with cairo_surface_get_type().
|
||||
*
|
||||
* Return value: a pointer to the newly allocated surface. The caller
|
||||
* owns the surface and should call cairo_surface_destroy when done
|
||||
|
|
|
|||
134
src/cairo.h
134
src/cairo.h
|
|
@ -896,6 +896,46 @@ cairo_font_face_destroy (cairo_font_face_t *font_face);
|
|||
cairo_public cairo_status_t
|
||||
cairo_font_face_status (cairo_font_face_t *font_face);
|
||||
|
||||
/**
|
||||
* cairo_font_type_t
|
||||
* @CAIRO_SCALED_FONT_TYPE_FT: The font is of type ft
|
||||
* @CAIRO_SCALED_FONT_TYPE_WIN32: The font is of type win32
|
||||
* @CAIRO_SCALED_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_<type>_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_<type>_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.
|
||||
*/
|
||||
typedef enum _cairo_font_type {
|
||||
CAIRO_FONT_TYPE_FT,
|
||||
CAIRO_FONT_TYPE_WIN32,
|
||||
CAIRO_FONT_TYPE_ATSUI
|
||||
} cairo_font_type_t;
|
||||
|
||||
cairo_public cairo_font_type_t
|
||||
cairo_font_face_get_type (cairo_scaled_font_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);
|
||||
|
|
@ -923,6 +963,9 @@ cairo_scaled_font_destroy (cairo_scaled_font_t *scaled_font);
|
|||
cairo_public cairo_status_t
|
||||
cairo_scaled_font_status (cairo_scaled_font_t *scaled_font);
|
||||
|
||||
cairo_public cairo_font_type_t
|
||||
cairo_scaled_font_get_type (cairo_scaled_font_t *scaled_font);
|
||||
|
||||
cairo_public void
|
||||
cairo_scaled_font_extents (cairo_scaled_font_t *scaled_font,
|
||||
cairo_font_extents_t *extents);
|
||||
|
|
@ -1147,14 +1190,64 @@ cairo_surface_create_similar (cairo_surface_t *other,
|
|||
cairo_public cairo_surface_t *
|
||||
cairo_surface_reference (cairo_surface_t *surface);
|
||||
|
||||
cairo_public void
|
||||
cairo_surface_finish (cairo_surface_t *surface);
|
||||
|
||||
cairo_public void
|
||||
cairo_surface_destroy (cairo_surface_t *surface);
|
||||
|
||||
cairo_public cairo_status_t
|
||||
cairo_surface_status (cairo_surface_t *surface);
|
||||
|
||||
cairo_public void
|
||||
cairo_surface_finish (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 typs 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_<type>_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_<type>_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.
|
||||
*/
|
||||
typedef enum _cairo_surface_type {
|
||||
CAIRO_SURFACE_TYPE_IMAGE,
|
||||
CAIRO_SURFACE_TYPE_PDF,
|
||||
CAIRO_SURFACE_TYPE_PS,
|
||||
CAIRO_SURFACE_TYPE_XLIB,
|
||||
CAIRO_SURFACE_TYPE_XCB,
|
||||
CAIRO_SURFACE_TYPE_GLITZ,
|
||||
CAIRO_SURFACE_TYPE_QUARTZ,
|
||||
CAIRO_SURFACE_TYPE_WIN32,
|
||||
CAIRO_SURFACE_TYPE_BEOS,
|
||||
CAIRO_SURFACE_TYPE_DIRECTFB,
|
||||
CAIRO_SURFACE_TYPE_SVG
|
||||
} cairo_surface_type_t;
|
||||
|
||||
cairo_public cairo_surface_type_t
|
||||
cairo_surface_get_type (cairo_surface_t *surface);
|
||||
|
||||
#if CAIRO_HAS_PNG_FUNCTIONS
|
||||
|
||||
|
|
@ -1290,6 +1383,43 @@ cairo_pattern_destroy (cairo_pattern_t *pattern);
|
|||
cairo_public cairo_status_t
|
||||
cairo_pattern_status (cairo_pattern_t *pattern);
|
||||
|
||||
/**
|
||||
* cairo_pattern_type_t
|
||||
|
||||
* @CAIRO_PATTERN_TYPE_SOLID: The pattern is a solid (uniform)
|
||||
* color. It may be opaque or translucent.
|
||||
* @CAIRO_PATTERN_TYPE_SURFACE: The pattern is a based on a surface (an image).
|
||||
* @CAIRO_PATTERN_TYPE_LINEAR_GRADIENT: The pattern is a linear gradient.
|
||||
* @CAIRO_PATTERN_TYPE_RADIAL_GRADIENT: The pattern is a radial gradient.
|
||||
*
|
||||
* @cairo_pattern_type_t us used to describe the type of a given pattern.
|
||||
*
|
||||
* The type of a pattern is determined by the function used to create
|
||||
* it. The cairo_pattern_create_rgb() and cairo_pattern_create_rgba()
|
||||
* functions create SOLID patterns. The reamaining
|
||||
* cairo_pattern_create functions map to pattern types in obvious
|
||||
* ways.
|
||||
*
|
||||
* The pattern type can be queried with cairo_pattern_get_type()
|
||||
*
|
||||
* Most cairo_pattern functions can be called with a pattern of any
|
||||
* type, (though trying to change the extend or filter for a solid
|
||||
* pattern will have no effect). A notable exception is
|
||||
* cairo_pattern_add_color_stop_rgb() and
|
||||
* cairo_pattern_add_color_stop_rgba() which must only be called with
|
||||
* gradient patterns. Otherwise the pattern will be shutdown and put
|
||||
* into an error state.
|
||||
*/
|
||||
typedef enum _cairo_pattern_type {
|
||||
CAIRO_PATTERN_TYPE_SOLID,
|
||||
CAIRO_PATTERN_TYPE_SURFACE,
|
||||
CAIRO_PATTERN_TYPE_LINEAR_GRADIENT,
|
||||
CAIRO_PATTERN_TYPE_RADIAL_GRADIENT
|
||||
} cairo_pattern_type_t;
|
||||
|
||||
cairo_public cairo_pattern_type_t
|
||||
cairo_pattern_get_type (cairo_pattern_t *pattern);
|
||||
|
||||
cairo_public void
|
||||
cairo_pattern_add_color_stop_rgb (cairo_pattern_t *pattern,
|
||||
double offset,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue