Image

Struct Image 

Source
pub struct Image {
    pub version: u8,
    pub width: u16,
    pub height: u16,
    /* private fields */
}
Expand description

Struct für die Bilddaten. Enthält eine Versionsnummer, die Breite und Höhe des Bildes, die Bit-Tiefe und die indizierten Bilddaten.

Fields§

§version: u8§width: u16§height: u16

Implementations§

Source§

impl Image

Source

pub fn new(version: u8, width: u16, height: u16, bytes: Vec<u8>) -> Self

Erstellt ein neues Bild. Die Bittiefe wird automatisch ermittelt und auf 4 oder 8 Bit gesetzt. Die Bilddaten müssen in einem Vektor mit der Größe width * height sein.

Source

pub unsafe fn new_unchecked( version: u8, width: u16, height: u16, bits: u8, bytes: Vec<u8>, ) -> Self

Erstellt ein neues Bild ohne Überprüfung der Bittiefe.

§Safety

Der Aufrufer muss sicher stellen, dass die Abmessung zu den Bilddaten passt und die Bittiefe korrekt ist.

Source

pub fn bit_depth(&self) -> u8

Die Bit-Tiefe des Bildes. Entweder 4 oder 8 bit.

Source

pub fn bytes(&self) -> &[u8]

Die Bilddaten.

Source

pub fn size(&self) -> usize

Die Abmessungen des Bildes.

Trait Implementations§

Source§

impl PartialEq for Image

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for Image

Auto Trait Implementations§

§

impl Freeze for Image

§

impl RefUnwindSafe for Image

§

impl Send for Image

§

impl Sync for Image

§

impl Unpin for Image

§

impl UnwindSafe for Image

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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.