#include <lcdpaintengine.h>
Collaboration diagram for LCDPaintEngine:
Public Member Functions | |
bool | begin (QPaintDevice *) |
void | drawEllipse (const QRectF &) |
void | drawEllipse (const QRect &) |
void | drawImage (const QRectF &, const QImage &, const QRectF &, Qt::ImageConversionFlags flags=Qt::AutoColor) |
void | drawLines (const QLineF *, int) |
void | drawLines (const QLine *, int) |
void | drawPath (const QPainterPath &) |
void | drawPixmap (const QRectF &, const QPixmap &, const QRectF &) |
void | drawPoints (const QPointF *, int) |
void | drawPoints (const QPoint *, int) |
void | drawPolygon (const QPointF *, int, QPaintEngine::PolygonDrawMode) |
void | drawPolygon (const QPoint *, int, QPaintEngine::PolygonDrawMode) |
void | drawRects (const QRectF *, int) |
void | drawRects (const QRect *, int) |
void | drawTextItem (const QPointF &, const QTextItem &) |
void | drawTiledPixmap (const QRectF &, const QPixmap &, const QPointF) |
bool | end () |
bool | hasFeature (PaintEngineFeatures) const |
QPaintEngine::Type | type () const |
void | updateState (const QPaintEngineState &) |
Private Attributes | |
ControllerInterface * | m_controller |
QMatrix | m_matrix |
QBrush | m_brush |
QPen | m_pen |
It has access to a LCD device via a controller that previously loaded and initialized by the ControllerLoader class.
bool LCDPaintEngine::begin | ( | QPaintDevice * | device | ) |
Set the controller for the paint engine the controller must be valid loaded and initialized.
AccessFailureException | is thrown when the device is not a LCDPaintDevice |
device | must be a LCDPaintDevice when we wan't to draw on a LCD and we wan't so it's required ;) |
void LCDPaintEngine::drawEllipse | ( | const QRect & | rect | ) |
It use the very fast Bresenham Ellipse Algorithm to draw an ellipse on a device. This algorithm don't use the CPU intensive sin or cos functions it calculates only with full integer values so this is very fast.
rect | is the bounding rectangle of the ellipse, it adjusts exact into this rectangle |
void LCDPaintEngine::drawEllipse | ( | const QRectF & | rect | ) |
This is an overloaded member function, provided for convenience.
rect | is converted into QRect |
void LCDPaintEngine::drawImage | ( | const QRectF & | r, | |
const QImage & | image, | |||
const QRectF & | sr, | |||
Qt::ImageConversionFlags | flags = Qt::AutoColor | |||
) |
Draw the part of the image specified by the sr rectangle in the given rectangle. Then the method convert the QImage into a QPixmap with the given conversion flags after that it will call the drawPixmap() method to draw it finally on a device.
r | rectangle | |
image | is converted into QPixmap | |
sr | source rectangle | |
flags | conversion flags |
void LCDPaintEngine::drawLines | ( | const QLine * | lines, | |
int | lineCount | |||
) |
It use the very fast Bresenham Algorithm to draw the lines on a device. The algorithm uses only integer addition and subtraction all of which are very cheap operations in standard computer architectures.
lines | is an array of lines | |
lineCount | count of lines in the array |
void LCDPaintEngine::drawLines | ( | const QLineF * | lines, | |
int | lineCount | |||
) |
This is an overloaded member function, provided for convenience.
lines | is converted into QLine | |
lineCount | count of lines in the array |
void LCDPaintEngine::drawPath | ( | const QPainterPath & | path | ) |
fallback mechanism for other drawing methods useful to draw objects that has filled brushes or thicker pens.
path | will be drawn on a device |
void LCDPaintEngine::drawPixmap | ( | const QRectF & | r, | |
const QPixmap & | pixmap, | |||
const QRectF & | _sr | |||
) |
Draw the part of the pixmap specified by the sr rectangle in the given r on a device. If the pixmap has an alpha channel then it will extracts the alpha channel from this image as an 8 bit gray scale image. You can draw colored or greyscaled images but then every rgb pixel will be converted into a grey value pixel. The value of the pixel determines if a pixel will be set (value >= 125) or not (value < 125). To increase the quality of the image you can dither it before you call this method. For a good quality you can use the Floyd Steinberg dithering algorithm.
r | rectangle gives the position and the size of the pixmap | |
pixmap | will be drawn on a device | |
_sr | source rectangle |
void LCDPaintEngine::drawPoints | ( | const QPoint * | points, | |
int | pointCount | |||
) |
Draws all points in the array on a device.
points | is an array of points | |
pointCount | count of points in the array |
void LCDPaintEngine::drawPoints | ( | const QPointF * | points, | |
int | pointCount | |||
) |
This is an overloaded member function, provided for convenience.
points | is converted into QPoint* | |
pointCount | count of points in the array |
void LCDPaintEngine::drawPolygon | ( | const QPoint * | points, | |
int | pointCount, | |||
QPaintEngine::PolygonDrawMode | mode | |||
) |
Draws a polygon on a device. The points describes a polygon; every point is with a line connected to the next point; the last point is connected with the start point.
points | is an array of points | |
pointCount | count of points in the array | |
mode | is not used |
void LCDPaintEngine::drawPolygon | ( | const QPointF * | points, | |
int | polyCount, | |||
QPaintEngine::PolygonDrawMode | mode | |||
) |
This is an overloaded member function, provided for convenience.
points | is converted into QPoint* | |
polyCount | count of points in the array | |
mode | is not used |
void LCDPaintEngine::drawRects | ( | const QRect * | rects, | |
int | rectCount | |||
) |
Draws a rectangle on a device.
rects | is an array of rectangles | |
rectCount | count of rectangles in the array |
void LCDPaintEngine::drawRects | ( | const QRectF * | rects, | |
int | rectCount | |||
) |
This is an overloaded member function, provided for convenience.
rects | is converted into QRectangle* | |
rectCount | count of rectangles in the array |
void LCDPaintEngine::drawTextItem | ( | const QPointF & | p, | |
const QTextItem & | textItem | |||
) |
Draws a text on a device. Every text with every font that is installed on the system can be drawn. The functionality of this method is that the text (with its font size, width and style) is put into an image. With this trick text can be drawn like a normal image.
p | contains the xy coordinate where the text will be displayed. | |
textItem | is the text item with the text ;) |
void LCDPaintEngine::drawTiledPixmap | ( | const QRectF & | , | |
const QPixmap & | , | |||
const | QPointF | |||
) |
Currently this is not implemented because this method is not needed. Send me mail when you need this method.
UnsupportedException |
bool LCDPaintEngine::end | ( | ) |
Draws the content in the buffer on the device.
bool LCDPaintEngine::hasFeature | ( | PaintEngineFeatures | feature | ) | const |
feature | which you inspect |
QPaintEngine::Type LCDPaintEngine::type | ( | ) | const |
Tell that our paint engine is a custom made engine
void LCDPaintEngine::updateState | ( | const QPaintEngineState & | state | ) |
Only the transform state will be checked and set.
state | which state is currently updated |
QBrush LCDPaintEngine::m_brush [private] |
ControllerInterface* LCDPaintEngine::m_controller [private] |
Active controller to access the device
QMatrix LCDPaintEngine::m_matrix [private] |
Hold the transform status of an item (e.g. when you move an item around the matrix is changed)
QPen LCDPaintEngine::m_pen [private] |