pub trait RgbImageExt: Sized {
// Required methods
fn from_color(width: u32, height: u32, color: impl Into<Rgb<u8>>) -> Self;
fn from_slice(buffer: &[u8]) -> Result<Self, ImageError>;
fn add_border(
&self,
margin: [u32; 4],
bg_color: impl Into<Rgb<u8>>,
) -> Result<Self, ImageError>;
fn add_percent_border(
&self,
margin_percent: [u32; 4],
bg_color: impl Into<Rgb<u8>>,
) -> Result<Self, ImageError>;
fn encode_jpeg_buffer(&self, quality: u8) -> Result<Vec<u8>, ImageError>;
fn save_with_quality<P: AsRef<Path>>(
&self,
file_name: P,
quality: u8,
) -> Result<(), ImageError>;
fn draw_text(
self,
text: &str,
text_color: impl Into<Rgb<u8>>,
scale: f32,
font: &impl Font,
draw_area: (i32, i32, i32, i32),
x_align: Align,
y_align: Align,
offset: [i32; 4],
) -> Self;
}Required Methods§
Sourcefn from_slice(buffer: &[u8]) -> Result<Self, ImageError>
fn from_slice(buffer: &[u8]) -> Result<Self, ImageError>
Sourcefn add_border(
&self,
margin: [u32; 4],
bg_color: impl Into<Rgb<u8>>,
) -> Result<Self, ImageError>
fn add_border( &self, margin: [u32; 4], bg_color: impl Into<Rgb<u8>>, ) -> Result<Self, ImageError>
Sourcefn add_percent_border(
&self,
margin_percent: [u32; 4],
bg_color: impl Into<Rgb<u8>>,
) -> Result<Self, ImageError>
fn add_percent_border( &self, margin_percent: [u32; 4], bg_color: impl Into<Rgb<u8>>, ) -> Result<Self, ImageError>
Sourcefn encode_jpeg_buffer(&self, quality: u8) -> Result<Vec<u8>, ImageError>
fn encode_jpeg_buffer(&self, quality: u8) -> Result<Vec<u8>, ImageError>
Sourcefn save_with_quality<P: AsRef<Path>>(
&self,
file_name: P,
quality: u8,
) -> Result<(), ImageError>
fn save_with_quality<P: AsRef<Path>>( &self, file_name: P, quality: u8, ) -> Result<(), ImageError>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.