[colr] Add public vtable for hb_color_line_t
This commit is contained in:
parent
7c9e42ed92
commit
fe4e9bd930
|
@ -25,50 +25,3 @@ void PaintColrGlyph::paint_glyph (hb_paint_context_t *c) const
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* hb_color_line_get_color_stops:
|
||||
* @color_line: a #hb_color_line_t object
|
||||
* @start: the index of the first color stop to return
|
||||
* @count: (inout) (optional): Input = the maximum number of feature tags to return;
|
||||
* Output = the actual number of feature tags returned (may be zero)
|
||||
* @color_stops: (out) (array length=count) (optional): Array of #hb_color_stop_t to populate
|
||||
*
|
||||
* Fetches a list of color stops from the given color line object.
|
||||
*
|
||||
* Note that due to variations being applied, the returned color stops
|
||||
* may be out of order. It is the callers responsibility to ensure that
|
||||
* color stops are sorted by their offset before they are used.
|
||||
*
|
||||
* Return value: the total number of color stops in @cl
|
||||
*
|
||||
* Since: REPLACEME
|
||||
*/
|
||||
unsigned int
|
||||
hb_color_line_get_color_stops (hb_color_line_t *color_line,
|
||||
unsigned int start,
|
||||
unsigned int *count,
|
||||
hb_color_stop_t *color_stops)
|
||||
{
|
||||
if (color_line->is_variable)
|
||||
return reinterpret_cast<const OT::ColorLine<OT::Variable> *>(color_line->base)->get_color_stops (color_line->c, start, count, color_stops, color_line->c->instancer);
|
||||
else
|
||||
return reinterpret_cast<const OT::ColorLine<OT::NoVariable> *>(color_line->base)->get_color_stops (color_line->c, start, count, color_stops, color_line->c->instancer);
|
||||
}
|
||||
|
||||
/**
|
||||
* hb_color_line_get_extend:
|
||||
* @color_line: a #hb_color_line_t object
|
||||
*
|
||||
* Fetches the extend mode of the color line object.
|
||||
*
|
||||
* Since: REPLACEME
|
||||
*/
|
||||
hb_paint_extend_t
|
||||
hb_color_line_get_extend (hb_color_line_t *color_line)
|
||||
{
|
||||
if (color_line->is_variable)
|
||||
return reinterpret_cast<const OT::ColorLine<OT::Variable> *>(color_line->base)->get_extend ();
|
||||
else
|
||||
return reinterpret_cast<const OT::ColorLine<OT::NoVariable> *>(color_line->base)->get_extend ();
|
||||
}
|
||||
|
|
|
@ -49,12 +49,6 @@ namespace OT {
|
|||
struct hb_paint_context_t;
|
||||
}
|
||||
|
||||
struct hb_color_line_t {
|
||||
struct OT::hb_paint_context_t *c;
|
||||
const void *base;
|
||||
bool is_variable;
|
||||
};
|
||||
|
||||
namespace OT {
|
||||
|
||||
struct COLR;
|
||||
|
@ -440,11 +434,31 @@ struct ColorLine
|
|||
return len;
|
||||
}
|
||||
|
||||
HB_INTERNAL static unsigned int static_get_color_stops (hb_color_line_t *color_line,
|
||||
void *color_line_data,
|
||||
unsigned int start,
|
||||
unsigned int *count,
|
||||
hb_color_stop_t *color_stops,
|
||||
void *user_data)
|
||||
{
|
||||
const ColorLine *thiz = (const ColorLine *) color_line_data;
|
||||
hb_paint_context_t *c = (hb_paint_context_t *) user_data;
|
||||
return thiz->get_color_stops (c, start, count, color_stops, c->instancer);
|
||||
}
|
||||
|
||||
hb_paint_extend_t get_extend () const
|
||||
{
|
||||
return (hb_paint_extend_t) (unsigned int) extend;
|
||||
}
|
||||
|
||||
HB_INTERNAL static hb_paint_extend_t static_get_extend (hb_color_line_t *color_line,
|
||||
void *color_line_data,
|
||||
void *user_data)
|
||||
{
|
||||
const ColorLine *thiz = (const ColorLine *) color_line_data;
|
||||
return thiz->get_extend ();
|
||||
}
|
||||
|
||||
Extend extend;
|
||||
Array16Of<Var<ColorStop>> stops;
|
||||
public:
|
||||
|
@ -620,7 +634,11 @@ struct PaintLinearGradient
|
|||
|
||||
void paint_glyph (hb_paint_context_t *c, uint32_t varIdxBase) const
|
||||
{
|
||||
hb_color_line_t cl = { c, &(this+colorLine), Var<HBUINT8>::is_variable };
|
||||
hb_color_line_t cl = {
|
||||
(void *) &(this+colorLine),
|
||||
(this+colorLine).static_get_color_stops, c,
|
||||
(this+colorLine).static_get_extend, nullptr
|
||||
};
|
||||
|
||||
c->funcs->linear_gradient (c->data, &cl,
|
||||
x0 + c->instancer (varIdxBase, 0),
|
||||
|
@ -667,7 +685,11 @@ struct PaintRadialGradient
|
|||
|
||||
void paint_glyph (hb_paint_context_t *c, uint32_t varIdxBase) const
|
||||
{
|
||||
hb_color_line_t cl = { c, &(this+colorLine), Var<HBUINT8>::is_variable };
|
||||
hb_color_line_t cl = {
|
||||
(void *) &(this+colorLine),
|
||||
(this+colorLine).static_get_color_stops, c,
|
||||
(this+colorLine).static_get_extend, nullptr
|
||||
};
|
||||
|
||||
c->funcs->radial_gradient (c->data, &cl,
|
||||
x0 + c->instancer (varIdxBase, 0),
|
||||
|
@ -714,7 +736,11 @@ struct PaintSweepGradient
|
|||
|
||||
void paint_glyph (hb_paint_context_t *c, uint32_t varIdxBase) const
|
||||
{
|
||||
hb_color_line_t cl = { c, &(this+colorLine), Var<HBUINT8>::is_variable };
|
||||
hb_color_line_t cl = {
|
||||
(void *) &(this+colorLine),
|
||||
(this+colorLine).static_get_color_stops, c,
|
||||
(this+colorLine).static_get_extend, nullptr
|
||||
};
|
||||
|
||||
c->funcs->sweep_gradient (c->data, &cl,
|
||||
centerX + c->instancer (varIdxBase, 0),
|
||||
|
|
|
@ -376,4 +376,53 @@ hb_paint_funcs_is_immutable (hb_paint_funcs_t *funcs)
|
|||
return hb_object_is_immutable (funcs);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* hb_color_line_get_color_stops:
|
||||
* @color_line: a #hb_color_line_t object
|
||||
* @start: the index of the first color stop to return
|
||||
* @count: (inout) (optional): Input = the maximum number of feature tags to return;
|
||||
* Output = the actual number of feature tags returned (may be zero)
|
||||
* @color_stops: (out) (array length=count) (optional): Array of #hb_color_stop_t to populate
|
||||
*
|
||||
* Fetches a list of color stops from the given color line object.
|
||||
*
|
||||
* Note that due to variations being applied, the returned color stops
|
||||
* may be out of order. It is the callers responsibility to ensure that
|
||||
* color stops are sorted by their offset before they are used.
|
||||
*
|
||||
* Return value: the total number of color stops in @cl
|
||||
*
|
||||
* Since: REPLACEME
|
||||
*/
|
||||
unsigned int
|
||||
hb_color_line_get_color_stops (hb_color_line_t *color_line,
|
||||
unsigned int start,
|
||||
unsigned int *count,
|
||||
hb_color_stop_t *color_stops)
|
||||
{
|
||||
return color_line->get_color_stops (color_line,
|
||||
color_line->data,
|
||||
start, count,
|
||||
color_stops,
|
||||
color_line->get_color_stops_user_data);
|
||||
}
|
||||
|
||||
/**
|
||||
* hb_color_line_get_extend:
|
||||
* @color_line: a #hb_color_line_t object
|
||||
*
|
||||
* Fetches the extend mode of the color line object.
|
||||
*
|
||||
* Since: REPLACEME
|
||||
*/
|
||||
hb_paint_extend_t
|
||||
hb_color_line_get_extend (hb_color_line_t *color_line)
|
||||
{
|
||||
return color_line->get_extend (color_line,
|
||||
color_line->data,
|
||||
color_line->get_extend_user_data);
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -287,15 +287,6 @@ typedef void (*hb_paint_image_func_t) (hb_paint_funcs_t *funcs,
|
|||
hb_glyph_extents_t *extents,
|
||||
void *user_data);
|
||||
|
||||
/**
|
||||
* hb_color_line_t:
|
||||
*
|
||||
* An opaque struct containing color information for a gradient.
|
||||
*
|
||||
* Since: REPLACEME
|
||||
*/
|
||||
typedef struct hb_color_line_t hb_color_line_t;
|
||||
|
||||
/**
|
||||
* hb_color_stop_t:
|
||||
* @offset: the offset of the color stop
|
||||
|
@ -315,12 +306,6 @@ typedef struct {
|
|||
hb_color_t color;
|
||||
} hb_color_stop_t;
|
||||
|
||||
HB_EXTERN unsigned int
|
||||
hb_color_line_get_color_stops (hb_color_line_t *color_line,
|
||||
unsigned int start,
|
||||
unsigned int *count,
|
||||
hb_color_stop_t *color_stops);
|
||||
|
||||
/**
|
||||
* hb_paint_extend_t:
|
||||
*
|
||||
|
@ -337,6 +322,51 @@ typedef enum {
|
|||
HB_PAINT_EXTEND_REFLECT
|
||||
} hb_paint_extend_t;
|
||||
|
||||
typedef struct hb_color_line_t hb_color_line_t;
|
||||
|
||||
typedef unsigned int (*hb_color_line_get_color_stops_func_t) (hb_color_line_t *color_line,
|
||||
void *color_line_data,
|
||||
unsigned int start,
|
||||
unsigned int *count,
|
||||
hb_color_stop_t *color_stops,
|
||||
void *user_data);
|
||||
|
||||
typedef hb_paint_extend_t (*hb_color_line_get_extend_func_t) (hb_color_line_t *color_line,
|
||||
void *color_line_data,
|
||||
void *user_data);
|
||||
|
||||
/**
|
||||
* hb_color_line_t:
|
||||
*
|
||||
* A struct containing color information for a gradient.
|
||||
*
|
||||
* Since: REPLACEME
|
||||
*/
|
||||
struct hb_color_line_t {
|
||||
void *data;
|
||||
|
||||
hb_color_line_get_color_stops_func_t get_color_stops;
|
||||
void *get_color_stops_user_data;
|
||||
|
||||
hb_color_line_get_extend_func_t get_extend;
|
||||
void *get_extend_user_data;
|
||||
|
||||
void *reserved0;
|
||||
void *reserved1;
|
||||
void *reserved2;
|
||||
void *reserved3;
|
||||
void *reserved5;
|
||||
void *reserved6;
|
||||
void *reserved7;
|
||||
void *reserved8;
|
||||
};
|
||||
|
||||
HB_EXTERN unsigned int
|
||||
hb_color_line_get_color_stops (hb_color_line_t *color_line,
|
||||
unsigned int start,
|
||||
unsigned int *count,
|
||||
hb_color_stop_t *color_stops);
|
||||
|
||||
HB_EXTERN hb_paint_extend_t
|
||||
hb_color_line_get_extend (hb_color_line_t *color_line);
|
||||
|
||||
|
|
Loading…
Reference in New Issue