pub struct WriterPaletted<W: Write> { /* private fields */ }Expand description
Create paletted PCX image.
Implementations§
Source§impl WriterPaletted<BufWriter<File>>
impl WriterPaletted<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> WriterPaletted<W>
impl<W: Write> WriterPaletted<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(&mut self, row: &[u8]) -> Result<()>
pub fn write_row(&mut self, row: &[u8]) -> Result<()>
Write next row of pixels.
Row length 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_palette(self, palette: &[u8]) -> Result<()>
pub fn write_palette(self, palette: &[u8]) -> Result<()>
Since palette is written to the end of PCX file this function must be called only after writing all the pixels.
Palette length must be not larger than 256*3 = 768 bytes and be divisible by 3. Format is R, G, B, R, G, B, …
Trait Implementations§
Source§impl<W: Clone + Write> Clone for WriterPaletted<W>
impl<W: Clone + Write> Clone for WriterPaletted<W>
Source§fn clone(&self) -> WriterPaletted<W>
fn clone(&self) -> WriterPaletted<W>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more