Glitch class

A digital glitch effect painter that creates cyberpunk-style glitch artifacts.

This effect simulates digital corruption with RGB channel splitting, scanlines, pixel displacement, and random artifacts. Perfect for cyberpunk, retro, or glitch art aesthetics.

Usage

CustomPaint(
  painter: Glitch(
    colors: [Colors.cyan, Colors.magenta],
    intensity: 0.8,
    speed: 1.5,
    touchPosition: () => Offset(0.5, 0.5),
  ),
)
Inheritance

Constructors

Glitch({required List<Color> colors, double intensity = 0.8, double speed = 1.0, GlitchType glitchType = GlitchType.digital, Offset touchPosition()?, double deviceDensity = 1.0})
Creates a digital glitch effect painter.

Properties

colors List<Color>
Colors for the glitch effect.
final
deviceDensity double
The device density.
finalinherited
glitchType GlitchType
Type of glitch effect to apply.
final
hashCode int
The hash code for this object.
no setterinherited
intensity double
Glitch intensity (0.0 to 1.0).
final
isShaderLoaded bool
Whether the shader has been loaded and compiled.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
semanticsBuilder SemanticsBuilderCallback?
Returns a function that builds semantic information for the picture drawn by this painter.
no setterinherited
shaderPath String
Path to the GLSL fragment shader file.
finalinherited
speed double
Animation speed (0.0 to 2.0).
final
touchPosition Offset Function()?
Touch/mouse position for interaction (normalized 0.0-1.0).
final
uniforms Map<String, dynamic>
Map of uniform values to pass to the shader.
finalinherited

Methods

addListener(VoidCallback listener) → void
Register a closure to be notified when it is time to repaint.
inherited
dispose() → void
Disposes of shader resources.
inherited
getTouchPosition() Offset
Gets the current touch position in normalized coordinates (0.0 to 1.0).
override
hitTest(Offset position) bool?
Called whenever a hit test is being performed on an object that is using this custom paint delegate.
inherited
loadShader() Future<void>
Loads and compiles the GLSL shader.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
paint(Canvas canvas, Size size) → void
Called whenever the object needs to paint. The given Canvas has its coordinate space configured such that the origin is at the top left of the box. The area of the box is the size of the size argument.
override
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that the object notifies when it is time to repaint.
inherited
setCustomUniforms(FragmentShader shader, int startIndex) → void
Sets custom uniforms specific to this shader effect.
override
shouldRebuildSemantics(covariant CustomPainter oldDelegate) bool
Called whenever a new instance of the custom painter delegate class is provided to the RenderCustomPaint object, or any time that a new CustomPaint object is created with a new instance of the custom painter delegate class (which amounts to the same thing, because the latter is implemented in terms of the former).
inherited
shouldRepaint(covariant Glitch oldDelegate) bool
Called whenever a new instance of the custom painter delegate class is provided to the RenderCustomPaint object, or any time that a new CustomPaint object is created with a new instance of the custom painter delegate class (which amounts to the same thing, because the latter is implemented in terms of the former).
override
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited