12#include <qpa/qplatformintegration.h>
13#include <qpa/qplatformpixmap.h>
14#include <private/qfontengine_p.h>
15#include <private/qguiapplication_p.h>
16#include <private/qpaintengineex_p.h>
17#include <private/qtextengine_p.h>
296 "At least one drawPolygon function must be implemented");
300 for (
int i = 0;
i < pointCount; ++
i) {
325 "At least one drawPolygon function must be implemented");
329 for (
int i=0;
i<pointCount; ++
i) {
408 qreal penWidth =
p->pen().widthF();
417 if (
p->pen().isCosmetic()) {
422 p->setBrush(
p->pen().brush());
425 for (
int i=0;
i<pointCount; ++
i) {
427 QRectF rect(
pos.x() - penWidth / 2,
pos.y() - penWidth / 2, penWidth, penWidth);
430 p->drawEllipse(
rect);
452 while (
i < pointCount &&
i < 256) {
506 while (x < tile->
width()) {
507 p.drawPixmap(
x, 0, *tile, 0, 0,
x,
pixmap.height());
511 while (y < tile->
height()) {
512 p.drawPixmap(0,
y, *tile, 0, 0, tile->
width(),
y);
520 qreal yPos, xPos, drawH, drawW, yOff, xOff;
523 while(yPos <
y +
h) {
524 drawH =
pixmap.height() - yOff;
525 if (yPos + drawH >
y +
h)
526 drawH =
y +
h - yPos;
529 while(xPos <
x +
w) {
530 drawW =
pixmap.width() - xOff;
531 if (xPos + drawW >
x +
w)
532 drawW =
x +
w - xPos;
533 if (drawW > 0 && drawH > 0)
554 if (sw*sh < 8192 && sw*sh < 16*
rect.width()*
rect.height()) {
555 int tw = sw, th = sh;
556 while (tw*th < 32678 && tw <
rect.width()/2)
558 while (tw*th < 32678 && th <
rect.height()/2)
561 if (
pixmap.depth() == 1) {
565 if (
pixmap.hasAlphaChannel())
585 Qt::ImageConversionFlags
flags)
708 qWarning(
"QPaintEngine::drawPath: Must be implemented when feature PainterPaths is set");
744 if (!
path.isEmpty()) {
762 for (
int i=0;
i<lineCount; ++
i) {
765 if (pts[0] == pts[1]) {
797 while (
i < lineCount &&
i < 256) {
798 fl[
i].p1.x = lines[
i].
x1();
799 fl[
i].p1.y = lines[
i].
y1();
800 fl[
i].p2.x = lines[
i].
x2();
801 fl[
i].p2.y = lines[
i].
y2();
830 while (
i < rectCount &&
i < 256) {
831 fr[
i].x = rects[
i].
x();
832 fr[
i].y = rects[
i].
y();
853 for (
int i=0;
i<rectCount; ++
i) {
855 path.addRect(rects[
i]);
861 for (
int i=0;
i<rectCount; ++
i) {
887 return d_func()->pdev;
917 d->baseSystemClip = region;
920 d->updateSystemClip();
921 if (
d->hasSystemTransform ||
d->hasSystemViewport) {
922 d->systemStateChanged();
936 return d_func()->systemClip;
948 qWarning(
"QPaintEngine::setSystemRect: Should not be changed while engine is active");
951 d_func()->systemRect =
rect;
962 return d_func()->systemRect;
973 qWarning(
"QPaintEngine::createPixmap: QPixmap cannot be created without a QGuiApplication");
990 qWarning(
"QPaintEngine::createPixmapFromImage: QPixmap cannot be created without a QGuiApplication");
995 if (
image.isDetached())
1017 if (glyphs.
size() == 0)
1028 for (
int k = 0; k <
positions.size(); k++)
IOBluetoothDevice * device
static QCoreApplication * instance() noexcept
Returns a pointer to the application's QCoreApplication (or QGuiApplication/QApplication) instance.
virtual QImage bitmapForGlyph(glyph_t, const QFixedPoint &subPixelPosition, const QTransform &t, const QColor &color=QColor())
virtual QFixed ascent() const
virtual void addOutlineToPath(qreal, qreal, const QGlyphLayout &, QPainterPath *, QTextItem::RenderFlags flags)
void getGlyphPositions(const QGlyphLayout &glyphs, const QTransform &matrix, QTextItem::RenderFlags flags, QVarLengthArray< glyph_t > &glyphs_out, QVarLengthArray< QFixedPoint > &positions)
virtual QFixed lineThickness() const
static QPlatformIntegration * platformIntegration()
static QFont font()
Returns the default application font.
QImage copy(const QRect &rect=QRect()) const
Returns a sub-area of the image as a new image.
constexpr QPointF p1() const
Returns the line's start point.
constexpr QPointF p2() const
Returns the line's end point.
constexpr int x2() const
Returns the x-coordinate of the line's end point.
constexpr int y2() const
Returns the y-coordinate of the line's end point.
constexpr int y1() const
Returns the y-coordinate of the line's start point.
constexpr int x1() const
Returns the x-coordinate of the line's start point.
virtual ~QPaintEnginePrivate()
void drawBoxTextItem(const QPointF &p, const QTextItemInt &ti)
bool brushNeedsResolving() const
QPainter * painter() const
Returns a pointer to the painter currently updating the paint engine.
QPen pen() const
Returns the pen in the current paint engine state.
bool penNeedsResolving() const
virtual QPixmap createPixmap(QSize size)
void setSystemRect(const QRect &rect)
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.
virtual void drawRects(const QRect *rects, int rectCount)
This is an overloaded member function, provided for convenience. It differs from the above function o...
virtual QPixmap createPixmapFromImage(QImage image, Qt::ImageConversionFlags flags=Qt::AutoColor)
virtual void updateState(const QPaintEngineState &state)=0
Reimplement this function to update the state of a paint engine.
QPaintEngine(PaintEngineFeatures features=PaintEngineFeatures())
Creates a paint engine with the featureset specified by caps.
virtual void drawLines(const QLine *lines, int lineCount)
This is an overloaded member function, provided for convenience. It differs from the above function o...
virtual void drawTextItem(const QPointF &p, const QTextItem &textItem)
This function draws the text item textItem at position p.
PolygonDrawMode
\value OddEvenMode The polygon should be drawn using OddEven fill rule.
virtual void drawPoints(const QPointF *points, int pointCount)
Draws the first pointCount points in the buffer points.
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.
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...
QPainter * painter() const
Returns the paint engine's painter.
void setPaintDevice(QPaintDevice *device)
virtual QPoint coordinateOffset() const
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...
void setSystemClip(const QRegion &baseClip)
virtual ~QPaintEngine()
Destroys the paint engine.
QPaintEngineState * state
bool isActive() const
Returns true if the paint engine is actively drawing; otherwise returns false.
bool hasFeature(PaintEngineFeatures feature) const
Returns true if the paint engine supports the specified feature; otherwise returns false.
virtual void drawEllipse(const QRectF &r)
Reimplement this function to draw the largest ellipse that can be contained within rectangle rect.
QRegion systemClip() const
QPaintDevice * paintDevice() const
Returns the device that this engine is painting on, if painting is active; otherwise returns \nullptr...
virtual void drawPath(const QPainterPath &path)
The default implementation ignores the path and does nothing.
QScopedPointer< QPaintEnginePrivate > d_ptr
The QPainter class performs low-level painting on widgets and other paint devices.
const QPen & pen() const
Returns the painter's current pen.
void drawRect(const QRectF &rect)
Draws the current rectangle with the current pen and brush.
void setPen(const QColor &color)
This is an overloaded member function, provided for convenience. It differs from the above function o...
void restore()
Restores the current painter state (pops a saved state off the stack).
void save()
Saves the current painter state (pushes the state onto a stack).
void drawImage(const QRectF &targetRect, const QImage &image, const QRectF &sourceRect, Qt::ImageConversionFlags flags=Qt::AutoColor)
Draws the rectangular portion source of the given image into the target rectangle in the paint device...
void fillPath(const QPainterPath &path, const QBrush &brush)
Fills the given path using the given brush.
void setBrush(const QBrush &brush)
Sets the painter's brush to the given brush.
void translate(const QPointF &offset)
Translates the coordinate system by the given offset; i.e.
void setRenderHint(RenderHint hint, bool on=true)
Sets the given render hint on the painter if on is true; otherwise clears the render hint.
void setWidthF(qreal width)
Sets the pen width to the given width in pixels with floating point precision.
Qt::PenCapStyle capStyle() const
Returns the pen's cap style.
Returns a copy of the pixmap that is transformed using the given transformation transform and transfo...
QSize size() const
Returns the size of the pixmap.
int width() const
Returns the width of the pixmap.
void fill(const QColor &fillColor=Qt::white)
Fills the pixmap with the given color.
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.
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
The QPolygonF class provides a list of points using floating point precision.
\inmodule QtCore\reentrant
constexpr qreal y() const noexcept
Returns the y-coordinate of the rectangle's top edge.
constexpr qreal height() const noexcept
Returns the height of the rectangle.
constexpr qreal width() const noexcept
Returns the width of the rectangle.
constexpr qreal x() const noexcept
Returns the x-coordinate of the rectangle's left edge.
\inmodule QtCore\reentrant
constexpr int height() const noexcept
Returns the height of the rectangle.
constexpr int x() const noexcept
Returns the x-coordinate of the rectangle's left edge.
constexpr int width() const noexcept
Returns the width of the rectangle.
constexpr int y() const noexcept
Returns the y-coordinate of the rectangle's top edge.
The QRegion class specifies a clip region for a painter.
\macro QT_RESTRICTED_CAST_FROM_ASCII
QFont font() const
Returns the font that should be used to draw the text.
qreal descent() const
Corresponds to the \l{QFontMetrics::descent()}{descent} of the piece of text that is drawn.
RenderFlags renderFlags() const
Returns the render flags used.
qreal ascent() const
Corresponds to the \l{QFontMetrics::ascent()}{ascent} of the piece of text that is drawn.
QString text() const
Returns the text that should be drawn.
qreal width() const
Specifies the total width of the text to be drawn.
constexpr size_type size() const noexcept
Combined button and popup list for selecting options.
static const QCssKnownValue positions[NumKnownPositionModes - 1]
int qRound(qfloat16 d) noexcept
GLint GLint GLint GLint GLint x
[0]
GLfloat GLfloat GLfloat w
[0]
GLint GLsizei GLsizei height
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLfloat GLfloat GLfloat GLfloat h
GLuint GLenum GLenum transform
GLfixed GLfixed GLint GLint GLfixed points
GLsizei const GLchar *const * path
Q_GUI_EXPORT void qt_draw_tile(QPaintEngine *gc, qreal x, qreal y, qreal w, qreal h, const QPixmap &pixmap, qreal xOffset, qreal yOffset)
void qt_fill_tile(QPixmap *tile, const QPixmap &pixmap)
static QPaintEngine * qt_polygon_recursion
#define Q_ASSERT_X(cond, x, msg)
#define Q_DECLARE_TYPEINFO(TYPE, FLAGS)
constexpr qreal toReal() const