public MKMapRect Divide(double amount, CGRectEdge edge, out MKMapRect remainder) { MKMapRect slice; MKMapRectDivide(this, out slice, out remainder, amount, edge); return(slice); }
/// <summary> /// Divides this rectangle into two new rectangles. /// </summary> public void DivideRect(ref CGRect slice, ref CGRect remainder, CGFloat amount, CGRectEdge edge) { CGRectDivide(this, ref slice, ref remainder, amount, edge); }
static extern void MKMapRectDivide(MKMapRect rect, out MKMapRect slice, out MKMapRect remainder, double amount, CGRectEdge edge);
public static void Divide(this RectangleF self, float amount, CGRectEdge edge, out RectangleF slice, out RectangleF remainder) { CGRectDivide(self, out slice, out remainder, amount, edge); }
static extern void CGRectDivide(RectangleF rect, out RectangleF slice, out RectangleF remainder, float amount, CGRectEdge edge);
public static void Divide(this CGRect self, nfloat amount, CGRectEdge edge, out CGRect slice, out CGRect remainder) { CGRectDivide(self, out slice, out remainder, amount, edge); }
static extern void CGRectDivide(CGRect rect, out CGRect slice, out CGRect remainder, /* GCFloat */ nfloat amount, CGRectEdge edge);
//[Verify (PlatformInvoke)] public static extern unsafe void BMKMapRectDivide(BMKMapRect rect, BMKMapRect *slice, BMKMapRect *remainder, double amount, CGRectEdge edge);
public static void Divide (this RectangleF self, float amount, CGRectEdge edge, out RectangleF slice, out RectangleF remainder) { CGRectDivide (self, out slice, out remainder, amount, edge); }
static extern void CGRectDivide (RectangleF rect, out RectangleF slice, out RectangleF remainder, float amount, CGRectEdge edge);
static extern void CGRectDivide(CGRect rect, out CGRect slice, out CGRect remainder, /* GCFloat */ nfloat amount, CGRectEdge edge);
public static void Divide(this CGRect self, nfloat amount, CGRectEdge edge, out CGRect slice, out CGRect remainder) { CGRectDivide (self, out slice, out remainder, amount, edge); }
public static Dictionary <string, CGRect> DividedIntegral(this CGRect rect, nfloat fraction, CGRectEdge fromEdge) { nfloat dimension = 0.0f; switch (fromEdge) { case CGRectEdge.MinXEdge: case CGRectEdge.MaxXEdge: dimension = rect.Size.Width; break; case CGRectEdge.MinYEdge: case CGRectEdge.MaxYEdge: dimension = rect.Size.Height; break; } var distance = Math.Round(dimension * fraction); rect.Divide((nfloat)distance, fromEdge, out var slice, out var remainder); var remainderSize = remainder.Size; switch (fromEdge) { case CGRectEdge.MinXEdge: case CGRectEdge.MaxXEdge: remainder.X += 1; remainderSize.Width -= 1; remainder.Size = remainderSize; break; case CGRectEdge.MinYEdge: case CGRectEdge.MaxYEdge: remainder.Y += 1; remainderSize.Height -= 1; remainder.Size = remainderSize; break; } return(new Dictionary <string, CGRect> { { "First", slice }, { "Second", remainder } }); }
static extern void MKMapRectDivide(MKMapRect rect, out MKMapRect slice, out MKMapRect remainder, double amount, CGRectEdge edge);
public MKMapRect Divide(double amount, CGRectEdge edge, out MKMapRect remainder) { MKMapRect slice; MKMapRectDivide (this, out slice, out remainder, amount, edge); return slice; }
/// <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"); } }