pub struct DisplayTarget {
pub primaries: Primaries,
pub transfer: Transfer,
pub sdr_white_nits: f32,
pub headroom: f32,
pub surface_format: SurfaceFormat,
pub source: TargetSource,
}Expand description
What a window’s surface expects.
Fields§
§primaries: PrimariesPrimaries and white of the encoding the surface declares (not the monitor’s).
transfer: Transfer§sdr_white_nits: f32Nits the encoding’s reference white maps to.
headroom: f32Highest value the target may carry, relative to SDR white (1.0 for SDR).
surface_format: SurfaceFormat§source: TargetSourceImplementations§
Source§impl DisplayTarget
impl DisplayTarget
Sourcepub fn srgb() -> DisplayTarget
pub fn srgb() -> DisplayTarget
sRGB, SDR, 8 bits: what every surface can show.
Sourcepub fn display_p3() -> DisplayTarget
pub fn display_p3() -> DisplayTarget
Display P3, SDR (what an application wanting the P3 gamut asks for).
Sourcepub fn hdr_pq(headroom: f32) -> DisplayTarget
pub fn hdr_pq(headroom: f32) -> DisplayTarget
HDR10: BT.2020 primaries, PQ, SDR white at 203 nits, headroom
times brighter at most.
Sourcepub fn hdr_hlg() -> DisplayTarget
pub fn hdr_hlg() -> DisplayTarget
BT.2100 HLG, SDR white at 75 % of the signal.
Sourcepub fn for_color_space(
color_space: ColorSpace,
format: SurfaceFormat,
headroom: f32,
source: TargetSource,
) -> DisplayTarget
pub fn for_color_space( color_space: ColorSpace, format: SurfaceFormat, headroom: f32, source: TargetSource, ) -> DisplayTarget
The encoding of a surface colour space on a format, as declared
by source; headroom is kept within what the transfer carries.
Sourcepub fn with_source(self, source: TargetSource) -> DisplayTarget
pub fn with_source(self, source: TargetSource) -> DisplayTarget
Who declared it.
Sourcepub fn color_space(&self) -> Option<ColorSpace>
pub fn color_space(&self) -> Option<ColorSpace>
The surface colour space this encoding is, if any (a 2.2 power counts as sRGB).
Sourcepub fn unsupported(&self) -> Option<Fallback>
pub fn unsupported(&self) -> Option<Fallback>
Why the viewport cannot draw this encoding faithfully, if it
cannot: it must be a colour space a surface can be configured
with, on a format that carries it, declared by whoever configured
the surface (an Assumed target is sRGB). A Tagged target needs
no colour space: the compositor protocol names its primaries and
transfer (DisplayTarget::untaggable).
Sourcepub fn untaggable(&self) -> Option<Fallback>
pub fn untaggable(&self) -> Option<Fallback>
Why a surface tagged through the compositor protocol cannot carry this encoding, if it cannot: the protocol names the sRGB, Display P3 and BT.2020 primaries (not custom ones) and every transfer but extended sRGB; the format must carry the transfer (half floats for extended linear, at least 10 bits for PQ and HLG).
Sourcepub fn is_supported(&self) -> bool
pub fn is_supported(&self) -> bool
Whether the viewport draws this target faithfully. The stage
encodes every transfer and primaries (CPU and GPU), so this says
whether the encoding is one a surface can be configured with, on
a format that carries it, declared by whoever configured it
(DisplayTarget::unsupported says why not). Others are drawn
as sRGB (DisplayTarget::effective).
Sourcepub fn effective(&self) -> DisplayTarget
pub fn effective(&self) -> DisplayTarget
The target actually drawn: this one when supported, else sRGB.
Sourcepub fn range(&self) -> [f32; 2]
pub fn range(&self) -> [f32; 2]
The bounds after the matrix: [0, 1] for SDR, [0, headroom]
for PQ and HLG, [-headroom, headroom] for the extended ones
(negatives carry colours outside the primaries).
Sourcepub fn describe(&self) -> String
pub fn describe(&self) -> String
A short description (“Display P3 primaries, sRGB transfer, SDR”).
Sourcepub fn missing(&self, wanted: &DisplayTarget) -> Option<String>
pub fn missing(&self, wanted: &DisplayTarget) -> Option<String>
What this target carries less than wanted (a wider gamut, more
headroom), if anything.
Trait Implementations§
Source§impl Clone for DisplayTarget
impl Clone for DisplayTarget
Source§fn clone(&self) -> DisplayTarget
fn clone(&self) -> DisplayTarget
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DisplayTarget
impl Debug for DisplayTarget
Source§impl Default for DisplayTarget
impl Default for DisplayTarget
Source§impl PartialEq for DisplayTarget
impl PartialEq for DisplayTarget
impl Copy for DisplayTarget
impl StructuralPartialEq for DisplayTarget
Auto Trait Implementations§
impl Freeze for DisplayTarget
impl RefUnwindSafe for DisplayTarget
impl Send for DisplayTarget
impl Sync for DisplayTarget
impl Unpin for DisplayTarget
impl UnsafeUnpin for DisplayTarget
impl UnwindSafe for DisplayTarget
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>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<F, T, S> SimdInto<T, S> for Fwhere
T: SimdFrom<F, S>,
S: Simd,
impl<F, T, S> SimdInto<T, S> for Fwhere
T: SimdFrom<F, S>,
S: Simd,
§impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
§fn to_owned_obj(&self, data: FontData<'_>) -> U
fn to_owned_obj(&self, data: FontData<'_>) -> U
T, using the provided data to resolve any offsets.