#[non_exhaustive]pub enum SheetColor {
Art,
Mask,
}Expand description
What a tileset’s pixels mean, which decides how its sprites respond to the cell’s foreground color.
This is a fact about how the artwork was authored, not about any one draw call, which is why it sits on the tileset rather than at the call site. A sheet of full-color terrain and a sheet of white icon masks can be loaded side by side and each behave correctly.
Orthogonal to Tint, which is per-cell and applies on top: see
Surface::with_tint.
Open question (retroglyph#559): a sheet mixing mask tiles and full-colour art tiles has no
way to say so today, since this is a sheet-wide setting. The likely answer is to split such a
sheet into two TilesetOptions loads, one per SheetColor, rather than adding a per-tile
escape hatch here. That is untested against a real mixed asset and not resolved by this
type as written.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Art
Full-color artwork, composited verbatim.
The cell’s Style::fg does not touch it. The default,
because a sheet that carries its own color is the common case and rendering it as
authored is the unsurprising outcome.
Mask
A white-on-transparent mask, colored by the cell’s foreground the way a font glyph is.
Equivalent to a Tint::Multiply by the resolved
foreground color, so a white pixel takes the foreground exactly and a grey one takes a
proportionally darker shade. This is how libtcod tilesets, Dwarf Fortress’s classic
tileset, and BearLibTerminal’s bitmap fonts all behave, and it is the one case where
reading fg as a sprite’s color is correct rather than a workaround.
It also keeps a sprite and its text fallback in agreement: the same fg colors the
sprite on a pixel backend and the fallback glyph on a cell backend.
Trait Implementations§
Source§impl Clone for SheetColor
impl Clone for SheetColor
Source§fn clone(&self) -> SheetColor
fn clone(&self) -> SheetColor
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SheetColor
impl Debug for SheetColor
Source§impl Default for SheetColor
impl Default for SheetColor
Source§fn default() -> SheetColor
fn default() -> SheetColor
Source§impl Hash for SheetColor
impl Hash for SheetColor
Source§impl PartialEq for SheetColor
impl PartialEq for SheetColor
Source§fn eq(&self, other: &SheetColor) -> bool
fn eq(&self, other: &SheetColor) -> bool
self and other values to be equal, and is used by ==.impl Copy for SheetColor
impl Eq for SheetColor
impl StructuralPartialEq for SheetColor
Auto Trait Implementations§
impl Freeze for SheetColor
impl RefUnwindSafe for SheetColor
impl Send for SheetColor
impl Sync for SheetColor
impl Unpin for SheetColor
impl UnsafeUnpin for SheetColor
impl UnwindSafe for SheetColor
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<C> WithAlpha for Cwhere
C: Copy,
impl<C> WithAlpha for Cwhere
C: Copy,
§fn with_alpha_first<A>(self, alpha: A) -> AlphaFirst<A, Self>
fn with_alpha_first<A>(self, alpha: A) -> AlphaFirst<A, Self>
self with alpha, storing alpha before the color in memory
(see [AlphaFirst]).§fn with_alpha_last<A>(self, alpha: A) -> AlphaLast<A, Self>
fn with_alpha_last<A>(self, alpha: A) -> AlphaLast<A, Self>
self with alpha, storing alpha after the color in memory
(see [AlphaLast]).