Package limn.graphics
Record Class BackdropEffect.Blur
java.lang.Object
java.lang.Record
limn.graphics.BackdropEffect.Blur
- Record Components:
tint- colour over the blurred backdrop; usually clear on the first of a pair, so the tint is not laid down twiceradius- how far the blur reaches, in points. 0 is no blur at all, and the pass is then exactly identityaxis- which way this pass smears; see the class note on why it is one at a time
- All Implemented Interfaces:
BackdropEffect
- Enclosing interface:
BackdropEffect
public static record BackdropEffect.Blur(Color tint, float radius, BackdropEffect.Blur.Axis axis)
extends Record
implements BackdropEffect
The backdrop blurred along one axis. Two of these, crossed, are a full blur.
Separable on purpose, and it is why this is affordable at all. A true two-dimensional blur of radius r costs r² samples per pixel; the same blur run horizontally and then vertically costs 2r and is indistinguishable. So this variant does one axis and the caller draws it twice, which works because a backdrop effect reads the framebuffer and writes the framebuffer: the second pass samples what the first one left.
// frosted glass: refract, then blur across, then down
canvas.fillBackdropRoundRect(shape, new BackdropEffect.Clear(tint, 20, 0.3f));
canvas.fillBackdropRoundRect(shape, new BackdropEffect.Blur(Color.TRANSPARENT, 8, Axis.X));
canvas.fillBackdropRoundRect(shape, new BackdropEffect.Blur(Color.TRANSPARENT, 8, Axis.Y));
Stacking is the general mechanism here, not a trick for this variant: any of these effects composes with any other by being drawn over it, at one flush and one copy each.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumWhich way one blur pass runs.Nested classes/interfaces inherited from interface limn.graphics.BackdropEffect
BackdropEffect.Blur, BackdropEffect.Clear, BackdropEffect.Crt, BackdropEffect.Pixelate, BackdropEffect.Wash -
Constructor Summary
ConstructorsConstructorDescriptionBlur(Color tint, float radius, BackdropEffect.Blur.Axis axis) Creates an instance of aBlurrecord class. -
Method Summary
Modifier and TypeMethodDescriptionaxis()Returns the value of theaxisrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.floatradius()Returns the value of theradiusrecord component.tint()Returns the value of thetintrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Method Details
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
tint
Returns the value of thetintrecord component.- Specified by:
tintin interfaceBackdropEffect- Returns:
- the value of the
tintrecord component
-
radius
public float radius()Returns the value of theradiusrecord component.- Returns:
- the value of the
radiusrecord component
-
axis
Returns the value of theaxisrecord component.- Returns:
- the value of the
axisrecord component
-