⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 freeimage.cs

📁 对gif
💻 CS
📖 第 1 页 / 共 5 页
字号:
		/// </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();
		}
	}
}

namespace FreeImageAPI
{
	/// <summary>
	/// The <b>BITMAPINFO</b> structure defines the dimensions and color information for a DIB.
	/// </summary>
	/// <remarks>
	/// A DIB consists of two distinct parts: a <b>BITMAPINFO</b> structure describing the dimensions
	/// and colors of the bitmap, and an array of bytes defining the pixels of the bitmap. The bits in
	/// the array are packed together, but each scan line must be padded with zeroes to end on a
	/// <b>LONG</b> data-type boundary. If the height of the bitmap is positive, the bitmap is a
	/// bottom-up DIB and its origin is the lower-left corner. If the height is negative, the bitmap is
	/// a top-down DIB and its origin is the upper left corner.
	/// <para/>
	/// A bitmap is packed when the bitmap array immediately follows the <b>BITMAPINFO</b> header.
	/// Packed bitmaps are referenced by a single pointer. For packed bitmaps, the <b>biClrUsed</b>
	/// member must be set to an even number when using the DIB_PAL_COLORS mode so that the DIB bitmap
	/// array starts on a <b>DWORD</b> boundary.
	/// <para/>
	/// <b>Note</b>  The <b>bmiColors</b> member should not contain palette indexes if the bitmap is to
	/// be stored in a file or transferred to another application.
	/// <para/>
	/// Unless the application has exclusive use and control of the bitmap, the bitmap color table
	/// should contain explicit RGB values.
	/// </remarks>
	[Serializable, StructLayout(LayoutKind.Sequential)]
	public struct BITMAPINFO : IEquatable<BITMAPINFO>
	{
		/// <summary>
		/// Specifies a <see cref="FreeImageAPI.BITMAPINFOHEADER"/> structure that contains information
		/// about the dimensions of color format.
		/// </summary>
		public BITMAPINFOHEADER bmiHeader;
		/// <summary>
		/// The <b>bmiColors</b> member contains one of the following:
		/// <list type="bullets">
		/// 
		/// <item>
		/// <term>
		/// An array of <see cref="FreeImageAPI.RGBQUAD"/>. The elements of the array that make up the
		/// color table.
		/// </term>
		/// </item>
		/// 
		/// <item>
		/// <term>
		/// An array of 16-bit unsigned integers that specifies indexes into the currently realized
		/// logical palette. This use of <b>bmiColors</b> is allowed for functions that use DIBs.
		/// When <b>bmiColors</b> elements contain indexes to a realized logical palette, they must
		/// also call the following bitmap functions:
		/// </term>
		/// </item>
		/// 
		/// </list>
		/// <b>CreateDIBitmap</b>
		/// <para/>
		/// <b>CreateDIBPatternBrush</b>
		/// <para/>
		/// <b>CreateDIBSection</b>
		/// <para/>
		/// The <i>iUsage</i> parameter of CreateDIBSection must be set to DIB_PAL_COLORS.
		/// <para/>
		/// The number of entries in the array depends on the values of the <b>biBitCount</b> and
		/// <b>biClrUsed</b> members of the <see cref="FreeImageAPI.BITMAPINFOHEADER"/> structure.
		/// <para/>
		/// The colors in the <b>bmiColors</b> table appear in order of importance. For more information,
		/// see the Remarks section.
		/// </summary>
		public RGBQUAD[] bmiColors;

		/// <summary>
		/// Tests whether two specified <see cref="BITMAPINFO"/> structures are equivalent.
		/// </summary>
		/// <param name="left">The <see cref="BITMAPINFO"/> that is to the left of the equality operator.</param>
		/// <param name="right">The <see cref="BITMAPINFO"/> that is to the right of the equality operator.</param>
		/// <returns>
		/// <b>true</b> if the two <see cref="BITMAPINFO"/> structures are equal; otherwise, <b>false</b>.
		/// </returns>
		public static bool operator ==(BITMAPINFO left, BITMAPINFO right)
		{
			if (left.bmiHeader != right.bmiHeader)
			{
				return false;
			}
			if ((left.bmiColors == null) && (right.bmiColors == null))
			{
				return true;
			}
			if ((left.bmiColors == null) || (right.bmiColors == null))
			{
				return false;
			}
			if (left.bmiColors.Length != right.bmiColors.Length)
			{
				return false;
			}
			for (int i = 0; i < left.bmiColors.Length; i++)
			{
				if (left.bmiColors[i] != right.bmiColors[i])
				{
					return false;
				}
			}
			return true;
		}

