adding together a jump-flood algorithm for rendering outlines
Some checks are pending
Format / all (push) Waiting to run
Lint / all (push) Waiting to run
Test / all (macOS-latest, beta) (push) Waiting to run
Test / all (macOS-latest, stable) (push) Waiting to run
Test / all (ubuntu-latest, beta) (push) Waiting to run
Test / all (ubuntu-latest, stable) (push) Waiting to run
Test / all (windows-latest, beta) (push) Waiting to run
Test / all (windows-latest, stable) (push) Waiting to run

This commit is contained in:
Chris Cochrun 2025-07-10 10:03:03 -05:00
parent 84de74e7c2
commit da3b02cf8a
6 changed files with 332 additions and 209 deletions

View file

@ -1,6 +1,7 @@
use cryoglyph::{
Attrs, Buffer, Cache, Color, Family, FontSystem, Metrics, Resolution, Shaping, SwashCache,
TextArea, TextAtlas, TextBounds, TextRenderer, Viewport,
cosmic_text::LetterSpacing, Attrs, AttrsOwned, Buffer, Cache, Color, Family, FontSystem,
Metrics, Resolution, Shaping, SwashCache, TextArea, TextAtlas, TextBounds, TextRenderer,
Viewport,
};
use std::sync::Arc;
use wgpu::{
@ -169,6 +170,21 @@ impl winit::application::ApplicationHandler for Application {
let mut encoder =
device.create_command_encoder(&CommandEncoderDescriptor { label: None });
let text_area = TextArea {
buffer: text_buffer,
left: 10.0,
top: 10.0,
scale: 3.5,
bounds: TextBounds {
left: 0,
top: 0,
right: 600,
bottom: 160,
},
default_color: Color::rgb(255, 255, 255),
stroke_size: 5.5,
stroke_color: Color::rgb(50, 50, 255),
};
text_renderer
.prepare(
@ -178,19 +194,7 @@ impl winit::application::ApplicationHandler for Application {
font_system,
atlas,
viewport,
[TextArea {
buffer: text_buffer,
left: 10.0,
top: 10.0,
scale: 1.0,
bounds: TextBounds {
left: 0,
top: 0,
right: 600,
bottom: 160,
},
default_color: Color::rgb(0, 0, 0),
}],
[text_area],
swash_cache,
)
.unwrap();
@ -205,7 +209,7 @@ impl winit::application::ApplicationHandler for Application {
view: &view,
resolve_target: None,
ops: Operations {
load: LoadOp::Clear(wgpu::Color::WHITE),
load: LoadOp::Clear(wgpu::Color::BLACK),
store: wgpu::StoreOp::Store,
},
})],