harfbuzz/src/hb-ot-color-colr-table.cc

48 lines
1.5 KiB
C++
Raw Normal View History

2022-12-16 05:16:54 +01:00
#include "hb-ot-color-colr-table.hh"
namespace OT {
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++)
{
2022-12-17 18:22:32 +01:00
const Paint &paint = paint_offset_lists.get_paint (i);
2022-12-16 05:16:54 +01:00
c->funcs->push_group (c->data);
2022-12-16 23:27:18 +01:00
c->recurse (paint);
2022-12-16 05:16:54 +01:00
c->funcs->pop_group (c->data, HB_PAINT_COMPOSITE_MODE_SRC_OVER);
}
}
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);
if (paint)
2022-12-16 23:27:18 +01:00
c->recurse (*paint);
2022-12-16 05:16:54 +01:00
}
}
unsigned int
hb_color_line_get_color_stops (hb_color_line_t *cl,
unsigned int start,
unsigned int *count,
hb_color_stop_t *color_stops)
{
2022-12-17 18:38:23 +01:00
if (cl->is_variable)
2022-12-17 18:58:52 +01:00
return reinterpret_cast<const OT::ColorLine<OT::Variable> *>(cl->base)->get_color_stops (start, count, color_stops, cl->c->instancer);
2022-12-17 18:38:23 +01:00
else
2022-12-17 18:58:52 +01:00
return reinterpret_cast<const OT::ColorLine<OT::NoVariable> *>(cl->base)->get_color_stops (start, count, color_stops, cl->c->instancer);
2022-12-16 05:16:54 +01:00
}
hb_paint_extend_t
hb_color_line_get_extend (hb_color_line_t *cl)
{
2022-12-17 18:38:23 +01:00
if (cl->is_variable)
return reinterpret_cast<const OT::ColorLine<OT::Variable> *>(cl->base)->get_extend ();
else
return reinterpret_cast<const OT::ColorLine<OT::NoVariable> *>(cl->base)->get_extend ();
2022-12-16 05:16:54 +01:00
}