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>
98 return QString(ti->chars, ti->num_chars);
296 "At least one drawPolygon function must be implemented");
299 QVarLengthArray<QT_Point>
p(pointCount);
300 for (
int i = 0;
i < pointCount; ++
i) {
325 "At least one drawPolygon function must be implemented");
328 QVarLengthArray<QT_PointF>
p(pointCount);
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) {
508 while (x < tile->
width()) {
509 p.drawPixmap(
x, 0, *tile, 0, 0,
x,
pixmap.height());
513 while (y < tile->
height()) {
514 p.drawPixmap(0,
y, *tile, 0, 0, tile->width(),
y);
522 qreal yPos, xPos, drawH, drawW, yOff, xOff;
525 while(yPos <
y +
h) {
526 drawH =
pixmap.height() - yOff;
527 if (yPos + drawH >
y +
h)
528 drawH =
y +
h - yPos;
531 while(xPos <
x +
w) {
532 drawW =
pixmap.width() - xOff;
533 if (xPos + drawW >
x +
w)
534 drawW =
x +
w - xPos;
535 if (drawW > 0 && drawH > 0)
556 if (sw*sh < 8192 && sw*sh < 16*
rect.width()*
rect.height()) {
557 int tw = sw, th = sh;
558 while (tw*th < 32678 && tw <
rect.width()/2)
560 while (tw*th < 32678 && th <
rect.height()/2)
563 if (
pixmap.depth() == 1) {
567 if (
pixmap.hasAlphaChannel())
587 Qt::ImageConversionFlags
flags)
710 qWarning(
"QPaintEngine::drawPath: Must be implemented when feature PainterPaths is set");
723 if (ti.glyphs.numGlyphs == 0)
728 QVarLengthArray<glyph_t> glyphs;
730 ti.fontEngine->getGlyphPositions(ti.glyphs,
matrix, ti.flags, glyphs,
positions);
735 for (
int i = 0;
i < ti.glyphs.numGlyphs; ++
i) {
745 ti.fontEngine->addOutlineToPath(0, 0, ti.glyphs, &
path, ti.flags);
746 if (!
path.isEmpty()) {
764 for (
int i=0;
i<lineCount; ++
i) {
767 if (pts[0] == pts[1]) {
799 while (
i < lineCount &&
i < 256) {
800 fl[
i].p1.x = lines[
i].
x1();
801 fl[
i].p1.y = lines[
i].
y1();
802 fl[
i].p2.x = lines[
i].
x2();
803 fl[
i].p2.y = lines[
i].
y2();
832 while (
i < rectCount &&
i < 256) {
833 fr[
i].x = rects[
i].
x();
834 fr[
i].y = rects[
i].
y();
855 for (
int i=0;
i<rectCount; ++
i) {
857 path.addRect(rects[
i]);
863 for (
int i=0;
i<rectCount; ++
i) {
866 QPointF(rf.x() + rf.width(), rf.y()),
867 QPointF(rf.x() + rf.width(), rf.y() + rf.height()),
868 QPointF(rf.x(), rf.y() + rf.height()) };
889 return d_func()->pdev;
919 d->baseSystemClip = region;
922 d->updateSystemClip();
923 if (
d->hasSystemTransform ||
d->hasSystemViewport) {
924 d->systemStateChanged();
938 return d_func()->systemClip;
950 qWarning(
"QPaintEngine::setSystemRect: Should not be changed while engine is active");
953 d_func()->systemRect =
rect;
964 return d_func()->systemRect;
975 qWarning(
"QPaintEngine::createPixmap: QPixmap cannot be created without a QGuiApplication");
992 qWarning(
"QPaintEngine::createPixmapFromImage: QPixmap cannot be created without a QGuiApplication");
997 if (
image.isDetached())
1010 if (!ti.glyphs.numGlyphs)
1014 const int size =
qRound(ti.fontEngine->ascent());
1016 QVarLengthArray<glyph_t> glyphs;
1018 ti.fontEngine->getGlyphPositions(ti.glyphs,
matrix, ti.flags, glyphs,
positions);
1019 if (glyphs.size() == 0)
1028 pen.
setWidthF(ti.fontEngine->lineThickness().toReal());
1030 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.
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.
\inmodule QtCore\compares equality \compareswith equality QLine \endcompareswith
constexpr QPointF p1() const
Returns the line's start point.
constexpr QPointF p2() const
Returns the line's end point.
\inmodule QtCore\compares equality \compareswith equality QLineF \endcompareswith
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.
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
\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.
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)
void gc(QV4::ExecutionEngine &engine, GCFlags flags)
#define Q_DECLARE_TYPEINFO(TYPE, FLAGS)
constexpr qreal toReal() const