跳转至
Structure

ImagePaint

A shape style that fills a shape by repeating a region of an image.

Declaration

@frozen struct ImagePaint : ShapeStyle

Overview

Use this shape style to tile images as strokes or fills.

See ShapeStyle for more info on how and where to use shape styles.

struct DogsEverywhereView: View {
    var body: some View {
        Rectangle()
            .fill(ImagePaint(image: Image("dog")))
    }
}

Availability

iOS 13.0+

macOS 10.15+

tvOS 13.0+

watchOS 6.0+

Topics


Instance Property

image The image to be drawn.

scale A scale factor applied to the image while being drawn.

sourceRect A unit-space rectangle defining how much of the source image to draw.


Initializer

init(image:sourceRect:scale:) Creates a shape-filling shape style from a source image.