pub struct WriterRgb<W: Write> { /* private fields */ }Expand description
Create 24-bit RGB PCX image.
Implementations§
Source§impl WriterRgb<BufWriter<File>>
impl WriterRgb<BufWriter<File>>
Sourcepub fn create_file<P: AsRef<Path>>(
path: P,
image_size: (u16, u16),
dpi: (u16, u16),
) -> Result<Self>
pub fn create_file<P: AsRef<Path>>( path: P, image_size: (u16, u16), dpi: (u16, u16), ) -> Result<Self>
Start writing PCX file. This function will create a file if it does not exist, and will overwrite it if it does.
If you are not sure what to pass to dpi value just use something like (100, 100) or (300, 300).
Source§impl<W: Write> WriterRgb<W>
impl<W: Write> WriterRgb<W>
Sourcepub fn new(stream: W, image_size: (u16, u16), dpi: (u16, u16)) -> Result<Self>
pub fn new(stream: W, image_size: (u16, u16), dpi: (u16, u16)) -> Result<Self>
Create new PCX writer.
If you are not sure what to pass to dpi value just use something like (100, 100) or (300, 300).
Sourcepub fn write_row_from_separate(
&mut self,
r: &[u8],
g: &[u8],
b: &[u8],
) -> Result<()>
pub fn write_row_from_separate( &mut self, r: &[u8], g: &[u8], b: &[u8], ) -> Result<()>
Write next row of pixels from separate buffers for R, G and B channels.
Length of each of r, g and b must be equal to the width of the image passed to new.
This function must be called number of times equal to the height of the image.
Order of rows is from top to bottom, order of pixels is from left to right.
Sourcepub fn write_row(&mut self, rgb: &[u8]) -> Result<()>
pub fn write_row(&mut self, rgb: &[u8]) -> Result<()>
Write next row of pixels from buffer which contains RGB values interleaved (i.e. R, G, B, R, G, B, …).
Length of the rgb buffer must be equal to the width of the image passed to new multiplied by 3.
This function must be called number of times equal to the height of the image.
Order of rows is from top to bottom, order of pixels is from left to right.