Skip to main content

ImageSource

Enum ImageSource 

Source
pub enum ImageSource {
    Encoded(Vec<u8>),
    Rgba {
        width: u32,
        height: u32,
        pixels: Vec<u8>,
    },
    Bgra {
        width: u32,
        height: u32,
        pixels: Vec<u8>,
    },
    Rgba16 {
        width: u32,
        height: u32,
        pixels: Vec<u16>,
    },
}
Expand description

O conteúdo de uma Image.

Variants§

§

Encoded(Vec<u8>)

Arquivo de imagem como está no disco (o canvas decodifica).

§

Rgba

Pixels RGBA (4 bytes por pixel, linha a linha, sem pré-multiplicar o alfa).

Fields

§width: u32
§height: u32
§pixels: Vec<u8>
§

Bgra

Pixels BGRA (a ordem que decodificadores de vídeo e o Windows costumam entregar), opacos ou já pré-multiplicados: o Direct2D os usa sem converter.

Fields

§width: u32
§height: u32
§pixels: Vec<u8>
§

Rgba16

Pixels RGBA de 16 bits por canal (0 a 65535, sem pré-multiplicar o alfa): a imagem médica e a fotografia de 16 bits. Com a saída de 10 bits ou a HDR (color_output), o Direct2D e o Skia desenham sem perder os tons; nos outros casos (e no navegador, de 8 bits), sai como a de 8 (ImageSource::to_rgba8).

Fields

§width: u32
§height: u32
§pixels: Vec<u16>

Implementations§

Source§

impl ImageSource

Source

pub fn to_rgba8(&self) -> Option<(u32, u32, Cow<'_, [u8]>)>

Os pixels RGBA de 8 bits (o de 16 bits arredondado; o BGRA trocado de ordem). None num arquivo codificado (quem decodifica é o canvas).

Trait Implementations§

Source§

impl Debug for ImageSource

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for ImageSource

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ImageSource

Auto Trait Implementations§

§

impl Forget for ImageSource

§

impl Freeze for ImageSource

§

impl Move for ImageSource

§

impl RefUnwindSafe for ImageSource

§

impl Send for ImageSource
where RawVecInner: Send,

§

impl Sync for ImageSource
where RawVecInner: Sync,

§

impl Unpin for ImageSource
where *const u8 is !null: Unpin,

§

impl UnsafeUnpin for ImageSource

§

impl UnwindSafe for ImageSource
where RawVecInner: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.