Skip to content

Implement remaining SVG filter primitives/CSS filter functions #1296

@grebmeg

Description

@grebmeg

Location: sparse_strips/vello_common/src/filter_effects.rs
Context: Initial filter effects implementation in #1286

The following filter primitives are defined in the FilterPrimitive enum. Currently only 3 are implemented:

  • Flood - Generate a solid color fill (typically used as input to other filter operations)
  • GaussianBlur - Gaussian blur using specified standard deviation
  • DropShadow - Drop shadow effect (compound primitive combining blur, offset, and compositing)
  • ColorMatrix - Matrix-based color transformations (4x5 matrix for arbitrary color space transformations, hue shifts, and color adjustments)
  • Offset - Geometric offset/translation (shifts input by dx, dy)
  • Composite - Porter-Duff compositing operations (over, in, out, atop, xor)
  • Blend - Photoshop-style blend modes (multiply, screen, overlay, etc.)
  • Morphology - Morphological operations (dilate/erode) for expanding or contracting shapes
  • ConvolveMatrix - Custom convolution kernels for sharpening, edge detection, embossing, and custom filters
  • Turbulence - Generate Perlin noise/turbulence patterns for textures, clouds, and organic randomness
  • DisplacementMap - Displace pixels using a displacement map for warping and distortion effects
  • ComponentTransfer - Per-channel transfer functions using lookup tables (for color corrections, gamma adjustments, and custom mappings)
  • Image - Reference external images as filter input from resource atlas
  • Tile - Tile the input to fill the filter region with repeating patterns
  • DiffuseLighting - Diffuse lighting simulation treating alpha channel as height map
  • SpecularLighting - Specular lighting simulation for shiny reflection highlights

The following filter functions (CSS-style shorthand filters) are defined in the FilterFunction enum. Currently only 1 is implemented:

  • Blur - Gaussian blur effect
  • Brightness - Brightness adjustment (linear multiplier)
  • Contrast - Contrast adjustment
  • Grayscale - Grayscale conversion with adjustable strength
  • HueRotate - Hue rotation by specified angle in degrees
  • Invert - Color inversion
  • Opacity - Opacity adjustment (multiplies alpha channel)
  • Saturate - Saturation adjustment
  • Sepia - Sepia tone effect (vintage/old photo appearance)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions