跳转至
Structure

FillStyle

A struct style for rasterizing vector shapes.

Declaration

@frozen struct FillStyle : Equatable

Overview

FillStyle determines the even-odd fill mode and antialiased mode on the style. When initializing a new FillStyle, eoFill is set to false by default and antialiased is set to true by default.

The even-odd rule fills a path depending on what is overlapping in the path. For example, a path with no overlaps will be fully filled but a path with an overlap will not have the overlapping part filled. See isEOFilled for an example. Anti-aliased smooths pixels on jagged edges by averaging the colors of the pixels at the boundary.

For example, to create a view with a circle shape and fill style:

struct ExampleView: View {
    var body: some View {
        Circle()
            .fill(Color.pink, style: FillStyle(eoFill: true))
    }
}
A view containinf a circle with pink fill with eoFill set to true, causing the use of the even-odd rule in the rendering of the shape.

Availability

iOS 13.0+

macOS 10.15+

tvOS 13.0+

watchOS 6.0+

Topics


Instance Property

isAntialiased A Boolean value that indicates whether to apply antialiasing the edges of a shape.

isEOFilled A Boolean value that indicates whether to use the even-odd rule when rendering a shape.


Initializer

init(eoFill:antialiased:) Creates a new fill style with the specified settings.


Type Method

==(a:b:) Returns a Boolean value indicating whether two values are equal.