[paint] Simplify api
Drop the hb_paint_context_t struct from the API, and only pass the font where we need it.
This commit is contained in:
parent
71bd5a0dfc
commit
6387004cad
|
@ -230,7 +230,6 @@ hb_paint_funcs_get_user_data
|
|||
hb_paint_funcs_make_immutable
|
||||
hb_paint_funcs_is_immutable
|
||||
|
||||
hb_paint_context_t
|
||||
hb_paint_push_transform_func_t
|
||||
hb_paint_funcs_set_push_transform_func
|
||||
hb_paint_pop_transform_func_t
|
||||
|
|
|
@ -335,19 +335,13 @@ struct glyf_accelerator_t
|
|||
|
||||
bool paint_glyph (hb_font_t *font, hb_codepoint_t gid, hb_paint_funcs_t *funcs, void *data, hb_color_t foreground) const
|
||||
{
|
||||
hb_paint_context_t ctx;
|
||||
funcs->push_root_transform (data, font);
|
||||
|
||||
ctx.font = font;
|
||||
ctx.palette = 0;
|
||||
ctx.foreground = foreground;
|
||||
funcs->push_clip_glyph (data, gid, font);
|
||||
funcs->color (data, foreground);
|
||||
funcs->pop_clip (data);
|
||||
|
||||
funcs->push_root_transform (data, &ctx);
|
||||
|
||||
funcs->push_clip_glyph (data, gid, &ctx);
|
||||
funcs->color (data, hb_paint_get_color (&ctx, 0xffff, 1.), &ctx);
|
||||
funcs->pop_clip (data, &ctx);
|
||||
|
||||
funcs->pop_root_transform (data, &ctx);
|
||||
funcs->pop_root_transform (data);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -661,25 +661,17 @@ hb_font_paint_glyph_default (hb_font_t *font,
|
|||
hb_color_t foreground,
|
||||
void *user_data)
|
||||
{
|
||||
hb_paint_context_t ctx;
|
||||
|
||||
ctx.font = font;
|
||||
ctx.palette = palette;
|
||||
ctx.foreground = foreground;
|
||||
|
||||
paint_funcs->push_transform (paint_data,
|
||||
font->parent->x_scale ? (float) font->x_scale / (float) font->parent->x_scale : 0.f,
|
||||
font->parent->y_scale ? (font->slant - font->parent->slant) *
|
||||
(float) font->x_scale / (float) font->parent->y_scale : 0.f,
|
||||
0.f,
|
||||
font->parent->y_scale ? (float) font->y_scale / (float) font->parent->y_scale : 0.f,
|
||||
0.f,
|
||||
0.f,
|
||||
&ctx);
|
||||
0.f, 0.f);
|
||||
|
||||
font->parent->paint_glyph (glyph, paint_funcs, paint_data, palette, foreground);
|
||||
|
||||
paint_funcs->pop_transform (paint_data, &ctx);
|
||||
paint_funcs->pop_transform (paint_data);
|
||||
}
|
||||
|
||||
DEFINE_NULL_INSTANCE (hb_font_funcs_t) =
|
||||
|
|
|
@ -555,19 +555,13 @@ bool _get_path (const OT::cff1::accelerator_t *cff, hb_font_t *font, hb_codepoin
|
|||
|
||||
bool OT::cff1::accelerator_t::paint_glyph (hb_font_t *font, hb_codepoint_t glyph, hb_paint_funcs_t *funcs, void *data, hb_color_t foreground) const
|
||||
{
|
||||
hb_paint_context_t ctx;
|
||||
funcs->push_root_transform (data, font);
|
||||
|
||||
ctx.font = font;
|
||||
ctx.palette = 0;
|
||||
ctx.foreground = foreground;
|
||||
funcs->push_clip_glyph (data, glyph, font);
|
||||
funcs->color (data, foreground);
|
||||
funcs->pop_clip (data);
|
||||
|
||||
funcs->push_root_transform (data, &ctx);
|
||||
|
||||
funcs->push_clip_glyph (data, glyph, &ctx);
|
||||
funcs->color (data, hb_paint_get_color (&ctx, 0xffff, 1.), &ctx);
|
||||
funcs->pop_clip (data, &ctx);
|
||||
|
||||
funcs->pop_root_transform (data, &ctx);
|
||||
funcs->pop_root_transform (data);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -145,19 +145,13 @@ bool OT::cff2::accelerator_t::get_extents (hb_font_t *font,
|
|||
|
||||
bool OT::cff2::accelerator_t::paint_glyph (hb_font_t *font, hb_codepoint_t glyph, hb_paint_funcs_t *funcs, void *data, hb_color_t foreground) const
|
||||
{
|
||||
hb_paint_context_t ctx;
|
||||
funcs->push_root_transform (data, font);
|
||||
|
||||
ctx.font = font;
|
||||
ctx.palette = 0;
|
||||
ctx.foreground = foreground;
|
||||
funcs->push_clip_glyph (data, glyph, font);
|
||||
funcs->color (data, foreground);
|
||||
funcs->pop_clip (data);
|
||||
|
||||
funcs->push_root_transform (data, &ctx);
|
||||
|
||||
funcs->push_clip_glyph (data, glyph, &ctx);
|
||||
funcs->color (data, hb_paint_get_color (&ctx, 0xffff, 1.), &ctx);
|
||||
funcs->pop_clip (data, &ctx);
|
||||
|
||||
funcs->pop_root_transform (data, &ctx);
|
||||
funcs->pop_root_transform (data);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -939,7 +939,6 @@ struct CBDT
|
|||
|
||||
bool paint_glyph (hb_font_t *font, hb_codepoint_t glyph, hb_paint_funcs_t *funcs, void *data) const
|
||||
{
|
||||
hb_paint_context_t ctx;
|
||||
hb_glyph_extents_t extents;
|
||||
hb_blob_t *blob = reference_png (font, glyph);
|
||||
|
||||
|
@ -949,11 +948,7 @@ struct CBDT
|
|||
if (unlikely (!hb_font_get_glyph_extents (font, glyph, &extents)))
|
||||
return false;
|
||||
|
||||
ctx.font = font;
|
||||
ctx.palette = 0;
|
||||
ctx.foreground = HB_COLOR (0, 0, 0, 255);
|
||||
|
||||
funcs->image (data, blob, HB_PAINT_IMAGE_FORMAT_PNG, &extents, &ctx);
|
||||
funcs->image (data, blob, HB_PAINT_IMAGE_FORMAT_PNG, &extents);
|
||||
|
||||
hb_blob_destroy (blob);
|
||||
return true;
|
||||
|
|
|
@ -2,19 +2,19 @@
|
|||
|
||||
namespace OT {
|
||||
|
||||
void PaintColrLayers::paint_glyph (hb_ot_paint_context_t *c) const
|
||||
void PaintColrLayers::paint_glyph (hb_paint_context_t *c) const
|
||||
{
|
||||
const LayerList &paint_offset_lists = c->get_colr_table ()->get_layerList ();
|
||||
for (unsigned i = firstLayerIndex; i < firstLayerIndex + numLayers; i++)
|
||||
{
|
||||
const Paint &paint = paint_offset_lists.get_paint (i);
|
||||
c->funcs->push_group (c->data, &c->ctx);
|
||||
c->funcs->push_group (c->data);
|
||||
c->recurse (paint);
|
||||
c->funcs->pop_group (c->data, HB_PAINT_COMPOSITE_MODE_SRC_OVER, &c->ctx);
|
||||
c->funcs->pop_group (c->data, HB_PAINT_COMPOSITE_MODE_SRC_OVER);
|
||||
}
|
||||
}
|
||||
|
||||
void PaintColrGlyph::paint_glyph (hb_ot_paint_context_t *c) const
|
||||
void PaintColrGlyph::paint_glyph (hb_paint_context_t *c) const
|
||||
{
|
||||
const COLR *colr_table = c->get_colr_table ();
|
||||
const Paint *paint = colr_table->get_base_glyph_paint (gid);
|
||||
|
@ -51,9 +51,9 @@ hb_color_line_get_color_stops (hb_color_line_t *color_line,
|
|||
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->ctx, start, count, color_stops, color_line->c->instancer);
|
||||
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->ctx, start, count, color_stops, color_line->c->instancer);
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -46,11 +46,11 @@
|
|||
|
||||
|
||||
namespace OT {
|
||||
struct hb_ot_paint_context_t;
|
||||
struct hb_paint_context_t;
|
||||
}
|
||||
|
||||
struct hb_color_line_t {
|
||||
struct OT::hb_ot_paint_context_t *c;
|
||||
struct OT::hb_paint_context_t *c;
|
||||
const void *base;
|
||||
bool is_variable;
|
||||
};
|
||||
|
@ -61,8 +61,8 @@ struct COLR;
|
|||
|
||||
struct Paint;
|
||||
|
||||
struct hb_ot_paint_context_t :
|
||||
hb_dispatch_context_t<hb_ot_paint_context_t>
|
||||
struct hb_paint_context_t :
|
||||
hb_dispatch_context_t<hb_paint_context_t>
|
||||
{
|
||||
template <typename T>
|
||||
return_t dispatch (const T &obj) { obj.paint_glyph (this); return hb_empty_t (); }
|
||||
|
@ -75,24 +75,45 @@ public:
|
|||
const void *base;
|
||||
hb_paint_funcs_t *funcs;
|
||||
void *data;
|
||||
hb_paint_context_t ctx;
|
||||
hb_font_t *font;
|
||||
unsigned int palette;
|
||||
hb_color_t foreground;
|
||||
VarStoreInstancer &instancer;
|
||||
int depth_left = HB_COLRV1_MAX_NESTING_LEVEL;
|
||||
|
||||
hb_ot_paint_context_t (const void *base_,
|
||||
hb_paint_context_t (const void *base_,
|
||||
hb_paint_funcs_t *funcs_,
|
||||
void *data_,
|
||||
hb_font_t *font_,
|
||||
unsigned int palette,
|
||||
hb_color_t foreground,
|
||||
unsigned int palette_,
|
||||
hb_color_t foreground_,
|
||||
VarStoreInstancer &instancer_) :
|
||||
base (base_),
|
||||
funcs (funcs_),
|
||||
data (data_),
|
||||
font (font_),
|
||||
palette (palette_),
|
||||
foreground (foreground_),
|
||||
instancer (instancer_)
|
||||
{ ctx.font = font_;
|
||||
ctx.palette = palette;
|
||||
ctx.foreground = foreground; }
|
||||
{ }
|
||||
|
||||
hb_color_t get_color (unsigned int color_index, float alpha)
|
||||
{
|
||||
hb_color_t color = foreground;
|
||||
|
||||
if (color_index != 0xffff)
|
||||
{
|
||||
unsigned int clen = 1;
|
||||
hb_face_t *face = hb_font_get_face (font);
|
||||
|
||||
hb_ot_color_palette_get_colors (face, palette, color_index, &clen, &color);
|
||||
}
|
||||
|
||||
return HB_COLOR (hb_color_get_blue (color),
|
||||
hb_color_get_green (color),
|
||||
hb_color_get_red (color),
|
||||
hb_color_get_alpha (color) * alpha);
|
||||
}
|
||||
|
||||
inline void recurse (const Paint &paint);
|
||||
};
|
||||
|
@ -236,16 +257,16 @@ struct Variable
|
|||
return_trace (c->check_struct (this) && value.sanitize (c));
|
||||
}
|
||||
|
||||
void paint_glyph (hb_ot_paint_context_t *c) const
|
||||
void paint_glyph (hb_paint_context_t *c) const
|
||||
{
|
||||
value.paint_glyph (c, varIdxBase);
|
||||
}
|
||||
|
||||
void get_color_stop (hb_paint_context_t *ctx,
|
||||
hb_color_stop_t *c,
|
||||
void get_color_stop (hb_paint_context_t *c,
|
||||
hb_color_stop_t *stop,
|
||||
const VarStoreInstancer &instancer) const
|
||||
{
|
||||
value.get_color_stop (ctx, c, varIdxBase, instancer);
|
||||
value.get_color_stop (c, stop, varIdxBase, instancer);
|
||||
}
|
||||
|
||||
hb_paint_extend_t get_extend () const
|
||||
|
@ -289,16 +310,16 @@ struct NoVariable
|
|||
return_trace (c->check_struct (this) && value.sanitize (c));
|
||||
}
|
||||
|
||||
void paint_glyph (hb_ot_paint_context_t *c) const
|
||||
void paint_glyph (hb_paint_context_t *c) const
|
||||
{
|
||||
value.paint_glyph (c, varIdxBase);
|
||||
}
|
||||
|
||||
void get_color_stop (hb_paint_context_t *ctx,
|
||||
hb_color_stop_t *c,
|
||||
void get_color_stop (hb_paint_context_t *c,
|
||||
hb_color_stop_t *stop,
|
||||
const VarStoreInstancer &instancer) const
|
||||
{
|
||||
value.get_color_stop (ctx, c, VarIdx::NO_VARIATION, instancer);
|
||||
value.get_color_stop (c, stop, VarIdx::NO_VARIATION, instancer);
|
||||
}
|
||||
|
||||
hb_paint_extend_t get_extend () const
|
||||
|
@ -333,15 +354,13 @@ struct ColorStop
|
|||
return_trace (c->check_struct (this));
|
||||
}
|
||||
|
||||
void get_color_stop (hb_paint_context_t *ctx,
|
||||
void get_color_stop (hb_paint_context_t *c,
|
||||
hb_color_stop_t *out,
|
||||
uint32_t varIdx,
|
||||
const VarStoreInstancer &instancer) const
|
||||
{
|
||||
out->offset = stopOffset.to_float(instancer (varIdx, 0));
|
||||
out->color = hb_paint_get_color (ctx,
|
||||
paletteIndex,
|
||||
alpha.to_float (instancer (varIdx, 1)));
|
||||
out->color = c->get_color (paletteIndex, alpha.to_float (instancer (varIdx, 1)));
|
||||
}
|
||||
|
||||
F2DOT14 stopOffset;
|
||||
|
@ -397,7 +416,7 @@ struct ColorLine
|
|||
|
||||
/* get up to count stops from start */
|
||||
unsigned int
|
||||
get_color_stops (hb_paint_context_t *ctx,
|
||||
get_color_stops (hb_paint_context_t *c,
|
||||
unsigned int start,
|
||||
unsigned int *count,
|
||||
hb_color_stop_t *color_stops,
|
||||
|
@ -409,7 +428,7 @@ struct ColorLine
|
|||
{
|
||||
unsigned int i;
|
||||
for (i = 0; i < *count && start + i < len; i++)
|
||||
stops[start + i].get_color_stop (ctx, &color_stops[i], instancer);
|
||||
stops[start + i].get_color_stop (c, &color_stops[i], instancer);
|
||||
*count = i;
|
||||
}
|
||||
|
||||
|
@ -484,7 +503,7 @@ struct Affine2x3
|
|||
return_trace (c->check_struct (this));
|
||||
}
|
||||
|
||||
void paint_glyph (hb_ot_paint_context_t *c, uint32_t varIdxBase) const
|
||||
void paint_glyph (hb_paint_context_t *c, uint32_t varIdxBase) const
|
||||
{
|
||||
c->funcs->push_transform (c->data,
|
||||
xx.to_float (c->instancer (varIdxBase, 0)),
|
||||
|
@ -492,8 +511,7 @@ struct Affine2x3
|
|||
xy.to_float (c->instancer (varIdxBase, 2)),
|
||||
yy.to_float (c->instancer (varIdxBase, 3)),
|
||||
dx.to_float (c->instancer (varIdxBase, 4)),
|
||||
dy.to_float (c->instancer (varIdxBase, 5)),
|
||||
&c->ctx);
|
||||
dy.to_float (c->instancer (varIdxBase, 5)));
|
||||
}
|
||||
|
||||
F16DOT16 xx;
|
||||
|
@ -527,7 +545,7 @@ struct PaintColrLayers
|
|||
return_trace (c->check_struct (this));
|
||||
}
|
||||
|
||||
HB_INTERNAL void paint_glyph (hb_ot_paint_context_t *c) const;
|
||||
HB_INTERNAL void paint_glyph (hb_paint_context_t *c) const;
|
||||
|
||||
HBUINT8 format; /* format = 1 */
|
||||
HBUINT8 numLayers;
|
||||
|
@ -556,13 +574,11 @@ struct PaintSolid
|
|||
return_trace (c->check_struct (this));
|
||||
}
|
||||
|
||||
void paint_glyph (hb_ot_paint_context_t *c, uint32_t varIdxBase) const
|
||||
void paint_glyph (hb_paint_context_t *c, uint32_t varIdxBase) const
|
||||
{
|
||||
c->funcs->color (c->data,
|
||||
hb_paint_get_color (&c->ctx,
|
||||
paletteIndex,
|
||||
alpha.to_float (c->instancer (varIdxBase, 0))),
|
||||
&c->ctx);
|
||||
c->get_color (paletteIndex,
|
||||
alpha.to_float (c->instancer (varIdxBase, 0))));
|
||||
}
|
||||
|
||||
HBUINT8 format; /* format = 2(noVar) or 3(Var)*/
|
||||
|
@ -593,7 +609,7 @@ struct PaintLinearGradient
|
|||
return_trace (c->check_struct (this) && colorLine.sanitize (c, this));
|
||||
}
|
||||
|
||||
void paint_glyph (hb_ot_paint_context_t *c, uint32_t varIdxBase) const
|
||||
void paint_glyph (hb_paint_context_t *c, uint32_t varIdxBase) const
|
||||
{
|
||||
hb_color_line_t cl = { c, &(this+colorLine), Var<HBUINT8>::is_variable };
|
||||
|
||||
|
@ -603,8 +619,7 @@ struct PaintLinearGradient
|
|||
x1 + c->instancer (varIdxBase, 2),
|
||||
y1 + c->instancer (varIdxBase, 3),
|
||||
x2 + c->instancer (varIdxBase, 4),
|
||||
y2 + c->instancer (varIdxBase, 5),
|
||||
&c->ctx);
|
||||
y2 + c->instancer (varIdxBase, 5));
|
||||
}
|
||||
|
||||
HBUINT8 format; /* format = 4(noVar) or 5 (Var) */
|
||||
|
@ -641,7 +656,7 @@ struct PaintRadialGradient
|
|||
return_trace (c->check_struct (this) && colorLine.sanitize (c, this));
|
||||
}
|
||||
|
||||
void paint_glyph (hb_ot_paint_context_t *c, uint32_t varIdxBase) const
|
||||
void paint_glyph (hb_paint_context_t *c, uint32_t varIdxBase) const
|
||||
{
|
||||
hb_color_line_t cl = { c, &(this+colorLine), Var<HBUINT8>::is_variable };
|
||||
|
||||
|
@ -651,8 +666,7 @@ struct PaintRadialGradient
|
|||
radius0 + c->instancer (varIdxBase, 2),
|
||||
x1 + c->instancer (varIdxBase, 3),
|
||||
y1 + c->instancer (varIdxBase, 4),
|
||||
radius1 + c->instancer (varIdxBase, 5),
|
||||
&c->ctx);
|
||||
radius1 + c->instancer (varIdxBase, 5));
|
||||
}
|
||||
|
||||
HBUINT8 format; /* format = 6(noVar) or 7 (Var) */
|
||||
|
@ -689,7 +703,7 @@ struct PaintSweepGradient
|
|||
return_trace (c->check_struct (this) && colorLine.sanitize (c, this));
|
||||
}
|
||||
|
||||
void paint_glyph (hb_ot_paint_context_t *c, uint32_t varIdxBase) const
|
||||
void paint_glyph (hb_paint_context_t *c, uint32_t varIdxBase) const
|
||||
{
|
||||
hb_color_line_t cl = { c, &(this+colorLine), Var<HBUINT8>::is_variable };
|
||||
|
||||
|
@ -697,8 +711,7 @@ struct PaintSweepGradient
|
|||
centerX + c->instancer (varIdxBase, 0),
|
||||
centerY + c->instancer (varIdxBase, 1),
|
||||
(startAngle.to_float (c->instancer (varIdxBase, 2)) + 1) * (float) M_PI,
|
||||
(endAngle.to_float (c->instancer (varIdxBase, 3)) + 1) * (float) M_PI,
|
||||
&c->ctx);
|
||||
(endAngle.to_float (c->instancer (varIdxBase, 3)) + 1) * (float) M_PI);
|
||||
}
|
||||
|
||||
HBUINT8 format; /* format = 8(noVar) or 9 (Var) */
|
||||
|
@ -736,13 +749,13 @@ struct PaintGlyph
|
|||
return_trace (c->check_struct (this) && paint.sanitize (c, this));
|
||||
}
|
||||
|
||||
void paint_glyph (hb_ot_paint_context_t *c) const
|
||||
void paint_glyph (hb_paint_context_t *c) const
|
||||
{
|
||||
c->funcs->push_inverse_root_transform (c->data, &c->ctx);
|
||||
c->funcs->push_clip_glyph (c->data, gid, &c->ctx);
|
||||
c->funcs->push_inverse_root_transform (c->data, c->font);
|
||||
c->funcs->push_clip_glyph (c->data, gid, c->font);
|
||||
c->recurse (this+paint);
|
||||
c->funcs->pop_clip (c->data, &c->ctx);
|
||||
c->funcs->pop_inverse_root_transform (c->data, &c->ctx);
|
||||
c->funcs->pop_clip (c->data);
|
||||
c->funcs->pop_inverse_root_transform (c->data);
|
||||
}
|
||||
|
||||
HBUINT8 format; /* format = 10 */
|
||||
|
@ -772,7 +785,7 @@ struct PaintColrGlyph
|
|||
return_trace (c->check_struct (this));
|
||||
}
|
||||
|
||||
HB_INTERNAL void paint_glyph (hb_ot_paint_context_t *c) const;
|
||||
HB_INTERNAL void paint_glyph (hb_paint_context_t *c) const;
|
||||
|
||||
HBUINT8 format; /* format = 11 */
|
||||
HBUINT16 gid;
|
||||
|
@ -802,11 +815,11 @@ struct PaintTransform
|
|||
transform.sanitize (c, this));
|
||||
}
|
||||
|
||||
void paint_glyph (hb_ot_paint_context_t *c) const
|
||||
void paint_glyph (hb_paint_context_t *c) const
|
||||
{
|
||||
(this+transform).paint_glyph (c);
|
||||
c->recurse (this+src);
|
||||
c->funcs->pop_transform (c->data, &c->ctx);
|
||||
c->funcs->pop_transform (c->data);
|
||||
}
|
||||
|
||||
HBUINT8 format; /* format = 12(noVar) or 13 (Var) */
|
||||
|
@ -835,15 +848,14 @@ struct PaintTranslate
|
|||
return_trace (c->check_struct (this) && src.sanitize (c, this));
|
||||
}
|
||||
|
||||
void paint_glyph (hb_ot_paint_context_t *c, uint32_t varIdxBase) const
|
||||
void paint_glyph (hb_paint_context_t *c, uint32_t varIdxBase) const
|
||||
{
|
||||
c->funcs->push_transform (c->data,
|
||||
1., 0., 0., 1.,
|
||||
dx + c->instancer (varIdxBase, 0),
|
||||
dy + c->instancer (varIdxBase, 0),
|
||||
&c->ctx);
|
||||
dy + c->instancer (varIdxBase, 0));
|
||||
c->recurse (this+src);
|
||||
c->funcs->pop_transform (c->data, &c->ctx);
|
||||
c->funcs->pop_transform (c->data);
|
||||
}
|
||||
|
||||
HBUINT8 format; /* format = 14(noVar) or 15 (Var) */
|
||||
|
@ -873,16 +885,15 @@ struct PaintScale
|
|||
return_trace (c->check_struct (this) && src.sanitize (c, this));
|
||||
}
|
||||
|
||||
void paint_glyph (hb_ot_paint_context_t *c, uint32_t varIdxBase) const
|
||||
void paint_glyph (hb_paint_context_t *c, uint32_t varIdxBase) const
|
||||
{
|
||||
c->funcs->push_transform (c->data,
|
||||
scaleX.to_float (c->instancer (varIdxBase, 0)),
|
||||
0., 0.,
|
||||
scaleY.to_float (c->instancer (varIdxBase, 1)),
|
||||
0., 0.,
|
||||
&c->ctx);
|
||||
0., 0.);
|
||||
c->recurse (this+src);
|
||||
c->funcs->pop_transform (c->data, &c->ctx);
|
||||
c->funcs->pop_transform (c->data);
|
||||
}
|
||||
|
||||
HBUINT8 format; /* format = 16 (noVar) or 17(Var) */
|
||||
|
@ -912,24 +923,21 @@ struct PaintScaleAroundCenter
|
|||
return_trace (c->check_struct (this) && src.sanitize (c, this));
|
||||
}
|
||||
|
||||
void paint_glyph (hb_ot_paint_context_t *c, uint32_t varIdxBase) const
|
||||
void paint_glyph (hb_paint_context_t *c, uint32_t varIdxBase) const
|
||||
{
|
||||
float tCenterX = centerX + c->instancer (varIdxBase, 2);
|
||||
float tCenterY = centerY + c->instancer (varIdxBase, 3);
|
||||
c->funcs->push_transform (c->data, 0., 0., 0., 0., +tCenterX, +tCenterY,
|
||||
&c->ctx);
|
||||
c->funcs->push_transform (c->data, 0., 0., 0., 0., +tCenterX, +tCenterY);
|
||||
c->funcs->push_transform (c->data,
|
||||
scaleX.to_float (c->instancer (varIdxBase, 0)),
|
||||
0., 0.,
|
||||
scaleY.to_float (c->instancer (varIdxBase, 1)),
|
||||
0., 0.,
|
||||
&c->ctx);
|
||||
c->funcs->push_transform (c->data, 0., 0., 0., 0., -tCenterX, -tCenterY,
|
||||
&c->ctx);
|
||||
0., 0.);
|
||||
c->funcs->push_transform (c->data, 0., 0., 0., 0., -tCenterX, -tCenterY);
|
||||
c->recurse (this+src);
|
||||
c->funcs->pop_transform (c->data, &c->ctx);
|
||||
c->funcs->pop_transform (c->data, &c->ctx);
|
||||
c->funcs->pop_transform (c->data, &c->ctx);
|
||||
c->funcs->pop_transform (c->data);
|
||||
c->funcs->pop_transform (c->data);
|
||||
c->funcs->pop_transform (c->data);
|
||||
}
|
||||
|
||||
HBUINT8 format; /* format = 18 (noVar) or 19(Var) */
|
||||
|
@ -961,13 +969,12 @@ struct PaintScaleUniform
|
|||
return_trace (c->check_struct (this) && src.sanitize (c, this));
|
||||
}
|
||||
|
||||
void paint_glyph (hb_ot_paint_context_t *c, uint32_t varIdxBase) const
|
||||
void paint_glyph (hb_paint_context_t *c, uint32_t varIdxBase) const
|
||||
{
|
||||
float s = scale + c->instancer (varIdxBase, 0);
|
||||
c->funcs->push_transform (c->data, s, 0., 0., s, 0., 0.,
|
||||
&c->ctx);
|
||||
c->funcs->push_transform (c->data, s, 0., 0., s, 0., 0.);
|
||||
c->recurse (this+src);
|
||||
c->funcs->pop_transform (c->data, &c->ctx);
|
||||
c->funcs->pop_transform (c->data);
|
||||
}
|
||||
|
||||
HBUINT8 format; /* format = 20 (noVar) or 21(Var) */
|
||||
|
@ -996,21 +1003,18 @@ struct PaintScaleUniformAroundCenter
|
|||
return_trace (c->check_struct (this) && src.sanitize (c, this));
|
||||
}
|
||||
|
||||
void paint_glyph (hb_ot_paint_context_t *c, uint32_t varIdxBase) const
|
||||
void paint_glyph (hb_paint_context_t *c, uint32_t varIdxBase) const
|
||||
{
|
||||
float s = scale + c->instancer (varIdxBase, 0);
|
||||
float tCenterX = centerX + c->instancer (varIdxBase, 1);
|
||||
float tCenterY = centerY + c->instancer (varIdxBase, 2);
|
||||
c->funcs->push_transform (c->data, 0., 0., 0., 0., +tCenterX, +tCenterY,
|
||||
&c->ctx);
|
||||
c->funcs->push_transform (c->data, s, 0., 0., s, 0., 0.,
|
||||
&c->ctx);
|
||||
c->funcs->push_transform (c->data, 0., 0., 0., 0., -tCenterX, -tCenterY,
|
||||
&c->ctx);
|
||||
c->funcs->push_transform (c->data, 0., 0., 0., 0., +tCenterX, +tCenterY);
|
||||
c->funcs->push_transform (c->data, s, 0., 0., s, 0., 0.);
|
||||
c->funcs->push_transform (c->data, 0., 0., 0., 0., -tCenterX, -tCenterY);
|
||||
c->recurse (this+src);
|
||||
c->funcs->pop_transform (c->data, &c->ctx);
|
||||
c->funcs->pop_transform (c->data, &c->ctx);
|
||||
c->funcs->pop_transform (c->data, &c->ctx);
|
||||
c->funcs->pop_transform (c->data);
|
||||
c->funcs->pop_transform (c->data);
|
||||
c->funcs->pop_transform (c->data);
|
||||
}
|
||||
|
||||
HBUINT8 format; /* format = 22 (noVar) or 23(Var) */
|
||||
|
@ -1041,15 +1045,14 @@ struct PaintRotate
|
|||
return_trace (c->check_struct (this) && src.sanitize (c, this));
|
||||
}
|
||||
|
||||
void paint_glyph (hb_ot_paint_context_t *c, uint32_t varIdxBase) const
|
||||
void paint_glyph (hb_paint_context_t *c, uint32_t varIdxBase) const
|
||||
{
|
||||
float a = angle.to_float (c->instancer (varIdxBase, 0));
|
||||
float cc = cosf (a * (float) M_PI);
|
||||
float ss = sinf (a * (float) M_PI);
|
||||
c->funcs->push_transform (c->data, cc, ss, -ss, cc, 0., 0.,
|
||||
&c->ctx);
|
||||
c->funcs->push_transform (c->data, cc, ss, -ss, cc, 0., 0.);
|
||||
c->recurse (this+src);
|
||||
c->funcs->pop_transform (c->data, &c->ctx);
|
||||
c->funcs->pop_transform (c->data);
|
||||
}
|
||||
|
||||
HBUINT8 format; /* format = 24 (noVar) or 25(Var) */
|
||||
|
@ -1078,23 +1081,20 @@ struct PaintRotateAroundCenter
|
|||
return_trace (c->check_struct (this) && src.sanitize (c, this));
|
||||
}
|
||||
|
||||
void paint_glyph (hb_ot_paint_context_t *c, uint32_t varIdxBase) const
|
||||
void paint_glyph (hb_paint_context_t *c, uint32_t varIdxBase) const
|
||||
{
|
||||
float a = angle.to_float (c->instancer (varIdxBase, 0));
|
||||
float cc = cosf (a * (float) M_PI);
|
||||
float ss = sinf (a * (float) M_PI);
|
||||
float tCenterX = centerX + c->instancer (varIdxBase, 1);
|
||||
float tCenterY = centerY + c->instancer (varIdxBase, 2);
|
||||
c->funcs->push_transform (c->data, 0., 0., 0., 0., +tCenterX, +tCenterY,
|
||||
&c->ctx);
|
||||
c->funcs->push_transform (c->data, cc, ss, -ss, cc, 0., 0.,
|
||||
&c->ctx);
|
||||
c->funcs->push_transform (c->data, 0., 0., 0., 0., -tCenterX, -tCenterY,
|
||||
&c->ctx);
|
||||
c->funcs->push_transform (c->data, 0., 0., 0., 0., +tCenterX, +tCenterY);
|
||||
c->funcs->push_transform (c->data, cc, ss, -ss, cc, 0., 0.);
|
||||
c->funcs->push_transform (c->data, 0., 0., 0., 0., -tCenterX, -tCenterY);
|
||||
c->recurse (this+src);
|
||||
c->funcs->pop_transform (c->data, &c->ctx);
|
||||
c->funcs->pop_transform (c->data, &c->ctx);
|
||||
c->funcs->pop_transform (c->data, &c->ctx);
|
||||
c->funcs->pop_transform (c->data);
|
||||
c->funcs->pop_transform (c->data);
|
||||
c->funcs->pop_transform (c->data);
|
||||
}
|
||||
|
||||
HBUINT8 format; /* format = 26 (noVar) or 27(Var) */
|
||||
|
@ -1125,14 +1125,13 @@ struct PaintSkew
|
|||
return_trace (c->check_struct (this) && src.sanitize (c, this));
|
||||
}
|
||||
|
||||
void paint_glyph (hb_ot_paint_context_t *c, uint32_t varIdxBase) const
|
||||
void paint_glyph (hb_paint_context_t *c, uint32_t varIdxBase) const
|
||||
{
|
||||
float x = +tanf (xSkewAngle.to_float(c->instancer (varIdxBase, 0)) * (float) M_PI);
|
||||
float y = -tanf (ySkewAngle.to_float(c->instancer (varIdxBase, 1)) * (float) M_PI);
|
||||
c->funcs->push_transform (c->data, 1., y, x, 1., 0., 0.,
|
||||
&c->ctx);
|
||||
c->funcs->push_transform (c->data, 1., y, x, 1., 0., 0.);
|
||||
c->recurse (this+src);
|
||||
c->funcs->pop_transform (c->data, &c->ctx);
|
||||
c->funcs->pop_transform (c->data);
|
||||
}
|
||||
|
||||
HBUINT8 format; /* format = 28(noVar) or 29 (Var) */
|
||||
|
@ -1162,22 +1161,19 @@ struct PaintSkewAroundCenter
|
|||
return_trace (c->check_struct (this) && src.sanitize (c, this));
|
||||
}
|
||||
|
||||
void paint_glyph (hb_ot_paint_context_t *c, uint32_t varIdxBase) const
|
||||
void paint_glyph (hb_paint_context_t *c, uint32_t varIdxBase) const
|
||||
{
|
||||
float x = +tanf (xSkewAngle.to_float(c->instancer (varIdxBase, 0)) * (float) M_PI);
|
||||
float y = -tanf (ySkewAngle.to_float(c->instancer (varIdxBase, 1)) * (float) M_PI);
|
||||
float tCenterX = centerX + c->instancer (varIdxBase, 2);
|
||||
float tCenterY = centerY + c->instancer (varIdxBase, 3);
|
||||
c->funcs->push_transform (c->data, 0., 0., 0., 0., +tCenterX, +tCenterY,
|
||||
&c->ctx);
|
||||
c->funcs->push_transform (c->data, 1., y, x, 1., 0., 0.,
|
||||
&c->ctx);
|
||||
c->funcs->push_transform (c->data, 0., 0., 0., 0., -tCenterX, -tCenterY,
|
||||
&c->ctx);
|
||||
c->funcs->push_transform (c->data, 0., 0., 0., 0., +tCenterX, +tCenterY);
|
||||
c->funcs->push_transform (c->data, 1., y, x, 1., 0., 0.);
|
||||
c->funcs->push_transform (c->data, 0., 0., 0., 0., -tCenterX, -tCenterY);
|
||||
c->recurse (this+src);
|
||||
c->funcs->pop_transform (c->data, &c->ctx);
|
||||
c->funcs->pop_transform (c->data, &c->ctx);
|
||||
c->funcs->pop_transform (c->data, &c->ctx);
|
||||
c->funcs->pop_transform (c->data);
|
||||
c->funcs->pop_transform (c->data);
|
||||
c->funcs->pop_transform (c->data);
|
||||
}
|
||||
|
||||
HBUINT8 format; /* format = 30(noVar) or 31 (Var) */
|
||||
|
@ -1212,14 +1208,14 @@ struct PaintComposite
|
|||
backdrop.sanitize (c, this));
|
||||
}
|
||||
|
||||
void paint_glyph (hb_ot_paint_context_t *c) const
|
||||
void paint_glyph (hb_paint_context_t *c) const
|
||||
{
|
||||
c->funcs->push_group (c->data, &c->ctx);
|
||||
c->funcs->push_group (c->data);
|
||||
c->recurse (this+backdrop);
|
||||
c->funcs->push_group (c->data, &c->ctx);
|
||||
c->funcs->push_group (c->data);
|
||||
c->recurse (this+src);
|
||||
c->funcs->pop_group (c->data, (hb_paint_composite_mode_t) (int) mode, &c->ctx);
|
||||
c->funcs->pop_group (c->data, HB_PAINT_COMPOSITE_MODE_SRC_OVER, &c->ctx);
|
||||
c->funcs->pop_group (c->data, (hb_paint_composite_mode_t) (int) mode);
|
||||
c->funcs->pop_group (c->data, HB_PAINT_COMPOSITE_MODE_SRC_OVER);
|
||||
}
|
||||
|
||||
HBUINT8 format; /* format = 32 */
|
||||
|
@ -1974,17 +1970,17 @@ struct COLR
|
|||
this+varIdxMap,
|
||||
hb_array (font->coords, font->num_coords));
|
||||
|
||||
hb_ot_paint_context_t c (this, funcs, data, font, palette, foreground, instancer);
|
||||
hb_paint_context_t c (this, funcs, data, font, palette, foreground, instancer);
|
||||
|
||||
const Paint *paint = get_base_glyph_paint (glyph);
|
||||
if (paint)
|
||||
{
|
||||
// COLRv1 glyph
|
||||
c.funcs->push_root_transform (c.data, &c.ctx);
|
||||
c.funcs->push_root_transform (c.data, font);
|
||||
|
||||
c.recurse (*paint);
|
||||
|
||||
c.funcs->pop_root_transform (c.data, &c.ctx);
|
||||
c.funcs->pop_root_transform (c.data);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -1996,9 +1992,9 @@ struct COLR
|
|||
for (const auto &r : (this+layersZ).as_array (numLayers)
|
||||
.sub_array (record->firstLayerIdx, record->numLayers))
|
||||
{
|
||||
c.funcs->push_clip_glyph (c.data, r.glyphId, &c.ctx);
|
||||
c.funcs->color (c.data, hb_paint_get_color (&c.ctx, r.colorIdx, 1.), &c.ctx);
|
||||
c.funcs->pop_clip (c.data, &c.ctx);
|
||||
c.funcs->push_clip_glyph (c.data, r.glyphId, c.font);
|
||||
c.funcs->color (c.data, c.get_color (r.colorIdx, 1.));
|
||||
c.funcs->pop_clip (c.data);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -2030,7 +2026,7 @@ struct COLR_accelerator_t : COLR::accelerator_t {
|
|||
};
|
||||
|
||||
void
|
||||
hb_ot_paint_context_t::recurse (const Paint &paint)
|
||||
hb_paint_context_t::recurse (const Paint &paint)
|
||||
{
|
||||
depth_left--;
|
||||
if (depth_left > 0)
|
||||
|
|
|
@ -234,7 +234,6 @@ struct sbix
|
|||
|
||||
bool paint_glyph (hb_font_t *font, hb_codepoint_t glyph, hb_paint_funcs_t *funcs, void *data) const
|
||||
{
|
||||
hb_paint_context_t ctx = { font, 0, HB_COLOR (0, 0, 0, 255) };
|
||||
if (!has_data ())
|
||||
return false;
|
||||
|
||||
|
@ -249,7 +248,7 @@ struct sbix
|
|||
if (!hb_font_get_glyph_extents (font, glyph, &extents))
|
||||
return false;
|
||||
|
||||
funcs->image (data, blob, HB_PAINT_IMAGE_FORMAT_PNG, &extents, &ctx);
|
||||
funcs->image (data, blob, HB_PAINT_IMAGE_FORMAT_PNG, &extents);
|
||||
|
||||
hb_blob_destroy (blob);
|
||||
return true;
|
||||
|
|
|
@ -95,8 +95,6 @@ struct SVG
|
|||
|
||||
bool paint_glyph (hb_font_t *font HB_UNUSED, hb_codepoint_t glyph, hb_paint_funcs_t *funcs, void *data) const
|
||||
{
|
||||
hb_paint_context_t ctx = { font, 0, HB_COLOR (0, 0, 0, 255) };
|
||||
|
||||
if (!has_data ())
|
||||
return false;
|
||||
|
||||
|
@ -105,7 +103,7 @@ struct SVG
|
|||
if (blob == hb_blob_get_empty ())
|
||||
return false;
|
||||
|
||||
funcs->image (data, blob, HB_PAINT_IMAGE_FORMAT_SVG, nullptr, &ctx);
|
||||
funcs->image (data, blob, HB_PAINT_IMAGE_FORMAT_SVG, nullptr);
|
||||
|
||||
hb_blob_destroy (blob);
|
||||
return true;
|
||||
|
|
|
@ -47,35 +47,30 @@ hb_paint_push_transform_nil (hb_paint_funcs_t *funcs, void *paint_data,
|
|||
float xx, float yx,
|
||||
float xy, float yy,
|
||||
float dx, float dy,
|
||||
const hb_paint_context_t *ctx,
|
||||
void *user_data) {}
|
||||
|
||||
static void
|
||||
hb_paint_pop_transform_nil (hb_paint_funcs_t *funcs, void *paint_data,
|
||||
const hb_paint_context_t *ctx,
|
||||
void *user_data) {}
|
||||
|
||||
static void
|
||||
hb_paint_push_clip_glyph_nil (hb_paint_funcs_t *funcs, void *paint_data,
|
||||
hb_codepoint_t glyph,
|
||||
const hb_paint_context_t *ctx,
|
||||
hb_font_t *font,
|
||||
void *user_data) {}
|
||||
|
||||
static void
|
||||
hb_paint_push_clip_rectangle_nil (hb_paint_funcs_t *funcs, void *paint_data,
|
||||
float xmin, float ymin, float xmax, float ymax,
|
||||
const hb_paint_context_t *ctx,
|
||||
void *user_data) {}
|
||||
|
||||
static void
|
||||
hb_paint_pop_clip_nil (hb_paint_funcs_t *funcs, void *paint_data,
|
||||
const hb_paint_context_t *ctx,
|
||||
void *user_data) {}
|
||||
|
||||
static void
|
||||
hb_paint_color_nil (hb_paint_funcs_t *funcs, void *paint_data,
|
||||
hb_color_t color,
|
||||
const hb_paint_context_t *ctx,
|
||||
void *user_data) {}
|
||||
|
||||
static void
|
||||
|
@ -83,7 +78,6 @@ hb_paint_image_nil (hb_paint_funcs_t *funcs, void *paint_data,
|
|||
hb_blob_t *image,
|
||||
hb_tag_t format,
|
||||
hb_glyph_extents_t *extents,
|
||||
const hb_paint_context_t *ctx,
|
||||
void *user_data) {}
|
||||
|
||||
static void
|
||||
|
@ -92,7 +86,6 @@ hb_paint_linear_gradient_nil (hb_paint_funcs_t *funcs, void *paint_data,
|
|||
float x0, float y0,
|
||||
float x1, float y1,
|
||||
float x2, float y2,
|
||||
const hb_paint_context_t *ctx,
|
||||
void *user_data) {}
|
||||
|
||||
static void
|
||||
|
@ -100,7 +93,6 @@ hb_paint_radial_gradient_nil (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,
|
||||
const hb_paint_context_t *ctx,
|
||||
void *user_data) {}
|
||||
|
||||
static void
|
||||
|
@ -109,18 +101,15 @@ hb_paint_sweep_gradient_nil (hb_paint_funcs_t *funcs, void *paint_data,
|
|||
float x0, float y0,
|
||||
float start_angle,
|
||||
float end_angle,
|
||||
const hb_paint_context_t *ctx,
|
||||
void *user_data) {}
|
||||
|
||||
static void
|
||||
hb_paint_push_group_nil (hb_paint_funcs_t *funcs, void *paint_data,
|
||||
const hb_paint_context_t *ctx,
|
||||
void *user_data) {}
|
||||
|
||||
static void
|
||||
hb_paint_pop_group_nil (hb_paint_funcs_t *funcs, void *paint_data,
|
||||
hb_paint_composite_mode_t mode,
|
||||
const hb_paint_context_t *ctx,
|
||||
void *user_data) {}
|
||||
|
||||
static bool
|
||||
|
@ -393,7 +382,6 @@ hb_paint_funcs_is_immutable (hb_paint_funcs_t *funcs)
|
|||
* @yy: yy component of the transform matrix
|
||||
* @dx: dx component of the transform matrix
|
||||
* @dy: dy component of the transform matrix
|
||||
* @ctx: the paint context
|
||||
*
|
||||
* Perform a "push-transform" paint operation.
|
||||
*
|
||||
|
@ -403,27 +391,24 @@ 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,
|
||||
const hb_paint_context_t *ctx)
|
||||
float dx, float dy)
|
||||
{
|
||||
funcs->push_transform (paint_data, xx, yx, xy, yy, dx, dy, ctx);
|
||||
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
|
||||
* @ctx: the paint context
|
||||
*
|
||||
* Perform a "pop-transform" paint operation.
|
||||
*
|
||||
* Since: REPLACEME
|
||||
*/
|
||||
void
|
||||
hb_paint_pop_transform (hb_paint_funcs_t *funcs, void *paint_data,
|
||||
const hb_paint_context_t *ctx)
|
||||
hb_paint_pop_transform (hb_paint_funcs_t *funcs, void *paint_data)
|
||||
{
|
||||
funcs->pop_transform (paint_data, ctx);
|
||||
funcs->pop_transform (paint_data);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -431,7 +416,7 @@ hb_paint_pop_transform (hb_paint_funcs_t *funcs, void *paint_data,
|
|||
* @funcs: paint functions
|
||||
* @paint_data: associated data passed by the caller
|
||||
* @glyph: the glyph ID
|
||||
* @ctx: the paint context
|
||||
* @font: the font
|
||||
*
|
||||
* Perform a "push-clip-glyph" paint operation.
|
||||
*
|
||||
|
@ -440,9 +425,9 @@ hb_paint_pop_transform (hb_paint_funcs_t *funcs, void *paint_data,
|
|||
void
|
||||
hb_paint_push_clip_glyph (hb_paint_funcs_t *funcs, void *paint_data,
|
||||
hb_codepoint_t glyph,
|
||||
const hb_paint_context_t *ctx)
|
||||
hb_font_t *font)
|
||||
{
|
||||
funcs->push_clip_glyph (paint_data, glyph, ctx);
|
||||
funcs->push_clip_glyph (paint_data, glyph, font);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -453,7 +438,6 @@ hb_paint_push_clip_glyph (hb_paint_funcs_t *funcs, void *paint_data,
|
|||
* @ymin: min Y for the rectangle
|
||||
* @xmax: max X for the rectangle
|
||||
* @ymax: max Y for the rectangle
|
||||
* @ctx: the paint context
|
||||
*
|
||||
* Perform a "push-clip-rect" paint operation.
|
||||
*
|
||||
|
@ -461,27 +445,24 @@ hb_paint_push_clip_glyph (hb_paint_funcs_t *funcs, void *paint_data,
|
|||
*/
|
||||
void
|
||||
hb_paint_push_clip_rectangle (hb_paint_funcs_t *funcs, void *paint_data,
|
||||
float xmin, float ymin, float xmax, float ymax,
|
||||
const hb_paint_context_t *ctx)
|
||||
float xmin, float ymin, float xmax, float ymax)
|
||||
{
|
||||
funcs->push_clip_rectangle (paint_data, xmin, ymin, xmax, ymax, ctx);
|
||||
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
|
||||
* @ctx: the paint context
|
||||
*
|
||||
* Perform a "pop-clip" paint operation.
|
||||
*
|
||||
* Since: REPLACEME
|
||||
*/
|
||||
void
|
||||
hb_paint_pop_clip (hb_paint_funcs_t *funcs, void *paint_data,
|
||||
const hb_paint_context_t *ctx)
|
||||
hb_paint_pop_clip (hb_paint_funcs_t *funcs, void *paint_data)
|
||||
{
|
||||
funcs->pop_clip (paint_data, ctx);
|
||||
funcs->pop_clip (paint_data);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -489,7 +470,6 @@ hb_paint_pop_clip (hb_paint_funcs_t *funcs, void *paint_data,
|
|||
* @funcs: paint functions
|
||||
* @paint_data: associated data passed by the caller
|
||||
* @color: The color to use
|
||||
* @ctx: the paint context
|
||||
*
|
||||
* Perform a "color" paint operation.
|
||||
*
|
||||
|
@ -497,10 +477,9 @@ hb_paint_pop_clip (hb_paint_funcs_t *funcs, void *paint_data,
|
|||
*/
|
||||
void
|
||||
hb_paint_color (hb_paint_funcs_t *funcs, void *paint_data,
|
||||
hb_color_t color,
|
||||
const hb_paint_context_t *ctx)
|
||||
hb_color_t color)
|
||||
{
|
||||
funcs->color (paint_data, color, ctx);
|
||||
funcs->color (paint_data, color);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -510,7 +489,6 @@ hb_paint_color (hb_paint_funcs_t *funcs, void *paint_data,
|
|||
* @image: image data
|
||||
* @format: tag describing the image data format
|
||||
* @extents: (nullable): the extents of the glyph
|
||||
* @ctx: the paint context
|
||||
*
|
||||
* Perform a "image" paint operation.
|
||||
*
|
||||
|
@ -520,10 +498,9 @@ void
|
|||
hb_paint_image (hb_paint_funcs_t *funcs, void *paint_data,
|
||||
hb_blob_t *image,
|
||||
hb_tag_t format,
|
||||
hb_glyph_extents_t *extents,
|
||||
const hb_paint_context_t *ctx)
|
||||
hb_glyph_extents_t *extents)
|
||||
{
|
||||
funcs->image (paint_data, image, format, extents, ctx);
|
||||
funcs->image (paint_data, image, format, extents);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -537,7 +514,6 @@ hb_paint_image (hb_paint_funcs_t *funcs, void *paint_data,
|
|||
* @y1: Y coordinate of the second point
|
||||
* @x2: X coordinate of the third point
|
||||
* @y2: Y coordinate of the third point
|
||||
* @ctx: the paint context
|
||||
*
|
||||
* Perform a "linear-gradient" paint operation.
|
||||
*
|
||||
|
@ -548,10 +524,9 @@ 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,
|
||||
const hb_paint_context_t *ctx)
|
||||
float x2, float y2)
|
||||
{
|
||||
funcs->linear_gradient (paint_data, color_line, x0, y0, x1, y1, x2, y2, ctx);
|
||||
funcs->linear_gradient (paint_data, color_line, x0, y0, x1, y1, x2, y2);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -565,7 +540,6 @@ hb_paint_linear_gradient (hb_paint_funcs_t *funcs, void *paint_data,
|
|||
* @x1: X coordinate of the second circle's center
|
||||
* @y1: Y coordinate of the second circle's center
|
||||
* @r1: radius of the second circle
|
||||
* @ctx: the paint context
|
||||
*
|
||||
* Perform a "radial-gradient" paint operation.
|
||||
*
|
||||
|
@ -575,10 +549,9 @@ 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,
|
||||
const hb_paint_context_t *ctx)
|
||||
float x1, float y1, float r1)
|
||||
{
|
||||
funcs->radial_gradient (paint_data, color_line, x0, y0, r0, y1, x1, r1, ctx);
|
||||
funcs->radial_gradient (paint_data, color_line, x0, y0, r0, y1, x1, r1);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -590,7 +563,6 @@ hb_paint_radial_gradient (hb_paint_funcs_t *funcs, void *paint_data,
|
|||
* @y0: Y coordinate of the circle's center
|
||||
* @start_angle: the start angle
|
||||
* @end_angle: the end angle
|
||||
* @ctx: the paint context
|
||||
*
|
||||
* Perform a "sweep-gradient" paint operation.
|
||||
*
|
||||
|
@ -600,27 +572,24 @@ 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,
|
||||
const hb_paint_context_t *ctx)
|
||||
float start_angle, float end_angle)
|
||||
{
|
||||
funcs->sweep_gradient (paint_data, color_line, x0, y0, start_angle, end_angle, ctx);
|
||||
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
|
||||
* @ctx: the paint context
|
||||
*
|
||||
* Perform a "push-group" paint operation.
|
||||
*
|
||||
* Since: REPLACEME
|
||||
*/
|
||||
void
|
||||
hb_paint_push_group (hb_paint_funcs_t *funcs, void *paint_data,
|
||||
const hb_paint_context_t *ctx)
|
||||
hb_paint_push_group (hb_paint_funcs_t *funcs, void *paint_data)
|
||||
{
|
||||
funcs->push_group (paint_data, ctx);
|
||||
funcs->push_group (paint_data);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -628,7 +597,6 @@ hb_paint_push_group (hb_paint_funcs_t *funcs, void *paint_data,
|
|||
* @funcs: paint functions
|
||||
* @paint_data: associated data passed by the caller
|
||||
* @mode: the compositing mode to use
|
||||
* @ctx: the paint context
|
||||
*
|
||||
* Perform a "pop-group" paint operation.
|
||||
*
|
||||
|
@ -636,10 +604,9 @@ hb_paint_push_group (hb_paint_funcs_t *funcs, void *paint_data,
|
|||
*/
|
||||
void
|
||||
hb_paint_pop_group (hb_paint_funcs_t *funcs, void *paint_data,
|
||||
hb_paint_composite_mode_t mode,
|
||||
const hb_paint_context_t *ctx)
|
||||
hb_paint_composite_mode_t mode)
|
||||
{
|
||||
funcs->pop_group (paint_data, mode, ctx);
|
||||
funcs->pop_group (paint_data, mode);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -91,29 +91,6 @@ hb_paint_funcs_make_immutable (hb_paint_funcs_t *funcs);
|
|||
HB_EXTERN hb_bool_t
|
||||
hb_paint_funcs_is_immutable (hb_paint_funcs_t *funcs);
|
||||
|
||||
/**
|
||||
* hb_paint_context_t:
|
||||
* @font: the font that is painted with
|
||||
* @palette: the palette index
|
||||
* @foreground: the foreground color
|
||||
*
|
||||
* Context information that is passed to paint functions.
|
||||
*/
|
||||
typedef struct hb_paint_context_t {
|
||||
hb_font_t *font;
|
||||
unsigned int palette;
|
||||
hb_color_t foreground;
|
||||
|
||||
/*< private >*/
|
||||
hb_var_num_t reserved1;
|
||||
hb_var_num_t reserved2;
|
||||
hb_var_num_t reserved3;
|
||||
hb_var_num_t reserved4;
|
||||
hb_var_num_t reserved5;
|
||||
hb_var_num_t reserved6;
|
||||
hb_var_num_t reserved7;
|
||||
} hb_paint_context_t;
|
||||
|
||||
/**
|
||||
* hb_paint_push_transform_func_t:
|
||||
* @funcs: paint functions object
|
||||
|
@ -124,7 +101,6 @@ typedef struct hb_paint_context_t {
|
|||
* @yy: yy component of the transform matrix
|
||||
* @dx: dx component of the transform matrix
|
||||
* @dy: dy component of the transform matrix
|
||||
* @ctx: the paint context
|
||||
* @user_data: User data pointer passed to hb_paint_funcs_set_push_transform_func()
|
||||
*
|
||||
* A virtual method for the #hb_paint_funcs_t to apply
|
||||
|
@ -141,14 +117,12 @@ typedef void (*hb_paint_push_transform_func_t) (hb_paint_funcs_t *funcs,
|
|||
float xx, float yx,
|
||||
float xy, float yy,
|
||||
float dx, float dy,
|
||||
const hb_paint_context_t *ctx,
|
||||
void *user_data);
|
||||
|
||||
/**
|
||||
* hb_paint_pop_transform_func_t:
|
||||
* @funcs: paint functions object
|
||||
* @paint_data: The data accompanying the paint functions in hb_font_paint_glyph()
|
||||
* @ctx: the paint context
|
||||
* @user_data: User data pointer passed to hb_paint_funcs_set_pop_transform_func()
|
||||
*
|
||||
* A virtual method for the #hb_paint_funcs_t to undo
|
||||
|
@ -159,7 +133,6 @@ typedef void (*hb_paint_push_transform_func_t) (hb_paint_funcs_t *funcs,
|
|||
*/
|
||||
typedef void (*hb_paint_pop_transform_func_t) (hb_paint_funcs_t *funcs,
|
||||
void *paint_data,
|
||||
const hb_paint_context_t *ctx,
|
||||
void *user_data);
|
||||
|
||||
/**
|
||||
|
@ -167,7 +140,7 @@ typedef void (*hb_paint_pop_transform_func_t) (hb_paint_funcs_t *funcs,
|
|||
* @funcs: paint functions object
|
||||
* @paint_data: The data accompanying the paint functions in hb_font_paint_glyph()
|
||||
* @glyph: the glyph ID
|
||||
* @ctx: the paint context
|
||||
* @font: the font
|
||||
* @user_data: User data pointer passed to hb_paint_funcs_set_push_clip_glyph_func()
|
||||
*
|
||||
* A virtual method for the #hb_paint_funcs_t to clip
|
||||
|
@ -185,7 +158,7 @@ typedef void (*hb_paint_pop_transform_func_t) (hb_paint_funcs_t *funcs,
|
|||
typedef void (*hb_paint_push_clip_glyph_func_t) (hb_paint_funcs_t *funcs,
|
||||
void *paint_data,
|
||||
hb_codepoint_t glyph,
|
||||
const hb_paint_context_t *ctx,
|
||||
hb_font_t *font,
|
||||
void *user_data);
|
||||
|
||||
/**
|
||||
|
@ -196,7 +169,6 @@ typedef void (*hb_paint_push_clip_glyph_func_t) (hb_paint_funcs_t *funcs,
|
|||
* @ymin: min Y for the rectangle
|
||||
* @xmax: max X for the rectangle
|
||||
* @ymax: max Y for the rectangle
|
||||
* @ctx: the paint context
|
||||
* @user_data: User data pointer passed to hb_paint_funcs_set_push_clip_rectangle_func()
|
||||
*
|
||||
* A virtual method for the #hb_paint_funcs_t to clip
|
||||
|
@ -215,14 +187,12 @@ typedef void (*hb_paint_push_clip_rectangle_func_t) (hb_paint_funcs_t *funcs,
|
|||
void *paint_data,
|
||||
float xmin, float ymin,
|
||||
float xmax, float ymax,
|
||||
const hb_paint_context_t *ctx,
|
||||
void *user_data);
|
||||
|
||||
/**
|
||||
* hb_paint_pop_clip_func_t:
|
||||
* @funcs: paint functions object
|
||||
* @paint_data: The data accompanying the paint functions in hb_font_paint_glyph()
|
||||
* @ctx: the paint context
|
||||
* @user_data: User data pointer passed to hb_paint_funcs_set_pop_clip_func()
|
||||
*
|
||||
* A virtual method for the #hb_paint_funcs_t to undo
|
||||
|
@ -233,7 +203,6 @@ typedef void (*hb_paint_push_clip_rectangle_func_t) (hb_paint_funcs_t *funcs,
|
|||
*/
|
||||
typedef void (*hb_paint_pop_clip_func_t) (hb_paint_funcs_t *funcs,
|
||||
void *paint_data,
|
||||
const hb_paint_context_t *ctx,
|
||||
void *user_data);
|
||||
|
||||
/**
|
||||
|
@ -241,7 +210,6 @@ typedef void (*hb_paint_pop_clip_func_t) (hb_paint_funcs_t *funcs,
|
|||
* @funcs: paint functions object
|
||||
* @paint_data: The data accompanying the paint functions in hb_font_paint_glyph()
|
||||
* @color: The color to use
|
||||
* @ctx: The paint context
|
||||
* @user_data: User data pointer passed to hb_paint_funcs_set_color_func()
|
||||
*
|
||||
* A virtual method for the #hb_paint_funcs_t to paint a
|
||||
|
@ -252,7 +220,6 @@ typedef void (*hb_paint_pop_clip_func_t) (hb_paint_funcs_t *funcs,
|
|||
typedef void (*hb_paint_color_func_t) (hb_paint_funcs_t *funcs,
|
||||
void *paint_data,
|
||||
hb_color_t color,
|
||||
const hb_paint_context_t *ctx,
|
||||
void *user_data);
|
||||
|
||||
/**
|
||||
|
@ -276,7 +243,6 @@ typedef void (*hb_paint_color_func_t) (hb_paint_funcs_t *funcs,
|
|||
* @image: the image data
|
||||
* @format: the image format as a tag
|
||||
* @extents: (nullable): glyph extents
|
||||
* @ctx: the paint context
|
||||
* @user_data: User data pointer passed to hb_paint_funcs_set_image_func()
|
||||
*
|
||||
* A virtual method for the #hb_paint_funcs_t to paint the
|
||||
|
@ -297,7 +263,6 @@ typedef void (*hb_paint_image_func_t) (hb_paint_funcs_t *funcs,
|
|||
hb_blob_t *image,
|
||||
hb_tag_t format,
|
||||
hb_glyph_extents_t *extents,
|
||||
const hb_paint_context_t *ctx,
|
||||
void *user_data);
|
||||
|
||||
/**
|
||||
|
@ -362,7 +327,6 @@ hb_color_line_get_extend (hb_color_line_t *color_line);
|
|||
* @y1: Y coordinate of the second point
|
||||
* @x2: X coordinate of the third point
|
||||
* @y2: Y coordinate of the third point
|
||||
* @ctx: the paint context
|
||||
* @user_data: User data pointer passed to hb_paint_funcs_set_linear_gradient_func()
|
||||
*
|
||||
* A virtual method for the #hb_paint_funcs_t to paint a linear
|
||||
|
@ -383,7 +347,6 @@ typedef void (*hb_paint_linear_gradient_func_t) (hb_paint_funcs_t *funcs,
|
|||
float x0, float y0,
|
||||
float x1, float y1,
|
||||
float x2, float y2,
|
||||
const hb_paint_context_t *ctx,
|
||||
void *user_data);
|
||||
|
||||
/**
|
||||
|
@ -397,7 +360,6 @@ typedef void (*hb_paint_linear_gradient_func_t) (hb_paint_funcs_t *funcs,
|
|||
* @x1: X coordinate of the second circle's center
|
||||
* @y1: Y coordinate of the second circle's center
|
||||
* @r1: radius of the second circle
|
||||
* @ctx: the paint context
|
||||
* @user_data: User data pointer passed to hb_paint_funcs_set_radial_gradient_func()
|
||||
*
|
||||
* A virtual method for the #hb_paint_funcs_t to paint a radial
|
||||
|
@ -417,7 +379,6 @@ typedef void (*hb_paint_radial_gradient_func_t) (hb_paint_funcs_t *funcs,
|
|||
hb_color_line_t *color_line,
|
||||
float x0, float y0, float r0,
|
||||
float x1, float y1, float r1,
|
||||
const hb_paint_context_t *ctx,
|
||||
void *user_data);
|
||||
|
||||
/**
|
||||
|
@ -429,7 +390,6 @@ typedef void (*hb_paint_radial_gradient_func_t) (hb_paint_funcs_t *funcs,
|
|||
* @y0: Y coordinate of the circle's center
|
||||
* @start_angle: the start angle, in radians
|
||||
* @end_angle: the end angle, in radians
|
||||
* @ctx: the paint context
|
||||
* @user_data: User data pointer passed to hb_paint_funcs_set_sweep_gradient_func()
|
||||
*
|
||||
* A virtual method for the #hb_paint_funcs_t to paint a sweep
|
||||
|
@ -450,7 +410,6 @@ typedef void (*hb_paint_sweep_gradient_func_t) (hb_paint_funcs_t *funcs,
|
|||
float x0, float y0,
|
||||
float start_angle,
|
||||
float end_angle,
|
||||
const hb_paint_context_t *ctx,
|
||||
void *user_data);
|
||||
|
||||
/**
|
||||
|
@ -498,7 +457,6 @@ typedef enum {
|
|||
* hb_paint_push_group_func_t:
|
||||
* @funcs: paint functions object
|
||||
* @paint_data: The data accompanying the paint functions in hb_font_paint_glyph()
|
||||
* @ctx: the paint context
|
||||
* @user_data: User data pointer passed to hb_paint_funcs_set_push_group_func()
|
||||
*
|
||||
* A virtual method for the #hb_paint_funcs_t to use
|
||||
|
@ -512,7 +470,6 @@ typedef enum {
|
|||
*/
|
||||
typedef void (*hb_paint_push_group_func_t) (hb_paint_funcs_t *funcs,
|
||||
void *paint_data,
|
||||
const hb_paint_context_t *ctx,
|
||||
void *user_data);
|
||||
|
||||
/**
|
||||
|
@ -520,7 +477,6 @@ typedef void (*hb_paint_push_group_func_t) (hb_paint_funcs_t *funcs,
|
|||
* @funcs: paint functions object
|
||||
* @paint_data: The data accompanying the paint functions in hb_font_paint_glyph()
|
||||
* @mode: the compositing mode to use
|
||||
* @ctx: the paint context
|
||||
* @user_data: User data pointer passed to hb_paint_funcs_set_pop_group_func()
|
||||
*
|
||||
* A virtual method for the #hb_paint_funcs_t to undo
|
||||
|
@ -536,7 +492,6 @@ typedef void (*hb_paint_push_group_func_t) (hb_paint_funcs_t *funcs,
|
|||
typedef void (*hb_paint_pop_group_func_t) (hb_paint_funcs_t *funcs,
|
||||
void *paint_data,
|
||||
hb_paint_composite_mode_t mode,
|
||||
const hb_paint_context_t *ctx,
|
||||
void *user_data);
|
||||
|
||||
/**
|
||||
|
@ -747,47 +702,40 @@ 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,
|
||||
const hb_paint_context_t *ctx);
|
||||
float dx, float dy);
|
||||
|
||||
HB_EXTERN void
|
||||
hb_paint_pop_transform (hb_paint_funcs_t *funcs, void *paint_data,
|
||||
const hb_paint_context_t *ctx);
|
||||
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,
|
||||
const hb_paint_context_t *ctx);
|
||||
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,
|
||||
const hb_paint_context_t *ctx);
|
||||
float xmax, float ymax);
|
||||
|
||||
HB_EXTERN void
|
||||
hb_paint_pop_clip (hb_paint_funcs_t *funcs, void *paint_data,
|
||||
const hb_paint_context_t *ctx);
|
||||
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_color_t color,
|
||||
const hb_paint_context_t *ctx);
|
||||
hb_color_t color);
|
||||
|
||||
HB_EXTERN void
|
||||
hb_paint_image (hb_paint_funcs_t *funcs, void *paint_data,
|
||||
hb_blob_t *image,
|
||||
hb_tag_t format,
|
||||
hb_glyph_extents_t *extents,
|
||||
const hb_paint_context_t *ctx);
|
||||
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,
|
||||
const hb_paint_context_t *ctx);
|
||||
float x2, float y2);
|
||||
|
||||
HB_EXTERN void
|
||||
hb_paint_radial_gradient (hb_paint_funcs_t *funcs, void *paint_data,
|
||||
|
@ -795,24 +743,20 @@ hb_paint_radial_gradient (hb_paint_funcs_t *funcs, void *paint_data,
|
|||
float x0, float y0,
|
||||
float r0,
|
||||
float x1, float y1,
|
||||
float r1,
|
||||
const hb_paint_context_t *ctx);
|
||||
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,
|
||||
const hb_paint_context_t *ctx);
|
||||
float start_angle, float end_angle);
|
||||
|
||||
HB_EXTERN void
|
||||
hb_paint_push_group (hb_paint_funcs_t *funcs, void *paint_data,
|
||||
const hb_paint_context_t *ctx);
|
||||
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,
|
||||
const hb_paint_context_t *ctx);
|
||||
hb_paint_composite_mode_t mode);
|
||||
|
||||
HB_END_DECLS
|
||||
|
||||
|
|
|
@ -69,153 +69,107 @@ struct hb_paint_funcs_t
|
|||
void push_transform (void *paint_data,
|
||||
float xx, float yx,
|
||||
float xy, float yy,
|
||||
float dx, float dy,
|
||||
const hb_paint_context_t *ctx)
|
||||
float dx, float dy)
|
||||
{ func.push_transform (this, paint_data,
|
||||
xx, yx, xy, yy, dx, dy,
|
||||
ctx,
|
||||
!user_data ? nullptr : user_data->push_transform); }
|
||||
void pop_transform (void *paint_data,
|
||||
const hb_paint_context_t *ctx)
|
||||
{ func.pop_transform (this, paint_data, ctx,
|
||||
void pop_transform (void *paint_data)
|
||||
{ func.pop_transform (this, paint_data,
|
||||
!user_data ? nullptr : user_data->pop_transform); }
|
||||
void push_clip_glyph (void *paint_data,
|
||||
hb_codepoint_t glyph,
|
||||
const hb_paint_context_t *ctx)
|
||||
hb_font_t *font)
|
||||
{ func.push_clip_glyph (this, paint_data,
|
||||
glyph,
|
||||
ctx,
|
||||
font,
|
||||
!user_data ? nullptr : user_data->push_clip_glyph); }
|
||||
void push_clip_rectangle (void *paint_data,
|
||||
float xmin, float ymin, float xmax, float ymax,
|
||||
const hb_paint_context_t *ctx)
|
||||
float xmin, float ymin, float xmax, float ymax)
|
||||
{ func.push_clip_rectangle (this, paint_data,
|
||||
xmin, ymin, xmax, ymax,
|
||||
ctx,
|
||||
!user_data ? nullptr : user_data->push_clip_rectangle); }
|
||||
void pop_clip (void *paint_data,
|
||||
const hb_paint_context_t *ctx)
|
||||
{ func.pop_clip (this, paint_data, ctx,
|
||||
void pop_clip (void *paint_data)
|
||||
{ func.pop_clip (this, paint_data,
|
||||
!user_data ? nullptr : user_data->pop_clip); }
|
||||
void color (void *paint_data,
|
||||
hb_color_t color,
|
||||
const hb_paint_context_t *ctx)
|
||||
hb_color_t color)
|
||||
{ func.color (this, paint_data,
|
||||
color,
|
||||
ctx,
|
||||
!user_data ? nullptr : user_data->color); }
|
||||
void image (void *paint_data,
|
||||
hb_blob_t *image,
|
||||
hb_tag_t format,
|
||||
hb_glyph_extents_t *extents,
|
||||
const hb_paint_context_t *ctx)
|
||||
hb_glyph_extents_t *extents)
|
||||
{ func.image (this, paint_data,
|
||||
image, format, extents,
|
||||
ctx,
|
||||
!user_data ? nullptr : user_data->image); }
|
||||
void linear_gradient (void *paint_data,
|
||||
hb_color_line_t *color_line,
|
||||
float x0, float y0,
|
||||
float x1, float y1,
|
||||
float x2, float y2,
|
||||
const hb_paint_context_t *ctx)
|
||||
float x2, float y2)
|
||||
{ func.linear_gradient (this, paint_data,
|
||||
color_line, x0, y0, x1, y1, x2, y2,
|
||||
ctx,
|
||||
!user_data ? nullptr : user_data->linear_gradient); }
|
||||
void radial_gradient (void *paint_data,
|
||||
hb_color_line_t *color_line,
|
||||
float x0, float y0, float r0,
|
||||
float x1, float y1, float r1,
|
||||
const hb_paint_context_t *ctx)
|
||||
float x1, float y1, float r1)
|
||||
{ func.radial_gradient (this, paint_data,
|
||||
color_line, x0, y0, r0, x1, y1, r1,
|
||||
ctx,
|
||||
!user_data ? nullptr : user_data->radial_gradient); }
|
||||
void sweep_gradient (void *paint_data,
|
||||
hb_color_line_t *color_line,
|
||||
float x0, float y0,
|
||||
float start_angle,
|
||||
float end_angle,
|
||||
const hb_paint_context_t *ctx)
|
||||
float end_angle)
|
||||
{ func.sweep_gradient (this, paint_data,
|
||||
color_line, x0, y0, start_angle, end_angle,
|
||||
ctx,
|
||||
!user_data ? nullptr : user_data->sweep_gradient); }
|
||||
void push_group (void *paint_data,
|
||||
const hb_paint_context_t *ctx)
|
||||
{ func.push_group (this, paint_data, ctx,
|
||||
void push_group (void *paint_data)
|
||||
{ func.push_group (this, paint_data,
|
||||
!user_data ? nullptr : user_data->push_group); }
|
||||
void pop_group (void *paint_data,
|
||||
hb_paint_composite_mode_t mode,
|
||||
const hb_paint_context_t *ctx)
|
||||
hb_paint_composite_mode_t mode)
|
||||
{ func.pop_group (this, paint_data,
|
||||
mode,
|
||||
ctx,
|
||||
!user_data ? nullptr : user_data->pop_group); }
|
||||
|
||||
void push_root_transform (void *paint_data,
|
||||
const hb_paint_context_t *ctx)
|
||||
const hb_font_t *font)
|
||||
{
|
||||
hb_font_t *font = ctx->font;
|
||||
int xscale = font->x_scale, yscale = font->y_scale;
|
||||
float upem = font->face->get_upem ();
|
||||
float slant = font->slant_xy;
|
||||
|
||||
func.push_transform (this, paint_data,
|
||||
xscale/upem, 0, slant * yscale/upem, yscale/upem, 0, 0,
|
||||
ctx,
|
||||
!user_data ? nullptr : user_data->push_transform);
|
||||
}
|
||||
void pop_root_transform (void *paint_data,
|
||||
const hb_paint_context_t *ctx)
|
||||
void pop_root_transform (void *paint_data)
|
||||
{
|
||||
func.pop_transform (this, paint_data, ctx,
|
||||
func.pop_transform (this, paint_data,
|
||||
!user_data ? nullptr : user_data->pop_transform);
|
||||
}
|
||||
|
||||
void push_inverse_root_transform (void *paint_data,
|
||||
const hb_paint_context_t *ctx)
|
||||
hb_font_t *font)
|
||||
{
|
||||
hb_font_t *font = ctx->font;
|
||||
int xscale = font->x_scale, yscale = font->y_scale;
|
||||
float upem = font->face->get_upem ();
|
||||
float slant = font->slant_xy;
|
||||
|
||||
func.push_transform (this, paint_data,
|
||||
upem/xscale, 0, -slant * upem/xscale, upem/yscale, 0, 0,
|
||||
ctx,
|
||||
!user_data ? nullptr : user_data->push_transform);
|
||||
}
|
||||
void pop_inverse_root_transform (void *paint_data,
|
||||
const hb_paint_context_t *ctx)
|
||||
void pop_inverse_root_transform (void *paint_data)
|
||||
{
|
||||
func.pop_transform (this, paint_data, ctx,
|
||||
func.pop_transform (this, paint_data,
|
||||
!user_data ? nullptr : user_data->pop_transform);
|
||||
}
|
||||
};
|
||||
DECLARE_NULL_INSTANCE (hb_paint_funcs_t);
|
||||
|
||||
static inline hb_color_t
|
||||
hb_paint_get_color (const hb_paint_context_t *ctx,
|
||||
unsigned int color_index,
|
||||
float alpha)
|
||||
{
|
||||
hb_color_t color = ctx->foreground;
|
||||
|
||||
if (color_index != 0xffff)
|
||||
{
|
||||
unsigned int clen = 1;
|
||||
hb_face_t *face = hb_font_get_face (ctx->font);
|
||||
|
||||
hb_ot_color_palette_get_colors (face, ctx->palette, color_index, &clen, &color);
|
||||
}
|
||||
|
||||
return HB_COLOR (hb_color_get_blue (color),
|
||||
hb_color_get_green (color),
|
||||
hb_color_get_red (color),
|
||||
hb_color_get_alpha (color) * alpha);
|
||||
}
|
||||
|
||||
|
||||
#endif /* HB_PAINT_HH */
|
||||
|
|
|
@ -484,7 +484,6 @@ push_transform (hb_paint_funcs_t *funcs,
|
|||
float xx, float yx,
|
||||
float xy, float yy,
|
||||
float dx, float dy,
|
||||
const hb_paint_context_t *ctx,
|
||||
void *user_data)
|
||||
{
|
||||
paint_data_t *data = user_data;
|
||||
|
@ -496,7 +495,6 @@ push_transform (hb_paint_funcs_t *funcs,
|
|||
static void
|
||||
pop_transform (hb_paint_funcs_t *funcs,
|
||||
void *paint_data,
|
||||
const hb_paint_context_t *ctx,
|
||||
void *user_data)
|
||||
{
|
||||
paint_data_t *data = user_data;
|
||||
|
@ -509,7 +507,7 @@ static void
|
|||
push_clip_glyph (hb_paint_funcs_t *funcs,
|
||||
void *paint_data,
|
||||
hb_codepoint_t glyph,
|
||||
const hb_paint_context_t *ctx,
|
||||
hb_font_t *font,
|
||||
void *user_data)
|
||||
{
|
||||
paint_data_t *data = user_data;
|
||||
|
@ -522,7 +520,6 @@ static void
|
|||
push_clip_rectangle (hb_paint_funcs_t *funcs,
|
||||
void *paint_data,
|
||||
float xmin, float ymin, float xmax, float ymax,
|
||||
const hb_paint_context_t *ctx,
|
||||
void *user_data)
|
||||
{
|
||||
paint_data_t *data = user_data;
|
||||
|
@ -534,7 +531,6 @@ push_clip_rectangle (hb_paint_funcs_t *funcs,
|
|||
static void
|
||||
pop_clip (hb_paint_funcs_t *funcs,
|
||||
void *paint_data,
|
||||
const hb_paint_context_t *ctx,
|
||||
void *user_data)
|
||||
{
|
||||
paint_data_t *data = user_data;
|
||||
|
@ -547,7 +543,6 @@ static void
|
|||
paint_color (hb_paint_funcs_t *funcs,
|
||||
void *paint_data,
|
||||
hb_color_t color,
|
||||
const hb_paint_context_t *ctx,
|
||||
void *user_data)
|
||||
{
|
||||
paint_data_t *data = user_data;
|
||||
|
@ -565,7 +560,6 @@ paint_image (hb_paint_funcs_t *funcs,
|
|||
hb_blob_t *blob,
|
||||
hb_tag_t format,
|
||||
hb_glyph_extents_t *extents,
|
||||
const hb_paint_context_t *ctx,
|
||||
void *user_data)
|
||||
{
|
||||
paint_data_t *data = user_data;
|
||||
|
@ -606,7 +600,6 @@ paint_linear_gradient (hb_paint_funcs_t *funcs,
|
|||
float x0, float y0,
|
||||
float x1, float y1,
|
||||
float x2, float y2,
|
||||
const hb_paint_context_t *ctx,
|
||||
void *user_data)
|
||||
{
|
||||
paint_data_t *data = user_data;
|
||||
|
@ -627,7 +620,6 @@ paint_radial_gradient (hb_paint_funcs_t *funcs,
|
|||
hb_color_line_t *color_line,
|
||||
float x0, float y0, float r0,
|
||||
float x1, float y1, float r1,
|
||||
const hb_paint_context_t *ctx,
|
||||
void *user_data)
|
||||
{
|
||||
paint_data_t *data = user_data;
|
||||
|
@ -648,7 +640,6 @@ paint_sweep_gradient (hb_paint_funcs_t *funcs,
|
|||
float cx, float cy,
|
||||
float start_angle,
|
||||
float end_angle,
|
||||
const hb_paint_context_t *ctx,
|
||||
void *user_data)
|
||||
{
|
||||
paint_data_t *data = user_data;
|
||||
|
@ -665,7 +656,6 @@ paint_sweep_gradient (hb_paint_funcs_t *funcs,
|
|||
static void
|
||||
push_group (hb_paint_funcs_t *funcs,
|
||||
void *paint_data,
|
||||
const hb_paint_context_t *ctx,
|
||||
void *user_data)
|
||||
{
|
||||
paint_data_t *data = user_data;
|
||||
|
@ -677,7 +667,6 @@ static void
|
|||
pop_group (hb_paint_funcs_t *funcs,
|
||||
void *paint_data,
|
||||
hb_paint_composite_mode_t mode,
|
||||
const hb_paint_context_t *ctx,
|
||||
void *user_data)
|
||||
{
|
||||
paint_data_t *data = user_data;
|
||||
|
|
|
@ -70,28 +70,6 @@ cairo_extend (hb_paint_extend_t extend)
|
|||
return CAIRO_EXTEND_PAD;
|
||||
}
|
||||
|
||||
void
|
||||
hb_cairo_get_font_color (const hb_paint_context_t *ctx,
|
||||
unsigned int color_index,
|
||||
float alpha,
|
||||
float *r, float *g, float *b, float *a)
|
||||
{
|
||||
hb_color_t color = ctx->foreground;
|
||||
|
||||
if (color_index != 0xffff)
|
||||
{
|
||||
unsigned int clen = 1;
|
||||
hb_face_t *face = hb_font_get_face (ctx->font);
|
||||
|
||||
hb_ot_color_palette_get_colors (face, ctx->palette, color_index, &clen, &color);
|
||||
}
|
||||
|
||||
*r = hb_color_get_red (color) / 255.f;
|
||||
*g = hb_color_get_green (color) / 255.f;
|
||||
*b = hb_color_get_blue (color) / 255.f;
|
||||
*a = (hb_color_get_alpha (color) / 255.f) * alpha;
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
hb_blob_t *blob;
|
||||
|
@ -120,7 +98,6 @@ read_blob (void *closure,
|
|||
|
||||
void
|
||||
hb_cairo_paint_glyph_image (cairo_t *cr,
|
||||
const hb_paint_context_t *ctx,
|
||||
hb_blob_t *blob,
|
||||
hb_tag_t format,
|
||||
hb_glyph_extents_t *extents)
|
||||
|
@ -228,7 +205,6 @@ normalize_color_line (hb_color_stop_t *stops,
|
|||
|
||||
void
|
||||
hb_cairo_paint_linear_gradient (cairo_t *cr,
|
||||
const hb_paint_context_t *ctx,
|
||||
hb_color_line_t *color_line,
|
||||
float x0, float y0,
|
||||
float x1, float y1,
|
||||
|
@ -278,7 +254,6 @@ hb_cairo_paint_linear_gradient (cairo_t *cr,
|
|||
|
||||
void
|
||||
hb_cairo_paint_radial_gradient (cairo_t *cr,
|
||||
const hb_paint_context_t *ctx,
|
||||
hb_color_line_t *color_line,
|
||||
float x0, float y0, float r0,
|
||||
float x1, float y1, float r1)
|
||||
|
@ -469,8 +444,7 @@ add_sweep_gradient_patches1 (float cx, float cy, float radius,
|
|||
}
|
||||
|
||||
static void
|
||||
add_sweep_gradient_patches (const hb_paint_context_t *ctx,
|
||||
hb_color_stop_t *stops,
|
||||
add_sweep_gradient_patches (hb_color_stop_t *stops,
|
||||
unsigned int n_stops,
|
||||
cairo_extend_t extend,
|
||||
float cx, float cy,
|
||||
|
@ -723,7 +697,6 @@ done:
|
|||
|
||||
void
|
||||
hb_cairo_paint_sweep_gradient (cairo_t *cr,
|
||||
const hb_paint_context_t *ctx,
|
||||
hb_color_line_t *color_line,
|
||||
float cx, float cy,
|
||||
float start_angle,
|
||||
|
@ -752,7 +725,7 @@ hb_cairo_paint_sweep_gradient (cairo_t *cr,
|
|||
extend = cairo_extend (hb_color_line_get_extend (color_line));
|
||||
pattern = cairo_pattern_create_mesh ();
|
||||
|
||||
add_sweep_gradient_patches (ctx, stops, len, extend, cx, cy,
|
||||
add_sweep_gradient_patches (stops, len, extend, cx, cy,
|
||||
radius, start_angle, end_angle, pattern);
|
||||
|
||||
cairo_set_source (cr, pattern);
|
||||
|
|
|
@ -70,32 +70,23 @@ hb_paint_composite_mode_to_cairo (hb_paint_composite_mode_t mode)
|
|||
return CAIRO_OPERATOR_SOURCE;
|
||||
}
|
||||
|
||||
void hb_cairo_get_font_color (const hb_paint_context_t *ctx,
|
||||
unsigned int color_index,
|
||||
float alpha,
|
||||
float *r, float *g, float *b, float *a);
|
||||
|
||||
void hb_cairo_paint_glyph_image (cairo_t *cr,
|
||||
const hb_paint_context_t *ctx,
|
||||
hb_blob_t *blob,
|
||||
hb_tag_t format,
|
||||
hb_glyph_extents_t *extents);
|
||||
|
||||
void hb_cairo_paint_linear_gradient (cairo_t *cr,
|
||||
const hb_paint_context_t *ctx,
|
||||
hb_color_line_t *color_line,
|
||||
float x0, float y0,
|
||||
float x1, float y1,
|
||||
float x2, float y2);
|
||||
|
||||
void hb_cairo_paint_radial_gradient (cairo_t *cr,
|
||||
const hb_paint_context_t *ctx,
|
||||
hb_color_line_t *color_line,
|
||||
float x0, float y0, float r0,
|
||||
float x1, float y1, float r1);
|
||||
|
||||
void hb_cairo_paint_sweep_gradient (cairo_t *cr,
|
||||
const hb_paint_context_t *ctx,
|
||||
hb_color_line_t *color_line,
|
||||
float x0, float y0,
|
||||
float start_angle, float end_angle);
|
||||
|
|
|
@ -111,7 +111,6 @@ push_transform (hb_paint_funcs_t *funcs,
|
|||
float xx, float yx,
|
||||
float xy, float yy,
|
||||
float dx, float dy,
|
||||
const hb_paint_context_t *ctx,
|
||||
void *user_data)
|
||||
{
|
||||
cairo_t *cr = (cairo_t *)paint_data;
|
||||
|
@ -127,7 +126,6 @@ push_transform (hb_paint_funcs_t *funcs,
|
|||
static void
|
||||
pop_transform (hb_paint_funcs_t *funcs,
|
||||
void *paint_data,
|
||||
const hb_paint_context_t *ctx,
|
||||
void *user_data)
|
||||
{
|
||||
cairo_t *cr = (cairo_t *)paint_data;
|
||||
|
@ -139,14 +137,14 @@ static void
|
|||
push_clip_glyph (hb_paint_funcs_t *funcs,
|
||||
void *paint_data,
|
||||
hb_codepoint_t glyph,
|
||||
const hb_paint_context_t *ctx,
|
||||
hb_font_t *font,
|
||||
void *user_data)
|
||||
{
|
||||
cairo_t *cr = (cairo_t *)paint_data;
|
||||
|
||||
cairo_save (cr);
|
||||
cairo_new_path (cr);
|
||||
hb_font_draw_glyph (ctx->font, glyph, get_cairo_draw_funcs (), cr);
|
||||
hb_font_draw_glyph (font, glyph, get_cairo_draw_funcs (), cr);
|
||||
cairo_close_path (cr);
|
||||
cairo_clip (cr);
|
||||
}
|
||||
|
@ -155,7 +153,6 @@ static void
|
|||
push_clip_rectangle (hb_paint_funcs_t *funcs,
|
||||
void *paint_data,
|
||||
float xmin, float ymin, float xmax, float ymax,
|
||||
const hb_paint_context_t *ctx,
|
||||
void *user_data)
|
||||
{
|
||||
cairo_t *cr = (cairo_t *)paint_data;
|
||||
|
@ -170,7 +167,6 @@ push_clip_rectangle (hb_paint_funcs_t *funcs,
|
|||
static void
|
||||
pop_clip (hb_paint_funcs_t *funcs,
|
||||
void *paint_data,
|
||||
const hb_paint_context_t *ctx,
|
||||
void *user_data)
|
||||
{
|
||||
cairo_t *cr = (cairo_t *)paint_data;
|
||||
|
@ -181,7 +177,6 @@ pop_clip (hb_paint_funcs_t *funcs,
|
|||
static void
|
||||
push_group (hb_paint_funcs_t *funcs,
|
||||
void *paint_data,
|
||||
const hb_paint_context_t *ctx,
|
||||
void *user_data)
|
||||
{
|
||||
cairo_t *cr = (cairo_t *)paint_data;
|
||||
|
@ -194,7 +189,6 @@ static void
|
|||
pop_group (hb_paint_funcs_t *funcs,
|
||||
void *paint_data,
|
||||
hb_paint_composite_mode_t mode,
|
||||
const hb_paint_context_t *ctx,
|
||||
void *user_data)
|
||||
{
|
||||
cairo_t *cr = (cairo_t *)paint_data;
|
||||
|
@ -210,7 +204,6 @@ static void
|
|||
paint_color (hb_paint_funcs_t *funcs,
|
||||
void *paint_data,
|
||||
hb_color_t color,
|
||||
const hb_paint_context_t *ctx,
|
||||
void *user_data)
|
||||
{
|
||||
cairo_t *cr = (cairo_t *)paint_data;
|
||||
|
@ -229,12 +222,11 @@ paint_image (hb_paint_funcs_t *funcs,
|
|||
hb_blob_t *blob,
|
||||
hb_tag_t format,
|
||||
hb_glyph_extents_t *extents,
|
||||
const hb_paint_context_t *ctx,
|
||||
void *user_data)
|
||||
{
|
||||
cairo_t *cr = (cairo_t *)paint_data;
|
||||
|
||||
hb_cairo_paint_glyph_image (cr, ctx, blob, format, extents);
|
||||
hb_cairo_paint_glyph_image (cr, blob, format, extents);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -244,12 +236,11 @@ paint_linear_gradient (hb_paint_funcs_t *funcs,
|
|||
float x0, float y0,
|
||||
float x1, float y1,
|
||||
float x2, float y2,
|
||||
const hb_paint_context_t *ctx,
|
||||
void *user_data)
|
||||
{
|
||||
cairo_t *cr = (cairo_t *)paint_data;
|
||||
|
||||
hb_cairo_paint_linear_gradient (cr, ctx, color_line, x0, y0, x1, y1, x2, y2);
|
||||
hb_cairo_paint_linear_gradient (cr, color_line, x0, y0, x1, y1, x2, y2);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -258,12 +249,11 @@ paint_radial_gradient (hb_paint_funcs_t *funcs,
|
|||
hb_color_line_t *color_line,
|
||||
float x0, float y0, float r0,
|
||||
float x1, float y1, float r1,
|
||||
const hb_paint_context_t *ctx,
|
||||
void *user_data)
|
||||
{
|
||||
cairo_t *cr = (cairo_t *)paint_data;
|
||||
|
||||
hb_cairo_paint_radial_gradient (cr, ctx, color_line, x0, y0, r0, x1, y1, r1);
|
||||
hb_cairo_paint_radial_gradient (cr, color_line, x0, y0, r0, x1, y1, r1);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -272,12 +262,11 @@ paint_sweep_gradient (hb_paint_funcs_t *funcs,
|
|||
hb_color_line_t *color_line,
|
||||
float x0, float y0,
|
||||
float start_angle, float end_angle,
|
||||
const hb_paint_context_t *ctx,
|
||||
void *user_data)
|
||||
{
|
||||
cairo_t *cr = (cairo_t *)paint_data;
|
||||
|
||||
hb_cairo_paint_sweep_gradient (cr, ctx, color_line, x0, y0, start_angle, end_angle);
|
||||
hb_cairo_paint_sweep_gradient (cr, color_line, x0, y0, start_angle, end_angle);
|
||||
}
|
||||
|
||||
static hb_paint_funcs_t *
|
||||
|
|
Loading…
Reference in New Issue