Beispiel #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);
 }
Beispiel #2
0
 public void replaceRegion(
     @ByVal MTLRegion region,
     @MachineSizedUInt long level,
     byte[] pixelBytes,
     @MachineSizedUInt long bytesPerRow) {
   replaceRegion(region, level, VM.getArrayValuesAddress(pixelBytes), bytesPerRow);
 }
Beispiel #3
0
 /*</constructors>*/
 public NSOutputStream(byte[] bytes) {
   super((SkipInit) null);
   if (bytes == null) {
     throw new NullPointerException("bytes");
   }
   initObject(init(VM.getArrayValuesAddress(bytes), bytes.length));
 }
Beispiel #4
0
 public long write(byte[] bytes, int offset, int length) {
   NSMutableData.checkOffsetAndCount(bytes.length, offset, length);
   if (length == 0) {
     return 0;
   }
   return write(VM.getArrayValuesAddress(bytes) + offset, length);
 }
Beispiel #5
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;
 }
Beispiel #6
0
 /**
  * @param offset
  * @param length
  * @return
  * @throws NSErrorException
  */
 public byte[] getBytes(int offset, int length) throws NSErrorException {
   byte[] bytes = new byte[length];
   NSError.NSErrorPtr err = new NSError.NSErrorPtr();
   getBytes(VM.getArrayValuesAddress(bytes), offset, length, err);
   if (err.get() != null) {
     throw new NSErrorException(err.get());
   }
   return bytes;
 }
Beispiel #7
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);
   }
 }
Beispiel #8
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);
   }
 }
Beispiel #9
0
 /*</members>*/
 public ByteBuffer getContents() {
   return VM.newDirectByteBuffer(getContents0(), (int) getLength());
 }
Beispiel #10
0
 public MIDIRawData setData(byte[] data) {
   setData0(VM.getArrayValuesAddress(data));
   setLength0(data.length);
   return this;
 }