🎉 Add text fills

This commit is contained in:
Elena Torro 2025-05-09 15:53:11 +02:00
parent c2ce7c6cf6
commit 42ef2f929a
11 changed files with 451 additions and 279 deletions

View file

@ -10,7 +10,7 @@ mod strokes;
mod surfaces;
mod text;
use skia_safe::{self as skia, image, Matrix, RRect, Rect};
use skia_safe::{self as skia, Matrix, RRect, Rect};
use std::borrow::Cow;
use std::collections::{HashMap, HashSet};
@ -19,7 +19,7 @@ use options::RenderOptions;
use surfaces::{SurfaceId, Surfaces};
use crate::performance;
use crate::shapes::{modified_children_ids, Corners, Fill, Shape, StructureEntry, Type};
use crate::shapes::{modified_children_ids, Corners, Shape, StructureEntry, Type};
use crate::tiles::{self, TileRect, TileViewbox, TileWithDistance};
use crate::uuid::Uuid;
use crate::view::Viewbox;
@ -427,13 +427,11 @@ impl RenderState {
text::render(self, &shape, &paragraphs, None, None);
for stroke in shape.strokes().rev() {
let mut image: Option<image::Image> = None;
if let Fill::Image(image_fill) = &stroke.fill {
image = self.images.get(&image_fill.id()).cloned();
}
let stroke_paints = shape.get_text_stroke_paint(stroke, image.as_ref());
let stroke_paragraphs = text_content
.get_skia_stroke_paragraphs(self.fonts.font_collection(), &stroke_paints);
let stroke_paragraphs = text_content.get_skia_stroke_paragraphs(
stroke,
&shape.selrect(),
self.fonts.font_collection(),
);
shadows::render_text_drop_shadows(self, &shape, &stroke_paragraphs, antialias);
text::render(
self,