#region MIT License /*Copyright (c) 2012-2015 Robert Rouhani SharpFont based on Tao.FreeType, Copyright (c) 2003-2007 Tao Framework Team Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.*/ #endregion using System; using System.Runtime.InteropServices; using SharpFont.Internal; using FT_Long = System.IntPtr; using FT_ULong = System.UIntPtr; namespace SharpFont { /// /// A structure used to model a size request. /// /// /// If is zero, then the horizontal scaling value is set equal to the vertical scaling value, /// and vice versa. /// [StructLayout(LayoutKind.Sequential)] public struct SizeRequest : IEquatable { #region Fields private SizeRequestType requestType; private FT_Long width; private FT_Long height; private uint horiResolution; private uint vertResolution; #endregion #region Properties /// /// Gets the type of request. See . /// public SizeRequestType RequestType { get { return requestType; } set { requestType = value; } } /// /// Gets or sets the desired width. /// public int Width { get { return (int)width; } set { width = (FT_Long)value; } } /// /// Gets or sets the desired height. /// public int Height { get { return (int)height; } set { height = (FT_Long)value; } } /// /// Gets or sets the horizontal resolution. If set to zero, is treated as a 26.6 fractional pixel /// value. /// [CLSCompliant(false)] public uint HorizontalResolution { get { return horiResolution; } set { horiResolution = value; } } /// /// Gets or sets the horizontal resolution. If set to zero, is treated as a 26.6 fractional pixel /// value. /// [CLSCompliant(false)] public uint VerticalResolution { get { return vertResolution; } set { vertResolution = value; } } #endregion #region Methods /// /// Compares two s for equality. /// /// A . /// Another . /// A value indicating equality. public static bool operator ==(SizeRequest left, SizeRequest right) { return left.Equals(right); } /// /// Compares two s for inequality. /// /// A . /// Another . /// A value indicating inequality. public static bool operator !=(SizeRequest left, SizeRequest right) { return !left.Equals(right); } /// /// Compares this instance of to another for equality. /// /// A . /// A value indicating equality. public bool Equals(SizeRequest other) { return requestType == other.requestType && width == other.width && height == other.height && horiResolution == other.horiResolution && vertResolution == other.vertResolution; } /// /// Compares this instance of to another object for equality. /// /// An object. /// A value indicating equality. public override bool Equals(object obj) { if (obj is SizeRequest) return this.Equals((SizeRequest)obj); else return false; } /// /// Gets a unique hash code for this instance. /// /// A unique hash code. public override int GetHashCode() { return requestType.GetHashCode() ^ width.GetHashCode() ^ height.GetHashCode() ^ horiResolution.GetHashCode() ^ vertResolution.GetHashCode(); } #endregion } }