public static CGGradient create(CGColorSpace space, CGColor[] colors, double[] locations) { return create(space, colors, (Object) locations); } public static CGGradient create(CGColorSpace space, CGColor[] colors, float[] locations) {
@Override protected void finalize () { cgGradient.dispose(); // meh } }
CGGradient gradient = new CGGradient(colorSpace, new double[] { 0, 1 }, new double[] { 0, 0, 0, 0, 0, 0, 0, 0.75 }); CGPoint gradCenter = new CGPoint(getBounds().getWidth() / 2, getBounds().getHeight() / 2);
@Override protected void finalize () { cgGradient.dispose(); // meh } }
public static CGGradient create(CGColorSpace space, CGColor[] colors, float[] locations) { return create(space, colors, (Object) locations); } private static CGGradient create(CGColorSpace space, CGColor[] colors, Object locations) {
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); } } /*<methods>*/
public static CGGradient create(CGColorSpace space, double[] components, double[] 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); } public static CGGradient create(CGColorSpace space, float[] components, float[] locations) {
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); } public static CGGradient create(CGColorSpace space, CGColor[] colors, double[] locations) {
protected RoboGradient(int[] colors, float[] positions) { // expand the color components from ARGB into an array of floats in RGBA order float[] comps = new float[colors.length*4]; int cc = 0; for (int color : colors) { comps[cc++] = ((color >> 16) & 0xFF) / 255f; comps[cc++] = ((color >> 8) & 0xFF) / 255f; comps[cc++] = ((color >> 0) & 0xFF) / 255f; comps[cc++] = ((color >> 24) & 0xFF) / 255f; } cgGradient = CGGradient.create(RoboGraphics.colorSpace, comps, positions); }
protected RoboGradient(Config cfg) { // expand the color components from ARGB into an array of floats in RGBA order float[] comps = new float[cfg.colors.length*4]; int cc = 0; for (int color : cfg.colors) { comps[cc++] = ((color >> 16) & 0xFF) / 255f; comps[cc++] = ((color >> 8) & 0xFF) / 255f; comps[cc++] = ((color >> 0) & 0xFF) / 255f; comps[cc++] = ((color >> 24) & 0xFF) / 255f; } cgGradient = CGGradient.create(RoboGraphics.colorSpace, comps, cfg.positions); }
public static CGGradient create(CGColorSpace space, CGColor[] colors, double[] locations) { return create(space, colors, (Object) locations); } public static CGGradient create(CGColorSpace space, CGColor[] colors, float[] locations) {
public static CGGradient create(CGColorSpace space, CGColor[] colors, float[] locations) { return create(space, colors, (Object) locations); } private static CGGradient create(CGColorSpace space, CGColor[] colors, Object locations) {
public static CGGradient create(CGColorSpace space, CGColor[] colors, double[] locations) { return create(space, colors, (Object) locations); } public static CGGradient create(CGColorSpace space, CGColor[] colors, float[] locations) {
public static CGGradient create(CGColorSpace space, CGColor[] colors, float[] locations) { return create(space, colors, (Object) locations); } private static CGGradient create(CGColorSpace space, CGColor[] colors, Object locations) {
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); } } /*<methods>*/
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); } } /*<methods>*/
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); } public static CGGradient create(CGColorSpace space, CGColor[] colors, double[] locations) {
public static CGGradient create(CGColorSpace space, double[] components, double[] 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); } public static CGGradient create(CGColorSpace space, float[] components, float[] locations) {
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); } public static CGGradient create(CGColorSpace space, CGColor[] colors, double[] locations) {
public static CGGradient create(CGColorSpace space, double[] components, double[] 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); } public static CGGradient create(CGColorSpace space, float[] components, float[] locations) {