LCDPaintEngine Class Reference

The LCDPaintEngine class provides primitives methods to draw on a LCD. More...

#include <lcdpaintengine.h>

Collaboration diagram for LCDPaintEngine:

Collaboration graph
[legend]
List of all members.

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

ControllerInterfacem_controller
QMatrix m_matrix
QBrush m_brush
QPen m_pen

Detailed Description

This class is the backend for LCDPaintDevice so that you can use QPainter or QPainterPath native.

It has access to a LCD device via a controller that previously loaded and initialized by the ControllerLoader class.

See also:
LCDPaintDevice, ControllerInterface and ControllerLoader


Member Function Documentation

bool LCDPaintEngine::begin ( QPaintDevice *  device  ) 

Set the controller for the paint engine the controller must be valid loaded and initialized.

Exceptions:
AccessFailureException is thrown when the device is not a LCDPaintDevice
Parameters:
device must be a LCDPaintDevice when we wan't to draw on a LCD and we wan't so it's required ;)
Returns:
true on success, otherwise false

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.

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

See also:
drawEllipse(const QRect&)
Parameters:
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.

Parameters:
r rectangle
image is converted into QPixmap
sr source rectangle
flags conversion flags
See also:
drawPixmap()

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.

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

Parameters:
lines is converted into QLine
lineCount count of lines in the array
See also:
drawLines(const QLine*, int)

void LCDPaintEngine::drawPath ( const QPainterPath &  path  ) 

fallback mechanism for other drawing methods useful to draw objects that has filled brushes or thicker pens.

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

Note:
Dithering will be automaticly done when you are using the GraphicPixmap class.
Parameters:
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.

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

Parameters:
points is converted into QPoint*
pointCount count of points in the array
See also:
drawPoint(const QPoint*, int)

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.

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

Parameters:
points is converted into QPoint*
polyCount count of points in the array
mode is not used
See also:
drawPolygon(const QPoint*, int, QPaintEngine::PolygonDrawMode)

void LCDPaintEngine::drawRects ( const QRect *  rects,
int  rectCount 
)

Draws a rectangle on a device.

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

Parameters:
rects is converted into QRectangle*
rectCount count of rectangles in the array
See also:
drawRects(const QRect*, int)

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.

Parameters:
p contains the xy coordinate where the text will be displayed.
textItem is the text item with the text ;)
Bug:
rotates the text more than 90 degrees clockwise then the position of the text is incorrect.

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.

Exceptions:
UnsupportedException 

bool LCDPaintEngine::end (  ) 

Draws the content in the buffer on the device.

Returns:
true on success, otherwise false

bool LCDPaintEngine::hasFeature ( PaintEngineFeatures  feature  )  const

Parameters:
feature which you inspect
Returns:
true if the paint engine has the feature otherwise false

QPaintEngine::Type LCDPaintEngine::type (  )  const

Tell that our paint engine is a custom made engine

Returns:
QPaintEngine::User

void LCDPaintEngine::updateState ( const QPaintEngineState &  state  ) 

Only the transform state will be checked and set.

Parameters:
state which state is currently updated


Member Data Documentation

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]


The documentation for this class was generated from the following files:
Generated on Thu Apr 5 13:12:52 2007 for LCDBuilder by  doxygen 1.4.7