Struct ico::IconDirEntry
[−]
[src]
pub struct IconDirEntry { /* fields omitted */ }
One entry in an ICO or CUR file; a single icon or cursor.
Methods
impl IconDirEntry
[src]
fn resource_type(&self) -> ResourceType
[src]
Returns the type of resource stored in this entry, either an icon or a cursor.
fn width(&self) -> u32
[src]
Returns the width of the image, in pixels.
fn height(&self) -> u32
[src]
Returns the height of the image, in pixels.
fn bits_per_pixel(&self) -> u16
[src]
Returns the bits-per-pixel (color depth) of the image. Returns zero if
self.resource_type() == ResourceType::Cursor
(since CUR files store
hotspot coordinates in place of this field).
fn cursor_hotspot(&self) -> Option<(u16, u16)>
[src]
Returns the coordinates of the cursor hotspot (pixels right from the
left edge of the image, and pixels down from the top edge), or None
if self.resource_type() != ResourceType::Cursor
.
fn is_png(&self) -> bool
[src]
Returns true if the image is encoded as a PNG, or false if it is encoded as a BMP.
fn data(&self) -> &[u8]
[src]
Returns the raw, encoded image data.
fn decode(&self) -> Result<IconImage>
[src]
Decodes this entry into an image. Returns an error if the data is malformed or can't be decoded.
fn encode(image: &IconImage) -> Result<IconDirEntry>
[src]
Encodes an image in a new entry. The encoding method is chosen automatically based on the image. Returns an error if the encoding fails.
fn encode_as_bmp(image: &IconImage) -> Result<IconDirEntry>
[src]
Encodes an image as a BMP in a new entry. The color depth is determined automatically based on the image. Returns an error if the encoding fails.
fn encode_as_png(image: &IconImage) -> Result<IconDirEntry>
[src]
Encodes an image as a PNG in a new entry. The color depth is determined automatically based on the image. Returns an error if the encoding fails.
Trait Implementations
impl Clone for IconDirEntry
[src]
fn clone(&self) -> IconDirEntry
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more