Exemplo n.º 1
0
 /**
  * @throws OSStatusException
  * @since Available in iOS 2.0 and later.
  */
 public int getPropertySize(Struct<?> specifier) throws OSStatusException {
   IntPtr ptr = new IntPtr();
   OSStatus status =
       getPropertyInfo0(
           this,
           specifier == null ? 0 : Struct.sizeOf(specifier),
           specifier == null ? null : specifier.as(VoidPtr.class),
           ptr);
   OSStatusException.throwIfNecessary(status);
   return ptr.get();
 }
Exemplo n.º 2
0
 /**
  * @throws OSStatusException
  * @since Available in iOS 2.0 and later.
  */
 public <T extends Struct<T>> T getProperty(Struct<?> specifier, Class<T> type)
     throws OSStatusException {
   T data = Struct.allocate(type);
   IntPtr dataSize = new IntPtr(Struct.sizeOf(data));
   OSStatus status =
       getProperty0(
           this,
           specifier == null ? 0 : Struct.sizeOf(specifier),
           specifier == null ? null : specifier.as(VoidPtr.class),
           dataSize,
           data.as(VoidPtr.class));
   OSStatusException.throwIfNecessary(status);
   return data;
 }
Exemplo n.º 3
0
 public CIVector(double[] values) {
   super((SkipInit) null);
   if (values == null) {
     throw new NullPointerException("values");
   }
   MachineSizedFloatPtr p = Struct.allocate(MachineSizedFloatPtr.class, values.length);
   p.set(values);
   initObject(initWithValues$count$(p, values.length));
 }
Exemplo n.º 4
0
 private static CGGradient create(CGColorSpace space, CGColor[] colors, Object locations) {
   if (colors == null) {
     throw new NullPointerException("colors");
   }
   try (CFMutableArray colorsArray =
       CFMutableArray.createMutable(null, colors.length, CoreFoundation.TypeArrayCallBacks())) {
     for (CGColor c : colors) {
       colorsArray.appendValue(Struct.toStruct(VoidPtr.class, c.getHandle()));
     }
     return create(
         space,
         colorsArray,
         locations != null
             ? VM.getArrayValuesAddress(CoreGraphics.toMachineSizedFloatArray(locations))
             : 0);
   }
 }
Exemplo n.º 5
0
 public static MKPolyline create(CLLocationCoordinate2D[] coords) {
   CLLocationCoordinate2D first = Struct.allocate(CLLocationCoordinate2D.class, coords.length);
   first.update(coords);
   return create(first, coords.length);
 }
Exemplo n.º 6
0
 /*</members>*/
 public static MKPolyline create(MKMapPoint[] points) {
   MKMapPoint first = Struct.allocate(MKMapPoint.class, points.length);
   first.update(points);
   return create(first, points.length);
 }