// ==========================================================
// FreeImage 3 .NET wrapper
// Original FreeImage 3 functions and .NET compatible derived functions
//
// Design and implementation by
// - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net)
// - Carsten Klein (cklein05@users.sourceforge.net)
//
// Contributors:
// - David Boland (davidboland@vodafone.ie)
//
// Main reference : MSDN Knowlede Base
//
// This file is part of FreeImage 3
//
// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY
// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES
// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE
// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED
// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT
// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY
// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL
// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER
// THIS DISCLAIMER.
//
// Use at your own risk!
// ==========================================================
// ==========================================================
// CVS
// $Revision: 1.5 $
// $Date: 2009/02/20 07:41:08 $
// $Id: FIMULTIBITMAP.cs,v 1.5 2009/02/20 07:41:08 cklein05 Exp $
// ==========================================================
using System;
using System.Runtime.InteropServices;
namespace FreeImageAPI
{
///
/// The FIMULTIBITMAP structure is a handle to a FreeImage multipaged bimtap.
///
[Serializable, StructLayout(LayoutKind.Sequential)]
public struct FIMULTIBITMAP : IComparable, IComparable, IEquatable
{
private IntPtr data;
///
/// A read-only field that represents a handle that has been initialized to zero.
///
public static readonly FIMULTIBITMAP Zero;
///
/// Tests whether two specified structures are equivalent.
///
/// The that is to the left of the equality operator.
/// The that is to the right of the equality operator.
///
/// true if the two structures are equal; otherwise, false.
///
public static bool operator ==(FIMULTIBITMAP left, FIMULTIBITMAP right)
{
return (left.data == right.data);
}
///
/// Tests whether two specified structures are different.
///
/// The that is to the left of the inequality operator.
/// The that is to the right of the inequality operator.
///
/// true if the two structures are different; otherwise, false.
///
public static bool operator !=(FIMULTIBITMAP left, FIMULTIBITMAP right)
{
return (left.data != right.data);
}
///
/// Gets whether the handle is a null or not.
///
/// true if this handle is a null;
/// otherwise, false.
public bool IsNull
{
get
{
return (data == IntPtr.Zero);
}
}
///
/// Sets the handle to null.
///
public void SetNull()
{
data = IntPtr.Zero;
}
///
/// Converts the numeric value of the object
/// to its equivalent string representation.
///
/// The string representation of the value of this instance.
public override string ToString()
{
return data.ToString();
}
///
/// Returns a hash code for this structure.
///
/// An integer value that specifies the hash code for this .
public override int GetHashCode()
{
return data.GetHashCode();
}
///
/// Determines whether the specified is equal to the current .
///
/// The to compare with the current .
/// true if the specified is equal to the current ; otherwise, false.
public override bool Equals(object obj)
{
return ((obj is FIMULTIBITMAP) && (this == ((FIMULTIBITMAP)obj)));
}
///
/// Indicates whether the current object is equal to another object of the same type.
///
/// An object to compare with this object.
/// true if the current object is equal to the other parameter; otherwise, false.
public bool Equals(FIMULTIBITMAP other)
{
return (this == other);
}
///
/// Compares this instance with a specified .
///
/// An object to compare with this instance.
/// A 32-bit signed integer indicating the lexical relationship between the two comparands.
/// is not a .
public int CompareTo(object obj)
{
if (obj == null)
{
return 1;
}
if (!(obj is FIMULTIBITMAP))
{
throw new ArgumentException("obj");
}
return CompareTo((FIMULTIBITMAP)obj);
}
///
/// Compares this instance with a specified object.
///
/// A to compare.
/// A signed number indicating the relative values of this instance
/// and .
public int CompareTo(FIMULTIBITMAP other)
{
return this.data.ToInt64().CompareTo(other.data.ToInt64());
}
}
}