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
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. |
CSharpUtilities::IconDeviceIndependentBitmap::IconDeviceIndependentBitmap | ( | int | width, |
int | height, | ||
Int16 | colorBitCount | ||
) | [inline] |
Construct an empty IconDeviceIndependentBitmap with the given width, height and color bit count.
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. |
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.
bitmap | The given bitmap. |
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.
stream | The given stream. |
ArgumentException | Throws if the stream contains an invalid icon. |
void CSharpUtilities::IconDeviceIndependentBitmap::Write | ( | Stream | stream | ) | [inline] |
Write this IconDeviceIndependentBitmap to the given stream.
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).
width | The width of that dib. |
height | The height of that dib. |
colorBitCount | The color bit count of that dib. |
static int CSharpUtilities::IconDeviceIndependentBitmap::GetHeaderSize | ( | ) | [inline, static] |
Get the dib header size.
int CSharpUtilities::IconDeviceIndependentBitmap::GetPaletteSize | ( | ) | [inline] |
Get the palette size of this dib.
int CSharpUtilities::IconDeviceIndependentBitmap::GetXorMaskBytes | ( | ) | [inline] |
Get the xor mask size.
int CSharpUtilities::IconDeviceIndependentBitmap::GetAndMaskBytes | ( | ) | [inline] |
Get the and mask size.
readonly Int16
CSharpUtilities::IconDeviceIndependentBitmap::DEFAULT_COLOR_BIT_COUNT
= 32 [static] |
Default color bit count of default pixel format.
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.