Maven module :un.api : api-image :
Class : un.api.color.AlphaBlending
Extends/Implements : un.api.color.AbstractBlending
Subclasses : -

Porter Duff alpha rules for color blending.
http://en.wikipedia.org/wiki/Alpha_blending#Alpha_blending
http://dev.w3.org/fxtf/compositing-1/#porterduffcompositingoperators
author  Johann Sorel


Variables : DEFAULT, CLEAR, SRC, DST, XOR, LIGHTER, SRC_OVER, SRC_IN, SRC_OUT, SRC_ATOP, DST_OVER, DST_IN, DST_OUT, DST_ATOP, alpha
Functions : getType, getAlpha, create, copy, src, dst, srcOver, dstOver, srcIn, dstIn, srcOut, dstOut, srcAtop, dstAtop, xor, porterDuffPreMul, porterDuffPreMul, porterDuff, porterDuff



Default blending method.
Equivalent to SRC_OVER with alpha at 1.0 .
public AlphaBlending DEFAULT

public int CLEAR

public int SRC

public int DST

public int XOR

public int LIGHTER

public int SRC_OVER

public int SRC_IN

public int SRC_OUT

public int SRC_ATOP

public int DST_OVER

public int DST_IN

public int DST_OUT

public int DST_ATOP

protected float alpha



Get blending type,
return  blending type
public int getType ()


Get global alpha blending used on source color.
return  float from 0 to 1.
public float getAlpha ()

public AlphaBlending create (int type, float alpha)


Only the source will be present.
public Color copy (Color a, Color b)


Only the source will be present.
public Color src (Color a, Color b)


Only the destination will be present.
public Color dst (Color a, Color b)


Source is placed over the destination
public Color srcOver (Color a, Color b)


Destination is placed over the source.
public Color dstOver (Color a, Color b)


The source that overlaps the destination, replaces the destination.
public Color srcIn (Color a, Color b)


Destination which overlaps the source, replaces the source.
public Color dstIn (Color a, Color b)


Source is placed, where it falls outside of the destination.
public Color srcOut (Color a, Color b)


Destination is placed, where it falls outside of the source.
public Color dstOut (Color a, Color b)


Source which overlaps the destination, replaces the destination. Destination is placed elsewhere.
public Color srcAtop (Color a, Color b)


Destination which overlaps the source replaces the source. Source is placed elsewhere.
public Color dstAtop (Color a, Color b)


The non-overlapping regions of source and destination are combined.
public Color xor (Color a, Color b)


Porter-Duff formula for premultiplied color component.
co = Fa x Cs + Fb x Cb
Where :
co is the output color pre-multiplied with the output alpha [0 <= co <= 1]
Fa is defined by the operator and controls inclusion of the source
Cs is the color of the source (multiplied by alpha)
Fb is defined by the operator and controls inclusion of the destination
Cb is the color of the destination (multiplied by alpha)
public float porterDuffPreMul (float Fa, float Cs, float Fb, float Cb)

public void porterDuffPreMul (float Fa, float[] Cs, int cso, float Fb, float[] Cb, int cbo, float[] buffer, int bo)


Porter-Duff formula for not premultiplied color component.
co = αs x Fa x Cs + αb x Fb x Cb
Where :
co is the output color pre-multiplied with the output alpha [0 <= co <= 1]
αs is the coverage of the source
Fa is defined by the operator and controls inclusion of the source
Cs is the color of the source (not multiplied by alpha)
αb is the coverage of the destination
Fb is defined by the operator and controls inclusion of the destination
Cb is the color of the destination (not multiplied by alpha)
public float porterDuff (float αs, float Fa, float Cs, float αb, float Fb, float Cb)

public void porterDuff (float αs, float Fa, float[] Cs, int cso, float αb, float Fb, float Cb, int cbo, float[] buffer, int bo)