Fixed wrong color for filling.

This commit is contained in:
5cript 2019-07-09 17:37:32 +02:00
parent dfba745f6a
commit 13b47c5542
1 changed files with 9 additions and 7 deletions

View File

@ -13,19 +13,21 @@ namespace Cairo
}
void DrawContext::fill(color_space r, color_space g, color_space b, color_space a)
{
save();
cairo_set_source_rgba (ctx_, r, g, b, a);
save();
cairo_set_source_rgba(
ctx_,
static_cast <double> (r) / colorMax,
static_cast <double> (g) / colorMax,
static_cast <double> (b) / colorMax,
static_cast <double> (a) / colorMax
);
cairo_set_operator(ctx_, CAIRO_OPERATOR_SOURCE);
cairo_paint(ctx_);
restore();
}
void DrawContext::fill(RGBA color)
{
save();
cairo_set_source_rgba (ctx_, color.r, color.g, color.b, color.a);
cairo_set_operator(ctx_, CAIRO_OPERATOR_SOURCE);
cairo_paint(ctx_);
restore();
fill(color.r, color.g, color.b, color.a);
}
void DrawContext::save()
{