[paint] Resolve colors
We don't need to pass the index/alpha pairs to client callbacks, and can just resolve the colors internally. Update test results.
This commit is contained in:
parent
bd1389bedf
commit
71bd5a0dfc
|
@ -344,7 +344,7 @@ struct glyf_accelerator_t
|
|||
funcs->push_root_transform (data, &ctx);
|
||||
|
||||
funcs->push_clip_glyph (data, gid, &ctx);
|
||||
funcs->color (data, 0xffff, 1., &ctx);
|
||||
funcs->color (data, hb_paint_get_color (&ctx, 0xffff, 1.), &ctx);
|
||||
funcs->pop_clip (data, &ctx);
|
||||
|
||||
funcs->pop_root_transform (data, &ctx);
|
||||
|
|
|
@ -560,10 +560,11 @@ bool OT::cff1::accelerator_t::paint_glyph (hb_font_t *font, hb_codepoint_t glyph
|
|||
ctx.font = font;
|
||||
ctx.palette = 0;
|
||||
ctx.foreground = foreground;
|
||||
|
||||
funcs->push_root_transform (data, &ctx);
|
||||
|
||||
funcs->push_clip_glyph (data, glyph, &ctx);
|
||||
funcs->color (data, 0xffff, 1., &ctx);
|
||||
funcs->color (data, hb_paint_get_color (&ctx, 0xffff, 1.), &ctx);
|
||||
funcs->pop_clip (data, &ctx);
|
||||
|
||||
funcs->pop_root_transform (data, &ctx);
|
||||
|
|
|
@ -154,7 +154,7 @@ bool OT::cff2::accelerator_t::paint_glyph (hb_font_t *font, hb_codepoint_t glyph
|
|||
funcs->push_root_transform (data, &ctx);
|
||||
|
||||
funcs->push_clip_glyph (data, glyph, &ctx);
|
||||
funcs->color (data, 0xffff, 1., &ctx);
|
||||
funcs->color (data, hb_paint_get_color (&ctx, 0xffff, 1.), &ctx);
|
||||
funcs->pop_clip (data, &ctx);
|
||||
|
||||
funcs->pop_root_transform (data, &ctx);
|
||||
|
|
|
@ -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 (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->ctx, start, count, color_stops, color_line->c->instancer);
|
||||
else
|
||||
return reinterpret_cast<const OT::ColorLine<OT::NoVariable> *>(color_line->base)->get_color_stops (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->ctx, start, count, color_stops, color_line->c->instancer);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -241,10 +241,11 @@ struct Variable
|
|||
value.paint_glyph (c, varIdxBase);
|
||||
}
|
||||
|
||||
void get_color_stop (hb_color_stop_t *c,
|
||||
void get_color_stop (hb_paint_context_t *ctx,
|
||||
hb_color_stop_t *c,
|
||||
const VarStoreInstancer &instancer) const
|
||||
{
|
||||
value.get_color_stop (c, varIdxBase, instancer);
|
||||
value.get_color_stop (ctx, c, varIdxBase, instancer);
|
||||
}
|
||||
|
||||
hb_paint_extend_t get_extend () const
|
||||
|
@ -293,10 +294,11 @@ struct NoVariable
|
|||
value.paint_glyph (c, varIdxBase);
|
||||
}
|
||||
|
||||
void get_color_stop (hb_color_stop_t *c,
|
||||
void get_color_stop (hb_paint_context_t *ctx,
|
||||
hb_color_stop_t *c,
|
||||
const VarStoreInstancer &instancer) const
|
||||
{
|
||||
value.get_color_stop (c, VarIdx::NO_VARIATION, instancer);
|
||||
value.get_color_stop (ctx, c, VarIdx::NO_VARIATION, instancer);
|
||||
}
|
||||
|
||||
hb_paint_extend_t get_extend () const
|
||||
|
@ -331,13 +333,15 @@ struct ColorStop
|
|||
return_trace (c->check_struct (this));
|
||||
}
|
||||
|
||||
void get_color_stop (hb_color_stop_t *out,
|
||||
void get_color_stop (hb_paint_context_t *ctx,
|
||||
hb_color_stop_t *out,
|
||||
uint32_t varIdx,
|
||||
const VarStoreInstancer &instancer) const
|
||||
{
|
||||
out->offset = stopOffset.to_float(instancer (varIdx, 0));
|
||||
out->color_index = paletteIndex;
|
||||
out->alpha = alpha.to_float(instancer (varIdx, 1));
|
||||
out->color = hb_paint_get_color (ctx,
|
||||
paletteIndex,
|
||||
alpha.to_float (instancer (varIdx, 1)));
|
||||
}
|
||||
|
||||
F2DOT14 stopOffset;
|
||||
|
@ -393,7 +397,8 @@ struct ColorLine
|
|||
|
||||
/* get up to count stops from start */
|
||||
unsigned int
|
||||
get_color_stops (unsigned int start,
|
||||
get_color_stops (hb_paint_context_t *ctx,
|
||||
unsigned int start,
|
||||
unsigned int *count,
|
||||
hb_color_stop_t *color_stops,
|
||||
const VarStoreInstancer &instancer) const
|
||||
|
@ -404,8 +409,7 @@ struct ColorLine
|
|||
{
|
||||
unsigned int i;
|
||||
for (i = 0; i < *count && start + i < len; i++)
|
||||
stops[start + i].get_color_stop (&color_stops[i],
|
||||
instancer);
|
||||
stops[start + i].get_color_stop (ctx, &color_stops[i], instancer);
|
||||
*count = i;
|
||||
}
|
||||
|
||||
|
@ -555,8 +559,9 @@ struct PaintSolid
|
|||
void paint_glyph (hb_ot_paint_context_t *c, uint32_t varIdxBase) const
|
||||
{
|
||||
c->funcs->color (c->data,
|
||||
paletteIndex,
|
||||
alpha.to_float (c->instancer (varIdxBase, 0)),
|
||||
hb_paint_get_color (&c->ctx,
|
||||
paletteIndex,
|
||||
alpha.to_float (c->instancer (varIdxBase, 0))),
|
||||
&c->ctx);
|
||||
}
|
||||
|
||||
|
@ -1992,7 +1997,7 @@ struct COLR
|
|||
.sub_array (record->firstLayerIdx, record->numLayers))
|
||||
{
|
||||
c.funcs->push_clip_glyph (c.data, r.glyphId, &c.ctx);
|
||||
c.funcs->color (c.data, r.colorIdx, 1., &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);
|
||||
}
|
||||
|
||||
|
|
|
@ -74,8 +74,7 @@ hb_paint_pop_clip_nil (hb_paint_funcs_t *funcs, void *paint_data,
|
|||
|
||||
static void
|
||||
hb_paint_color_nil (hb_paint_funcs_t *funcs, void *paint_data,
|
||||
unsigned int color_index,
|
||||
float alpha,
|
||||
hb_color_t color,
|
||||
const hb_paint_context_t *ctx,
|
||||
void *user_data) {}
|
||||
|
||||
|
@ -489,8 +488,7 @@ hb_paint_pop_clip (hb_paint_funcs_t *funcs, void *paint_data,
|
|||
* hb_paint_color:
|
||||
* @funcs: paint functions
|
||||
* @paint_data: associated data passed by the caller
|
||||
* @color_index: Index of a color in the color palette
|
||||
* @alpha: Alpha to apply in addition
|
||||
* @color: The color to use
|
||||
* @ctx: the paint context
|
||||
*
|
||||
* Perform a "color" paint operation.
|
||||
|
@ -499,11 +497,10 @@ hb_paint_pop_clip (hb_paint_funcs_t *funcs, void *paint_data,
|
|||
*/
|
||||
void
|
||||
hb_paint_color (hb_paint_funcs_t *funcs, void *paint_data,
|
||||
unsigned int color_index,
|
||||
float alpha,
|
||||
hb_color_t color,
|
||||
const hb_paint_context_t *ctx)
|
||||
{
|
||||
funcs->color (paint_data, color_index, alpha, ctx);
|
||||
funcs->color (paint_data, color, ctx);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -46,7 +46,7 @@ HB_BEGIN_DECLS
|
|||
*
|
||||
* The callbacks also assume that the caller uses
|
||||
* hb_ot_color_palette_get_colors() to obtain colors
|
||||
* from one of the fonts color palettes. If the font does
|
||||
* from the color palette that is selected. If the font does
|
||||
* not have color palettes, the color index will always
|
||||
* be 0xFFFF, indicating the use of the foreground color.
|
||||
*
|
||||
|
@ -240,27 +240,18 @@ typedef void (*hb_paint_pop_clip_func_t) (hb_paint_funcs_t *funcs,
|
|||
* hb_paint_color_func_t:
|
||||
* @funcs: paint functions object
|
||||
* @paint_data: The data accompanying the paint functions in hb_font_paint_glyph()
|
||||
* @color_index: Index of a color in the fonts selected color palette
|
||||
* @alpha: alpha to apply in addition
|
||||
* @ctx: the paint context
|
||||
* @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
|
||||
* color everywhere within the current clip.
|
||||
*
|
||||
* The @color_index can be either an index into one of the fonts
|
||||
* color palettes, or the special value 0xFFFF, which indicates that
|
||||
* the foreground color should be used.
|
||||
*
|
||||
* In either case, the @alpha value should be applied in addition
|
||||
* (i.e. multiplied with) the alpha value found in the color.
|
||||
*
|
||||
* Since: REPLACEME
|
||||
*/
|
||||
typedef void (*hb_paint_color_func_t) (hb_paint_funcs_t *funcs,
|
||||
void *paint_data,
|
||||
unsigned int color_index,
|
||||
float alpha,
|
||||
hb_color_t color,
|
||||
const hb_paint_context_t *ctx,
|
||||
void *user_data);
|
||||
|
||||
|
@ -321,27 +312,18 @@ typedef struct hb_color_line_t hb_color_line_t;
|
|||
/**
|
||||
* hb_color_stop_t:
|
||||
* @offset: the offset of the color stop
|
||||
* @color_index: either a color palette index or the special value 0xFFFF
|
||||
* @alpha: alpha to apply
|
||||
* @color: the color
|
||||
*
|
||||
* Information about a color stop on a color line.
|
||||
*
|
||||
* Color lines typically have offsets ranging between 0 and 1,
|
||||
* but that is not required.
|
||||
*
|
||||
* The @color_index can be either an index into one of the fonts
|
||||
* color palettes, or the special value 0xFFFF, which indicates that
|
||||
* the foreground color should be used.
|
||||
*
|
||||
* in either case, the @alpha value should be applied in addition
|
||||
* (i.e. multiplied with) the alpha value found in the color.
|
||||
*
|
||||
* Since: REPLACEME
|
||||
*/
|
||||
typedef struct {
|
||||
float offset;
|
||||
unsigned int color_index;
|
||||
float alpha;
|
||||
hb_color_t color;
|
||||
} hb_color_stop_t;
|
||||
|
||||
HB_EXTERN unsigned int
|
||||
|
@ -789,8 +771,7 @@ 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,
|
||||
unsigned int color_index,
|
||||
float alpha,
|
||||
hb_color_t color,
|
||||
const hb_paint_context_t *ctx);
|
||||
|
||||
HB_EXTERN void
|
||||
|
|
|
@ -98,11 +98,10 @@ struct hb_paint_funcs_t
|
|||
{ func.pop_clip (this, paint_data, ctx,
|
||||
!user_data ? nullptr : user_data->pop_clip); }
|
||||
void color (void *paint_data,
|
||||
unsigned int color_index,
|
||||
float alpha,
|
||||
hb_color_t color,
|
||||
const hb_paint_context_t *ctx)
|
||||
{ func.color (this, paint_data,
|
||||
color_index, alpha,
|
||||
color,
|
||||
ctx,
|
||||
!user_data ? nullptr : user_data->color); }
|
||||
void image (void *paint_data,
|
||||
|
@ -197,4 +196,26 @@ struct hb_paint_funcs_t
|
|||
};
|
||||
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 */
|
||||
|
|
|
@ -7,10 +7,10 @@ start transform 0.019531 0.000000 0.000000 0.019531 0.000000 0.000000
|
|||
p0 280.000000 440.000000 radius 0.000000
|
||||
p1 280.000000 440.000000 radius 467.000000
|
||||
colors
|
||||
0.000000 16 1.000000
|
||||
0.448792 15 1.000000
|
||||
0.808594 14 1.000000
|
||||
1.000000 12 1.000000
|
||||
0.000000 186 141 104 255
|
||||
0.448792 183 138 103 255
|
||||
0.808594 173 130 100 255
|
||||
1.000000 164 123 98 255
|
||||
end transform
|
||||
end clip
|
||||
end transform
|
||||
|
@ -23,29 +23,29 @@ start transform 0.019531 0.000000 0.000000 0.019531 0.000000 0.000000
|
|||
p1 1019.000000 -27.000000
|
||||
p2 231.000000 -815.000000
|
||||
colors
|
||||
0.000000 12 1.000000
|
||||
1.000000 12 1.000000
|
||||
0.000000 164 123 98 255
|
||||
1.000000 164 123 98 255
|
||||
end clip
|
||||
end transform
|
||||
pop group mode 3
|
||||
push group
|
||||
start transform 51.200001 0.000000 -0.000000 51.200001 0.000000 0.000000
|
||||
start clip glyph 15
|
||||
solid 9 1.000000
|
||||
solid 145 103 77 255
|
||||
end clip
|
||||
end transform
|
||||
pop group mode 3
|
||||
push group
|
||||
start transform 51.200001 0.000000 -0.000000 51.200001 0.000000 0.000000
|
||||
start clip glyph 16
|
||||
solid 0 1.000000
|
||||
solid 30 136 229 255
|
||||
end clip
|
||||
end transform
|
||||
pop group mode 3
|
||||
push group
|
||||
start transform 51.200001 0.000000 -0.000000 51.200001 0.000000 0.000000
|
||||
start clip glyph 21
|
||||
solid 9 1.000000
|
||||
solid 145 103 77 255
|
||||
end clip
|
||||
end transform
|
||||
pop group mode 3
|
||||
|
@ -58,15 +58,15 @@ start transform 0.019531 0.000000 0.000000 0.019531 0.000000 0.000000
|
|||
p1 180.000000 -106.000000
|
||||
p2 -212.000000 1265.000000
|
||||
colors
|
||||
0.000000 5 1.000000
|
||||
1.000000 1 1.000000
|
||||
0.000000 100 181 246 255
|
||||
1.000000 33 150 243 255
|
||||
end clip
|
||||
end transform
|
||||
pop group mode 3
|
||||
push group
|
||||
start transform 51.200001 0.000000 -0.000000 51.200001 0.000000 0.000000
|
||||
start clip glyph 18
|
||||
solid 2 0.200012
|
||||
solid 66 66 66 51
|
||||
end clip
|
||||
end transform
|
||||
pop group mode 3
|
||||
|
@ -79,10 +79,10 @@ start transform 0.019531 0.000000 0.000000 0.019531 0.000000 0.000000
|
|||
p0 588.000000 198.000000 radius 0.000000
|
||||
p1 588.000000 198.000000 radius 342.000000
|
||||
colors
|
||||
0.000000 16 1.000000
|
||||
0.448792 15 1.000000
|
||||
0.808594 14 1.000000
|
||||
1.000000 12 1.000000
|
||||
0.000000 186 141 104 255
|
||||
0.448792 183 138 103 255
|
||||
0.808594 173 130 100 255
|
||||
1.000000 164 123 98 255
|
||||
end transform
|
||||
end clip
|
||||
end transform
|
||||
|
@ -90,7 +90,7 @@ start transform 0.019531 0.000000 0.000000 0.019531 0.000000 0.000000
|
|||
push group
|
||||
start transform 51.200001 0.000000 -0.000000 51.200001 0.000000 0.000000
|
||||
start clip glyph 20
|
||||
solid 9 1.000000
|
||||
solid 145 103 77 255
|
||||
end clip
|
||||
end transform
|
||||
pop group mode 3
|
||||
|
|
|
@ -7,10 +7,10 @@ start transform 0.019531 0.000000 0.003906 0.019531 0.000000 0.000000
|
|||
p0 280.000000 440.000000 radius 0.000000
|
||||
p1 280.000000 440.000000 radius 467.000000
|
||||
colors
|
||||
0.000000 16 1.000000
|
||||
0.448792 15 1.000000
|
||||
0.808594 14 1.000000
|
||||
1.000000 12 1.000000
|
||||
0.000000 186 141 104 255
|
||||
0.448792 183 138 103 255
|
||||
0.808594 173 130 100 255
|
||||
1.000000 164 123 98 255
|
||||
end transform
|
||||
end clip
|
||||
end transform
|
||||
|
@ -23,29 +23,29 @@ start transform 0.019531 0.000000 0.003906 0.019531 0.000000 0.000000
|
|||
p1 1019.000000 -27.000000
|
||||
p2 231.000000 -815.000000
|
||||
colors
|
||||
0.000000 12 1.000000
|
||||
1.000000 12 1.000000
|
||||
0.000000 164 123 98 255
|
||||
1.000000 164 123 98 255
|
||||
end clip
|
||||
end transform
|
||||
pop group mode 3
|
||||
push group
|
||||
start transform 51.200001 0.000000 -10.240000 51.200001 0.000000 0.000000
|
||||
start clip glyph 15
|
||||
solid 9 1.000000
|
||||
solid 145 103 77 255
|
||||
end clip
|
||||
end transform
|
||||
pop group mode 3
|
||||
push group
|
||||
start transform 51.200001 0.000000 -10.240000 51.200001 0.000000 0.000000
|
||||
start clip glyph 16
|
||||
solid 0 1.000000
|
||||
solid 30 136 229 255
|
||||
end clip
|
||||
end transform
|
||||
pop group mode 3
|
||||
push group
|
||||
start transform 51.200001 0.000000 -10.240000 51.200001 0.000000 0.000000
|
||||
start clip glyph 21
|
||||
solid 9 1.000000
|
||||
solid 145 103 77 255
|
||||
end clip
|
||||
end transform
|
||||
pop group mode 3
|
||||
|
@ -58,15 +58,15 @@ start transform 0.019531 0.000000 0.003906 0.019531 0.000000 0.000000
|
|||
p1 180.000000 -106.000000
|
||||
p2 -212.000000 1265.000000
|
||||
colors
|
||||
0.000000 5 1.000000
|
||||
1.000000 1 1.000000
|
||||
0.000000 100 181 246 255
|
||||
1.000000 33 150 243 255
|
||||
end clip
|
||||
end transform
|
||||
pop group mode 3
|
||||
push group
|
||||
start transform 51.200001 0.000000 -10.240000 51.200001 0.000000 0.000000
|
||||
start clip glyph 18
|
||||
solid 2 0.200012
|
||||
solid 66 66 66 51
|
||||
end clip
|
||||
end transform
|
||||
pop group mode 3
|
||||
|
@ -79,10 +79,10 @@ start transform 0.019531 0.000000 0.003906 0.019531 0.000000 0.000000
|
|||
p0 588.000000 198.000000 radius 0.000000
|
||||
p1 588.000000 198.000000 radius 342.000000
|
||||
colors
|
||||
0.000000 16 1.000000
|
||||
0.448792 15 1.000000
|
||||
0.808594 14 1.000000
|
||||
1.000000 12 1.000000
|
||||
0.000000 186 141 104 255
|
||||
0.448792 183 138 103 255
|
||||
0.808594 173 130 100 255
|
||||
1.000000 164 123 98 255
|
||||
end transform
|
||||
end clip
|
||||
end transform
|
||||
|
@ -90,7 +90,7 @@ start transform 0.019531 0.000000 0.003906 0.019531 0.000000 0.000000
|
|||
push group
|
||||
start transform 51.200001 0.000000 -10.240000 51.200001 0.000000 0.000000
|
||||
start clip glyph 20
|
||||
solid 9 1.000000
|
||||
solid 145 103 77 255
|
||||
end clip
|
||||
end transform
|
||||
pop group mode 3
|
||||
|
|
|
@ -5,10 +5,10 @@ start transform 0.020000 0.000000 0.000000 0.020000 0.000000 0.000000
|
|||
center 500.000000 600.000000
|
||||
angles 0.000000 6.283185
|
||||
colors
|
||||
0.250000 7 1.000000
|
||||
0.416687 4 1.000000
|
||||
0.583313 0 1.000000
|
||||
0.750000 8 1.000000
|
||||
0.250000 250 240 230 255
|
||||
0.416687 0 0 255 255
|
||||
0.583313 255 0 0 255
|
||||
0.750000 47 79 79 255
|
||||
end clip
|
||||
end transform
|
||||
end transform
|
||||
|
|
|
@ -2,7 +2,7 @@ start transform 0.020000 0.000000 0.000000 0.020000 0.000000 0.000000
|
|||
push group
|
||||
start transform 50.000000 0.000000 -0.000000 50.000000 0.000000 0.000000
|
||||
start clip glyph 3
|
||||
solid 4 0.500000
|
||||
solid 0 0 255 127
|
||||
end clip
|
||||
end transform
|
||||
push group
|
||||
|
@ -11,7 +11,7 @@ start transform 0.020000 0.000000 0.000000 0.020000 0.000000 0.000000
|
|||
start transform 0.000000 0.000000 0.000000 0.000000 -1000.000000 -1000.000000
|
||||
start transform 50.000000 0.000000 -0.000000 50.000000 0.000000 0.000000
|
||||
start clip glyph 3
|
||||
solid 1 0.700012
|
||||
solid 255 165 0 178
|
||||
end clip
|
||||
end transform
|
||||
end transform
|
||||
|
|
|
@ -2,14 +2,14 @@ start transform 0.020000 0.000000 0.000000 0.020000 0.000000 0.000000
|
|||
push group
|
||||
start transform 50.000000 0.000000 -0.000000 50.000000 0.000000 0.000000
|
||||
start clip glyph 3
|
||||
solid 4 0.500000
|
||||
solid 0 0 255 127
|
||||
end clip
|
||||
end transform
|
||||
push group
|
||||
start transform 1.000000 0.000000 0.000000 1.000000 200.000000 200.000000
|
||||
start transform 50.000000 0.000000 -0.000000 50.000000 0.000000 0.000000
|
||||
start clip glyph 3
|
||||
solid 1 0.700012
|
||||
solid 255 165 0 178
|
||||
end clip
|
||||
end transform
|
||||
end transform
|
||||
|
|
|
@ -2,7 +2,7 @@ start transform 0.020000 0.000000 0.000000 0.020000 0.000000 0.000000
|
|||
push group
|
||||
start transform 50.000000 0.000000 -0.000000 50.000000 0.000000 0.000000
|
||||
start clip glyph 3
|
||||
solid 10 1.000000
|
||||
solid 0 0 0 255
|
||||
end clip
|
||||
end transform
|
||||
pop group mode 3
|
||||
|
@ -13,7 +13,7 @@ start transform 0.020000 0.000000 0.000000 0.020000 0.000000 0.000000
|
|||
start transform 0.000000 0.000000 0.000000 0.000000 -333.000000 -667.000000
|
||||
start transform 50.000000 0.000000 -0.000000 50.000000 0.000000 0.000000
|
||||
start clip glyph 2
|
||||
solid 12 1.000000
|
||||
solid 255 220 1 255
|
||||
end clip
|
||||
end transform
|
||||
end transform
|
||||
|
@ -25,7 +25,7 @@ start transform 0.020000 0.000000 0.000000 0.020000 0.000000 0.000000
|
|||
start transform 0.000000 0.000000 0.000000 0.000000 -667.000000 -333.000000
|
||||
start transform 50.000000 0.000000 -0.000000 50.000000 0.000000 0.000000
|
||||
start clip glyph 2
|
||||
solid 11 1.000000
|
||||
solid 104 199 232 255
|
||||
end clip
|
||||
end transform
|
||||
end transform
|
||||
|
|
|
@ -6,9 +6,9 @@ start transform 0.020000 0.000000 0.000000 0.020000 0.000000 0.000000
|
|||
p1 2300.000000 950.000000
|
||||
p2 -1000.000000 250.000000
|
||||
colors
|
||||
0.000000 0 1.000000
|
||||
0.500000 4 1.000000
|
||||
1.000000 2 1.000000
|
||||
0.000000 255 0 0 255
|
||||
0.500000 0 0 255 255
|
||||
1.000000 255 255 0 255
|
||||
end clip
|
||||
end transform
|
||||
end transform
|
||||
|
|
|
@ -3,7 +3,7 @@ start transform 0.020000 0.000000 0.000000 0.020000 0.000000 0.000000
|
|||
start transform 1.000000 0.000000 0.000000 1.000000 150.000000 0.000000
|
||||
start transform 50.000000 0.000000 -0.000000 50.000000 0.000000 0.000000
|
||||
start clip glyph 174
|
||||
solid 3 1.000000
|
||||
solid 0 128 0 255
|
||||
end clip
|
||||
end transform
|
||||
end transform
|
||||
|
@ -17,8 +17,8 @@ start transform 0.020000 0.000000 0.000000 0.020000 0.000000 0.000000
|
|||
p1 500.000000 950.000000
|
||||
p2 600.000000 250.000000
|
||||
colors
|
||||
0.000000 0 1.000000
|
||||
1.000000 4 1.000000
|
||||
0.000000 255 0 0 255
|
||||
1.000000 0 0 255 255
|
||||
end clip
|
||||
end transform
|
||||
end transform
|
||||
|
|
|
@ -6,8 +6,8 @@ start transform 0.020000 0.000000 0.000000 0.020000 0.000000 0.000000
|
|||
p1 900.000000 250.000000
|
||||
p2 100.000000 300.000000
|
||||
colors
|
||||
0.000000 0 1.000000
|
||||
1.000000 4 1.000000
|
||||
0.000000 255 0 0 255
|
||||
1.000000 0 0 255 255
|
||||
end clip
|
||||
end transform
|
||||
end transform
|
||||
|
|
|
@ -5,9 +5,9 @@ start transform 0.020000 0.000000 0.000000 0.020000 0.000000 0.000000
|
|||
p0 166.000000 768.000000 radius 0.000000
|
||||
p1 166.000000 768.000000 radius 256.000000
|
||||
colors
|
||||
0.000000 3 1.000000
|
||||
0.500000 9 1.000000
|
||||
1.000000 0 1.000000
|
||||
0.000000 0 128 0 255
|
||||
0.500000 255 255 255 255
|
||||
1.000000 255 0 0 255
|
||||
end clip
|
||||
end transform
|
||||
end transform
|
||||
|
|
|
@ -546,14 +546,17 @@ pop_clip (hb_paint_funcs_t *funcs,
|
|||
static void
|
||||
paint_color (hb_paint_funcs_t *funcs,
|
||||
void *paint_data,
|
||||
unsigned int color_index,
|
||||
float alpha,
|
||||
hb_color_t color,
|
||||
const hb_paint_context_t *ctx,
|
||||
void *user_data)
|
||||
{
|
||||
paint_data_t *data = user_data;
|
||||
|
||||
print (data, "solid %u %f", color_index, alpha);
|
||||
print (data, "solid %d %d %d %d",
|
||||
hb_color_get_red (color),
|
||||
hb_color_get_green (color),
|
||||
hb_color_get_blue (color),
|
||||
hb_color_get_alpha (color));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -587,7 +590,12 @@ print_color_line (paint_data_t *data,
|
|||
print (data, "colors");
|
||||
data->level += 1;
|
||||
for (unsigned int i = 0; i < len; i++)
|
||||
print (data, "%f %u %f", stops[i].offset, stops[i].color_index, stops[i].alpha);
|
||||
print (data, "%f %d %d %d %d",
|
||||
stops[i].offset,
|
||||
hb_color_get_red (stops[i].color),
|
||||
hb_color_get_green (stops[i].color),
|
||||
hb_color_get_blue (stops[i].color),
|
||||
hb_color_get_alpha (stops[i].color));
|
||||
data->level -= 1;
|
||||
}
|
||||
|
||||
|
@ -746,7 +754,7 @@ test_hb_ot_color_colr_v1 (gconstpointer d)
|
|||
*/
|
||||
if (getenv ("GENERATE_DATA"))
|
||||
{
|
||||
g_print ("%s\n", data.string->str);
|
||||
g_print ("%s", data.string->str);
|
||||
exit (0);
|
||||
}
|
||||
|
||||
|
|
|
@ -259,8 +259,11 @@ hb_cairo_paint_linear_gradient (cairo_t *cr,
|
|||
cairo_pattern_set_extend (pattern, cairo_extend (hb_color_line_get_extend (color_line)));
|
||||
for (unsigned int i = 0; i < len; i++)
|
||||
{
|
||||
float r, g, b, a;
|
||||
hb_cairo_get_font_color (ctx, stops[i].color_index, stops[i].alpha, &r, &g, &b, &a);
|
||||
double r, g, b, a;
|
||||
r = hb_color_get_red (stops[i].color) / 255.;
|
||||
g = hb_color_get_green (stops[i].color) / 255.;
|
||||
b = hb_color_get_blue (stops[i].color) / 255.;
|
||||
a = hb_color_get_alpha (stops[i].color) / 255.;
|
||||
cairo_pattern_add_color_stop_rgba (pattern, stops[i].offset, r, g, b, a);
|
||||
}
|
||||
|
||||
|
@ -307,8 +310,11 @@ hb_cairo_paint_radial_gradient (cairo_t *cr,
|
|||
|
||||
for (unsigned int i = 0; i < len; i++)
|
||||
{
|
||||
float r, g, b, a;
|
||||
hb_cairo_get_font_color (ctx, stops[i].color_index, stops[i].alpha, &r, &g, &b, &a);
|
||||
double r, g, b, a;
|
||||
r = hb_color_get_red (stops[i].color) / 255.;
|
||||
g = hb_color_get_green (stops[i].color) / 255.;
|
||||
b = hb_color_get_blue (stops[i].color) / 255.;
|
||||
a = hb_color_get_alpha (stops[i].color) / 255.;
|
||||
cairo_pattern_add_color_stop_rgba (pattern, stops[i].offset, r, g, b, a);
|
||||
}
|
||||
|
||||
|
@ -486,7 +492,10 @@ add_sweep_gradient_patches (const hb_paint_context_t *ctx,
|
|||
color_t c;
|
||||
if (start_angle > 0)
|
||||
{
|
||||
hb_cairo_get_font_color (ctx, stops[0].color_index, stops[0].alpha, &c.r, &c.g, &c.b, &c.a);
|
||||
c.r = hb_color_get_red (stops[0].color) / 255.;
|
||||
c.g = hb_color_get_green (stops[0].color) / 255.;
|
||||
c.b = hb_color_get_blue (stops[0].color) / 255.;
|
||||
c.a = hb_color_get_alpha (stops[0].color) / 255.;
|
||||
add_sweep_gradient_patches1 (cx, cy, radius,
|
||||
0., &c,
|
||||
start_angle, &c,
|
||||
|
@ -494,7 +503,10 @@ add_sweep_gradient_patches (const hb_paint_context_t *ctx,
|
|||
}
|
||||
if (end_angle < 2 * M_PI)
|
||||
{
|
||||
hb_cairo_get_font_color (ctx, stops[n_stops-1].color_index, stops[n_stops-1].alpha, &c.r, &c.g, &c.b, &c.a);
|
||||
c.r = hb_color_get_red (stops[n_stops - 1].color) / 255.;
|
||||
c.g = hb_color_get_green (stops[n_stops - 1].color) / 255.;
|
||||
c.b = hb_color_get_blue (stops[n_stops - 1].color) / 255.;
|
||||
c.a = hb_color_get_alpha (stops[n_stops - 1].color) / 255.;
|
||||
add_sweep_gradient_patches1 (cx, cy, radius,
|
||||
end_angle, &c,
|
||||
2 * M_PI, &c,
|
||||
|
@ -530,7 +542,10 @@ add_sweep_gradient_patches (const hb_paint_context_t *ctx,
|
|||
for (unsigned i = 0; i < n_stops; i++)
|
||||
{
|
||||
angles[i] = start_angle + stops[i].offset * (end_angle - start_angle);
|
||||
hb_cairo_get_font_color (ctx, stops[i].color_index, stops[i].alpha, &colors[i].r, &colors[i].g, &colors[i].b, &colors[i].a);
|
||||
colors[i].r = hb_color_get_red (stops[i].color) / 255.;
|
||||
colors[i].g = hb_color_get_green (stops[i].color) / 255.;
|
||||
colors[i].b = hb_color_get_blue (stops[i].color) / 255.;
|
||||
colors[i].a = hb_color_get_alpha (stops[i].color) / 255.;
|
||||
}
|
||||
|
||||
if (extend == CAIRO_EXTEND_PAD)
|
||||
|
|
|
@ -209,16 +209,17 @@ pop_group (hb_paint_funcs_t *funcs,
|
|||
static void
|
||||
paint_color (hb_paint_funcs_t *funcs,
|
||||
void *paint_data,
|
||||
unsigned int color_index,
|
||||
float alpha,
|
||||
hb_color_t color,
|
||||
const hb_paint_context_t *ctx,
|
||||
void *user_data)
|
||||
{
|
||||
cairo_t *cr = (cairo_t *)paint_data;
|
||||
float r, g, b, a;
|
||||
|
||||
hb_cairo_get_font_color (ctx, color_index, alpha, &r, &g, &b, &a);
|
||||
cairo_set_source_rgba (cr, (double)r, (double)g, (double)b, (double)a);
|
||||
cairo_set_source_rgba (cr,
|
||||
hb_color_get_red (color) / 255.,
|
||||
hb_color_get_green (color) / 255.,
|
||||
hb_color_get_blue (color) / 255.,
|
||||
hb_color_get_alpha (color) / 255.);
|
||||
cairo_paint (cr);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue