[paint] Add back "remote-control" API

This reverts commit f146299a40.
This commit is contained in:
Behdad Esfahbod 2022-12-27 12:37:53 -07:00
parent 43b0364eda
commit 7b0f9abc89
3 changed files with 326 additions and 0 deletions

View File

@ -270,6 +270,19 @@ hb_paint_push_group_func_t
hb_paint_funcs_set_push_group_func hb_paint_funcs_set_push_group_func
hb_paint_pop_group_func_t hb_paint_pop_group_func_t
hb_paint_funcs_set_pop_group_func hb_paint_funcs_set_pop_group_func
hb_paint_push_transform
hb_paint_pop_transform
hb_paint_push_clip_glyph
hb_paint_push_clip_rectangle
hb_paint_pop_clip
hb_paint_color
hb_paint_image
hb_paint_linear_gradient
hb_paint_radial_gradient
hb_paint_sweep_gradient
hb_paint_push_group
hb_paint_pop_group
</SECTION> </SECTION>
<SECTION> <SECTION>

View File

@ -428,4 +428,250 @@ hb_color_line_get_extend (hb_color_line_t *color_line)
} }
/**
* hb_paint_push_transform:
* @funcs: paint functions
* @paint_data: associated data passed by the caller
* @xx: xx component of the transform matrix
* @yx: yx component of the transform matrix
* @xy: xy component of the transform matrix
* @yy: yy component of the transform matrix
* @dx: dx component of the transform matrix
* @dy: dy component of the transform matrix
*
* Perform a "push-transform" paint operation.
*
* Since: REPLACEME
*/
void
hb_paint_push_transform (hb_paint_funcs_t *funcs, void *paint_data,
float xx, float yx,
float xy, float yy,
float dx, float dy)
{
funcs->push_transform (paint_data, xx, yx, xy, yy, dx, dy);
}
/**
* hb_paint_pop_transform:
* @funcs: paint functions
* @paint_data: associated data passed by the caller
*
* Perform a "pop-transform" paint operation.
*
* Since: REPLACEME
*/
void
hb_paint_pop_transform (hb_paint_funcs_t *funcs, void *paint_data)
{
funcs->pop_transform (paint_data);
}
/**
* hb_paint_push_clip_glyph:
* @funcs: paint functions
* @paint_data: associated data passed by the caller
* @glyph: the glyph ID
* @font: the font
*
* Perform a "push-clip-glyph" paint operation.
*
* Since: REPLACEME
*/
void
hb_paint_push_clip_glyph (hb_paint_funcs_t *funcs, void *paint_data,
hb_codepoint_t glyph,
hb_font_t *font)
{
funcs->push_clip_glyph (paint_data, glyph, font);
}
/**
* hb_paint_push_clip_rectangle:
* @funcs: paint functions
* @paint_data: associated data passed by the caller
* @xmin: min X for the rectangle
* @ymin: min Y for the rectangle
* @xmax: max X for the rectangle
* @ymax: max Y for the rectangle
*
* Perform a "push-clip-rect" paint operation.
*
* Since: REPLACEME
*/
void
hb_paint_push_clip_rectangle (hb_paint_funcs_t *funcs, void *paint_data,
float xmin, float ymin, float xmax, float ymax)
{
funcs->push_clip_rectangle (paint_data, xmin, ymin, xmax, ymax);
}
/**
* hb_paint_pop_clip:
* @funcs: paint functions
* @paint_data: associated data passed by the caller
*
* Perform a "pop-clip" paint operation.
*
* Since: REPLACEME
*/
void
hb_paint_pop_clip (hb_paint_funcs_t *funcs, void *paint_data)
{
funcs->pop_clip (paint_data);
}
/**
* hb_paint_color:
* @funcs: paint functions
* @paint_data: associated data passed by the caller
* @is_foreground: whether the color is the foreground
* @color: The color to use
*
* Perform a "color" paint operation.
*
* Since: REPLACEME
*/
void
hb_paint_color (hb_paint_funcs_t *funcs, void *paint_data,
hb_bool_t is_foreground,
hb_color_t color)
{
funcs->color (paint_data, is_foreground, color);
}
/**
* hb_paint_image:
* @funcs: paint functions
* @paint_data: associated data passed by the caller
* @image: image data
* @width: width of the raster image in pixels, or 0
* @height: height of the raster image in pixels, or 0
* @format: the image format as a tag
* @slant: the synthetic slant ratio to be applied to the image during rendering
* @extents: (nullable): the extents of the glyph
*
* Perform a "image" paint operation.
*
* Since: REPLACEME
*/
void
hb_paint_image (hb_paint_funcs_t *funcs, void *paint_data,
hb_blob_t *image,
unsigned int width,
unsigned int height,
hb_tag_t format,
float slant,
hb_glyph_extents_t *extents)
{
funcs->image (paint_data, image, width, height, format, slant, extents);
}
/**
* hb_paint_linear_gradient:
* @funcs: paint functions
* @paint_data: associated data passed by the caller
* @color_line: Color information for the gradient
* @x0: X coordinate of the first point
* @y0: Y coordinate of the first point
* @x1: X coordinate of the second point
* @y1: Y coordinate of the second point
* @x2: X coordinate of the third point
* @y2: Y coordinate of the third point
*
* Perform a "linear-gradient" paint operation.
*
* Since: REPLACEME
*/
void
hb_paint_linear_gradient (hb_paint_funcs_t *funcs, void *paint_data,
hb_color_line_t *color_line,
float x0, float y0,
float x1, float y1,
float x2, float y2)
{
funcs->linear_gradient (paint_data, color_line, x0, y0, x1, y1, x2, y2);
}
/**
* hb_paint_radial_gradient:
* @funcs: paint functions
* @paint_data: associated data passed by the caller
* @color_line: Color information for the gradient
* @x0: X coordinate of the first circle's center
* @y0: Y coordinate of the first circle's center
* @r0: radius of the first circle
* @x1: X coordinate of the second circle's center
* @y1: Y coordinate of the second circle's center
* @r1: radius of the second circle
*
* Perform a "radial-gradient" paint operation.
*
* Since: REPLACEME
*/
void
hb_paint_radial_gradient (hb_paint_funcs_t *funcs, void *paint_data,
hb_color_line_t *color_line,
float x0, float y0, float r0,
float x1, float y1, float r1)
{
funcs->radial_gradient (paint_data, color_line, x0, y0, r0, y1, x1, r1);
}
/**
* hb_paint_sweep_gradient:
* @funcs: paint functions
* @paint_data: associated data passed by the caller
* @color_line: Color information for the gradient
* @x0: X coordinate of the circle's center
* @y0: Y coordinate of the circle's center
* @start_angle: the start angle
* @end_angle: the end angle
*
* Perform a "sweep-gradient" paint operation.
*
* Since: REPLACEME
*/
void
hb_paint_sweep_gradient (hb_paint_funcs_t *funcs, void *paint_data,
hb_color_line_t *color_line,
float x0, float y0,
float start_angle, float end_angle)
{
funcs->sweep_gradient (paint_data, color_line, x0, y0, start_angle, end_angle);
}
/**
* hb_paint_push_group:
* @funcs: paint functions
* @paint_data: associated data passed by the caller
*
* Perform a "push-group" paint operation.
*
* Since: REPLACEME
*/
void
hb_paint_push_group (hb_paint_funcs_t *funcs, void *paint_data)
{
funcs->push_group (paint_data);
}
/**
* hb_paint_pop_group:
* @funcs: paint functions
* @paint_data: associated data passed by the caller
* @mode: the compositing mode to use
*
* Perform a "pop-group" paint operation.
*
* Since: REPLACEME
*/
void
hb_paint_pop_group (hb_paint_funcs_t *funcs, void *paint_data,
hb_paint_composite_mode_t mode)
{
funcs->pop_group (paint_data, mode);
}
#endif #endif

