|  | Home · All Classes · Modules

# QPainter.PixmapFragment Class Reference
[QtGui module]

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...

### Methods

- __init__ (self)
- __init__ (self, PixmapFragment)

### Static Methods

- PixmapFragment create (QPointF pos, QRectF sourceRect, float scaleX = 1, float scaleY = 1, float rotation = 0, float opacity = 1)

### Members

- float height
- float opacity
- float rotation
- float scaleX
- float scaleY
- float sourceLeft
- float sourceTop
- float width
- float x
- float y

## Detailed Description

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

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 heigth 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.

## Method Documentation

### PixmapFragment.__init__ (self)

### PixmapFragment.__init__ (self, PixmapFragment)

### PixmapFragment PixmapFragment.create (QPointF pos, QRectF sourceRect, float scaleX = 1, float scaleY = 1, float rotation = 0, float opacity = 1)

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

This function was introduced in Qt 4.7.

## Member Documentation

### float height

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

### float opacity

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

### float rotation

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

### float scaleX

This variable holds the horizontal scale of the target rectangle.

### float scaleY

This variable holds the vertical scale of the target rectangle.

### float sourceLeft

This variable holds the left coordinate of the source rectangle.

### float sourceTop

This variable holds the top coordinate of the source rectangle.

### float width

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

### float x

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

### float y

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