pub struct RustImageData { /* private fields */ }

Implementations§

source§

impl RustImageData

source

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

Trait Implementations§

source§

impl RustImage for RustImageData

source§

fn empty() -> Self

create an empty image
source§

fn is_empty(&self) -> bool

source§

fn from_bytes(bytes: &[u8]) -> Result<Self>

Create a new image from a byte slice
source§

fn from_path(path: &str) -> Result<Self>

Read image from file path
source§

fn get_size(&self) -> (u32, u32)

width and height
source§

fn resize(&self, width: u32, height: u32, filter: FilterType) -> Result<Self>

en: Adjust the size of the image without retaining the aspect ratio zh: 调整图片大小,不保留长宽比
source§

fn save_to_path(&self, path: &str) -> Result<()>

source§

fn thumbnail(&self, width: u32, height: u32) -> Result<Self>

Scale this image down to fit within a specific size. Returns a new image. The image’s aspect ratio is preserved. The image is scaled to the maximum possible size that fits within the bounds specified by nwidth and nheight. Read more
source§

fn to_jpeg(&self, quality: u8) -> Result<RustImageBuffer>

en: Convert image to jpeg format, quality is the quality, give a value of 0-100, 100 is the highest quality, the returned image is a new image, and the data itself will not be modified zh: 把图片转为 jpeg 格式,quality(0-100) 为质量,输出字节数组,可直接通过 io 写入文件
source§

fn to_png(&self) -> Result<RustImageBuffer>

en: Convert to png format, the returned image is a new image, and the data itself will not be modified zh: 转为 png 格式,返回的为新的图片,本身数据不会修改
source§

fn to_bitmap(&self) -> Result<RustImageBuffer>

Auto Trait Implementations§

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> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

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

§

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>,

§

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.