View File

@ -859,6 +859,73 @@ hb_paint_funcs_set_pop_group_func (hb_paint_funcs_t *funcs,
void *user_data, void *user_data,
hb_destroy_func_t destroy); hb_destroy_func_t destroy);
/*
* Manual API
*/
HB_EXTERN void
hb_paint_push_transform (hb_paint_funcs_t *funcs, void *paint_data,
float xx, float yx,
float xy, float yy,
float dx, float dy);
HB_EXTERN void
hb_paint_pop_transform (hb_paint_funcs_t *funcs, void *paint_data);
HB_EXTERN void
hb_paint_push_clip_glyph (hb_paint_funcs_t *funcs, void *paint_data,
hb_codepoint_t glyph,
hb_font_t *font);
HB_EXTERN void
hb_paint_push_clip_rectangle (hb_paint_funcs_t *funcs, void *paint_data,
float xmin, float ymin,
float xmax, float ymax);
HB_EXTERN void
hb_paint_pop_clip (hb_paint_funcs_t *funcs, void *paint_data);
HB_EXTERN void
hb_paint_color (hb_paint_funcs_t *funcs, void *paint_data,
hb_bool_t is_foreground,
hb_color_t color);
HB_EXTERN void
hb_paint_image (hb_paint_funcs_t *funcs, void *paint_data,
hb_blob_t *image,
unsigned int width,
unsigned int height,
hb_tag_t format,
float slant,
hb_glyph_extents_t *extents);
HB_EXTERN void
hb_paint_linear_gradient (hb_paint_funcs_t *funcs, void *paint_data,
hb_color_line_t *color_line,
float x0, float y0,
float x1, float y1,
float x2, float y2);
HB_EXTERN void
hb_paint_radial_gradient (hb_paint_funcs_t *funcs, void *paint_data,
hb_color_line_t *color_line,
float x0, float y0,
float r0,
float x1, float y1,
float r1);
HB_EXTERN void
hb_paint_sweep_gradient (hb_paint_funcs_t *funcs, void *paint_data,
hb_color_line_t *color_line,
float x0, float y0,
float start_angle, float end_angle);
HB_EXTERN void
hb_paint_push_group (hb_paint_funcs_t *funcs, void *paint_data);
HB_EXTERN void
hb_paint_pop_group (hb_paint_funcs_t *funcs, void *paint_data,
hb_paint_composite_mode_t mode);
HB_END_DECLS HB_END_DECLS