Ejemplo n.º 1
0
 public static CGGradient create(CGColorSpace space, float[] components, float[] locations) {
   if (space == null) {
     throw new NullPointerException("space");
   }
   if (components == null) {
     throw new NullPointerException("components");
   }
   return create(
       space,
       VM.getArrayValuesAddress(CoreGraphics.toMachineSizedFloatArray(components)),
       locations != null
           ? VM.getArrayValuesAddress(CoreGraphics.toMachineSizedFloatArray(locations))
           : 0,
       locations != null ? locations.length : 0);
 }
Ejemplo n.º 2
0
 public void replaceRegion(
     @ByVal MTLRegion region,
     @MachineSizedUInt long level,
     byte[] pixelBytes,
     @MachineSizedUInt long bytesPerRow) {
   replaceRegion(region, level, VM.getArrayValuesAddress(pixelBytes), bytesPerRow);
 }
Ejemplo n.º 3
0
 public byte[] getBytes(
     int length,
     @MachineSizedUInt long bytesPerRow,
     @ByVal MTLRegion region,
     @MachineSizedUInt long level) {
   byte[] bytes = new byte[length];
   getBytes(VM.getArrayValuesAddress(bytes), bytesPerRow, region, level);
   return bytes;
 }
Ejemplo n.º 4
0
 private static CGGradient create(CGColorSpace space, CGColor[] colors, Object locations) {
   if (colors == null) {
     throw new NullPointerException("colors");
   }
   try (CFArray colorsArray = CFArray.create(colors)) {
     return create(
         space,
         colorsArray,
         locations != null
             ? VM.getArrayValuesAddress(CoreGraphics.toMachineSizedFloatArray(locations))
             : 0);
   }
 }
Ejemplo n.º 5
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);
   }
 }