コード例 #1
0
        /// <summary>
        /// Copies data from an unmanaged memory pointer to a managed <see cref="TurboJpegScalingFactor"/> array.
        /// </summary>
        /// <param name="pointer">The memory pointer to copy from.</param>
        /// <param name="elements">The number of array elements to copy.</param>
        /// <returns>An array of the specified size populated from <paramref name="pointer" />.</returns>
        public static TurboJpegScalingFactor[] ToTurboJpegScalingFactorArray(this IntPtr pointer, int elements)
        {
            Contract.Requires(pointer != IntPtr.Zero);
            Contract.Requires(elements >= 0);

            var array      = new TurboJpegScalingFactor[elements];
            var structSize = Marshal.SizeOf(typeof(TurboJpegScalingFactor));
            var j          = pointer;

            for (var i = 0; i < elements; i += 1, j += structSize)
            {
                array[i] = (TurboJpegScalingFactor)Marshal.PtrToStructure(j, typeof(TurboJpegScalingFactor));
            }

            return(array);
        }
コード例 #2
0
 /// <summary>
 /// Returns true or false, depending on whether this instance and <paramref name="other"/> have the same
 /// numerator and denominator.
 /// </summary>
 public bool Equals(TurboJpegScalingFactor other)
 {
     return(this.numerator == other.numerator && this.denominator == other.denominator);
 }
コード例 #3
0
        /// <summary>
        /// Copies data from an unmanaged memory pointer to a managed <see cref="TurboJpegScalingFactor"/> array.
        /// </summary>
        /// <param name="pointer">The memory pointer to copy from.</param>
        /// <param name="elements">The number of array elements to copy.</param>
        /// <returns>An array of the specified size populated from <paramref name="pointer" />.</returns>
        public static TurboJpegScalingFactor[] ToTurboJpegScalingFactorArray(this IntPtr pointer, int elements)
        {
            Contract.Requires(pointer != IntPtr.Zero);
            Contract.Requires(elements >= 0);

            var array = new TurboJpegScalingFactor[elements];
            var structSize = Marshal.SizeOf(typeof(TurboJpegScalingFactor));
            var j = pointer;
            for (var i = 0; i < elements; i += 1, j += structSize)
            {
                array[i] = (TurboJpegScalingFactor) Marshal.PtrToStructure(j, typeof(TurboJpegScalingFactor));
            }

            return array;
        }
コード例 #4
0
 /// <summary>
 /// Returns true or false, depending on whether this instance and <paramref name="other"/> have the same 
 /// numerator and denominator. 
 /// </summary>
 public bool Equals(TurboJpegScalingFactor other)
 {
     return this.numerator == other.numerator && this.denominator == other.denominator;
 }