Home · All Classes · Main Classes · Deprecated |
MScalableImage is a class for drawing scaled pixmaps into screen without breaking the boundaries of the image. More...
Inherits QObject.
Public Member Functions | |
MScalableImage () | |
MScalableImage (const QPixmap *pixmap, int left, int right, int top, int bottom, const QString &pixmapId="") | |
virtual | ~MScalableImage () |
void | borders (int *left, int *right, int *top, int *bottom) const |
void | setBorders (int left, int right, int top, int bottom) |
const QTileRules & | tileRules () const |
void | setTileRules (const QTileRules &tileRules) |
void | setPixmap (const QPixmap *pixmap) |
const QPixmap * | pixmap () const |
void | draw (int x, int y, int w, int h, QPainter *painter) const |
void | draw (const QPoint &pos, const QSize &size, QPainter *painter) const |
void | draw (const QRect &rect, QPainter *painter) const |
void | draw (qreal x, qreal y, qreal w, qreal h, QPainter *painter) const |
void | draw (const QPointF &pos, const QSizeF &size, QPainter *painter) const |
void | draw (const QRectF &rect, QPainter *painter) const |
void | enableOptimizedRendering (bool enable) |
void | draw (const QRect &rect, const QPoint &pixmapOffset, const QPixmap *pixmap, QPainter *painter) const |
Protected Member Functions | |
MScalableImage (MScalableImagePrivate *dd) | |
Protected Attributes | |
MScalableImagePrivate *const | d_ptr |
MScalableImage is a class for drawing scaled pixmaps into screen without breaking the boundaries of the image.
The image is constructed from 9 blocks and it is scalable in every direction.
<corner> <h_edge> <corner> <v_edge> <center> <v_edge> <corner> <h_edge> <corner>
The scalable area of the image is defined using the left, right, top and bottom border parameters. The borders are defined as pixels and they cannot be larger than the used source pixmap.
The corner blocks are not scaled at all. The horizontal edges (h_edge) are scaled only horizontally and the vertical edges (v_edge) only vertically. The center block is scaled vertically and horizontally if needed. The size inputted into one the draw() methods cannot be smaller than the defined borders.
MScalableImage::MScalableImage | ( | ) |
Default constructor. Initiates pixmap and borders to 0.
MScalableImage::MScalableImage | ( | const QPixmap * | pixmap, | |
int | left, | |||
int | right, | |||
int | top, | |||
int | bottom, | |||
const QString & | pixmapId = "" | |||
) |
Constructor. Initiates pixmap and borders to inputted values.
pixmapId | - optional pixmapId associated with a scalable image which will be included into warnings if MScalableImage happen to find those |
MScalableImage::~MScalableImage | ( | ) | [virtual] |
Destructor.
MScalableImage::MScalableImage | ( | MScalableImagePrivate * | dd | ) | [protected] |
void MScalableImage::borders | ( | int * | left, | |
int * | right, | |||
int * | top, | |||
int * | bottom | |||
) | const |
Get borders for the image.
The borders are defined as pixels. See createScalable() for description about how the borders affect to the image drawing/scaling.
Draws scalable image.This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Draws scalable image.This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void MScalableImage::draw | ( | qreal | x, | |
qreal | y, | |||
qreal | w, | |||
qreal | h, | |||
QPainter * | painter | |||
) | const |
Draws scalable image.This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Draws scalable image.This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void MScalableImage::draw | ( | int | x, | |
int | y, | |||
int | w, | |||
int | h, | |||
QPainter * | painter | |||
) | const |
Draws scalable image.
The image is drawn starting from the topleft corner defined by the x and y coordinates. The image is scaled to fit the w and h. Scaling follows the rules defined in the createScalable() method.
If -1 is defined as w or h appropriate value from the image is used so no scaling takes place.
Draws scalable image.This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void MScalableImage::draw | ( | const QRect & | rect, | |
const QPoint & | pixmapOffset, | |||
const QPixmap * | pixmap, | |||
QPainter * | painter | |||
) | const |
Draws the scalable image using color channel from pixmap and alpha channel from scalable image.
rect | Target rectangle, where scalable image is drawn into. | |
pixmapOffset | Start sampling offset of the pixmap to be filled. | |
pixmap | Pixmap to be used for filling the opaque areas of the scalable image, this can be NULL. | |
painter | Painter to be used for drawing. |
void MScalableImage::enableOptimizedRendering | ( | bool | enable | ) |
Enable/disable optimized rendering.
If enable is true, the image patches are packed into one vertex array and it is rendered with one glDrawArray call. If enable is false, the image patches are rendered separately.
const QPixmap * MScalableImage::pixmap | ( | ) | const |
Returns the pixmap that was given as parameter into the createScalable() or setPixmap() methods.
void MScalableImage::setBorders | ( | int | left, | |
int | right, | |||
int | top, | |||
int | bottom | |||
) |
Set borders for the image.
The borders are defined as pixels. See createScalable() for description about how the borders affect to the image drawing/scaling.
void MScalableImage::setPixmap | ( | const QPixmap * | pixmap | ) |
Set/change the drawn pixmap.
The ownership of pixmap is not changed by this method, the caller of the method is still responsible for releasing the pixmap after done using it.
void MScalableImage::setTileRules | ( | const QTileRules & | tileRules | ) |
Set tiling rulest for the image.
By default, the horizontal and vertical tile rules are set to Qt::StretchTile. See QTileRules documentation for more details.
const QTileRules & MScalableImage::tileRules | ( | ) | const |
Get tiling rules of the image.
MScalableImagePrivate* const MScalableImage::d_ptr [protected] |
Copyright © 2010 Nokia Corporation | MeeGo Touch |