pub enum LayerFilter {
Blur {
sigma: f32,
},
DropShadow {
offset: (f32, f32),
sigma: f32,
color: AlphaColor<Srgb>,
},
}Expand description
A filter the engine can apply to an isolated layer.
Engine-internal on purpose: this is the vocabulary
push_filter_layer records with, not a frust_scene command.
Variants§
Blur
A Gaussian blur of standard deviation sigma, in the layer’s own user
space — the transform in force when the layer is opened scales it into
device space.
DropShadow
A shadow-only drop shadow: the layer’s alpha, blurred by sigma,
shifted by offset, and recoloured to color — never the layer’s own
unfiltered content composited back over it (see drop_shadow’s own
doc for why).
Fields
offset: (f32, f32)Horizontal, vertical offset of the shadow, in the layer’s own user
space — the transform in force when the layer is opened scales it
into device space, exactly as sigma is.
sigma: f32The shadow’s blur standard deviation. Zero blurs nothing, leaving a hard-edged, offset silhouette.
color: AlphaColor<Srgb>The shadow’s own colour. Its alpha scales the shadow’s own opacity; the layer’s colour never reaches the shadow.
Implementations§
Source§impl LayerFilter
impl LayerFilter
Sourcepub fn filter_data(self, transform: Affine) -> Result<FilterData, EngineError>
pub fn filter_data(self, transform: Affine) -> Result<FilterData, EngineError>
The recorder-side description of this filter under transform.
This is what carries the filter’s expansion into the recording: a blurred layer’s tile-aligned bounds grow by 3σ on every side, because the blur paints outside the contents that produced it, and the page the layer is rendered into is sized from those grown bounds.
§Errors
EngineError::InvalidGeometry for a σ that is not finite, is
negative, or is past MAX_BLUR_SIGMA — in the layer’s own user space
or in the device space transform scales it into (a
Self::DropShadow’s own offset held to the same finiteness) — and
EngineError::InvalidTransform for a transform that is not finite —
the same terms the compiler already refuses a draw’s own geometry and
transform on, checked here because every quantity below is derived from
both.