pub struct TheRGBABuffer { /* private fields */ }Implementations§
Source§impl TheRGBABuffer
TheRGBABuffer contains the pixel buffer for a canvas or icon.
impl TheRGBABuffer
TheRGBABuffer contains the pixel buffer for a canvas or icon.
Sourcepub fn empty() -> TheRGBABuffer
pub fn empty() -> TheRGBABuffer
Create an empty buffer.
Sourcepub fn new(dim: TheDim) -> TheRGBABuffer
pub fn new(dim: TheDim) -> TheRGBABuffer
Creates a buffer of the given dimension.
Sourcepub fn from(buffer: Vec<u8>, width: u32, height: u32) -> TheRGBABuffer
pub fn from(buffer: Vec<u8>, width: u32, height: u32) -> TheRGBABuffer
Creates a buffer from existing data.
Sourcepub fn pixels_mut(&mut self) -> &mut [u8] ⓘ
pub fn pixels_mut(&mut self) -> &mut [u8] ⓘ
Gets a mutable slice of the buffer.
Sourcepub fn extract(&self, dim: &TheDim) -> TheRGBABuffer
pub fn extract(&self, dim: &TheDim) -> TheRGBABuffer
Extracts a sub-buffer of given dimensions from the current buffer.
Sourcepub fn copy_into(&mut self, x: i32, y: i32, other: &TheRGBABuffer)
pub fn copy_into(&mut self, x: i32, y: i32, other: &TheRGBABuffer)
Copy the other buffer into this buffer at the given coordinates.
Sourcepub fn copy_into_par(&mut self, x: i32, y: i32, other: &TheRGBABuffer)
pub fn copy_into_par(&mut self, x: i32, y: i32, other: &TheRGBABuffer)
Parallel version of copy_into using Rayon. Has identical clipping/safety behavior.
Enabled when the rayon feature is on. When the feature is off, it falls back to the serial version.
Sourcepub fn blend_into(&mut self, x: i32, y: i32, other: &TheRGBABuffer)
pub fn blend_into(&mut self, x: i32, y: i32, other: &TheRGBABuffer)
Blend the other buffer into this buffer at the given coordinates (single-threaded reference path).
Sourcepub fn blend_into_par(&mut self, x: i32, y: i32, other: &TheRGBABuffer)
pub fn blend_into_par(&mut self, x: i32, y: i32, other: &TheRGBABuffer)
Blend the other buffer into this buffer at the given coordinates (adaptive parallel version). Falls back to the single-threaded path for small regions to avoid overhead.
Sourcepub fn copy_horizontal_range_into(
&mut self,
x: i32,
y: i32,
other: &TheRGBABuffer,
range: Range<i32>,
)
pub fn copy_horizontal_range_into( &mut self, x: i32, y: i32, other: &TheRGBABuffer, range: Range<i32>, )
Copy the horizontal range of the other buffer into this buffer at the given coordinates.
Sourcepub fn copy_vertical_range_into(
&mut self,
x: i32,
y: i32,
other: &TheRGBABuffer,
range: Range<i32>,
)
pub fn copy_vertical_range_into( &mut self, x: i32, y: i32, other: &TheRGBABuffer, range: Range<i32>, )
Copy the vertical range of the other buffer into this buffer at the given coordinates.
Sourcepub fn scaled(&self, new_width: i32, new_height: i32) -> TheRGBABuffer
pub fn scaled(&self, new_width: i32, new_height: i32) -> TheRGBABuffer
Creates a scaled version of the buffer.
Sourcepub fn scaled_into(&self, into: &mut TheRGBABuffer)
pub fn scaled_into(&self, into: &mut TheRGBABuffer)
Creates a scaled version of the buffer by writing into the other buffer.
Sourcepub fn scaled_into_linear(&self, into: &mut TheRGBABuffer)
pub fn scaled_into_linear(&self, into: &mut TheRGBABuffer)
Creates a scaled version of the buffer by writing into the other buffer.
Sourcepub fn scaled_into_using_dim(&self, into: &mut TheRGBABuffer, dim: &TheDim)
pub fn scaled_into_using_dim(&self, into: &mut TheRGBABuffer, dim: &TheDim)
Creates a scaled version of the buffer by writing into the other buffer while respecting the dimensions.
Sourcepub fn extract_region(&self, region: &TheRGBARegion) -> TheRGBABuffer
pub fn extract_region(&self, region: &TheRGBARegion) -> TheRGBABuffer
Extracts a region from the buffer.
Sourcepub fn extract_sequence(
&self,
sequence: &TheRGBARegionSequence,
) -> Vec<TheRGBABuffer>
pub fn extract_sequence( &self, sequence: &TheRGBARegionSequence, ) -> Vec<TheRGBABuffer>
Extracts the regions of the sequence from the buffer.
Sourcepub fn at_f_vec4f(&self, uv: Vec2<f32>) -> Option<Vec4<f32>>
pub fn at_f_vec4f(&self, uv: Vec2<f32>) -> Option<Vec4<f32>>
Returns the pixel at the given UV coordinate as [f32;4]
Sourcepub fn at_f(&self, uv: Vec2<f32>) -> Option<[u8; 4]>
pub fn at_f(&self, uv: Vec2<f32>) -> Option<[u8; 4]>
Returns the pixel at the given UV coordinate.
Sourcepub fn at(&self, position: Vec2<i32>) -> Option<[u8; 4]>
pub fn at(&self, position: Vec2<i32>) -> Option<[u8; 4]>
Returns the pixel at the given position.
pub fn at_vec4(&self, position: Vec2<i32>) -> Option<Vec4<f32>>
Sourcepub fn multiply_by_pixel(&mut self, add: [u8; 4], pixel: [u8; 4])
pub fn multiply_by_pixel(&mut self, add: [u8; 4], pixel: [u8; 4])
Multiplies every pixel in the buffer by the given RGBA pixel (component-wise, 0-255 space).
Sourcepub fn draw_line(&mut self, x0: i32, y0: i32, x1: i32, y1: i32, color: [u8; 4])
pub fn draw_line(&mut self, x0: i32, y0: i32, x1: i32, y1: i32, color: [u8; 4])
Draws a line from (x0, y0) to (x1, y1) with the given color.
Sourcepub fn draw_horizontal_line(&mut self, x0: i32, x1: i32, y: i32, color: [u8; 4])
pub fn draw_horizontal_line(&mut self, x0: i32, x1: i32, y: i32, color: [u8; 4])
Draws a horizontal line from (x0, y) to (x1, y) with the given color.
Sourcepub fn draw_vertical_line(&mut self, x: i32, y0: i32, y1: i32, color: [u8; 4])
pub fn draw_vertical_line(&mut self, x: i32, y0: i32, y1: i32, color: [u8; 4])
Draws a vertical line from (x, y0) to (x, y1) with the given color.
Sourcepub fn draw_rect_outline(&mut self, rect: &TheDim, color: &[u8; 4])
pub fn draw_rect_outline(&mut self, rect: &TheDim, color: &[u8; 4])
Draws the outline of a given rectangle
Sourcepub fn draw_rounded_rect(
&mut self,
dim: &TheDim,
color: &[u8; 4],
rounding: &(f32, f32, f32, f32),
border_size: f32,
border_color: &[u8; 4],
)
pub fn draw_rounded_rect( &mut self, dim: &TheDim, color: &[u8; 4], rounding: &(f32, f32, f32, f32), border_size: f32, border_color: &[u8; 4], )
Draws a rounded rect with a border
Sourcepub fn draw_disc(
&mut self,
dim: &TheDim,
color: &[u8; 4],
border_size: f32,
border_color: &[u8; 4],
)
pub fn draw_disc( &mut self, dim: &TheDim, color: &[u8; 4], border_size: f32, border_color: &[u8; 4], )
Draws a rounded rect with a border
Sourcepub fn draw_text(
&mut self,
position: Vec2<i32>,
font: &Font,
text: &str,
size: f32,
color: [u8; 4],
halign: TheHorizontalAlign,
valign: TheVerticalAlign,
)
pub fn draw_text( &mut self, position: Vec2<i32>, font: &Font, text: &str, size: f32, color: [u8; 4], halign: TheHorizontalAlign, valign: TheVerticalAlign, )
Render an aligned text in the buffer.
Sourcepub fn pixel_index(&self, x: i32, y: i32) -> Option<usize>
pub fn pixel_index(&self, x: i32, y: i32) -> Option<usize>
Helper method to calculate the buffer index for a pixel at (x, y).
Sourcepub fn set_pixel(&mut self, x: i32, y: i32, color: &[u8; 4])
pub fn set_pixel(&mut self, x: i32, y: i32, color: &[u8; 4])
Sets the color of a pixel at (x, y).
Sourcepub fn to_png(&self) -> Result<Vec<u8>, EncodingError>
pub fn to_png(&self) -> Result<Vec<u8>, EncodingError>
Convert the buffer to an RGBA PNG image.
Sourcepub fn render_hsl_hue_waveform(&mut self)
pub fn render_hsl_hue_waveform(&mut self)
Draw an hsl hue waveform used by color pickers.
Trait Implementations§
Source§impl Clone for TheRGBABuffer
impl Clone for TheRGBABuffer
Source§fn clone(&self) -> TheRGBABuffer
fn clone(&self) -> TheRGBABuffer
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TheRGBABuffer
impl Debug for TheRGBABuffer
Source§impl Default for TheRGBABuffer
impl Default for TheRGBABuffer
Source§fn default() -> TheRGBABuffer
fn default() -> TheRGBABuffer
Source§impl<'de> Deserialize<'de> for TheRGBABuffer
impl<'de> Deserialize<'de> for TheRGBABuffer
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<TheRGBABuffer, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<TheRGBABuffer, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for TheRGBABuffer
impl PartialEq for TheRGBABuffer
Source§impl PartialOrd for TheRGBABuffer
impl PartialOrd for TheRGBABuffer
Source§impl Serialize for TheRGBABuffer
impl Serialize for TheRGBABuffer
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for TheRGBABuffer
Auto Trait Implementations§
impl Freeze for TheRGBABuffer
impl RefUnwindSafe for TheRGBABuffer
impl Send for TheRGBABuffer
impl Sync for TheRGBABuffer
impl Unpin for TheRGBABuffer
impl UnsafeUnpin for TheRGBABuffer
impl UnwindSafe for TheRGBABuffer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.