@MarshalsPointer public static long toNative(List<? extends CFType> l, long flags) { if (l == null) { return 0L; } CFArray o = null; if (l instanceof CFArray) { o = (CFArray) l; } else { o = CFArray.create((List<? extends CFType>) l); } return CFType.Marshaler.toNative(o, flags); }
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); } }