		/// <summary>
		/// Tests whether two specified <see cref="BITMAPINFO"/> structures are different.
		/// </summary>
		/// <param name="left">The <see cref="BITMAPINFO"/> that is to the left of the inequality operator.</param>
		/// <param name="right">The <see cref="BITMAPINFO"/> that is to the right of the inequality operator.</param>
		/// <returns>
		/// <b>true</b> if the two <see cref="BITMAPINFO"/> structures are different; otherwise, <b>false</b>.
		/// </returns>
		public static bool operator !=(BITMAPINFO left, BITMAPINFO right)
		{
			return !(left == right);
		}

		/// <summary>
		/// Tests whether the specified <see cref="BITMAPINFO"/> structure is equivalent to this <see cref="BITMAPINFO"/> structure.
		/// </summary>
		/// <param name="other">A <see cref="BITMAPINFO"/> structure to compare to this instance.</param>
		/// <returns><b>true</b> if <paramref name="obj"/> is a <see cref="BITMAPINFO"/> structure
		/// equivalent to this <see cref="BITMAPINFO"/> structure; otherwise, <b>false</b>.</returns>
		public bool Equals(BITMAPINFO other)
		{
			return (this == other);
		}

		/// <summary>
		/// Tests whether the specified object is a <see cref="BITMAPINFO"/> structure
		/// and is equivalent to this <see cref="BITMAPINFO"/> structure.
		/// </summary>
		/// <param name="obj">The object to test.</param>
		/// <returns><b>true</b> if <paramref name="obj"/> is a <see cref="BITMAPINFO"/> structure
		/// equivalent to this <see cref="BITMAPINFO"/> structure; otherwise, <b>false</b>.</returns>
		public override bool Equals(object obj)
		{
			return ((obj is BITMAPINFO) && (this == ((BITMAPINFO)obj)));
		}

		/// <summary>
		/// Returns a hash code for this <see cref="BITMAPINFO"/> structure.
		/// </summary>
		/// <returns>An integer value that specifies the hash code for this <see cref="BITMAPINFO"/>.</returns>
		public override int GetHashCode()
		{
			int hash = bmiHeader.GetHashCode();
			if (bmiColors != null)
			{
				for (int c = 0; c < bmiColors.Length; c++)
				{
					hash ^= bmiColors[c].GetHashCode();
					hash <<= 1;
				}
				hash <<= 1;
			}
			else
			{
				hash >>= 1;
			}
			return hash;
		}
	}
}

namespace FreeImageAPI
{
	/// <summary>
	/// The <b>FIBITMAP</b> structure is a handle to a FreeImage bimtap.
	/// </summary>
	/// <remarks>
	/// The handle represented by a <b>FIBITBAP</b> structure provides
	/// access to either a singlepage bitmap or exactly one page of
	/// a multipage bitmap.
	/// </remarks>
	[Serializable, StructLayout(LayoutKind.Sequential)]
	public struct FIBITMAP : IComparable, IComparable<FIBITMAP>, IEquatable<FIBITMAP>
	{
		private IntPtr data;

		/// <summary>
		/// Initializes a new instance of the <see cref="FIBITMAP"/> structure to the value indicated by
		/// a specified pointer to a native <see cref="FIBITMAP"/> structure.
		/// </summary>
		/// <param name="ptr">A pointer to a native <see cref="FIBITMAP"/> structure.</param>
		public FIBITMAP(int ptr)
		{
			data = new IntPtr(ptr);
		}

		/// <summary>
		/// Initializes a new instance of the <see cref="FIBITMAP"/> structure to the value indicated by
		/// a specified pointer to a native <see cref="FIBITMAP"/> structure.
		/// </summary>
		/// <param name="ptr">A pointer to a native <see cref="FIBITMAP"/> structure.</param>
		public FIBITMAP(IntPtr ptr)
		{
			data = ptr;
		}

		/// <summary>
		/// Tests whether two specified <see cref="FIBITMAP"/> structures are equivalent.
		/// </summary>
		/// <param name="left">The <see cref="FIBITMAP"/> that is to the left of the equality operator.</param>
		/// <param name="right">The <see cref="FIBITMAP"/> that is to the right of the equality operator.</param>
		/// <returns>
		/// <b>true</b> if the two <see cref="FIBITMAP"/> structures are equal; otherwise, <b>false</b>.
		/// </returns>
		public static bool operator ==(FIBITMAP left, FIBITMAP right)
		{
			return (left.data == right.data);
		}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -