Enum Class BlendMode
- All Implemented Interfaces:
Serializable,Comparable<BlendMode>,Constable
Canvas painting combines with what is already on the
target. Part of the canvas state (Canvas.setBlendMode(limn.graphics.BlendMode)), so it is
saved/restored with Canvas.save()/Canvas.restore() and
applies to every primitive: shapes, text, images.
The pipeline is premultiplied-alpha end to end; each mode maps to a fixed blend equation, and switching modes mid-frame is a batch break (one extra draw call), so group same-mode painting where possible.
Inside a group drawn as one picture, an Opacity container below 1 or a
layer, a mode combines with what the group itself drew, and where it
drew nothing the source is drawn as itself, as an isolated group of a web page has it; outside any
group it combines with the window. A multiplied tint inside a fading container therefore shows
as itself while the container fades and multiplies what is beneath once the container is at 1.
Inside a group MULTIPLY is drawn in two passes, of which the second reads what the first
left, so draws in it share their two draw calls only while no two of them can cover the same
pixel, sixty-four at most; each draw that can takes two of its own. What that costs on every frame
that draws the group as a picture, while it fades or while it is turned, and never at rest, as
measured on a graphics card: shapes a pixel apart or more share (ten rectangles or circles in a
row, 3 draw calls; a heat map of 200 cells with one-pixel gaps, 9); shapes that touch or stand
less than a pixel apart do not, since beside a corner each one's antialiasing reaches a pixel of
the other (ten bars of a chart side by side, 21); ten tints that overlap, about 20 more; a line
of text, whose neighbouring glyphs' pictures usually share a pixel, 9 to 11 for
43 characters, where outside a group it is 1.
A 1.x minor release may add constants to this enum: a switch over it needs a
default branch.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionAdditive: source adds to the destination, for light, glow, fire, laser and particle effects that brighten whatever they overlap.Multiply: source darkens the destination, for shadows, vignettes, tint layers.Source-over: ordinary painting, the default. -
Method Summary
-
Enum Constant Details
-
NORMAL
Source-over: ordinary painting, the default. -
ADDITIVE
Additive: source adds to the destination, for light, glow, fire, laser and particle effects that brighten whatever they overlap. Black is neutral; overlapping strokes accumulate toward white. -
MULTIPLY
Multiply: source darkens the destination, for shadows, vignettes, tint layers. White is neutral; overlapping strokes accumulate toward black.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-