CSharpUtilities::IconDeviceIndependentBitmap Class Reference


Detailed Description

A IconDeviceIndependentBitmap stores a device independent bitmap (DIB).

This class makes the loading and saving of *.ico files much easier.

The format of the wrapped bitmap in IconDeviceIndependentBitmap is a little bit different with standard windows bitmap: It contains a "xor mask" and an "and mask".

For more information about the icon DIB format, please reference msdn: http://msdn.microsoft.com/en-us/library/ms997538.aspx

List of all members.

Public Member Functions

  IconDeviceIndependentBitmap (int width, int height, Int16 colorBitCount)
  Construct an empty IconDeviceIndependentBitmap with the given width, height and color bit count.
  IconDeviceIndependentBitmap (Bitmap bitmap)
  Construct an IconDeviceIndependentBitmap from the given bitmap.
  IconDeviceIndependentBitmap (Stream stream)
  Load an IconDeviceIndependentBitmap from the given stream.
void  Write (Stream stream)
  Write this IconDeviceIndependentBitmap to the given stream.
int  GetPaletteSize ()
  Get the palette size of this dib.
int  GetXorMaskBytes ()
  Get the xor mask size.
int  GetAndMaskBytes ()
  Get the and mask size.

Static Public Member Functions

static int  CalculateTotalImageByteCount (int width, int height, int colorBitCount)
  Calculate the total bytes of a IconDeviceIndependentBitmap that will be stored in file, including the dib header (Notice the dib header is not icon file entry).
static int  GetHeaderSize ()
  Get the dib header size.

Static Public Attributes

static readonly Int16  DEFAULT_COLOR_BIT_COUNT = 32
  Default color bit count of default pixel format.

Properties

int  SizeImage [get]
  Get the total bytes of a IconDeviceIndependentBitmap that will be stored in file, including the dib header.
byte  Width [get]
  The width of this dib.
byte  Height [get]
  The height of this dib.
Int16  BitCount [get]
  The color bit count of this dib.
byte[]  XorMask [get]
  The xor mask array of this dib.
byte[]  AndMask [get]
  The and mask array of this dib.

Constructor & Destructor Documentation

CSharpUtilities::IconDeviceIndependentBitmap::IconDeviceIndependentBitmap ( int  width,
int  height,
Int16  colorBitCount 
) [inline]

Construct an empty IconDeviceIndependentBitmap with the given width, height and color bit count.

Parameters:
width The width of the icon. This parameter must be ranged in [1, 255]
height The height of the icon. This parameter must be ranged in [1, 255]
colorBitCount The color bit count of the icon. This parameter must be greater than 8 because we don't support palette colors for now.
Exceptions:
ArgumentException Throws if width or height is not ranged in [1, 255], or if colorBitCount is less than or equal to 8.
CSharpUtilities::IconDeviceIndependentBitmap::IconDeviceIndependentBitmap ( Bitmap  bitmap ) [inline]

Construct an IconDeviceIndependentBitmap from the given bitmap.

Parameters:
bitmap The given bitmap.
Exceptions:
ArgumentException Throws if bitmap.Width or bitmap.Height exceeds 255, or if color bit count of the given bitmap is less than or equal to 8.
CSharpUtilities::IconDeviceIndependentBitmap::IconDeviceIndependentBitmap ( Stream  stream ) [inline]

Load an IconDeviceIndependentBitmap from the given stream.

Parameters:
stream The given stream.
Exceptions:
ArgumentException Throws if the stream contains an invalid icon.

Member Function Documentation

void CSharpUtilities::IconDeviceIndependentBitmap::Write ( Stream  stream ) [inline]

Write this IconDeviceIndependentBitmap to the given stream.

Parameters:
stream The given stream.
static int CSharpUtilities::IconDeviceIndependentBitmap::CalculateTotalImageByteCount ( int  width,
int  height,
int  colorBitCount 
) [inline, static]

Calculate the total bytes of a IconDeviceIndependentBitmap that will be stored in file, including the dib header (Notice the dib header is not icon file entry).

Parameters:
width The width of that dib.
height The height of that dib.
colorBitCount The color bit count of that dib.
Returns:
The total bytes of that dib.
static int CSharpUtilities::IconDeviceIndependentBitmap::GetHeaderSize ( ) [inline, static]

Get the dib header size.

Returns:
The dib header size.
int CSharpUtilities::IconDeviceIndependentBitmap::GetPaletteSize ( ) [inline]

Get the palette size of this dib.

Returns:
The palette size of this dib.
int CSharpUtilities::IconDeviceIndependentBitmap::GetXorMaskBytes ( ) [inline]

Get the xor mask size.

Returns:
The xor mask size.
int CSharpUtilities::IconDeviceIndependentBitmap::GetAndMaskBytes ( ) [inline]

Get the and mask size.

Returns:
The and mask size.

Member Data Documentation

Default color bit count of default pixel format.


Property Documentation

int CSharpUtilities::IconDeviceIndependentBitmap::SizeImage [get]

Get the total bytes of a IconDeviceIndependentBitmap that will be stored in file, including the dib header.

byte CSharpUtilities::IconDeviceIndependentBitmap::Width [get]

The width of this dib.

byte CSharpUtilities::IconDeviceIndependentBitmap::Height [get]

The height of this dib.

Int16 CSharpUtilities::IconDeviceIndependentBitmap::BitCount [get]

The color bit count of this dib.

byte [] CSharpUtilities::IconDeviceIndependentBitmap::XorMask [get]

The xor mask array of this dib.

In DEFAULT_COLOR_BIT_COUNT bit argb format.

byte [] CSharpUtilities::IconDeviceIndependentBitmap::AndMask [get]

The and mask array of this dib.

Each bit represents a pixel.


CSharpUtilities::IconDeviceIndependentBitmap CSharpUtilities::IconDeviceIndependentBitmap CSharpUtilities::IconDeviceIndependentBitmap CSharpUtilities::IconDeviceIndependentBitmap CSharpUtilities::IconDeviceIndependentBitmap CSharpUtilities::IconDeviceIndependentBitmap CSharpUtilities::IconDeviceIndependentBitmap CSharpUtilities::IconDeviceIndependentBitmap CSharpUtilities::IconDeviceIndependentBitmap CSharpUtilities::IconDeviceIndependentBitmap
CSharpUtilities::IconDeviceIndependentBitmap CSharpUtilities::IconDeviceIndependentBitmap CSharpUtilities::IconDeviceIndependentBitmap CSharpUtilities::IconDeviceIndependentBitmap CSharpUtilities::IconDeviceIndependentBitmap CSharpUtilities::IconDeviceIndependentBitmap CSharpUtilities::IconDeviceIndependentBitmap CSharpUtilities::IconDeviceIndependentBitmap CSharpUtilities::IconDeviceIndependentBitmap CSharpUtilities::IconDeviceIndependentBitmap