- Qt 6.7
- Qt GUI
- C++ Classes
- PixmapFragment
- Qt 6.7.1 Reference Documentation

# PixmapFragment Class

class QPainter::PixmapFragment

This class is used in conjunction with the QPainter::drawPixmapFragments() function to specify how a pixmap, or sub-rect of a pixmap, is drawn. More...

- List of all members, including inherited members

## Public Variables

qreal | height
qreal | opacity
qreal | rotation
qreal | scaleX
qreal | scaleY
qreal | sourceLeft
qreal | sourceTop
qreal | width
qreal | x
qreal | y

## Static Public Members

QPainter::PixmapFragment | create(const QPointF &pos, const QRectF &sourceRect, qreal scaleX = 1, qreal scaleY = 1, qreal rotation = 0, qreal opacity = 1)

## Detailed Description

The sourceLeft, sourceTop, width and height variables are used as a source rectangle within the pixmap passed into the QPainter::drawPixmapFragments() function. The variables x, y, width and height are used to calculate the target rectangle that is drawn. x and y denotes the center of the target rectangle. The width and height in the target rectangle is scaled by the scaleX and scaleY values. The resulting target rectangle is then rotated rotation degrees around the x, y center point.

See also QPainter::drawPixmapFragments().

## Member Function Documentation

### `[static]` QPainter::PixmapFragment PixmapFragment::create(const QPointF &pos, const QRectF &sourceRect, qreal scaleX = 1, qreal scaleY = 1, qreal rotation = 0, qreal opacity = 1)

This is a convenience function that returns a QPainter::PixmapFragment that is initialized with the pos, sourceRect, scaleX, scaleY, rotation, opacity parameters.

## Member Variable Documentation

### qreal PixmapFragment::height

This variable holds the height of the source rectangle and is used to calculate the height of the target rectangle.

### qreal PixmapFragment::opacity

This variable holds the opacity of the target rectangle, where 0.0 is fully transparent and 1.0 is fully opaque.

### qreal PixmapFragment::rotation

This variable holds the rotation of the target rectangle in degrees. The target rectangle is rotated after it has been scaled.

### qreal PixmapFragment::scaleX

This variable holds the horizontal scale of the target rectangle.

### qreal PixmapFragment::scaleY

This variable holds the vertical scale of the target rectangle.

### qreal PixmapFragment::sourceLeft

This variable holds the left coordinate of the source rectangle.

### qreal PixmapFragment::sourceTop

This variable holds the top coordinate of the source rectangle.

### qreal PixmapFragment::width

This variable holds the width of the source rectangle and is used to calculate the width of the target rectangle.

### qreal PixmapFragment::x

This variable holds the x coordinate of center point in the target rectangle.

### qreal PixmapFragment::y

This variable holds the y coordinate of the center point in the target rectangle.