From fe70db1f4ce078f7b41c163a1c0ead31fd04850a Mon Sep 17 00:00:00 2001 From: Martin Haug Date: Tue, 8 Feb 2022 21:12:09 +0100 Subject: New color stuff - CMYK function - More default colors - Interpret RGB values as sRGB --- src/export/render.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/export/render.rs') diff --git a/src/export/render.rs b/src/export/render.rs index c41bcbf2..8b7aa46d 100644 --- a/src/export/render.rs +++ b/src/export/render.rs @@ -10,7 +10,7 @@ use usvg::FitTo; use crate::font::{Face, FaceId}; use crate::frame::{Element, Frame, Geometry, Group, Shape, Stroke, Text}; -use crate::geom::{self, Color, Length, Paint, PathElement, Size, Transform}; +use crate::geom::{self, Length, Paint, PathElement, Size, Transform}; use crate::image::{Image, RasterImage, Svg}; use crate::Context; @@ -279,7 +279,8 @@ fn render_outline_glyph( let bottom = top + mh; // Premultiply the text color. - let Paint::Solid(Color::Rgba(c)) = text.fill; + let Paint::Solid(color) = text.fill; + let c = color.to_rgba(); let color = sk::ColorU8::from_rgba(c.r, c.g, c.b, 255).premultiply().get(); // Blend the glyph bitmap with the existing pixels on the canvas. @@ -453,7 +454,8 @@ impl From for sk::Transform { impl From for sk::Paint<'static> { fn from(paint: Paint) -> Self { let mut sk_paint = sk::Paint::default(); - let Paint::Solid(Color::Rgba(c)) = paint; + let Paint::Solid(color) = paint; + let c = color.to_rgba(); sk_paint.set_color_rgba8(c.r, c.g, c.b, c.a); sk_paint.anti_alias = true; sk_paint -- cgit v1.2.3