Mercurial > hg > orthanc-stone
diff Framework/Scene2D/Internals/CairoTextRenderer.cpp @ 804:61ba4b504e9a
PolylineSceneLayer now has one color per chain
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 28 May 2019 15:58:21 +0200 |
parents | 9e51fb773bbd |
children | 6e888cf6a48b |
line wrap: on
line diff
--- a/Framework/Scene2D/Internals/CairoTextRenderer.cpp Tue May 28 14:18:46 2019 +0200 +++ b/Framework/Scene2D/Internals/CairoTextRenderer.cpp Tue May 28 15:58:21 2019 +0200 @@ -48,9 +48,7 @@ } const unsigned int width = source->GetWidth(); - const unsigned int red = layer.GetRed(); - const unsigned int green = layer.GetGreen(); - const unsigned int blue = layer.GetBlue(); + const Color& color = layer.GetColor(); for (unsigned int y = 0; y < source->GetHeight(); y++) { @@ -62,9 +60,9 @@ unsigned int alpha = *p; // Premultiplied alpha - q[0] = static_cast<uint8_t>((blue * alpha) / 255); - q[1] = static_cast<uint8_t>((green * alpha) / 255); - q[2] = static_cast<uint8_t>((red * alpha) / 255); + q[0] = static_cast<uint8_t>((color.GetBlue() * alpha) / 255); + q[1] = static_cast<uint8_t>((color.GetGreen() * alpha) / 255); + q[2] = static_cast<uint8_t>((color.GetRed() * alpha) / 255); q[3] = *p; p++; @@ -85,7 +83,9 @@ const TextSceneLayer& layer = GetLayer<TextSceneLayer>(); cairo_t* cr = GetCairoContext(); - cairo_set_source_rgb(cr, layer.GetRedAsFloat(), layer.GetGreenAsFloat(), layer.GetBlueAsFloat()); + cairo_set_source_rgb(cr, layer.GetColor().GetRedAsFloat(), + layer.GetColor().GetGreenAsFloat(), + layer.GetColor().GetBlueAsFloat()); double dx, dy; // In pixels ComputeAnchorTranslation(dx, dy, layer.GetAnchor(), text_.GetWidth(),