mirror of
https://github.com/penpot/penpot.git
synced 2025-12-12 06:24:17 +01:00
🐛 Fix inner strokes with opacity using erode instead of multiple blending modes
This commit is contained in:
@@ -740,27 +740,18 @@ fn get_text_stroke_paints(stroke: &Stroke, bounds: &Rect, text_paint: &Paint) ->
|
||||
set_paint_fill(&mut paint, &stroke.fill, bounds);
|
||||
paints.push(paint);
|
||||
} else {
|
||||
// outer
|
||||
let mut paint = skia::Paint::default();
|
||||
paint.set_style(skia::PaintStyle::Stroke);
|
||||
paint.set_blend_mode(skia::BlendMode::DstATop);
|
||||
paint.set_anti_alias(true);
|
||||
paint.set_stroke_width(stroke.width * 2.0);
|
||||
paints.push(paint);
|
||||
|
||||
let mut paint = skia::Paint::default();
|
||||
let mut paint = text_paint.clone();
|
||||
paint.set_style(skia::PaintStyle::Fill);
|
||||
paint.set_blend_mode(skia::BlendMode::Clear);
|
||||
paint.set_anti_alias(true);
|
||||
paint.set_anti_alias(false);
|
||||
set_paint_fill(&mut paint, &stroke.fill, bounds);
|
||||
paints.push(paint);
|
||||
|
||||
// inner
|
||||
let mut paint = skia::Paint::default();
|
||||
paint.set_style(skia::PaintStyle::Stroke);
|
||||
paint.set_stroke_width(stroke.width * 2.0);
|
||||
paint.set_blend_mode(skia::BlendMode::Xor);
|
||||
paint.set_anti_alias(true);
|
||||
set_paint_fill(&mut paint, &stroke.fill, bounds);
|
||||
let image_filter =
|
||||
skia_safe::image_filters::erode((stroke.width, stroke.width), None, None);
|
||||
paint.set_image_filter(image_filter);
|
||||
paint.set_anti_alias(false);
|
||||
paint.set_blend_mode(skia::BlendMode::DstOut);
|
||||
paints.push(paint);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user