/// <summary> /// Indicates whether a rectangle contains a specified point. /// </summary> /// <param name="rect">The rectangle to examine.</param> /// <param name="point">The point to examine.</param> /// <returns>Returns 1 if the specified point is located within the specified rectangle; otherwise, 0.</returns> /// <remarks>Original declaration is : int CGRectContainsPoint ( CGRect rect, CGPoint point );</remarks> public static int CGRectContainsPoint(CGRect rect, CGPoint point) { return ((point.x >= CGRectGetMinX(rect)) && (point.x < CGRectGetMaxX(rect)) && (point.y >= CGRectGetMinY(rect)) && (point.y < CGRectGetMaxY(rect))) ? 1 : 0; }
/// <summary> /// <para>Returns the point resulting from an affine transformation of an existing point.</para> /// <para>Original signature is : CGPoint CGPointApplyAffineTransform ( CGPoint point, CGAffineTransform t );</para> /// <para>Available in Mac OS X version 10.0 and later.</para> /// </summary> /// <param name="point">A point that specifies the x- and y-coordinates to transform.</param> /// <param name="t">The affine transform to apply.</param> /// <returns>A new point resulting from applying the specified affine transform to the existing point.</returns> public static CGPoint CGPointApplyAffineTransform (CGPoint point, CGAffineTransform t) { return new CGPoint ( t.a * point.x + t.c * point.y + t.tx, t.b * point.x + t.d * point.y + t.ty ); }
/// <summary> /// Converts a <see cref="CGPoint"/> instance to a <see cref="NSPoint"/> /// </summary> /// <param name="cgpoint">The <see cref="CGPoint"/> to convert.</param> /// <returns>A new <see cref="NSPoint"/> instance.</returns> public static NSPoint NSPointFromCGPoint(CGPoint cgpoint) { return NSMakePoint(cgpoint.x, cgpoint.y); }
public virtual bool PlotSpaceShouldHandlePointingDeviceUpEventAtPoint(CPTPlotSpace space, Id @event, CGPoint point) { CPTRangePlot rangePlot = graph.PlotWithIdentifier(PLOT_IDENTIFIER).CastTo<CPTRangePlot>(); rangePlot.AreaFill = ( rangePlot.AreaFill != null ? null : areaFill ); rangePlot.BarLineStyle = ( rangePlot.BarLineStyle != null ? null : barLineStyle ); return false; }
/// <summary> /// Computes the size between the two points. The values are always positives. /// </summary> /// <param name="cgPoint1">The point 1.</param> /// <param name="cgPoint2">The point 2.</param> /// <returns>A <see cref="NSSize"/> instance that contains the size between the two points.</returns> public static CGSize Substract(CGPoint cgPoint1, CGPoint cgPoint2) { return new CGSize(Math.Abs(cgPoint2.x - cgPoint1.x), Math.Abs(cgPoint2.y - cgPoint1.y)); }
/// <summary> /// Translates the point by the specified size. /// </summary> /// <param name="cgPoint">A point.</param> /// <param name="cgSize">A size.</param> /// <returns></returns> public static CGPoint Substract(CGPoint cgPoint, CGSize cgSize) { return new CGPoint(cgPoint.x - cgSize.width, cgPoint.y - cgSize.height); }
/// <summary> /// Translates the point by the specified size. /// </summary> /// <param name="cgPoint">A point.</param> /// <param name="cgSize">A size.</param> /// <returns></returns> public static CGPoint Add(CGPoint cgPoint, CGSize cgSize) { return new CGPoint(cgPoint.x + cgSize.width, cgPoint.y + cgSize.height); }