Struct pcx::Reader [−][src]
PCX file reader.
Fields
header: Header
File header. All useful values are available via Reader
methods so you don't actually need it.
Methods
impl Reader<BufReader<File>>
[src]
impl Reader<BufReader<File>>
impl<R: Read> Reader<R>
[src]
impl<R: Read> Reader<R>
pub fn new(stream: R) -> Result<Self>
[src]
pub fn new(stream: R) -> Result<Self>
Start reading PCX file.
pub fn dimensions(&self) -> (u16, u16)
[src]
pub fn dimensions(&self) -> (u16, u16)
Get width and height of the image.
pub fn width(&self) -> u16
[src]
pub fn width(&self) -> u16
The width of this image.
pub fn height(&self) -> u16
[src]
pub fn height(&self) -> u16
The height of this image.
pub fn is_paletted(&self) -> bool
[src]
pub fn is_paletted(&self) -> bool
Whether this image is paletted or 24-bit RGB.
pub fn palette_length(&self) -> Option<u16>
[src]
pub fn palette_length(&self) -> Option<u16>
Get number of colors in the palette if this image is paletted. Number of colors is either 2, 4, 8, 16 or 256.
pub fn next_row_paletted(&mut self, buffer: &mut [u8]) -> Result<()>
[src]
pub fn next_row_paletted(&mut self, buffer: &mut [u8]) -> Result<()>
Read next row of the paletted image. Check that is_paletted()
is true
before calling this function.
buffer
length must be equal to the image width.
Order of rows is from top to bottom, order of pixels is from left to right.
pub fn next_row_rgb_separate(
&mut self,
r: &mut [u8],
g: &mut [u8],
b: &mut [u8]
) -> Result<()>
[src]
pub fn next_row_rgb_separate(
&mut self,
r: &mut [u8],
g: &mut [u8],
b: &mut [u8]
) -> Result<()>
Read next row of the RGB image to separate R, G and B buffers. Check that is_paletted()
is false
before calling this function.
r
, g
, b
buffer lengths must be equal to the image width.
Order of rows is from top to bottom, order of pixels is from left to right.
pub fn next_row_rgb(&mut self, rgb: &mut [u8]) -> Result<()>
[src]
pub fn next_row_rgb(&mut self, rgb: &mut [u8]) -> Result<()>
Read next row of the RGB image to one buffer with interleaved RGB values. Check that is_paletted()
is false
before calling this function.
rgb
buffer length must be equal to the image width multiplied by 3.
Order of rows is from top to bottom, order of pixels is from left to right.
pub fn read_palette(self, buffer: &mut [u8]) -> Result<usize>
[src]
pub fn read_palette(self, buffer: &mut [u8]) -> Result<usize>
Read color palette.
If palette contains 256-colors then it is stored at the end of file and this function will read the file to the end.
Returns number of colors in palette or zero if there is no palette. The actual number of bytes written to the output buffer is equal to the returned value multiplied by 3. Format of the output buffer is R, G, B, R, G, B, ...
Trait Implementations
impl<R: Clone + Read> Clone for Reader<R>
[src]
impl<R: Clone + Read> Clone for Reader<R>
fn clone(&self) -> Reader<R>
[src]
fn clone(&self) -> Reader<R>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl<R: Debug + Read> Debug for Reader<R>
[src]
impl<R: Debug + Read> Debug for Reader<R>