- Qt 6.12
- Qt Canvas Painter
- QtCanvas2D
- imagepattern2d
- Qt Canvas Painter | Commercial or GPLv3

# imagepattern2d QML Value Type

Provides imagepattern2d type matching to QCanvasImagePattern. More...

Import Statement: | `import QtCanvas2D`
Since: | Qt 6.12
Status: | Technology preview

This type is in technology preview and is subject to change.

## Methods

- size imageSize()
- real rotation()
- void setImageSize(real width, real height)
- void setImageSize(size imageSize)
- void setRotation(real rotation)
- void setStartPosition(real x, real y)
- void setStartPosition(point start)
- void setTintColor(color tintColor)
- point startPosition()
- color tintColor()

## Detailed Description

This value type is provided by the QtCanvas2D import.

See also QCanvasImagePattern.

## Method Documentation

### size imageSize()

Returns the size of a single image in pattern.

See also setImageSize().

### real rotation()

Returns the pattern rotation in radians.

See also setRotation().

### void setImageSize(real width, real height)

Sets the size of a single image in pattern to ( width, height).

See also imageSize().

### void setImageSize(size imageSize)

Sets the size of a single image in pattern to imageSize.

This is an overloaded function.

### void setRotation(real rotation)

Sets the pattern rotation to rotation in radians. Rotation is done around the image startPosition(). The default value is `0.0`, meaning the image is not rotated.

See also rotation().

### void setStartPosition(real x, real y)

Sets the start point of image pattern to (x, y). Start position means top-left corner of an image in pattern. Pattern will then be extended to all positions from here (if image `Repeat` flag has been set).

See also startPosition().

### void setStartPosition(point start)

Sets the start point of image pattern to start. Start position means top-left corner of an image in pattern. Pattern will then be extended to all positions from here (if image `Repeat` flag has been set).

This is an overloaded function.

### void setTintColor(color tintColor)

Sets the pattern tint color to tintColor. The color of the pattern image will be multiplied with this tint color in the shader. The default value is white, meaning no tinting.

Note: To set alpha globally, use QCanvasPainter::setGlobalAlpha()

See also tintColor().

### point startPosition()

Returns the start point of image pattern.

See also setStartPosition().

### color tintColor()

Returns the pattern tint color.

See also setTintColor().