public static CGPoint fromDictionary(NSDictionary<NSString, NSNumber> dict) { CGPoint p = new CGPoint(); if (!fromDictionary(dict, p)) { throw new IllegalArgumentException("Failed to create CGPoint from dictionary " + dict); } return p; }
@WeaklyLinked public CGRect inset(UIEdgeInsets insets) { getOrigin().setX(getOrigin().getX() + insets.getLeft()); getOrigin().setY(getOrigin().getY() + insets.getTop()); getSize().setWidth(getSize().getWidth() - (insets.getLeft() + insets.getRight())); getSize().setHeight(getSize().getHeight() - (insets.getTop() + insets.getBottom())); return this; }
/** * @since Available in iOS 2.0 and later. */ @Bridge(symbol="CGPointApplyAffineTransform", optional=true) private static native @ByVal CGPoint apply(@ByVal CGPoint point, @ByVal CGAffineTransform t); /*</methods>*/
public double getX() { return this.getOrigin().getX(); }
public double getY() { return this.getOrigin().getY(); }
/** * @since Available in iOS 3.2 and later. */ public CGPoint[] getLineOrigins(CFRange range) { if (range == null) throw new NullPointerException("range"); int size = range.getLength() == 0 ? getLines().size() : (int)range.getLength(); if (size == 0) { return new CGPoint[0]; } CGPoint array = Struct.allocate(CGPoint.class, size); getLineOrigins(range, array); return array.toArray(size); } /*<methods>*/
@Override public boolean equals(Object obj) { return obj instanceof CGPoint && equalsTo(this, (CGPoint) obj); }
@Callback private static void cbApplier(@Pointer long applierPtr, CGPathElement element) { Applier applier = (Applier) VM.castAddressToObject(applierPtr); CGPoint point1 = null; CGPoint point2 = null; CGPoint point3 = null; switch (element.getType()) { case AddLineToPoint: case MoveToPoint: point1 = element.getPoints(); break; case AddQuadCurveToPoint: point1 = element.getPoints(); point2 = point1.next(); break; case AddCurveToPoint: point1 = element.getPoints(); point2 = point1.next(); point3 = point2.next(); break; case CloseSubpath: break; } applier.apply(element.getType(), point1, point2, point3); } /*<methods>*/
public CGRect setX(double x) { this.getOrigin().setX(x); return this; }
public CGRect setY(double y) { this.getOrigin().setY(y); return this; }
public double getX() { return this.getOrigin().getX(); }