GraphicsContextShading
A color or pattern that you can use to outline or fill a path.
Declaration
type GraphicsContextShading =
| 'backdrop'
| 'foreground'
| { color: { colorSpace?: ColorRGBColorSpace; red: number; green: number; blue: number; opacity?: number; }; }
| { color: { colorSpace?: ColorRGBColorSpace; white: number; opacity?: number; }; }
| { color: Color; }
| { conicGradient: { gradient: Gradient; center: CGPoint; angle?: Angle; options?: GraphicsContextGradientOptions; }; }
| { linearGradient: { gradient: Gradient; startPoint: CGPoint; endPoint: CGPoint; options?: GraphicsContextGradientOptions; }; }
| { meshGradient: MeshGradient; }
| { palette: GraphicsContextShading[]; }
| { radialGradient: { gradient: Gradient; center: CGPoint; startRadius: number; endRadius: number; options?: GraphicsContextGradientOptions; }; }
| { radialGradient: { gradient: Gradient; startCenter: CGPoint; startRadius: number; endCenter: CGPoint; endRadius: number; options?: GraphicsContextGradientOptions; }; }
| { shader: { shader: Shader; bounds?: CGRect; }; }
| { style: ShapeStyle; }
| { tiledImage: { image: Image; origin?: CGPoint; sourceRect?: CGRect; scale?: number; }; };struct ShadingPass a literal, or build one with SwiftUI.GraphicsContextShading from import { SwiftUI } from 'swiftui-react-native'.
Type properties
'backdrop'SwiftUI.GraphicsContextShading.backdrop'foreground'SwiftUI.GraphicsContextShading.foreground
Type methods
Overview
Use a shading instance to describe the color or pattern of a path that
you outline with a method like stroke(_:with:style:), or of the
interior of a region that you fill with the fill(_:with:style:)
method. Get a shading instance by calling one of the Shading
structure's factory methods. You can base shading on:
- A
Color. - A
Gradient. - Any type that conforms to
ShapeStyle. - An
Image. - What you've already drawn into the context.
- A collection of other shading instances.
From Apple’s SwiftUI documentation. Code samples there are Swift.
See also
More in Drawing and shapes.
- AngleA geometric angle whose value you access in either radians or degrees.
- AngularGradientAn angular gradient.
- AnyGradientA color gradient.
- BlendModeModes for compositing a view with overlapping content.
- ButtonBorderShapeA shape used to draw a button's border.
- ColorMatrixA matrix to use in an RGBA color transformation.
- ConcentricRectangleAnimatableDataThe type defining the data to animate.
- ContainerRelativeShapeA shape that is replaced by an inset version of the current container shape. If no container shape was defined, is replaced by a rectangle.
- ContentShapeKindsA kind for the content shape of a view.
- CoordinateSpaceProtocolA frame of reference within the layout system.
- DefaultGlassEffectShapeThe default shape applied by glass effects, a capsule.
- EllipticalGradientA radial gradient that draws an ellipse.