📄 bitmapinfoheader.cs
字号:
/// number of entries specified by the <b>biClrUsed</b> member of the <b>BITMAPINFOHEADER</b>.
/// <para/>
/// If the <b>biCompression</b> member of the <b>BITMAPINFOHEADER</b> is BI_BITFIELDS,
/// the <b>bmiColors</b> member contains three <b>DWORD</b> color masks that specify the red, green,
/// and blue components, respectively, of each pixel. Each <b>DWORD</b> in the bitmap array represents
/// a single pixel.
/// <para/>
/// <b>Windows NT/ 2000:</b> When the <b>biCompression</b> member is BI_BITFIELDS, bits set in each
/// <b>DWORD</b> mask must be contiguous and should not overlap the bits of another mask. All the
/// bits in the pixel do not need to be used.
/// <para/>
/// <b>Windows 95/98/Me:</b> When the <b>biCompression</b> member is BI_BITFIELDS, the system
/// supports only the following 32-bpp color mask: The blue mask is 0x000000FF, the green mask is
/// 0x0000FF00, and the red mask is 0x00FF0000.
/// </description>
/// </item>
/// </list>
/// </summary>
public ushort biBitCount;
/// <summary>
/// Specifies the type of compression for a compressed bottom-up bitmap (top-down DIBs cannot be
/// compressed).
/// <list type="table">
/// <listheader>
/// <term>Value</term>
/// <description>Meaning</description>
/// </listheader>
///
/// <item>
/// <term>BI_RGB</term>
/// <description>An uncompressed format.</description>
/// </item>
///
/// <item>
/// <term>BI_RLE8</term>
/// <description>A run-length encoded (RLE) format for bitmaps with 8 bpp. The compression format
/// is a 2-byte format consisting of a count byte followed by a byte containing a color index.
/// </description>
/// </item>
///
/// <item>
/// <term>BI_RLE4</term>
/// <description>An RLE format for bitmaps with 4 bpp. The compression format is a 2-byte format
/// consisting of a count byte followed by two word-length color indexes.</description>
/// </item>
///
/// <item>
/// <term>BI_BITFIELDS</term>
/// <description>Specifies that the bitmap is not compressed and that the color table consists
/// of three <b>DWORD</b> color masks that specify the red, green, and blue components, respectively,
/// of each pixel. This is valid when used with 16- and 32-bpp bitmaps.</description>
/// </item>
///
/// <item>
/// <term>BI_JPEG</term>
/// <description><b>Windows 98/Me, Windows 2000/XP:</b> Indicates that the image is a JPEG image.
/// </description>
/// </item>
///
/// <item>
/// <term>BI_PNG</term>
/// <description><b>Windows 98/Me, Windows 2000/XP:</b> Indicates that the image is a PNG image.
/// </description>
/// </item>
///
/// </list>
/// </summary>
public uint biCompression;
/// <summary>
/// Specifies the size, in bytes, of the image. This may be set to zero for BI_RGB bitmaps.
/// <para/>
/// <b>Windows 98/Me, Windows 2000/XP:</b> If <b>biCompression</b> is BI_JPEG or BI_PNG,
/// <b>biSizeImage</b> indicates the size of the JPEG or PNG image buffer, respectively.
/// </summary>
public uint biSizeImage;
/// <summary>
/// Specifies the horizontal resolution, in pixels-per-meter, of the target device for the bitmap.
/// An application can use this value to select a bitmap from a resource group that best matches
/// the characteristics of the current device.
/// </summary>
public int biXPelsPerMeter;
/// <summary>
/// Specifies the vertical resolution, in pixels-per-meter, of the target device for the bitmap.
/// </summary>
public int biYPelsPerMeter;
/// <summary>
/// Specifies the number of color indexes in the color table that are actually used by the bitmap.
/// If this value is zero, the bitmap uses the maximum number of colors corresponding to the value
/// of the biBitCount member for the compression mode specified by <b>biCompression</b>.
/// <para/>
/// If <b>iClrUsed</b> is nonzero and the <b>biBitCount</b> member is less than 16, the <b>biClrUsed</b>
/// member specifies the actual number of colors the graphics engine or device driver accesses.
/// If <b>biBitCount</b> is 16 or greater, the <b>biClrUsed</b> member specifies the size of the color
/// table used to optimize performance of the system color palettes. If <b>biBitCount</b> equals 16 or 32,
/// the optimal color palette starts immediately following the three <b>DWORD</b> masks.
/// <para/>
/// When the bitmap array immediately follows the <see cref="BITMAPINFO"/> structure, it is a packed bitmap.
/// Packed bitmaps are referenced by a single pointer. Packed bitmaps require that the
/// <b>biClrUsed</b> member must be either zero or the actual size of the color table.
/// </summary>
public uint biClrUsed;
/// <summary>
/// Specifies the number of color indexes that are required for displaying the bitmap. If this value
/// is zero, all colors are required.
/// </summary>
public uint biClrImportant;
/// <summary>
/// Tests whether two specified <see cref="BITMAPINFOHEADER"/> structures are equivalent.
/// </summary>
/// <param name="left">The <see cref="BITMAPINFOHEADER"/> that is to the left of the equality operator.</param>
/// <param name="right">The <see cref="BITMAPINFOHEADER"/> that is to the right of the equality operator.</param>
/// <returns>
/// <b>true</b> if the two <see cref="BITMAPINFOHEADER"/> structures are equal; otherwise, <b>false</b>.
/// </returns>
public static bool operator ==(BITMAPINFOHEADER left, BITMAPINFOHEADER right)
{
return ((left.biSize == right.biSize) &&
(left.biWidth == right.biWidth) &&
(left.biHeight == right.biHeight) &&
(left.biPlanes == right.biPlanes) &&
(left.biBitCount == right.biBitCount) &&
(left.biCompression == right.biCompression) &&
(left.biSizeImage == right.biSizeImage) &&
(left.biXPelsPerMeter == right.biXPelsPerMeter) &&
(left.biYPelsPerMeter == right.biYPelsPerMeter) &&
(left.biClrUsed == right.biClrUsed) &&
(left.biClrImportant == right.biClrImportant));
}
/// <summary>
/// Tests whether two specified <see cref="BITMAPINFOHEADER"/> structures are different.
/// </summary>
/// <param name="left">The <see cref="BITMAPINFOHEADER"/> that is to the left of the inequality operator.</param>
/// <param name="right">The <see cref="BITMAPINFOHEADER"/> that is to the right of the inequality operator.</param>
/// <returns>
/// <b>true</b> if the two <see cref="BITMAPINFOHEADER"/> structures are different; otherwise, <b>false</b>.
/// </returns>
public static bool operator !=(BITMAPINFOHEADER left, BITMAPINFOHEADER right)
{
return !(left == right);
}
/// <summary>
/// Tests whether the specified <see cref="BITMAPINFOHEADER"/> structure is equivalent to this <see cref="BITMAPINFOHEADER"/> structure.
/// </summary>
/// <param name="other">A <see cref="BITMAPINFOHEADER"/> structure to compare to this instance.</param>
/// <returns><b>true</b> if <paramref name="obj"/> is a <see cref="BITMAPINFOHEADER"/> structure
/// equivalent to this <see cref="BITMAPINFOHEADER"/> structure; otherwise, <b>false</b>.</returns>
public bool Equals(BITMAPINFOHEADER other)
{
return (this == other);
}
/// <summary>
/// Tests whether the specified object is a <see cref="BITMAPINFOHEADER"/> structure
/// and is equivalent to this <see cref="BITMAPINFOHEADER"/> structure.
/// </summary>
/// <param name="obj">The object to test.</param>
/// <returns><b>true</b> if <paramref name="obj"/> is a <see cref="BITMAPINFOHEADER"/> structure
/// equivalent to this <see cref="BITMAPINFOHEADER"/> structure; otherwise, <b>false</b>.</returns>
public override bool Equals(object obj)
{
return ((obj is BITMAPINFOHEADER) && (this == (BITMAPINFOHEADER)obj));
}
/// <summary>
/// Returns a hash code for this <see cref="BITMAPINFOHEADER"/> structure.
/// </summary>
/// <returns>An integer value that specifies the hash code for this <see cref="BITMAPINFOHEADER"/>.</returns>
public override int GetHashCode()
{
return base.GetHashCode();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -