Exemple #1
0
		/// <summary>
		/// Initializes a new instance of the <see cref="NSEdgeInsets64"/> struct.
		/// </summary>
		/// <param name="top">The top.</param>
		/// <param name="left">The left.</param>
		/// <param name="bottom">The bottom.</param>
		/// <param name="right">The right.</param>
		public NSEdgeInsets64 (CGFloat top, CGFloat left, CGFloat bottom, CGFloat right)
		{
			this.top = top;
			this.left = left;
			this.bottom = bottom;
			this.right = right;
		}
Exemple #2
0
		public SCNVector4(CGFloat x, CGFloat y, CGFloat z, CGFloat w)
		{
			this.x = x;
			this.y = y;
			this.z = z;
			this.w = w;
		}
Exemple #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Monobjc.Foundation.NSRect64"/> struct.
        /// </summary>
        /// <param name="x">The x.</param>
        /// <param name="y">The y.</param>
        /// <param name="width">The width.</param>
        /// <param name="height">The height.</param>
		public NSRect64(CGFloat x, CGFloat y, CGFloat width, CGFloat height)
        {
            this.origin.x = x;
            this.origin.y = y;
            this.size.width = width;
            this.size.height = height;
        }
Exemple #4
0
        /// <summary>
        /// Divides this rectangle into two new rectangles.
        /// </summary>
        public void DivideRect(ref NSRect slice,
                               ref NSRect remainder,
		                       CGFloat amount,
                               NSRectEdge edge)
        {
            NSDivideRect(this, ref slice, ref remainder, amount, edge);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="CGAffineTransform64"/> struct.
        /// </summary>
        /// <param name="a">A.</param>
        /// <param name="b">The b.</param>
        /// <param name="c">The c.</param>
        /// <param name="d">The d.</param>
        /// <param name="tx">The tx.</param>
        /// <param name="ty">The ty.</param>
		public CGAffineTransform64(CGFloat a, CGFloat b, CGFloat c, CGFloat d, CGFloat tx, CGFloat ty)
        {
            this.a = a;
            this.b = b;
            this.c = c;
            this.d = d;
            this.tx = tx;
            this.ty = ty;
        }
Exemple #6
0
        public void TestCasting()
        {
            NSInteger value;

            short s = -123;
            int i = -123456;
            long l = -1234567890;
            ushort us = 123;
            uint ui = 123456;
            ulong ul = 1234567890;
            float f = 12345.6789f;
            double d = 12345.6789d;
            //NSInteger nint = -123456;
            NSUInteger nuint = 123456;
            CGFloat cgfloat = new CGFloat(12345.6789f);

            value = s;
            Assert.AreEqual(value, new NSInteger(s), "Value must be equal");
            value = i;
            Assert.AreEqual(value, new NSInteger(i), "Value must be equal");
            value = l;
            Assert.AreEqual(value, new NSInteger((int)l), "Value must be equal");
            value = us;
            Assert.AreEqual(value, new NSInteger(us), "Value must be equal");
            value = ui;
            Assert.AreEqual(value, new NSInteger((int)ui), "Value must be equal");
            value = ul;
            Assert.AreEqual(value, new NSInteger((int)ul), "Value must be equal");
            value = (NSInteger) f;
            Assert.AreEqual(value, new NSInteger((int)f), "Value must be equal");
            value = (NSInteger) d;
            Assert.AreEqual(value, new NSInteger((int)d), "Value must be equal");
            //value = nint;
            //Assert.AreEqual(value, new NSInteger(nint.value), "Value must be equal");
            value = nuint;
            Assert.AreEqual(value, new NSInteger((int)nuint.value), "Value must be equal");
            value = (NSInteger) cgfloat;
            Assert.AreEqual(value, new NSInteger((int)cgfloat.value), "Value must be equal");
        }
		/// <summary>
		/// <para>Returns an affine transformation matrix constructed from values you provide.</para>
		/// <para>Original signature is : CGAffineTransform CGAffineTransformMake ( CGFloat a, CGFloat b, CGFloat c, CGFloat d, CGFloat tx, CGFloat ty );</para>
		/// <para>Available in Mac OS X version 10.0 and later.</para>
		/// </summary>
		/// <param name="a">The value at position [1,1] in the matrix.</param>
		/// <param name="b">The value at position [1,2] in the matrix.</param>
		/// <param name="c">The value at position [2,1] in the matrix.</param>
		/// <param name="d">The value at position [2,2] in the matrix.</param>
		/// <param name="tx">The value at position [3,1] in the matrix.</param>
		/// <param name="ty">The value at position [3,2] in the matrix.</param>
		/// <returns>A new affine transform matrix constructed from the values you specify.</returns>
		public static CGAffineTransform Make (CGFloat a, CGFloat b, CGFloat c, CGFloat d, CGFloat tx, CGFloat ty)
		{
			return new CGAffineTransform (a, b, c, d, tx, ty);
		}
		/// <summary>
		/// <para>Returns an affine transformation matrix constructed by translating an existing affine transform.</para>
		/// <para>Original signature is : CGAffineTransform CGAffineTransformTranslate ( CGAffineTransform t, CGFloat tx, CGFloat ty );</para>
		/// <para>Available in Mac OS X version 10.0 and later.</para>
		/// </summary>
		/// <param name="t">An existing affine transform.</param>
		/// <param name="tx">The value by which to move x values with the affine transform.</param>
		/// <param name="ty">The value by which to move y values with the affine transform.</param>
		/// <returns>A new affine transformation matrix.</returns>
		public static CGAffineTransform Translate (CGAffineTransform t, CGFloat tx, CGFloat ty)
		{
			return new CGAffineTransform (
                            t.a,
                            t.b,
                            t.c, 
                            t.d,
                            t.tx + tx,
                            t.ty + ty
			);
		}
		/// <summary>
		/// <para>Returns an affine transformation matrix constructed by scaling an existing affine transform.</para>
		/// <para>Original signature is : CGAffineTransform CGAffineTransformScale ( CGAffineTransform t, CGFloat sx, CGFloat sy );</para>
		/// <para>Available in Mac OS X version 10.0 and later.</para>
		/// </summary>
		/// <param name="t">An existing affine transform.</param>
		/// <param name="sx">The value by which to scale x values of the affine transform.</param>
		/// <param name="sy">The value by which to scale y values of the affine transform.</param>
		/// <returns>A new affine transformation matrix.</returns>
		public static CGAffineTransform Scale (CGAffineTransform t, CGFloat sx, CGFloat sy)
		{
			return new CGAffineTransform (
                            t.a * sx, 
                            t.b * sx, 
                            t.c * sy,
                            t.d * sy,
                            t.tx * sx,
                            t.ty * sy
			);
		}
		/// <summary>
		/// <para>Returns an affine transformation matrix constructed by rotating an existing affine transform.</para>
		/// <para>Original signature is : CGAffineTransform CGAffineTransformRotate ( CGAffineTransform t, CGFloat angle );</para>
		/// <para>Available in Mac OS X version 10.0 and later.</para>
		/// </summary>
		/// <param name="t">An existing affine transform.</param>
		/// <param name="angle">The angle, in radians, by which to rotate the affine transform.</param>
		/// <returns>A new affine transformation matrix.</returns>
		public static CGAffineTransform Rotate (CGAffineTransform t, CGFloat angle)
		{
			return new CGAffineTransform (
                            t.a * Math.Cos (angle) - t.b * Math.Sin (angle),     
                            t.a * Math.Sin (angle) + t.b * Math.Cos (angle),      
                            t.c * Math.Cos (angle) - t.d * Math.Sin (angle),        
                            t.c * Math.Sin (angle) + t.d * Math.Cos (angle),        
                            t.tx * Math.Cos (angle) - t.ty * Math.Sin (angle),       
                            t.tx * Math.Sin (angle) + t.ty * Math.Cos (angle)
			);
		}
		/// <summary>
		/// <para>Returns an affine transformation matrix constructed from translation values you provide.</para>
		/// <para>Original signature is : CGAffineTransform CGAffineTransformMakeTranslation ( CGFloat tx, CGFloat ty );</para>
		/// <para>Available in Mac OS X version 10.0 and later.</para>
		/// </summary>
		/// <param name="tx">The value by which to move the x-axis of the coordinate system.</param>
		/// <param name="ty">The value by which to move the y-axis of the coordinate system.</param>
		/// <returns>A new affine transform matrix.</returns>
		public static CGAffineTransform MakeTranslation (CGFloat tx, CGFloat ty)
		{
			return new CGAffineTransform (1.0, 0, 0, 1.0, tx, tx);
		}
Exemple #12
0
        /// <summary>
        /// Returns a rectangle structure constructed from coordinate and dimension values you provide.
        /// </summary>
        /// <param name="x">The x-coordinate of the rectangle's origin point.</param>
        /// <param name="y">The y-coordinate of the rectangle's origin point.</param>
        /// <param name="width">The width of the rectangle.</param>
        /// <param name="height">The height of the rectangle.</param>
        /// <returns>Returns a rectangle with the specified location and dimensions.</returns>
        /// <remarks>Original declaration is : CGRect CGRectMake ( float x, float y, float width, float height );</remarks>
		public static CGRect CGRectMake(CGFloat x, CGFloat y, CGFloat width, CGFloat height)
        {
            return new CGRect(x, y, width, height);
        }
Exemple #13
0
        /// <summary>
        /// Creates a rectangle that offsets this rectangle by the specified amount.
        /// </summary>
		public NSRect OffsetRect(CGFloat dX, CGFloat dY)
        {
            return NSOffsetRect(this, dX, dY);
        }
Exemple #14
0
        /// <summary>
        /// Creates a new NSPoint from the specified values.
        /// </summary>
        /// <remarks>Original declaration is : NSPoint NSMakePoint(float x, float y)</remarks>
		public static NSPoint NSMakePoint(CGFloat x,
		                                  CGFloat y)
        {
            return new NSPoint(x, y);
        }
Exemple #15
0
        /// <summary>
        /// Returns the result of the division of the size instance by the given factor.
        /// </summary>
        /// <param name="size">The size.</param>
        /// <param name="factor">The factor.</param>
        /// <returns></returns>
		public static NSSize Divide(NSSize size, CGFloat factor)
        {
            return new NSSize(size.width/factor, size.height/factor);
        }
Exemple #16
0
        /// <summary>
        /// Creates a new NSSize from the specified values.
        /// </summary>
        /// <remarks>Original declaration is : NSSize NSMakeSize(float width, float height)</remarks>
		public static NSSize NSMakeSize(CGFloat width,
		                                CGFloat height)
        {
            return new NSSize(width, height);
        }
Exemple #17
0
		/// <summary>
		/// Initializes a new instance of the <see cref="CATransform3D64"/> struct.
		/// </summary>
		public CATransform3D64 (CGFloat m11, CGFloat m12, CGFloat m13, CGFloat m14, 
		                        CGFloat m21, CGFloat m22, CGFloat m23, CGFloat m24, 
		                        CGFloat m31, CGFloat m32, CGFloat m33, CGFloat m34, 
		                        CGFloat m41, CGFloat m42, CGFloat m43, CGFloat m44)
		{
			this.m11 = m11;
			this.m12 = m12;
			this.m13 = m13;
			this.m14 = m14;
			this.m21 = m21;
			this.m22 = m22;
			this.m23 = m23;
			this.m24 = m24;
			this.m31 = m31;
			this.m32 = m32;
			this.m33 = m33;
			this.m34 = m34;
			this.m41 = m41;
			this.m42 = m42;
			this.m43 = m43;
			this.m44 = m44;
		}
Exemple #18
0
        /// <summary>
        /// Divides a source rectangle into two component rectangles.
        /// </summary>
        /// <param name="rect">The source rectangle.</param>
        /// <param name="slice">On input, a pointer to an uninitialized rectangle. On return, a rectangle that contains the specified edge and extends the distance beyond it specified by the amount parameter.</param>
        /// <param name="remainder">On input, a pointer to an uninitialized rectangle. On return, the rectangle contains the portion of the source rectangle that remains after CGRectEdge produces the 'slice' rectangle.</param>
        /// <param name="amount">A distance from the rectangle's side that is specified in the edge parameter. This distance defines the line, parallel to the specified side, that Quartz uses to divide the source rectangle.</param>
        /// <param name="edge">A CGRectEdge value (CGRectMinXEdge, CGRectMinYEdge, CGRectMaxXEdge, or CGRectMaxYEdge) that specifies the side of the rectangle from which the distance passed in the amount parameter is measured. CGRectDivide produces a 'slice' rectangle that contains the specified edge and extends amount distance beyond it.</param>
        /// <returns>Returns 1 if the two specified rectangles have equal size and origin values, or are both null. Otherwise, returns 0.</returns>
        /// <remarks>Original declaration is : void CGRectDivide ( CGRect rect, CGRect *slice, CGRect *remainder, float amount, CGRectEdge edge );</remarks>
		public static void CGRectDivide(CGRect rect, ref CGRect slice, ref CGRect remainder, CGFloat amount, CGRectEdge edge)
        {
            if (CGRectIsEmpty(rect) == 1)
            {
                slice = CGRectZero;
                remainder = CGRectZero;
            }

            switch (edge)
            {
                case CGRectEdge.CGRectMinXEdge:
                    {
                        float delta = amount;
                        if (amount > rect.size.width)
                        {
                            delta = rect.size.width;
                        }

                        slice = CGRectMake(rect.origin.x,
                                           rect.origin.y,
                                           delta,
                                           rect.size.height);
                        remainder = CGRectMake(rect.origin.x + delta,
                                               rect.origin.y,
                                               rect.size.width - delta,
                                               rect.size.height);
                    }
                    break;
                case CGRectEdge.CGRectMinYEdge:
                    {
                        float delta = amount;
                        if (amount > rect.size.height)
                        {
                            delta = rect.size.height;
                        }

                        slice = CGRectMake(rect.origin.x,
                                           rect.origin.y,
                                           rect.size.width,
                                           delta);
                        remainder = CGRectMake(rect.origin.x,
                                               rect.origin.y + delta,
                                               rect.size.width,
                                               rect.size.height - delta);
                    }
                    break;
                case CGRectEdge.CGRectMaxXEdge:
                    {
                        float delta = amount;
                        if (amount > rect.size.width)
                        {
                            delta = rect.size.width;
                        }

                        slice = CGRectMake(rect.origin.x + rect.size.width - delta,
                                           rect.origin.y,
                                           delta,
                                           rect.size.height);
                        remainder = CGRectMake(rect.origin.x,
                                               rect.origin.y,
                                               rect.size.width - delta,
                                               rect.size.height);
                    }
                    break;
                case CGRectEdge.CGRectMaxYEdge:
                    {
                        float delta = amount;
                        if (amount > rect.size.height)
                        {
                            delta = rect.size.height;
                        }

                        slice = CGRectMake(rect.origin.x,
                                           rect.origin.y + rect.size.height - delta,
                                           rect.size.width,
                                           delta);
                        remainder = CGRectMake(rect.origin.x,
                                               rect.origin.y,
                                               rect.size.width,
                                               rect.size.height - delta);
                    }
                    break;
                default:
                    throw new ArgumentOutOfRangeException("edge");
            }
        }
Exemple #19
0
        /// <summary>
        /// Returns a rectangle with an origin offset from that of the source rectangle.
        /// </summary>
        /// <param name="rect">The source rectangle.</param>
        /// <param name="dx">The value by which to move the x-coordinate of the source rectangle's origin.</param>
        /// <param name="dy">The value by which to move the y-coordinate of the source rectangle's origin.</param>
        /// <returns>A rectangle with the same size as the source, but with its origin offset by dx units along the x-axis and dy units along the y-axis with respect to the source.</returns>
        /// <remarks>Original declaration is : CGRect CGRectOffset ( CGRect rect, float dx, float dy );</remarks>
		public static CGRect CGRectOffset(CGRect rect, CGFloat dx, CGFloat dy)
        {
            return CGRectMake(rect.origin.x + dx,
                              rect.origin.y + dy,
                              rect.size.width,
                              rect.size.height);
        }
Exemple #20
0
        /// <summary>
        /// Offsets the rectangle by the specified amount.
        /// </summary>
        /// <remarks>Original declaration is : NSRect NSOffsetRect(NSRect aRect, float dX, float dY)</remarks>
		public static NSRect NSOffsetRect(NSRect aRect, CGFloat dX, CGFloat dY)
        {
            NSRect result = aRect;
            result.origin.x += dX;
            result.origin.y += dY;
            return result;
        }
Exemple #21
0
        /// <summary>
        /// Divides a rectangle into two new rectangles.
        /// </summary>
        /// <remarks>Original declaration is : void NSDivideRect(NSRect inRect, NSRect *slice, NSRect *remainder, float amount, NSRectEdge edge)</remarks>
        public static void NSDivideRect(NSRect inRect,
		                                ref NSRect slice,
		                                ref NSRect remainder,
		                                CGFloat amount,
		                                NSRectEdge edge)
        {
            if (NSIsEmptyRect(inRect))
            {
                slice = NSZeroRect;
                remainder = NSZeroRect;
            }

            switch (edge)
            {
                case NSRectEdge.NSMinXEdge:
                    {
                        float delta = amount;
                        if (amount > inRect.size.width)
                        {
                            delta = inRect.size.width;
                        }

                        slice = NSMakeRect(inRect.origin.x,
                                           inRect.origin.y,
                                           delta,
                                           inRect.size.height);
                        remainder = NSMakeRect(inRect.origin.x + delta,
                                               inRect.origin.y,
                                               inRect.size.width - delta,
                                               inRect.size.height);
                    }
                    break;
                case NSRectEdge.NSMinYEdge:
                    {
                        float delta = amount;
                        if (amount > inRect.size.height)
                        {
                            delta = inRect.size.height;
                        }

                        slice = NSMakeRect(inRect.origin.x,
                                           inRect.origin.y,
                                           inRect.size.width,
                                           delta);
                        remainder = NSMakeRect(inRect.origin.x,
                                               inRect.origin.y + delta,
                                               inRect.size.width,
                                               inRect.size.height - delta);
                    }
                    break;
                case NSRectEdge.NSMaxXEdge:
                    {
                        float delta = amount;
                        if (amount > inRect.size.width)
                        {
                            delta = inRect.size.width;
                        }

                        slice = NSMakeRect(inRect.origin.x + inRect.size.width - delta,
                                           inRect.origin.y,
                                           delta,
                                           inRect.size.height);
                        remainder = NSMakeRect(inRect.origin.x,
                                               inRect.origin.y,
                                               inRect.size.width - delta,
                                               inRect.size.height);
                    }
                    break;
                case NSRectEdge.NSMaxYEdge:
                    {
                        float delta = amount;
                        if (amount > inRect.size.height)
                        {
                            delta = inRect.size.height;
                        }

                        slice = NSMakeRect(inRect.origin.x,
                                           inRect.origin.y + inRect.size.height - delta,
                                           inRect.size.width,
                                           delta);
                        remainder = NSMakeRect(inRect.origin.x,
                                               inRect.origin.y,
                                               inRect.size.width,
                                               inRect.size.height - delta);
                    } 
                    break;
                default:
                    throw new ArgumentOutOfRangeException("edge");
            }
        }
Exemple #22
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Monobjc.Foundation.NSPoint64"/> struct.
        /// </summary>
        /// <param name="x">The x.</param>
        /// <param name="y">The y.</param>
		public NSPoint64(CGFloat x, CGFloat y)
        {
            this.x = x;
            this.y = y;
        }
Exemple #23
0
 /// <summary>
 /// Returns the product of the size instance by the given factor.
 /// </summary>
 /// <param name="size">The size.</param>
 /// <param name="factor">The factor.</param>
 /// <returns></returns>
 public static NSSize Multiply(NSSize size, CGFloat factor)
 {
     return new NSSize(size.width*factor, size.height*factor);
 }
Exemple #24
0
		/// <summary>
		/// Initializes a new instance of the <see cref="Monobjc.SceneKit.SCNVector3_64"/> struct.
		/// </summary>
		public SCNVector3_64(CGFloat x, CGFloat y, CGFloat z)
		{
			this.x = x;
			this.y = y;
			this.z = z;
		}
		/// <summary>
		/// <para>Returns an affine transformation matrix constructed from a rotation value you provide.</para>
		/// <para>Original signature is : CGAffineTransform CGAffineTransformMakeRotation ( CGFloat angle );</para>
		/// <para>Available in Mac OS X version 10.0 and later.</para>
		/// </summary>
		/// <param name="angle">The angle, in radians, by which this matrix rotates the coordinate system axes. A positive value specifies clockwise rotation, a negative value specifies counterclockwise.</param>
		/// <returns>A new affine transformation matrix.</returns>
		public static CGAffineTransform MakeRotation (CGFloat angle)
		{
			return new CGAffineTransform (Math.Cos (angle), Math.Sin (angle), -Math.Sin (angle), Math.Cos (angle), 0, 0);
		}
Exemple #26
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Monobjc.ApplicationServices.CGVector64"/> struct.
        /// </summary>
        /// <param name="x">The x.</param>
        /// <param name="y">The y.</param>
		public CGVector64(CGFloat x, CGFloat y)
        {
            this.x = x;
            this.y = y;
        }
		/// <summary>
		/// <para>Returns an affine transformation matrix constructed from scaling values you provide.</para>
		/// <para>Original signature is : CGAffineTransform CGAffineTransformMakeScale ( CGFloat sx, CGFloat sy );</para>
		/// <para>Available in Mac OS X version 10.0 and later.</para>
		/// </summary>
		/// <param name="sx">The factor by which to scale the x-axis of the coordinate system.</param>
		/// <param name="sy">The factor by which to scale the y-axis of the coordinate system.</param>
		/// <returns>A new affine transformation matrix.</returns>
		public static CGAffineTransform MakeScale (CGFloat sx, CGFloat sy)
		{
			return new CGAffineTransform (sx, 0, 0, sy, 0, 0);
		}
Exemple #28
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Monobjc.ApplicationServices.CGSize64"/> struct.
        /// </summary>
        /// <param name="width">The width.</param>
        /// <param name="height">The height.</param>
		public CGSize64(CGFloat width, CGFloat height)
        {
            this.width = width;
            this.height = height;
        }