pub enum AlphaMode {
Premultiplied,
Straight,
}Expand description
How a texture’s colour channels relate to its alpha.
The whole pipeline composites premultiplied, so the fragment stage has to know which form it is sampling: a premultiplied texel is divided back to straight RGB before the PartsColor maths, a straight one is used as is. The flag rides in the texture’s own bind group, so it costs no extra pipeline.
SSRenderer::upload_texture premultiplies on the CPU and is always
AlphaMode::Premultiplied; SSRenderer::set_texture takes whatever the
supplier has, which for an engine’s asset system is usually
AlphaMode::Straight.
Variants§
Premultiplied
rgb is already multiplied by a. Correct under linear filtering, and
what SpriteStudio’s own atlas path produces.
Straight
rgb is independent of a (the usual form of a decoded PNG, and what an
engine hands over unless it was told otherwise).
Trait Implementations§
impl Copy for AlphaMode
impl Eq for AlphaMode
impl StructuralPartialEq for AlphaMode
Auto Trait Implementations§
impl Freeze for AlphaMode
impl RefUnwindSafe for AlphaMode
impl Send for AlphaMode
impl Sync for AlphaMode
impl Unpin for AlphaMode
impl UnsafeUnpin for AlphaMode
impl UnwindSafe for AlphaMode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.