euv_engine/renderer/enum.rs
1/// Defines how new pixels are composited with existing pixels on the canvas.
2///
3/// Maps directly to the CSS `globalCompositeOperation` property.
4#[derive(Clone, Copy, Debug, Default, Eq, Hash, PartialEq)]
5pub enum BlendMode {
6 /// The source is drawn over the destination (default alpha blending).
7 #[default]
8 Normal,
9 /// The source color is multiplied with the destination, producing a darker result.
10 Multiply,
11 /// The source and destination are inverted, multiplied, then inverted again.
12 Screen,
13 /// The source and destination colors are added together, clamped to maximum brightness.
14 Lighter,
15 /// Combines `Multiply` and `Screen` based on the destination color.
16 Overlay,
17 /// Keeps the darker of the source and destination per channel.
18 Darken,
19 /// Keeps the lighter of the source and destination per channel.
20 Lighten,
21 /// Dodges the destination color brightening it based on the source.
22 ColorDodge,
23 /// Burns the destination color darkening it based on the source.
24 ColorBurn,
25 /// A harsher version of `Overlay` using the source color as the filter.
26 HardLight,
27 /// A softer version of `Overlay` using the source color as the filter.
28 SoftLight,
29 /// Subtracts the darker color from the lighter color per channel.
30 Difference,
31 /// Similar to `Difference` but with lower contrast.
32 Exclusion,
33 /// Uses the hue of the source with the saturation and luminosity of the destination.
34 Hue,
35 /// Uses the saturation of the source with the hue and luminosity of the destination.
36 Saturation,
37 /// Uses the hue and saturation of the source with the luminosity of the destination.
38 Color,
39 /// Uses the luminosity of the source with the hue and saturation of the destination.
40 Luminosity,
41}
42
43/// Rendering quality preset controlling anti-aliasing smoothing strategy.
44///
45/// Maps to the canvas `imageSmoothingQuality` value plus an explicit
46/// `imageSmoothingEnabled` toggle. Combined with a CSS `image-rendering:
47/// pixelated` rule on the consumer side, `Low` produces crisp pixel-art
48/// rendering while `High` produces smooth vector-style rendering.
49#[derive(Clone, Copy, Debug, Default, Eq, Hash, PartialEq)]
50pub enum RenderQuality {
51 /// Fastest rendering, pixelated scaling.
52 ///
53 /// Disables `imageSmoothingEnabled` on the canvas context and sets
54 /// `imageSmoothingQuality = "low"`. Pair with CSS `image-rendering:
55 /// pixelated` for sharp nearest-neighbour scaling.
56 Low,
57 /// Balanced rendering with default smoothing quality.
58 ///
59 /// Sets `imageSmoothingQuality = "medium"`.
60 Medium,
61 /// Highest fidelity rendering with smooth edges and high-quality scaling.
62 ///
63 /// Sets `imageSmoothingQuality = "high"`. Best for vector-style content
64 /// on HiDPI displays. This is the default — when no explicit quality is
65 /// requested, the engine errs on the side of visual fidelity rather than
66 /// performance, since users typically notice aliasing artifacts before
67 /// they notice a few extra milliseconds of GPU time.
68 #[default]
69 High,
70}