Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.
public final class Compositor
- Object
- Compositor
Software compositing of ARGB pixel arrays.
Uses the formulas of the W3C Compositing and Blending specification: the blended color is
mixed with the layer’s color by the backdrop’s alpha, then composited source-over. Pixels
are non-premultiplied 0xAARRGGBB ints, as Image.getRGB returns them.
Fields
public static final int SCRATCH = 18 | The scratch space blend(int, int, BlendMode, float, double[]) needs, in doubles. |
Methods
public static void composite(int[] src, int[] dst, BlendMode mode, float opacity) | Composites src over dst in place. |
public static int blend(int src, int dst, BlendMode mode, float opacity) | Composites one pixel and returns the result. |
public static int blend(int src, int dst, BlendMode mode, float opacity, double[] scratch) | Blends one pixel without allocating, for loops over many pixels. |
Inherited methods
Field details
SCRATCH
public static final int SCRATCH = 18The scratch space
blend(int, int, BlendMode, float, double[]) needs, in doubles.Method details
composite
public static void composite(int[] src, int[] dst, BlendMode mode, float opacity)Composites
src over dst in place.Parameters
srcint[]- the layer’s pixels
dstint[]- the backdrop, overwritten with the result; same length as
src modeBlendMode- how colors combine
opacityfloat- the layer’s opacity, 0 to 1, applied on top of each pixel’s own alpha
blend
public static int blend(int src, int dst, BlendMode mode, float opacity)Composites one pixel and returns the result.
Parameters
srcint- the layer’s pixel
dstint- the backdrop pixel
modeBlendMode- how colors combine
opacityfloat- the layer’s opacity, 0 to 1
blend
public static int blend(int src, int dst, BlendMode mode, float opacity, double[] scratch)Blends one pixel without allocating, for loops over many pixels.
Parameters
srcint- the layer’s pixel
dstint- the backdrop pixel
modeBlendMode- how colors combine
opacityfloat- the layer’s opacity, 0 to 1
scratchdouble[]- at least
SCRATCHdoubles, reused across calls
Returns
the composited pixel