Struct bmp_rust::bmp::BMP

source ·
pub struct BMP {
    pub contents: Vec<u8>,
    /* private fields */
}

Fields§

§contents: Vec<u8>

Implementations§

source§

impl BMP

source

pub fn new(height: i32, width: u32, default_color: Option<[u8; 4]>) -> BMP

source

pub fn new_from_file(file_path: &str) -> BMP

source

pub fn num_bytes_to_kilobytes(bytes: u32) -> u32

source

pub fn rgba_to_hex(rgba: [u8; 4]) -> String

source

pub fn hex_to_rgba(hex: String) -> [u8; 4]

source

pub fn composite_colors(color1: [u8; 4], color2: [u8; 4]) -> [u8; 4]

source

pub fn get_header(&self) -> BITMAPFILEHEADER

source

pub fn get_size(&self, use_header: bool) -> u32

source

pub fn get_dib_header(&self) -> Result<DIBHEADER, ErrorKind>

source

pub fn get_pixel_data(&self) -> Result<VecDeque<Vec<Vec<u8>>>, ErrorKind>

source

pub fn get_color_of_px(&self, x: usize, y: usize) -> Result<[u8; 4], ErrorKind>

source

pub fn get_color_of_px_efficient( &self, x: usize, y: usize, dib_header: &DIBHEADER, pixel_data: &VecDeque<Vec<Vec<u8>>> ) -> Result<[u8; 4], ErrorKind>

source

pub fn get_format(&self) -> String

source

pub fn change_color_of_pixel( &mut self, x: u16, y: u16, new_color: [u8; 4] ) -> Result<(), ErrorKind>

source

pub fn change_color_of_pixel_efficient( &mut self, x: u16, y: u16, new_color: [u8; 4], dib_header: &DIBHEADER, header: &BITMAPFILEHEADER ) -> Result<(), ErrorKind>

source

pub fn change_color_of_pixels( &mut self, pixels: Vec<[u16; 2]>, new_color: [u8; 4] ) -> Result<(), ErrorKind>

source

pub fn draw_image(&mut self, x: u16, y: u16, bmp2: BMP) -> Result<(), ErrorKind>

source

pub fn change_opacity(&mut self, opacity: u8) -> Result<(), ErrorKind>

source

pub fn invert(&mut self, invert_alpha: Option<bool>) -> Result<(), ErrorKind>

source

pub fn translate(&mut self, x: i16, y: i16) -> Result<(), ErrorKind>

source

pub fn rotate(&mut self, deg: f64) -> Result<(), ErrorKind>

source

pub fn separable_blur( &mut self, radius: u8, gen_distribution: impl Fn(u8, u8) -> u16, horizontal: Option<bool>, vertical: Option<bool> ) -> Result<(), ErrorKind>

source

pub fn box_blur(&mut self, radius: u8) -> Result<(), ErrorKind>

source

pub fn gaussian_blur(&mut self, radius: u8) -> Result<(), ErrorKind>

source

pub fn draw_line( &mut self, fill: [u8; 4], p1: [u16; 2], p2: [u16; 2] ) -> Result<(), ErrorKind>

source

pub fn draw_rectangle( &mut self, fill: Option<[u8; 4]>, stroke: Option<[u8; 4]>, p1: [u16; 2], p2: [u16; 2] ) -> Result<(), ErrorKind>

source

pub fn draw_ellipse( &mut self, center: [u16; 2], xlength: u16, ylength: u16, stroke: [u8; 4], fill: Option<[u8; 4]>, guess: bool ) -> Result<(), ErrorKind>

source

pub fn fill_bucket( &mut self, fill: [u8; 4], x: usize, y: usize ) -> Result<Vec<[u16; 2]>, ErrorKind>

source

pub fn save_to_new(self, file_path: &str) -> Result<(), ErrorKind>

Trait Implementations§

source§

impl Clone for BMP

source§

fn clone(&self) -> BMP

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl PartialEq<BMP> for BMP

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Auto Trait Implementations§

§

impl RefUnwindSafe for BMP

§

impl Send for BMP

§

impl Sync for BMP

§

impl Unpin for BMP

§

impl UnwindSafe for BMP

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.