GraphicsContextFilter

A type that applies image processing operations to rendered content.

StructureiOS 15.0+macOS 12.0+tvOS 15.0+watchOS 8.0+GraphicsContext.Filter in SwiftUI

Declaration

React
type GraphicsContextFilter =
  | 'luminanceToAlpha'
  | { alphaMultiply: Color; }
  | { alphaThreshold: { min: number; max?: number; color?: Color; }; }
  | { blur: { radius: number; options?: GraphicsContextBlurOptions; }; }
  | { brightness: number; }
  | { colorInvert: number; }
  | { colorMatrix: { matrix: ColorMatrix; isPremultiplied: boolean; }; }
  | { colorMatrix: ColorMatrix; }
  | { colorMultiply: Color; }
  | { colorShader: Shader; }
  | { contrast: number; }
  | { distortionShader: { shader: Shader; maxSampleOffset: CGSize; }; }
  | { grayscale: number; }
  | { hueRotation: Angle; }
  | { layerShader: { shader: Shader; maxSampleOffset: CGSize; }; }
  | { projectionTransform: ProjectionTransform; }
  | { saturation: number; }
  | { shadow: { color?: Color; radius: number; x?: number; y?: number; blendMode?: GraphicsContextBlendMode; options?: GraphicsContextShadowOptions; }; };
Swift
struct Filter

Pass a literal, or build one with SwiftUI.GraphicsContextFilter from import { SwiftUI } from 'swiftui-react-native'.

Type properties

Type methods

Overview

Create and configure a filter that produces an image processing effect, like adding a drop shadow or a blur effect, by calling one of the factory methods defined by the Filter structure. Call the addFilter(_:options:) method to add the filter to a GraphicsContext. The filter only affects content that you draw into the context after adding the filter.

From Apple’s SwiftUI documentation. Code samples there are Swift.

See also

More in Drawing and shapes.