📄 freeimage.cs
字号:
/// </summary>
/// <param name="obj">An object to compare with this instance.</param>
/// <returns>A 32-bit signed integer indicating the lexical relationship between the two comparands.</returns>
/// <exception cref="ArgumentException"><paramref name="obj"/> is not a <see cref="FIMETADATA"/>.</exception>
public int CompareTo(object obj)
{
if (obj == null)
{
return 1;
}
if (!(obj is FIMETADATA))
{
throw new ArgumentException();
}
return CompareTo((FIMETADATA)obj);
}
/// <summary>
/// Compares this instance with a specified <see cref="FIMETADATA"/> object.
/// </summary>
/// <param name="other">A <see cref="FIMETADATA"/> to compare.</param>
/// <returns>A signed number indicating the relative values of this instance
/// and <paramref name="other"/>.</returns>
public int CompareTo(FIMETADATA other)
{
return this.data.ToInt64().CompareTo(other.data.ToInt64());
}
}
}
namespace FreeImageAPI
{
/// <summary>
/// The <b>FITAG</b> structure is a handle to a FreeImage metadata tag.
/// </summary>
[Serializable, StructLayout(LayoutKind.Sequential)]
public struct FITAG : IComparable, IComparable<FITAG>, IEquatable<FITAG>
{
private IntPtr data;
/// <summary>
/// Initializes a new instance of the <see cref="FITAG"/> structure to the value indicated by
/// a specified pointer to a native <see cref="FITAG"/> structure.
/// </summary>
/// <param name="ptr">A pointer to a native <see cref="FITAG"/> structure.</param>
public FITAG(int ptr)
{
data = new IntPtr(ptr);
}
/// <summary>
/// Initializes a new instance of the <see cref="FITAG"/> structure to the value indicated by
/// a specified pointer to a native <see cref="FITAG"/> structure.
/// </summary>
/// <param name="ptr">A pointer to a native <see cref="FITAG"/> structure.</param>
public FITAG(IntPtr ptr)
{
data = ptr;
}
/// <summary>
/// Tests whether two specified <see cref="FITAG"/> structures are equivalent.
/// </summary>
/// <param name="left">The <see cref="FITAG"/> that is to the left of the equality operator.</param>
/// <param name="right">The <see cref="FITAG"/> that is to the right of the equality operator.</param>
/// <returns>
/// <b>true</b> if the two <see cref="FITAG"/> structures are equal; otherwise, <b>false</b>.
/// </returns>
public static bool operator ==(FITAG left, FITAG right)
{
return (left.data == right.data);
}
/// <summary>
/// Tests whether two specified <see cref="FITAG"/> structures are different.
/// </summary>
/// <param name="left">The <see cref="FITAG"/> that is to the left of the inequality operator.</param>
/// <param name="right">The <see cref="FITAG"/> that is to the right of the inequality operator.</param>
/// <returns>
/// <b>true</b> if the two <see cref="FITAG"/> structures are different; otherwise, <b>false</b>.
/// </returns>
public static bool operator !=(FITAG left, FITAG right)
{
return (left.data != right.data);
}
/// <summary>
/// Converts the pointer specified in <paramref name="ptr"/> to a <see cref="FITAG"/> structure.
/// </summary>
/// <param name="ptr">A 32-bit value to be converted into a <see cref="FITAG"/> structure.</param>
/// <returns>A <see cref="FITAG"/> structure initialized with the specified pointer.</returns>
public static implicit operator FITAG(int ptr)
{
return new FITAG(ptr);
}
/// <summary>
/// Converts the <see cref="FITAG"/> structure specified in <paramref name="handle"/> to a 32-bit value.
/// </summary>
/// <param name="handle">A <see cref="FITAG"/> structure to be converted into a 32-bit value.</param>
/// <returns>A 32-bit value initialized with the pointer of the <see cref="FITAG"/> structure.</returns>
public static implicit operator int(FITAG handle)
{
return handle.data.ToInt32();
}
/// <summary>
/// Converts the pointer specified in <paramref name="ptr"/> to a <see cref="FITAG"/> structure.
/// </summary>
/// <param name="ptr">A 32-bit value to be converted into a <see cref="FITAG"/> structure.</param>
/// <returns>A <see cref="FITAG"/> structure initialized with the specified pointer.</returns>
public static implicit operator FITAG(IntPtr ptr)
{
return new FITAG(ptr);
}
/// <summary>
/// Converts the <see cref="FITAG"/> structure specified in <paramref name="handle"/> to an IntPtr.
/// </summary>
/// <param name="handle">A <see cref="FITAG"/> structure to be converted into an IntPtr.</param>
/// <returns>An IntPtr initialized with the pointer of the <see cref="FITAG"/> structure.</returns>
public static implicit operator IntPtr(FITAG handle)
{
return handle.data;
}
/// <summary>
/// Gets whether the pointer is a null pointer or not.
/// </summary>
/// <value><b>true</b> if this <see cref="FITAG"/> is a null pointer;
/// otherwise, <b>false</b>.</value>
public bool IsNull
{
get
{
return (data == IntPtr.Zero);
}
}
/// <summary>
/// Converts the numeric value of the <see cref="FITAG"/> object
/// to its equivalent string representation.
/// </summary>
/// <returns>The string representation of the value of this instance.</returns>
public override string ToString()
{
return data.ToString();
}
/// <summary>
/// Returns a hash code for this <see cref="FITAG"/> structure.
/// </summary>
/// <returns>An integer value that specifies the hash code for this <see cref="FITAG"/>.</returns>
public override int GetHashCode()
{
return data.GetHashCode();
}
/// <summary>
/// Determines whether the specified <see cref="Object"/> is equal to the current <see cref="Object"/>.
/// </summary>
/// <param name="obj">The <see cref="Object"/> to compare with the current <see cref="Object"/>.</param>
/// <returns><b>true</b> if the specified <see cref="Object"/> is equal to the current <see cref="Object"/>; otherwise, <b>false</b>.</returns>
public override bool Equals(object obj)
{
return ((obj is FITAG) && (this == ((FITAG)obj)));
}
/// <summary>
/// Indicates whether the current object is equal to another object of the same type.
/// </summary>
/// <param name="other">An object to compare with this object.</param>
/// <returns><b>true</b> if the current object is equal to the other parameter; otherwise, <b>false</b>.</returns>
public bool Equals(FITAG other)
{
return (this == other);
}
/// <summary>
/// Compares this instance with a specified <see cref="Object"/>.
/// </summary>
/// <param name="obj">An object to compare with this instance.</param>
/// <returns>A 32-bit signed integer indicating the lexical relationship between the two comparands.</returns>
/// <exception cref="ArgumentException"><paramref name="obj"/> is not a <see cref="FITAG"/>.</exception>
public int CompareTo(object obj)
{
if (obj == null)
{
return 1;
}
if (!(obj is FITAG))
{
throw new ArgumentException();
}
return CompareTo((FITAG)obj);
}
/// <summary>
/// Compares this instance with a specified <see cref="FITAG"/> object.
/// </summary>
/// <param name="other">A <see cref="FITAG"/> to compare.</param>
/// <returns>A signed number indicating the relative values of this instance
/// and <paramref name="other"/>.</returns>
public int CompareTo(FITAG other)
{
return this.data.ToInt64().CompareTo(other.data.ToInt64());
}
}
}
namespace FreeImageAPI.IO
{
/// <summary>
/// Structure for implementing access to custom handles.
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public struct FreeImageIO
{
/// <summary>
/// Delegate to the C++ function <b>fread</b>.
/// </summary>
public ReadProc readProc;
/// <summary>
/// Delegate to the C++ function <b>fwrite</b>.
/// </summary>
public WriteProc writeProc;
/// <summary>
/// Delegate to the C++ function <b>fseek</b>.
/// </summary>
public SeekProc seekProc;
/// <summary>
/// Delegate to the C++ function <b>ftell</b>.
/// </summary>
public TellProc tellProc;
}
}
namespace FreeImageAPI
{
/// <summary>
/// The <b>RGBQUAD</b> structure describes a color consisting of relative
/// intensities of red, green, blue and alpha value. Each single color
/// component consumes 8 bits and so, takes values in the range from 0 to 255.
/// </summary>
/// <remarks>
/// <para>
/// The <b>RGBQUAD</b> structure provides access to an underlying Win32 <b>RGBQUAD</b>
/// structure. To determine the alpha, red, green or blue component of a color,
/// use the rgbReserved, rgbRed, rgbGreen or rgbBlue fields, respectively.
/// </para>
/// <para>For easy integration of the underlying structure into the .NET framework,
/// the <b>RGBQUAD</b> structure implements implicit conversion operators to
/// convert the represented color to and from the <see cref="System.Drawing.Color"/>
/// type. This makes the <see cref="System.Drawing.Color"/> type a real replacement
/// for the <b>RGBQUAD</b> structure and my be used in all situations which require
/// an <b>RGBQUAD</b> type.
/// </para>
/// <para>
/// Each color component rgbReserved, rgbRed, rgbGreen or rgbBlue of <b>RGBQUAD</b>
/// is translated into it's corresponding color component A, R, G or B of
/// <see cref="System.Drawing.Color"/> by an one-to-one manner and vice versa.
/// </para>
/// <para>
/// <b>Conversion from System.Drawing.Color to RGBQUAD</b>
/// </para>
/// <c>RGBQUAD.component = Color.component</c>
/// <para>
/// <b>Conversion from RGBQUAD to System.Drawing.Color</b>
/// </para>
/// <c>Color.component = RGBQUAD.component</c>
/// <para>
/// The same conversion is also applied when the <see cref="FreeImageAPI.RGBQUAD.Color"/>
/// property or the <see cref="FreeImageAPI.RGBQUAD(System.Drawing.Color)"/> constructor
/// is invoked.
/// </para>
/// </remarks>
/// <example>
/// The following code example demonstrates the various conversions between the
/// <b>RGBQUAD</b> structure and the <see cref="System.Drawing.Color"/> structure.
/// <code>
/// RGBQUAD rgbq;
/// // Initialize the structure using a native .NET Color structure.
/// rgbq = new RGBQUAD(Color.Indigo);
/// // Initialize the structure using the implicit operator.
/// rgbq = Color.DarkSeaGreen;
/// // Convert the RGBQUAD instance into a native .NET Color
/// // using its implicit operator.
/// Color color = rgbq;
/// // Using the structure's Color property for converting it
/// // into a native .NET Color.
/// Color another = rgbq.Color;
/// </code>
/// </example>
[Serializable, StructLayout(LayoutKind.Explicit)]
public struct RGBQUAD : IComparable, IComparable<RGBQUAD>, IEquatable<RGBQUAD>
{
/// <summary>
/// The blue color component.
/// </summary>
[FieldOffset(0)]
public byte rgbBlue;
/// <summary>
/// The green color component.
/// </summary>
[FieldOffset(1)]
public byte rgbGreen;
/// <summary>
/// The red color component.
/// </summary>
[FieldOffset(2)]
public byte rgbRed;
/// <summary>
/// The alpha color component.
/// </summary>
[FieldOffset(3)]
public byte rgbReserved;
/// <summary>
/// The color's value.
/// </summar
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -