Instance Method インスタンスメソッド

clipToLayer(opacity:options:content:)

Adds a clip shape that you define in a new layer to the context’s array of clip shapes.

Declaration 宣言

mutating func clipToLayer(opacity: Double = 1, options: GraphicsContext.ClipOptions = ClipOptions(), content: (inout GraphicsContext) throws -> Void) rethrows

Parameters パラメータ

opacity

A value that SwiftUI uses to multiply the alpha channel of the rasterized layer that you define in the content closure. The alpha values that result define the clip shape.

options

A set of options that tell SwiftUI how to interpret the clip shape. For example, you can invert the clip shape by setting the inverse option.

content

A closure that receives as input a new GraphicsContext, which represents a new transparency layer. The alpha channel of content that you draw into this context, multiplied by the opacity parameter, defines the clip shape.

Discussion 議論

Call this method to add a shape to the array of clip shapes that the context uses to define a clipping mask. Shapes that you add affect only subsequent drawing operations.

See Also 参照

Masking