49 #include <private/qtextengine_p.h> 51 #include <private/qfontengine_p.h> 52 #include <private/qpaintengineex_p.h> 362 Q_ASSERT_X(qt_polygon_recursion !=
this,
"QPaintEngine::drawPolygon",
363 "At least one drawPolygon function must be implemented");
364 qt_polygon_recursion =
this;
367 for (
int i = 0; i < pointCount; ++i) {
368 p[i].x =
qRound(points[i].x());
369 p[i].y =
qRound(points[i].y());
371 drawPolygon((
QPoint *)p.
data(), pointCount, mode);
372 qt_polygon_recursion = 0;
392 Q_ASSERT_X(qt_polygon_recursion !=
this,
"QPaintEngine::drawPolygon",
393 "At least one drawPolygon function must be implemented");
394 qt_polygon_recursion =
this;
397 for (
int i=0; i<pointCount; ++i) {
398 p[i].x = points[i].
x();
399 p[i].y = points[i].
y();
401 drawPolygon((
QPointF *)p.
data(), pointCount, mode);
402 qt_polygon_recursion = 0;
502 for (
int i=0; i<pointCount; ++i) {
504 QRectF rect(pos.
x() - penWidth / 2, pos.
y() - penWidth / 2, penWidth, penWidth);
529 while (i < pointCount && i < 256) {
530 fp[i].
x = points[i].
x();
531 fp[i].
y = points[i].
y();
559 drawPolygon(polygon.
data(), polygon.
size(), ConvexMode);
569 drawEllipse(
QRectF(rect));
588 int x = pixmap.
width();
589 while (x < tile->
width()) {
594 while (y < tile->height()) {
603 qreal yPos, xPos, drawH, drawW, yOff, xOff;
606 while(yPos < y + h) {
607 drawH = pixmap.
height() - yOff;
608 if (yPos + drawH > y + h)
609 drawH = y + h - yPos;
612 while(xPos < x + w) {
613 drawW = pixmap.
width() - xOff;
614 if (xPos + drawW > x + w)
615 drawW = x + w - xPos;
616 if (drawW > 0 && drawH > 0)
634 int sw = pixmap.
width();
637 if (sw*sh < 8192 && sw*sh < 16*rect.
width()*rect.
height()) {
638 int tw = sw, th = sh;
639 while (tw*th < 32678 && tw < rect.
width()/2)
641 while (tw*th < 32678 && th < rect.
height()/2)
644 if (pixmap.
depth() == 1) {
671 Qt::ImageConversionFlags flags)
806 qWarning(
"QPaintEngine::drawPath: Must be implemented when feature PainterPaths is set");
844 for (
int i=0; i<lineCount; ++i) {
847 if (pts[0] == pts[1]) {
882 while (i < lineCount && i < 256) {
883 fl[i].p1.x = lines[i].
x1();
884 fl[i].p1.y = lines[i].
y1();
885 fl[i].p2.x = lines[i].
x2();
886 fl[i].p2.y = lines[i].
y2();
918 while (i < rectCount && i < 256) {
919 fr[i].x = rects[i].
x();
920 fr[i].y = rects[i].
y();
921 fr[i].w = rects[i].
width();
922 fr[i].h = rects[i].
height();
941 for (
int i=0; i<rectCount; ++i) {
949 for (
int i=0; i<rectCount; ++i) {
966 d_func()->pdev = device;
975 return d_func()->pdev;
1041 d->systemClip = region;
1044 if (
d->hasSystemTransform ||
d->hasSystemViewport) {
1045 d->transformSystemClip();
1046 d->systemStateChanged();
1063 return d_func()->systemClip;
1078 qWarning(
"QPaintEngine::setSystemRect: Should not be changed while engine is active");
1081 d_func()->systemRect = rect;
1095 return d_func()->systemRect;
1109 if (glyphs.
size() == 0)
1112 QSize s(size - 3, size - 3);
1120 for (
int k = 0; k < positions.size(); k++)
void setTransform(const QTransform &transform, bool combine=false)
Sets the world transformation matrix.
The QPainter class performs low-level painting on widgets and other paint devices.
virtual QFixed lineThickness() const
bool isEmpty() const
Returns true if either there are no elements in this path, or if the only element is a MoveToElement;...
static QPixmap fromImage(const QImage &image, Qt::ImageConversionFlags flags=Qt::AutoColor)
Converts the given image to a pixmap using the specified flags to control the conversion.
qreal y() const
Returns the y-coordinate of the rectangle's top edge.
QImage copy(const QRect &rect=QRect()) const
Returns a sub-area of the image as a new image.
const QTransform & transform() const
Returns the world transformation matrix.
#define QT_END_NAMESPACE
This macro expands to.
int width() const
Returns the width of the pixmap.
QPaintDevice * paintDevice() const
Returns the device that this engine is painting on, if painting is active; otherwise returns 0...
QSize size() const
Returns the size of the pixmap.
void syncState()
Updates all dirty states in this engine.
The QLine class provides a two-dimensional vector using integer precision.
bool brushNeedsResolving() const
Returns whether the coordinate of the fill have been specified as bounded by the current rendering op...
virtual void drawPath(const QPainterPath &path)
The default implementation ignores the path and does nothing.
QPaintEngine(PaintEngineFeatures features=0)
Creates a paint engine with the featureset specified by caps.
PaintEngineFeatures gccaps
The QPainterPath class provides a container for painting operations, enabling graphical shapes to be ...
QPaintEngineState * state
virtual void drawRects(const QRect *rects, int rectCount)
The default implementation converts the first rectCount rectangles in the buffer rects to a QRectF an...
QPointF p1() const
Returns the line's start point.
virtual void addOutlineToPath(qreal, qreal, const QGlyphLayout &, QPainterPath *, QTextItem::RenderFlags flags)
virtual void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr)=0
Reimplement this function to draw the part of the pm specified by the sr rectangle in the given r...
void qt_draw_tile(QPaintEngine *gc, qreal x, qreal y, qreal w, qreal h, const QPixmap &pixmap, qreal xOffset, qreal yOffset)
The QPointF class defines a point in the plane using floating point precision.
void restore()
Restores the current painter state (pops a saved state off the stack).
int width() const
Returns the width of the rectangle.
virtual void drawPoints(const QPointF *points, int pointCount)
Draws the first pointCount points in the buffer points.
bool isExtended() const
Returns true if the paint engine is a QPaintEngineEx derivative.
int depth() const
Returns the depth of the pixmap.
int height() const
Returns the height of the rectangle.
The QString class provides a Unicode character string.
QString text() const
Returns the text that should be drawn.
bool penNeedsResolving() const
Returns whether the coordinate of the stroke have been specified as bounded by the current rendering ...
The QPen class defines how a QPainter should draw lines and outlines of shapes.
int y1() const
Returns the y-coordinate of the line's start point.
void save()
Saves the current painter state (pushes the state onto a stack).
qreal x() const
Returns the x-coordinate of this point.
static QFont font()
Returns the default application font.
The QLineF class provides a two-dimensional vector using floating point precision.
void setFillRule(Qt::FillRule fillRule)
Sets the fill rule of the painter path to the given fillRule.
QRect systemRect() const
Retrieves the rect for drawing within the backing store.
The QBitmap class provides monochrome (1-bit depth) pixmaps.
virtual HDC getDC() const
Empty default implementation.
void setRenderHint(RenderHint hint, bool on=true)
Sets the given render hint on the painter if on is true; otherwise clears the render hint...
QPainter * painter() const
Returns the paint engine's painter.
const QPen & pen() const
Returns the painter's current pen.
#define QT_BEGIN_NAMESPACE
This macro expands to.
void drawEllipse(const QRectF &r)
Draws the ellipse defined by the given rectangle.
bool isActive() const
Returns true if the paint engine is actively drawing; otherwise returns false.
The QRectF class defines a rectangle in the plane using floating point precision. ...
QPolygonF toFillPolygon(const QMatrix &matrix=QMatrix()) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
void fillPath(const QPainterPath &path, const QBrush &brush)
Fills the given path using the given brush.
bool isCosmetic() const
Returns true if the pen is cosmetic; otherwise returns false.
static const QCssKnownValue positions[NumKnownPositionModes - 1]
qreal height() const
Returns the height of the rectangle.
virtual QFixed ascent() const =0
The QPolygonF class provides a vector of points using floating point precision.
void getGlyphPositions(const QGlyphLayout &glyphs, const QTransform &matrix, QTextItem::RenderFlags flags, QVarLengthArray< glyph_t > &glyphs_out, QVarLengthArray< QFixedPoint > &positions)
Q_CORE_EXPORT void qWarning(const char *,...)
qreal ascent() const
Corresponds to the ascent of the piece of text that is drawn.
The QImage class provides a hardware-independent image representation that allows direct access to th...
int x2() const
Returns the x-coordinate of the line's end point.
void addRect(const QRectF &rect)
Adds the given rectangle to this path as a closed subpath.
qreal width() const
Returns the width of the rectangle.
RenderFlags renderFlags() const
Returns the render flags used.
virtual void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode)
Reimplement this virtual function to draw the polygon defined by the pointCount first points in point...
The QRegion class specifies a clip region for a painter.
QBrush brush() const
Returns the brush used to fill strokes generated with this pen.
virtual void releaseDC(HDC hdc) const
Empty default implementation.
qreal descent() const
Corresponds to the descent of the piece of text that is drawn.
The QPaintEngine class provides an abstract definition of how QPainter draws to a given device on a g...
void updateState(const QPaintEngineState &state)
Reimplement this function to update the state of a paint engine.
void setSystemClip(const QRegion &baseClip)
Sets the system clip for this engine.
virtual void drawLines(const QLine *lines, int lineCount)
The default implementation converts the first lineCount lines in lines to a QLineF and calls the floa...
qreal width() const
Specifies the total width of the text to be drawn.
QPainter * painter() const
Returns a pointer to the painter currently updating the paint engine.
void fill(const QColor &fillColor=Qt::white)
Fills the pixmap with the given color.
#define Q_ASSERT_X(cond, where, what)
int width() const
Returns the width of the image.
QScopedPointer< QPaintEnginePrivate > d_ptr
virtual void drawEllipse(const QRectF &r)
Reimplement this function to draw the largest ellipse that can be contained within rectangle rect...
The QFont class specifies a font used for drawing text.
int y() const
Returns the y-coordinate of the rectangle's top edge.
qreal x() const
Returns the x-coordinate of the rectangle's left edge.
virtual void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr, Qt::ImageConversionFlags flags=Qt::AutoColor)
Reimplement this function to draw the part of the image specified by the sr rectangle in the given re...
void setWidthF(qreal width)
Sets the pen width to the given width in pixels with floating point precision.
int x() const
Returns the x-coordinate of the rectangle's left edge.
The QPoint class defines a point in the plane using integer precision.
void setBrush(const QBrush &brush)
Sets the painter's brush to the given brush.
void setPen(const QColor &color)
Sets the painter's pen to have style Qt::SolidLine, width 0 and the specified color.
QPointF p2() const
Returns the line's end point.
qreal widthF() const
Returns the pen width with floating point precision.
The QRect class defines a rectangle in the plane using integer precision.
void setSystemRect(const QRect &rect)
Sets the target rect for drawing within the backing store.
int height() const
Returns the height of the image.
virtual ~QPaintEngine()
Destroys the paint engine.
void drawRect(const QRectF &rect)
Draws the current rectangle with the current pen and brush.
int y() const
Returns the y coordinate of this point.
static void drawPoints(const T *points, int n, const QTransform &transform, IDirectFBSurface *surface)
qreal y() const
Returns the y-coordinate of this point.
The QPixmap class is an off-screen image representation that can be used as a paint device...
void drawPixmap(const QRectF &targetRect, const QPixmap &pixmap, const QRectF &sourceRect)
Draws the rectangular portion source of the given pixmap into the given target in the paint device...
int height() const
Returns the height of the pixmap.
The QSize class defines the size of a two-dimensional object using integer point precision.
T * data()
Returns a pointer to the data stored in the vector.
static QPaintEngine * qt_polygon_recursion
int y2() const
Returns the y-coordinate of the line's end point.
int x() const
Returns the x coordinate of this point.
QPen pen() const
Returns the pen in the current paint engine state.
The QTextItem class provides all the information required to draw text in a custom paint engine...
Qt::PenCapStyle capStyle() const
Returns the pen's cap style.
void drawBoxTextItem(const QPointF &p, const QTextItemInt &ti)
void qt_fill_tile(QPixmap *tile, const QPixmap &pixmap)
bool hasAlphaChannel() const
Returns true if the pixmap has a format that respects the alpha channel, otherwise returns false...
int x1() const
Returns the x-coordinate of the line's start point.
virtual QPoint coordinateOffset() const
Returns the offset from the painters origo to the engines origo.
void setPaintDevice(QPaintDevice *device)
QRegion systemClip() const
Returns the system clip.
int size() const
Returns the number of items in the vector.
QFont font() const
Returns the font that should be used to draw the text.
virtual void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s)
Reimplement this function to draw the pixmap in the given rect, starting at the given p...
Q_DECL_CONSTEXPR int qRound(qreal d)
void addEllipse(const QRectF &rect)
Creates an ellipse within the specified boundingRectangle and adds it to the painter path as a closed...
bool hasFeature(PaintEngineFeatures feature) const
Returns true if the paint engine supports the specified feature; otherwise returns false...
void translate(const QPointF &offset)
Translates the coordinate system by the given offset; i.e.
virtual void drawTextItem(const QPointF &p, const QTextItem &textItem)
This function draws the text item textItem at position p.