Resolve fill and stroke paints when filling and stroking text.
Makes text respect global alpha.
This commit is contained in:
parent
667a6c7c43
commit
b9b1472b6c
|
@ -27,12 +27,14 @@ use std::sync::Arc;
|
||||||
|
|
||||||
impl CanvasRenderingContext2D {
|
impl CanvasRenderingContext2D {
|
||||||
pub fn fill_text(&mut self, string: &str, position: Vector2F) {
|
pub fn fill_text(&mut self, string: &str, position: Vector2F) {
|
||||||
let paint_id = self.canvas.scene.push_paint(&self.current_state.fill_paint);
|
let paint = self.current_state.resolve_paint(&self.current_state.fill_paint);
|
||||||
|
let paint_id = self.canvas.scene.push_paint(&paint);
|
||||||
self.fill_or_stroke_text(string, position, paint_id, TextRenderMode::Fill);
|
self.fill_or_stroke_text(string, position, paint_id, TextRenderMode::Fill);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn stroke_text(&mut self, string: &str, position: Vector2F) {
|
pub fn stroke_text(&mut self, string: &str, position: Vector2F) {
|
||||||
let paint_id = self.canvas.scene.push_paint(&self.current_state.stroke_paint);
|
let paint = self.current_state.resolve_paint(&self.current_state.stroke_paint);
|
||||||
|
let paint_id = self.canvas.scene.push_paint(&paint);
|
||||||
let render_mode = TextRenderMode::Stroke(self.current_state.resolve_stroke_style());
|
let render_mode = TextRenderMode::Stroke(self.current_state.resolve_stroke_style());
|
||||||
self.fill_or_stroke_text(string, position, paint_id, render_mode);
|
self.fill_or_stroke_text(string, position, paint_id, render_mode);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue