48 #if !defined(QT_NO_EGL) 49 #include <QtGui/private/qeglcontext_p.h> 52 #include <QtCore/qvarlengtharray.h> 53 #include <QtGui/private/qdrawhelper_p.h> 54 #include <QtGui/private/qtextengine_p.h> 55 #include <QtGui/private/qfontengine_p.h> 56 #include <QtGui/private/qpainterpath_p.h> 57 #include <QtGui/private/qstatictext_p.h> 58 #include <QtGui/QApplication> 59 #include <QtGui/QDesktopWidget> 60 #include <QtCore/qmath.h> 68 #if !defined(OPENVG_VERSION_1_1) && !defined(QVG_NO_RENDER_TO_MASK) 69 #define QVG_NO_RENDER_TO_MASK 1 71 #if defined(QVG_SCISSOR_CLIP) && !defined(QVG_NO_RENDER_TO_MASK) 72 #define QVG_NO_RENDER_TO_MASK 1 78 #if !defined(QVG_NO_DRAW_GLYPHS) 108 QT_VG_BLEND_OVERLAY_KHR = 0x2010,
109 QT_VG_BLEND_HARDLIGHT_KHR = 0x2011,
110 QT_VG_BLEND_SOFTLIGHT_SVG_KHR = 0x2012,
111 QT_VG_BLEND_SOFTLIGHT_KHR = 0x2013,
112 QT_VG_BLEND_COLORDODGE_KHR = 0x2014,
113 QT_VG_BLEND_COLORBURN_KHR = 0x2015,
114 QT_VG_BLEND_DIFFERENCE_KHR = 0x2016,
115 QT_VG_BLEND_SUBTRACT_KHR = 0x2017,
116 QT_VG_BLEND_INVERT_KHR = 0x2018,
117 QT_VG_BLEND_EXCLUSION_KHR = 0x2019,
118 QT_VG_BLEND_LINEARDODGE_KHR = 0x201a,
119 QT_VG_BLEND_LINEARBURN_KHR = 0x201b,
120 QT_VG_BLEND_VIVIDLIGHT_KHR = 0x201c,
121 QT_VG_BLEND_LINEARLIGHT_KHR = 0x201d,
122 QT_VG_BLEND_PINLIGHT_KHR = 0x201e,
123 QT_VG_BLEND_HARDMIX_KHR = 0x201f,
124 QT_VG_BLEND_CLEAR_KHR = 0x2020,
125 QT_VG_BLEND_DST_KHR = 0x2021,
126 QT_VG_BLEND_SRC_OUT_KHR = 0x2022,
127 QT_VG_BLEND_DST_OUT_KHR = 0x2023,
128 QT_VG_BLEND_SRC_ATOP_KHR = 0x2024,
129 QT_VG_BLEND_DST_ATOP_KHR = 0x2025,
130 QT_VG_BLEND_XOR_KHR = 0x2026
139 void setTransform(VGMatrixMode mode,
const QTransform& transform);
141 void draw(VGPath path,
const QPen& pen,
const QBrush& brush, VGint rule = VG_EVEN_ODD);
142 void stroke(VGPath path,
const QPen& pen);
143 void fill(VGPath path,
const QBrush& brush, VGint rule = VG_EVEN_ODD);
144 VGPath vectorPathToVGPath(
const QVectorPath& path);
148 (VGPaint paint,
const QBrush& brush, VGMatrixMode mode,
149 VGPaintType prevPaintType);
150 void setPenParams(
const QPen& pen);
151 void setBrushTransform(
const QBrush& brush, VGMatrixMode mode);
152 void setupColorRamp(
const QGradient *grad, VGPaint paint);
153 void setImageOptions();
154 void systemStateChanged();
155 #if !defined(QVG_SCISSOR_CLIP) 189 #if !defined(QVG_NO_MODIFY_PATH) 229 #if !defined(QVG_NO_DRAW_GLYPHS) 230 QVGFontCache fontCache;
245 if (!pathTransformSet) {
247 if (renderingQuality == VG_RENDERING_QUALITY_NONANTIALIASED && currentPen !=
Qt::NoPen)
248 aliasedTransform = aliasedTransform
250 setTransform(VG_MATRIX_PATH_USER_TO_SURFACE, aliasedTransform);
251 pathTransformSet =
true;
257 if (forcePenChange || pen != currentPen) {
259 forcePenChange =
false;
261 (penPaint, pen.
brush(),
262 VG_MATRIX_STROKE_PAINT_TO_USER, penType);
269 if (forceBrushChange || brush != currentBrush) {
270 currentBrush = brush;
271 forceBrushChange =
false;
273 (brushPaint, brush, VG_MATRIX_FILL_PAINT_TO_USER, brushType);
275 if (fillPaint != brushPaint) {
276 vgSetPaint(brushPaint, VG_FILL_PATH);
277 fillPaint = brushPaint;
289 return hasExtendedRadialGradientPen || hasExtendedRadialGradientBrush;
294 return hasExtendedRadialGradientPen;
299 return hasExtendedRadialGradientBrush;
303 inline void setImageMode(VGImageMode mode);
304 inline void setRenderingQuality(VGRenderingQuality mode);
305 inline void setImageQuality(VGImageQuality mode);
306 inline void setBlendMode(VGBlendMode mode);
307 inline void setFillRule(VGint mode);
318 if (imageMode != mode) {
320 vgSeti(VG_IMAGE_MODE, mode);
326 if (renderingQuality != mode) {
327 vgSeti(VG_RENDERING_QUALITY, mode);
328 renderingQuality = mode;
329 pathTransformSet =
false;
335 if (imageQuality != mode) {
336 vgSeti(VG_IMAGE_QUALITY, mode);
343 if (blendMode != mode) {
344 vgSeti(VG_BLEND_MODE, mode);
351 if (fillRule != mode) {
353 vgSeti(VG_FILL_RULE, mode);
359 matrixMode = (VGMatrixMode)0;
360 imageMode = (VGImageMode)0;
361 blendMode = (VGBlendMode)0;
362 renderingQuality = (VGRenderingQuality)0;
363 imageQuality = (VGImageQuality)0;
396 #if !defined(QVG_NO_MODIFY_PATH) 418 #if !defined(QVG_NO_DRAW_GLYPHS) 419 fontEngineCleaner = 0;
437 vgSetParameteri(
penPaint, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR);
438 vgSetPaint(
penPaint, VG_STROKE_PATH);
440 vgSeti(VG_MATRIX_MODE, VG_MATRIX_STROKE_PAINT_TO_USER);
444 vgSetParameteri(
brushPaint, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR);
448 vgSeti(VG_MATRIX_MODE, VG_MATRIX_FILL_PAINT_TO_USER);
453 vgSetParameteri(
opacityPaint, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR);
459 vgSetParameterfv(
opacityPaint, VG_PAINT_COLOR, 4, values);
461 #if !defined(QVG_NO_MODIFY_PATH) 465 rectPath = vgCreatePath(VG_PATH_FORMAT_STANDARD,
471 VG_PATH_CAPABILITY_ALL);
472 static VGubyte
const segments[5] = {
483 coords[3] = coords[1];
484 coords[4] = coords[2];
486 coords[6] = coords[0];
487 coords[7] = coords[5];
488 vgAppendPathData(
rectPath, 5, segments, coords);
491 linePath = vgCreatePath(VG_PATH_FORMAT_STANDARD,
497 VG_PATH_CAPABILITY_ALL);
498 vgAppendPathData(
linePath, 2, segments, coords);
501 const char *
extensions =
reinterpret_cast<const char *
>(vgGetString(VG_EXTENSIONS));
515 #if !defined(QVG_NO_MODIFY_PATH) 524 #if !defined(QVG_NO_DRAW_GLYPHS) 525 QVGFontCache::Iterator
it;
526 for (it = fontCache.begin(); it != fontCache.end(); ++
it)
529 delete fontEngineCleaner;
539 vgSeti(VG_MATRIX_MODE, mode);
542 mat[0] = transform.
m11();
543 mat[1] = transform.
m12();
544 mat[2] = transform.
m13();
545 mat[3] = transform.
m21();
546 mat[4] = transform.
m22();
547 mat[5] = transform.
m23();
548 mat[6] = transform.
m31();
549 mat[7] = transform.
m32();
550 mat[8] = transform.
m33();
558 VGfloat devh = pdev->
height();
602 VGPath vgpath = vgCreatePath(VG_PATH_FORMAT_STANDARD,
608 VG_PATH_CAPABILITY_ALL);
617 for (
int i = 0; i < count; ++i) {
618 switch (elements[i]) {
621 segments.
append(VG_MOVE_TO_ABS);
break;
624 segments.
append(VG_LINE_TO_ABS);
break;
627 segments.
append(VG_CUBIC_TO_ABS);
break;
634 segments.
append(VG_CLOSE_PATH);
637 reinterpret_cast<const VGfloat *
>(points));
650 for (
int i = 0; i < count; ++i) {
651 switch (elements[i]) {
657 segments.
append(VG_MOVE_TO_ABS);
665 segments.
append(VG_LINE_TO_ABS);
684 segments.
append(VG_CUBIC_TO_ABS);
695 for (
int i = 0; i < count; ++i) {
696 switch (elements[i]) {
700 temp = transform.
map(
QPointF(points[0], points[1]));
703 segments.
append(VG_MOVE_TO_ABS);
709 temp = transform.
map(
QPointF(points[0], points[1]));
712 segments.
append(VG_LINE_TO_ABS);
718 temp = transform.
map(
QPointF(points[0], points[1]));
727 temp = transform.
map(
QPointF(points[0], points[1]));
733 segments.
append(VG_CUBIC_TO_ABS);
746 segments.
append(VG_MOVE_TO_ABS);
751 segments.
append(VG_LINE_TO_ABS);
756 temp = transform.
map(
QPointF(points[0], points[1]));
759 segments.
append(VG_MOVE_TO_ABS);
762 temp = transform.
map(
QPointF(points[0], points[1]));
765 segments.
append(VG_LINE_TO_ABS);
772 segments.
append(VG_CLOSE_PATH);
774 vgAppendPathData(vgpath, segments.
count(),
784 VGPath vgpath = vgCreatePath(VG_PATH_FORMAT_STANDARD,
790 VG_PATH_CAPABILITY_ALL);
812 bool haveStart =
false;
813 bool haveEnd =
false;
817 for (
int i = 0; i < count; ++i) {
818 switch (elements[i].
type) {
822 if (haveStart && haveEnd && startx == endx && starty == endy) {
824 segments.
append(VG_CLOSE_PATH);
826 startx = elements[i].
x;
827 starty = elements[i].
y;
832 segments.
append(VG_MOVE_TO_ABS);
838 endx = elements[i].
x;
839 endy = elements[i].
y;
843 segments.
append(VG_LINE_TO_ABS);
849 coords.
append(elements[i].x);
850 coords.
append(elements[i].y);
858 coords.
append(elements[i].x);
859 coords.
append(elements[i].y);
864 segments.
append(VG_CUBIC_TO_ABS);
874 for (
int i = 0; i < count; ++i) {
875 switch (elements[i].
type) {
879 if (haveStart && haveEnd && startx == endx && starty == endy) {
881 segments.
append(VG_CLOSE_PATH);
883 temp = transform.
map(
QPointF(elements[i].x, elements[i].y));
890 segments.
append(VG_MOVE_TO_ABS);
896 temp = transform.
map(
QPointF(elements[i].x, elements[i].y));
902 segments.
append(VG_LINE_TO_ABS);
908 temp = transform.
map(
QPointF(elements[i].x, elements[i].y));
918 temp = transform.
map(
QPointF(elements[i].x, elements[i].y));
925 segments.
append(VG_CUBIC_TO_ABS);
934 if (haveStart && haveEnd && startx == endx && starty == endy) {
936 segments.
append(VG_CLOSE_PATH);
939 vgAppendPathData(vgpath, segments.
count(),
947 static VGubyte roundedrect_types[] = {
966 xRadius = xRadius * rect.
width() / 200.;
967 yRadius = yRadius * rect.
height() / 200.;
970 xRadius =
qMin(xRadius, rect.
width() / 2);
976 x2 - (1 -
KAPPA) * xRadius, y1,
977 x2, y1 + (1 -
KAPPA) * yRadius,
980 x2, y2 - (1 -
KAPPA) * yRadius,
981 x2 - (1 -
KAPPA) * xRadius, y2,
984 x1 + (1 -
KAPPA) * xRadius, y2,
985 x1, y2 - (1 -
KAPPA) * yRadius,
988 x1, y1 + (1 -
KAPPA) * yRadius,
989 x1 + (1 -
KAPPA) * xRadius, y1,
993 #if !defined(QVG_NO_MODIFY_PATH) 996 vgpath = vgCreatePath(VG_PATH_FORMAT_STANDARD,
1002 VG_PATH_CAPABILITY_ALL);
1003 vgAppendPathData(vgpath, 10, roundedrect_types, pts);
1006 vgModifyPathCoords(vgpath, 0, 9, pts);
1009 VGPath vgpath = vgCreatePath(VG_PATH_FORMAT_STANDARD,
1015 VG_PATH_CAPABILITY_ALL);
1016 vgAppendPathData(vgpath, 10, roundedrect_types, pts);
1032 int height = sourceImage.
height();
1033 int width = sourceImage.
width();
1034 for (
int y=0; y<height; ++y) {
1037 for (
int x=0; x < width; ++x)
1038 target[x] = (source[x>>3] >> (x&7)) & 1 ? fg : bg;
1060 format = VG_sXRGB_8888;
1063 format = VG_sARGB_8888;
1066 format = VG_sARGB_8888_PRE;
1069 format = VG_sRGB_565;
1074 format = VG_sARGB_8888_PRE;
1081 (format, img.
width(), img.
height(), VG_IMAGE_QUALITY_FASTER);
1101 return VG_INVALID_HANDLE;
1103 format = VG_sXRGB_8888;
1106 format = VG_sARGB_8888;
1109 format = VG_sARGB_8888_PRE;
1112 format = VG_sRGB_565;
1118 format = VG_sARGB_8888_PRE;
1126 (format, sr.
width(), sr.
height(), VG_IMAGE_QUALITY_FASTER);
1139 painter.
begin(&img);
1144 const uchar *pixels = img.constBits();
1147 (VG_sARGB_8888_PRE, img.width(), img.height(), VG_IMAGE_QUALITY_FASTER);
1149 (vgImg, pixels, img.bytesPerLine(), VG_sARGB_8888_PRE, 0, 0,
1150 img.width(), img.height());
1161 painter.
begin(&img);
1166 const uchar *pixels = img.constBits();
1169 (VG_sARGB_8888_PRE, img.width(), img.height(), VG_IMAGE_QUALITY_FASTER);
1171 (vgImg, pixels, img.bytesPerLine(), VG_sARGB_8888_PRE, 0, 0,
1172 img.width(), img.height());
1178 (VGPaint paint,
const QBrush& brush, VGMatrixMode mode,
1179 VGPaintType prevType)
1186 if (prevType == VG_PAINT_TYPE_PATTERN || prevType == (VGPaintType)0)
1187 vgPaintPattern(paint, VG_INVALID_HANDLE);
1189 switch (brush.
style()) {
1194 values[0] = color.
redF();
1195 values[1] = color.greenF();
1196 values[2] = color.blueF();
1197 values[3] = color.alphaF() *
opacity;
1198 if (prevType != VG_PAINT_TYPE_COLOR)
1199 vgSetParameteri(paint, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR);
1200 vgSetParameterfv(paint, VG_PAINT_COLOR, 4, values);
1201 return VG_PAINT_TYPE_COLOR;
1209 values[0] = grad->
start().
x();
1210 values[1] = grad->start().y();
1211 values[2] = grad->finalStop().x();
1212 values[3] = grad->finalStop().y();
1213 if (prevType != VG_PAINT_TYPE_LINEAR_GRADIENT)
1214 vgSetParameteri(paint, VG_PAINT_TYPE, VG_PAINT_TYPE_LINEAR_GRADIENT);
1215 vgSetParameterfv(paint, VG_PAINT_LINEAR_GRADIENT, 4, values);
1217 return VG_PAINT_TYPE_LINEAR_GRADIENT;
1225 values[0] = grad->
center().
x();
1226 values[1] = grad->center().y();
1227 values[2] = grad->focalPoint().x();
1228 values[3] = grad->focalPoint().y();
1229 values[4] = grad->radius();
1230 if (prevType != VG_PAINT_TYPE_RADIAL_GRADIENT)
1231 vgSetParameteri(paint, VG_PAINT_TYPE, VG_PAINT_TYPE_RADIAL_GRADIENT);
1232 vgSetParameterfv(paint, VG_PAINT_RADIAL_GRADIENT, 5, values);
1234 return VG_PAINT_TYPE_RADIAL_GRADIENT;
1252 }
else if (opacity == 1.0) {
1274 if (vgImg == VG_INVALID_HANDLE)
1276 if (prevType != VG_PAINT_TYPE_PATTERN)
1277 vgSetParameteri(paint, VG_PAINT_TYPE, VG_PAINT_TYPE_PATTERN);
1278 vgSetParameteri(paint, VG_PAINT_PATTERN_TILING_MODE, VG_TILE_REPEAT);
1279 vgPaintPattern(paint, vgImg);
1281 vgDestroyImage(vgImg);
1282 return VG_PAINT_TYPE_PATTERN;
1287 qWarning() <<
"QVGPaintEnginePrivate::setBrush: conical gradients are not supported by OpenVG";
1293 if (stops.
size() > 0)
1294 color = stops[0].second;
1295 values[0] = color.
redF();
1296 values[1] = color.
greenF();
1297 values[2] = color.
blueF();
1299 if (prevType != VG_PAINT_TYPE_COLOR)
1300 vgSetParameteri(paint, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR);
1301 vgSetParameterfv(paint, VG_PAINT_COLOR, 4, values);
1302 return VG_PAINT_TYPE_COLOR;
1325 if (prevType != VG_PAINT_TYPE_PATTERN)
1326 vgSetParameteri(paint, VG_PAINT_TYPE, VG_PAINT_TYPE_PATTERN);
1327 vgSetParameteri(paint, VG_PAINT_PATTERN_TILING_MODE, VG_TILE_REPEAT);
1328 vgPaintPattern(paint, vgImg);
1329 vgDestroyImage(vgImg);
1330 return VG_PAINT_TYPE_PATTERN;
1335 return (VGPaintType)0;
1342 VGfloat width = pen.
widthF();
1349 vgSetf(VG_STROKE_LINE_WIDTH, width);
1352 vgSetf(VG_STROKE_CAP_STYLE, VG_CAP_BUTT);
1354 vgSetf(VG_STROKE_CAP_STYLE, VG_CAP_SQUARE);
1356 vgSetf(VG_STROKE_CAP_STYLE, VG_CAP_ROUND);
1359 vgSetf(VG_STROKE_JOIN_STYLE, VG_JOIN_MITER);
1360 vgSetf(VG_STROKE_MITER_LIMIT, pen.
miterLimit());
1362 vgSetf(VG_STROKE_JOIN_STYLE, VG_JOIN_BEVEL);
1364 vgSetf(VG_STROKE_JOIN_STYLE, VG_JOIN_ROUND);
1368 vgSetfv(VG_STROKE_DASH_PATTERN, 0, NULL);
1372 for (
int i = 0; i < dashPattern.
count(); ++i)
1373 currentDashPattern[i] = dashPattern[i] * width;
1374 vgSetfv(VG_STROKE_DASH_PATTERN, currentDashPattern.count(), currentDashPattern.data());
1375 vgSetf(VG_STROKE_DASH_PHASE, pen.
dashOffset());
1376 vgSetf(VG_STROKE_DASH_PHASE_RESET, VG_FALSE);
1393 if (mode == VG_MATRIX_FILL_PAINT_TO_USER) {
1405 vgSeti(VG_MATRIX_MODE, mode);
1412 mat[0] = transform.
m11();
1413 mat[1] = transform.
m12();
1414 mat[2] = transform.
m13();
1415 mat[3] = transform.
m21();
1416 mat[4] = transform.
m22();
1417 mat[5] = transform.
m23();
1418 mat[6] = transform.
m31();
1419 mat[7] = transform.
m32();
1420 mat[8] = transform.
m33();
1428 VGColorRampSpreadMode spreadMode;
1430 spreadMode = VG_COLOR_RAMP_SPREAD_REFLECT;
1432 spreadMode = VG_COLOR_RAMP_SPREAD_REPEAT;
1434 spreadMode = VG_COLOR_RAMP_SPREAD_PAD;
1437 int n = 5*stops.
size();
1440 for (
int i = 0; i < stops.
size(); ++i ) {
1441 QColor col = stops[i].second;
1442 fill_stops[i*5] = stops[i].
first;
1443 fill_stops[i*5 + 1] = col.
redF();
1444 fill_stops[i*5 + 2] = col.
greenF();
1445 fill_stops[i*5 + 3] = col.
blueF();
1449 vgSetParameteri(paint, VG_PAINT_COLOR_RAMP_SPREAD_MODE, spreadMode);
1450 vgSetParameteri(paint, VG_PAINT_COLOR_RAMP_PREMULTIPLIED, VG_FALSE);
1451 vgSetParameterfv(paint, VG_PAINT_COLOR_RAMP_STOPS, n, fill_stops.
data());
1456 isNew(true), clipRegion(other.clipRegion),
1501 VGbitfield mode = 0;
1504 mode |= VG_STROKE_PATH;
1509 mode |= VG_FILL_PATH;
1512 ensurePathTransform();
1513 vgDrawPath(path, mode);
1522 ensurePathTransform();
1523 vgDrawPath(path, VG_STROKE_PATH);
1532 QPen savedPen = currentPen;
1534 ensurePathTransform();
1535 currentPen = savedPen;
1536 vgDrawPath(path, VG_FILL_PATH);
1561 vgSeti(VG_SCISSORING, VG_FALSE);
1562 vgSeti(VG_MASKING, VG_FALSE);
1569 if (
d->needsEmulation()) {
1574 VGPath vgpath =
d->vectorPathToVGPath(path);
1576 d->draw(vgpath, s->
pen, s->
brush, VG_EVEN_ODD);
1578 d->draw(vgpath, s->
pen, s->
brush, VG_NON_ZERO);
1579 vgDestroyPath(vgpath);
1587 if (
d->needsEmulation(brush)) {
1595 VGPath vgpath =
d->vectorPathToVGPath(path);
1597 d->fill(vgpath, brush, VG_EVEN_ODD);
1599 d->fill(vgpath, brush, VG_NON_ZERO);
1600 vgDestroyPath(vgpath);
1606 if (
d->needsEmulation(pen.
brush())) {
1610 VGPath vgpath =
d->vectorPathToVGPath(path);
1611 d->stroke(vgpath, pen);
1612 vgDestroyPath(vgpath);
1630 if (m11 == 0.0f && m22 == 0.0f) {
1631 if (m12 == 1.0f && m21 == -1.0f)
1633 else if (m12 == -1.0f && m21 == 1.0f)
1635 }
else if (m12 == 0.0f && m21 == 0.0f) {
1636 if (m11 == -1.0f && m22 == -1.0f)
1638 else if (m11 == 1.0f && m22 == 1.0f)
1645 #if defined(QVG_SCISSOR_CLIP) 1666 QRectF rect(points[0], points[1], points[2] - points[0],
1667 points[5] - points[1]);
1687 region =
d->transform.map(region);
1703 if (region.
numRects() <=
d->maxScissorRects) {
1793 #else // !QVG_SCISSOR_CLIP 1802 d->maskValid =
false;
1803 d->maskIsSet =
true;
1804 d->scissorMask =
false;
1806 vgSeti(VG_MASKING, VG_FALSE);
1816 QRectF rect(points[0], points[1], points[2] - points[0],
1817 points[5] - points[1]);
1822 #if !defined(QVG_NO_RENDER_TO_MASK) 1824 int width = pdev->
width();
1825 int height = pdev->
height();
1828 vgMask(VG_INVALID_HANDLE, VG_CLEAR_MASK, 0, 0, width, height);
1830 }
else if (!
d->maskValid) {
1831 d->ensureMask(
this, width, height);
1834 d->ensurePathTransform();
1835 VGPath vgpath =
d->vectorPathToVGPath(path);
1839 vgRenderToMask(vgpath, VG_FILL_PATH, VG_UNION_MASK);
1843 vgRenderToMask(vgpath, VG_FILL_PATH, VG_INTERSECT_MASK);
1848 vgDestroyPath(vgpath);
1850 vgSeti(VG_MASKING, VG_TRUE);
1851 d->maskValid =
true;
1852 d->maskIsSet =
false;
1853 d->scissorMask =
false;
1872 d->maskValid =
false;
1873 d->maskIsSet =
true;
1874 d->scissorMask =
false;
1876 vgSeti(VG_MASKING, VG_FALSE);
1882 QRect r =
d->transform.mapRect(rect);
1887 vgSeti(VG_MASKING, VG_FALSE);
1888 d->maskValid =
false;
1889 d->maskIsSet =
true;
1890 d->scissorMask =
false;
1906 d->maskValid =
false;
1907 d->maskIsSet =
false;
1908 d->scissorMask =
false;
1910 d->modifyMask(
this, VG_FILL_MASK, r);
1915 d->maskValid =
false;
1916 d->maskIsSet =
false;
1917 d->scissorMask =
true;
1918 d->maskRect = clipRect;
1919 vgSeti(VG_MASKING, VG_FALSE);
1927 QRect r =
d->transform.mapRect(rect);
1928 if (!
d->maskValid) {
1935 d->maskIsSet =
true;
1939 d->maskIsSet =
false;
1942 d->scissorMask =
true;
1948 vgSeti(VG_MASKING, VG_FALSE);
1949 d->maskValid =
false;
1950 d->maskIsSet =
true;
1951 d->scissorMask =
false;
1954 d->modifyMask(
this, VG_INTERSECT_MASK, r);
1963 if (!(
d->maskIsSet))
1964 d->modifyMask(
this, VG_UNION_MASK,
d->transform.mapRect(rect));
1991 d->maskValid =
false;
1992 d->maskIsSet =
true;
1993 d->scissorMask =
false;
1995 vgSeti(VG_MASKING, VG_FALSE);
2001 QRegion r =
d->transform.map(region);
2006 vgSeti(VG_MASKING, VG_FALSE);
2007 d->maskValid =
false;
2008 d->maskIsSet =
true;
2009 d->scissorMask =
false;
2021 d->maskValid =
false;
2022 d->maskIsSet =
false;
2023 d->scissorMask =
true;
2025 vgSeti(VG_MASKING, VG_FALSE);
2028 d->maskValid =
false;
2029 d->maskIsSet =
false;
2030 d->scissorMask =
false;
2032 d->modifyMask(
this, VG_FILL_MASK, r);
2047 QRegion r =
d->transform.map(region);
2052 vgSeti(VG_MASKING, VG_FALSE);
2053 d->maskValid =
false;
2054 d->maskIsSet =
true;
2055 d->scissorMask =
false;
2058 d->modifyMask(
this, VG_INTERSECT_MASK, r);
2067 if (!(
d->maskIsSet))
2068 d->modifyMask(
this, VG_UNION_MASK,
d->transform.map(region));
2074 #if !defined(QVG_NO_RENDER_TO_MASK) 2119 #if !defined(QVG_NO_RENDER_TO_MASK) 2132 d->maskValid =
false;
2133 d->maskIsSet =
true;
2134 d->scissorMask =
false;
2136 vgSeti(VG_MASKING, VG_FALSE);
2141 int width = pdev->
width();
2142 int height = pdev->
height();
2145 vgMask(VG_INVALID_HANDLE, VG_CLEAR_MASK, 0, 0, width, height);
2147 }
else if (!
d->maskValid) {
2148 d->ensureMask(
this, width, height);
2151 d->ensurePathTransform();
2152 VGPath vgpath =
d->painterPathToVGPath(path);
2156 vgRenderToMask(vgpath, VG_FILL_PATH, VG_UNION_MASK);
2160 vgRenderToMask(vgpath, VG_FILL_PATH, VG_INTERSECT_MASK);
2165 vgDestroyPath(vgpath);
2167 vgSeti(VG_MASKING, VG_TRUE);
2168 d->maskValid =
true;
2169 d->maskIsSet =
false;
2170 d->scissorMask =
false;
2179 scissorMask =
false;
2181 vgMask(VG_INVALID_HANDLE, VG_FILL_MASK, 0, 0, width, height);
2184 vgMask(VG_INVALID_HANDLE, VG_CLEAR_MASK, 0, 0, width, height);
2185 if (maskRect.isValid()) {
2186 vgMask(VG_INVALID_HANDLE, VG_FILL_MASK,
2187 maskRect.x(), height - maskRect.y() - maskRect.height(),
2188 maskRect.width(), maskRect.height());
2199 int width = pdev->
width();
2200 int height = pdev->
height();
2203 ensureMask(engine, width, height);
2206 for (
int i = 0; i < rects.
size(); ++i) {
2207 vgMask(VG_INVALID_HANDLE, op,
2208 rects[i].x(), height - rects[i].y() - rects[i].height(),
2209 rects[i].width(), rects[i].height());
2212 vgSeti(VG_MASKING, VG_TRUE);
2215 scissorMask =
false;
2222 int width = pdev->
width();
2223 int height = pdev->
height();
2226 ensureMask(engine, width, height);
2229 vgMask(VG_INVALID_HANDLE, op,
2230 rect.
x(), height - rect.
y() - rect.
height(),
2234 vgSeti(VG_MASKING, VG_TRUE);
2237 scissorMask =
false;
2240 #endif // !QVG_SCISSOR_CLIP 2248 #if defined(QVG_SCISSOR_CLIP) 2253 vgSeti(VG_MASKING, VG_FALSE);
2254 d->maskValid =
false;
2266 vgSeti(VG_SCISSORING, VG_FALSE);
2267 d->scissorActive =
false;
2268 d->scissorDirty =
false;
2274 #if !defined(QVG_SCISSOR_CLIP) 2276 if (
d->scissorMask) {
2278 region =
d->maskRect;
2284 vgSeti(VG_SCISSORING, VG_FALSE);
2285 d->scissorActive =
false;
2286 d->scissorDirty =
false;
2294 vgSeti(VG_SCISSORING, VG_FALSE);
2295 d->scissorActive =
false;
2296 d->scissorDirty =
false;
2301 if (
d->scissorActive && region ==
d->scissorRegion && !
d->scissorDirty)
2305 int count = rects.
count();
2306 if (count >
d->maxScissorRects) {
2307 #if !defined(QVG_SCISSOR_CLIP) 2308 count =
d->maxScissorRects;
2313 vgMask(VG_INVALID_HANDLE, VG_CLEAR_MASK,
2314 0, 0, width, height);
2315 for (
int i = 0; i < rects.
size(); ++i) {
2316 vgMask(VG_INVALID_HANDLE, VG_FILL_MASK,
2317 rects[i].x(), height - rects[i].y() - rects[i].height(),
2318 rects[i].width(), rects[i].height());
2321 vgSeti(VG_SCISSORING, VG_FALSE);
2322 vgSeti(VG_MASKING, VG_TRUE);
2323 d->maskValid =
true;
2324 d->maskIsSet =
false;
2325 d->scissorMask =
false;
2326 d->scissorActive =
false;
2327 d->scissorDirty =
false;
2328 d->scissorRegion = region;
2335 for (
int i = 0; i < count; ++i) {
2336 params[i * 4 + 0] = rects[i].x();
2337 params[i * 4 + 1] = height - rects[i].y() - rects[i].height();
2338 params[i * 4 + 2] = rects[i].width();
2339 params[i * 4 + 3] = rects[i].height();
2342 vgSetiv(VG_SCISSOR_RECTS, count * 4, params.
data());
2343 vgSeti(VG_SCISSORING, VG_TRUE);
2344 d->scissorDirty =
false;
2345 d->scissorActive =
true;
2346 d->scissorRegion = region;
2362 int width = pdev->
width();
2363 int height = pdev->
height();
2366 return (rect.
x() == 0 && rect.
y() == 0 &&
2367 rect.
width() == width && rect.
height() == height);
2373 int width = pdev->
width();
2374 int height = pdev->
height();
2376 return (rect.
x() == 0 && rect.
y() == 0 &&
2377 rect.
width() == width && rect.
height() == height);
2382 #if defined(QVG_SCISSOR_CLIP) 2383 vgSeti(VG_MASKING, VG_FALSE);
2391 d->maskValid =
false;
2392 d->maskIsSet =
true;
2393 d->scissorMask =
false;
2396 d->replayClipOperations();
2400 vgSeti(VG_MASKING, VG_FALSE);
2401 d->maskValid =
false;
2402 d->maskIsSet =
false;
2403 d->scissorMask =
false;
2414 d->hasExtendedRadialGradientPen =
2423 d->hasExtendedRadialGradientPen =
d->needsEmulation(
state()->brush);
2431 d->forcePenChange =
true;
2432 d->forceBrushChange =
true;
2440 d->forcePenChange =
true;
2441 d->forceBrushChange =
true;
2449 VGint vgMode = VG_BLEND_SRC_OVER;
2451 switch (
state()->composition_mode) {
2453 vgMode = VG_BLEND_SRC_OVER;
2456 vgMode = VG_BLEND_DST_OVER;
2459 vgMode = VG_BLEND_SRC;
2462 vgMode = VG_BLEND_SRC_IN;
2465 vgMode = VG_BLEND_DST_IN;
2468 vgMode = VG_BLEND_ADDITIVE;
2471 vgMode = VG_BLEND_MULTIPLY;
2474 vgMode = VG_BLEND_SCREEN;
2477 vgMode = VG_BLEND_DARKEN;
2480 vgMode = VG_BLEND_LIGHTEN;
2483 if (
d->hasAdvancedBlending) {
2484 switch (
state()->composition_mode) {
2524 if (vgMode == VG_BLEND_SRC_OVER)
2529 d->setBlendMode(VGBlendMode(vgMode));
2539 VGRenderingQuality rq =
2541 ? VG_RENDERING_QUALITY_BETTER
2542 : VG_RENDERING_QUALITY_NONANTIALIASED;
2545 ? VG_IMAGE_QUALITY_BETTER
2546 : VG_IMAGE_QUALITY_NONANTIALIASED;
2548 d->setRenderingQuality(rq);
2549 d->setImageQuality(iq);
2558 qreal oldPenScale =
d->penScale;
2560 if (
d->penScale != oldPenScale)
2561 d->forcePenChange =
true;
2569 QRect r =
d->transform.mapRect(rect).toRect();
2571 if (
d->clearColor != color ||
d->clearOpacity != s->
opacity) {
2573 values[0] = color.
redF();
2574 values[1] = color.
greenF();
2575 values[2] = color.
blueF();
2577 vgSetfv(VG_CLEAR_COLOR, 4, values);
2578 d->clearColor = color;
2581 vgClear(r.
x(), height - r.
y() - r.
height(),
2602 if (
d->needsEmulation(brush)) {
2607 #if !defined(QVG_NO_MODIFY_PATH) 2609 if (
d->simpleTransform) {
2610 coords[0] = rect.
x();
2611 coords[1] = rect.
y();
2612 coords[2] = rect.
x() + rect.
width();
2613 coords[3] = coords[1];
2614 coords[4] = coords[2];
2615 coords[5] = rect.
y() + rect.
height();
2616 coords[6] = coords[0];
2617 coords[7] = coords[5];
2632 vgModifyPathCoords(
d->rectPath, 0, 4, coords);
2633 d->fill(
d->rectPath, brush);
2649 #if !defined(QVG_NO_MODIFY_PATH) 2651 if (
d->simpleTransform) {
2652 coords[0] = rect.
x();
2653 coords[1] = rect.
y();
2654 coords[2] = rect.
x() + rect.
width();
2655 coords[3] = coords[1];
2656 coords[4] = coords[2];
2657 coords[5] = rect.
y() + rect.
height();
2658 coords[6] = coords[0];
2659 coords[7] = coords[5];
2674 vgModifyPathCoords(
d->rectPath, 0, 4, coords);
2675 d->fill(
d->rectPath,
QBrush(color));
2684 if (
d->needsEmulation()) {
2688 if (
d->simpleTransform) {
2690 VGPath vgpath =
d->roundedRectPath(rect, xrad, yrad, mode);
2692 #if defined(QVG_NO_MODIFY_PATH) 2693 vgDestroyPath(vgpath);
2702 #if !defined(QVG_NO_MODIFY_PATH) 2704 if (
d->needsEmulation()) {
2709 for (
int i = 0; i < rectCount; ++i, ++rects) {
2711 if (
d->simpleTransform) {
2712 coords[0] = rects->
x();
2713 coords[1] = rects->
y();
2714 coords[2] = rects->
x() + rects->
width();
2715 coords[3] = coords[1];
2716 coords[4] = coords[2];
2717 coords[5] = rects->
y() + rects->
height();
2718 coords[6] = coords[0];
2719 coords[7] = coords[5];
2725 rects->
y() + rects->
height()));
2727 rects->
y() + rects->
height()));
2737 vgModifyPathCoords(
d->rectPath, 0, 4, coords);
2747 #if !defined(QVG_NO_MODIFY_PATH) 2749 if (
d->needsEmulation()) {
2754 for (
int i = 0; i < rectCount; ++i, ++rects) {
2756 if (
d->simpleTransform) {
2757 coords[0] = rects->
x();
2758 coords[1] = rects->
y();
2759 coords[2] = rects->
x() + rects->
width();
2760 coords[3] = coords[1];
2761 coords[4] = coords[2];
2762 coords[5] = rects->
y() + rects->
height();
2763 coords[6] = coords[0];
2764 coords[7] = coords[5];
2779 vgModifyPathCoords(
d->rectPath, 0, 4, coords);
2789 #if !defined(QVG_NO_MODIFY_PATH) 2791 if (
d->needsEmulation()) {
2796 for (
int i = 0; i < lineCount; ++i, ++lines) {
2798 if (
d->simpleTransform) {
2799 coords[0] = lines->
x1();
2800 coords[1] = lines->
y1();
2801 coords[2] = lines->
x2();
2802 coords[3] = lines->
y2();
2811 vgModifyPathCoords(
d->linePath, 0, 2, coords);
2812 d->stroke(
d->linePath, s->
pen);
2821 #if !defined(QVG_NO_MODIFY_PATH) 2823 if (
d->needsEmulation()) {
2828 for (
int i = 0; i < lineCount; ++i, ++lines) {
2830 if (
d->simpleTransform) {
2831 coords[0] = lines->
x1();
2832 coords[1] = lines->
y1();
2833 coords[2] = lines->
x2();
2834 coords[3] = lines->
y2();
2843 vgModifyPathCoords(
d->linePath, 0, 2, coords);
2844 d->stroke(
d->linePath, s->
pen);
2856 if (
d->needsEmulation()) {
2860 if (
d->simpleTransform) {
2862 VGPath path = vgCreatePath(VG_PATH_FORMAT_STANDARD,
2868 VG_PATH_CAPABILITY_ALL);
2869 static VGubyte segments[4] = {
2876 VGfloat halfwid = r.
width() / 2;
2877 VGfloat halfht = r.
height() / 2;
2878 coords[0] = r.
x() + r.
width();
2879 coords[1] = r.
y() + halfht;
2880 coords[2] = halfwid;
2883 coords[5] = -r.
width();
2885 coords[7] = halfwid;
2888 coords[10] = r.
width();
2890 vgAppendPathData(path, 4, segments, coords);
2892 vgDestroyPath(path);
2910 if (
d->needsEmulation()) {
2915 VGPath vgpath =
d->painterPathToVGPath(path);
2917 d->draw(vgpath, s->
pen, s->
brush, VG_EVEN_ODD);
2919 d->draw(vgpath, s->
pen, s->
brush, VG_NON_ZERO);
2920 vgDestroyPath(vgpath);
2925 #if !defined(QVG_NO_MODIFY_PATH) 2928 if (
d->needsPenEmulation()) {
2940 for (
int i = 0; i < pointCount; ++i, ++points) {
2942 if (
d->simpleTransform) {
2943 coords[0] = points->
x();
2944 coords[1] = points->
y();
2945 coords[2] = coords[0];
2946 coords[3] = coords[1];
2948 QPointF p =
d->transform.map(*points);
2951 coords[2] = coords[0];
2952 coords[3] = coords[1];
2954 vgModifyPathCoords(
d->linePath, 0, 2, coords);
2955 d->stroke(
d->linePath, pen);
2964 #if !defined(QVG_NO_MODIFY_PATH) 2967 if (
d->needsEmulation()) {
2979 for (
int i = 0; i < pointCount; ++i, ++points) {
2981 if (
d->simpleTransform) {
2982 coords[0] = points->
x();
2983 coords[1] = points->
y();
2984 coords[2] = coords[0];
2985 coords[3] = coords[1];
2990 coords[2] = coords[0];
2991 coords[3] = coords[1];
2993 vgModifyPathCoords(
d->linePath, 0, 2, coords);
2994 d->stroke(
d->linePath, pen);
3005 if (
d->needsEmulation()) {
3011 VGPath path = vgCreatePath(VG_PATH_FORMAT_STANDARD,
3017 VG_PATH_CAPABILITY_ALL);
3020 for (
int i = 0; i < pointCount; ++i, ++points) {
3021 if (
d->simpleTransform) {
3025 QPointF temp =
d->transform.map(*points);
3030 segments.
append(VG_MOVE_TO_ABS);
3032 segments.
append(VG_LINE_TO_ABS);
3035 segments.
append(VG_CLOSE_PATH);
3036 vgAppendPathData(path, segments.
count(),
3040 d->draw(path, s->
pen, s->
brush, VG_NON_ZERO);
3044 d->stroke(path, s->
pen);
3048 d->draw(path, s->
pen, s->
brush, VG_EVEN_ODD);
3051 vgDestroyPath(path);
3058 if (
d->needsEmulation()) {
3064 VGPath path = vgCreatePath(VG_PATH_FORMAT_STANDARD,
3070 VG_PATH_CAPABILITY_ALL);
3073 for (
int i = 0; i < pointCount; ++i, ++points) {
3074 if (
d->simpleTransform) {
3083 segments.
append(VG_MOVE_TO_ABS);
3085 segments.
append(VG_LINE_TO_ABS);
3088 segments.
append(VG_CLOSE_PATH);
3089 vgAppendPathData(path, segments.
count(),
3093 d->draw(path, s->
pen, s->
brush, VG_NON_ZERO);
3097 d->stroke(path, s->
pen);
3101 d->draw(path, s->
pen, s->
brush, VG_EVEN_ODD);
3104 vgDestroyPath(path);
3109 if (opacity != 1.0f && simpleTransform) {
3110 if (opacity != paintOpacity) {
3115 values[3] = opacity;
3116 vgSetParameterfv(opacityPaint, VG_PAINT_COLOR, 4, values);
3117 paintOpacity = opacity;
3119 if (fillPaint != opacityPaint) {
3120 vgSetPaint(opacityPaint, VG_FILL_PATH);
3121 fillPaint = opacityPaint;
3123 setImageMode(VG_DRAW_IMAGE_MULTIPLY);
3125 setImageMode(VG_DRAW_IMAGE_NORMAL);
3135 const QRectF& r, VGImage vgImg,
3138 if (vgImg == VG_INVALID_HANDLE)
3140 VGImage child = VG_INVALID_HANDLE;
3146 #if !defined(QT_SHIVAVG) 3147 child = vgChildImage(vgImg, src.
x(), src.
y(), src.
width(), src.
height());
3157 transform.
scale(scaleX, scaleY);
3158 d->
setTransform(VG_MATRIX_IMAGE_USER_TO_SURFACE, transform);
3164 vgDestroyImage(child);
3168 const QPointF& pos, VGImage vgImg)
3170 if (vgImg == VG_INVALID_HANDLE)
3175 d->
setTransform(VG_MATRIX_IMAGE_USER_TO_SURFACE, transform);
3186 const int minTileSize = 16;
3187 int tileWidth = 512;
3188 int tileHeight = tileWidth;
3191 VGImage tile = VG_INVALID_HANDLE;
3193 while (tile == VG_INVALID_HANDLE && tileWidth >= minTileSize) {
3195 VG_IMAGE_QUALITY_FASTER);
3196 if (tile == VG_INVALID_HANDLE) {
3201 if (tile == VG_INVALID_HANDLE) {
3202 qWarning(
"drawImageTiled: Failed to create %dx%d tile, giving up", tileWidth, tileHeight);
3206 VGfloat opacityMatrix[20] = {
3207 1.0f, 0.0f, 0.0f, 0.0f,
3208 0.0f, 1.0f, 0.0f, 0.0f,
3209 0.0f, 0.0f, 1.0f, 0.0f,
3211 0.0f, 0.0f, 0.0f, 0.0f
3213 VGImage tileWithOpacity = VG_INVALID_HANDLE;
3216 tileWidth, tileHeight, VG_IMAGE_QUALITY_NONANTIALIASED);
3217 if (tileWithOpacity == VG_INVALID_HANDLE)
3218 qWarning(
"drawImageTiled: Failed to create extra tile, ignoring opacity");
3221 QRect sourceRect = sr.toRect();
3225 VGfloat scaleX = r.
width() / sourceRect.
width();
3234 for (
int y = sourceRect.
y(); y < sourceRect.
height(); y += tileHeight) {
3235 int h =
qMin(tileHeight, sourceRect.
height() - y);
3238 for (
int x = sourceRect.
x(); x < sourceRect.
width(); x += tileWidth) {
3239 int w =
qMin(tileWidth, sourceRect.
width() - x);
3245 vgImageSubData(tile, sptr, image.
bytesPerLine(), tileFormat, 0, 0, w, h);
3248 transform.translate(r.
x() + x, r.
y() + y);
3249 transform.scale(scaleX, scaleY);
3250 d->
setTransform(VG_MATRIX_IMAGE_USER_TO_SURFACE, transform);
3252 VGImage actualTile = tile;
3253 if (tileWithOpacity != VG_INVALID_HANDLE) {
3254 vgColorMatrix(tileWithOpacity, actualTile, opacityMatrix);
3255 if (w < tileWidth || h < tileHeight)
3256 actualTile = vgChildImage(tileWithOpacity, 0, 0, w, h);
3258 actualTile = tileWithOpacity;
3259 }
else if (w < tileWidth || h < tileHeight) {
3260 actualTile = vgChildImage(tile, 0, 0, w, h);
3262 vgDrawImage(actualTile);
3264 if (actualTile != tile && actualTile != tileWithOpacity)
3265 vgDestroyImage(actualTile);
3269 vgDestroyImage(tile);
3270 if (tileWithOpacity != VG_INVALID_HANDLE)
3271 vgDestroyImage(tileWithOpacity);
3296 d->
setTransform(VG_MATRIX_IMAGE_USER_TO_SURFACE, transform);
3315 || image.
depth() == 1) {
3346 if (vgpd->
vgImage != VG_INVALID_HANDLE)
3372 if (vgpd->
vgImage != VG_INVALID_HANDLE)
3385 Qt::ImageConversionFlags
flags)
3395 if (vgImg != VG_INVALID_HANDLE) {
3407 int bpp = image.
depth() >> 3;
3412 offset = ((y + sr.
height()) * bpl) - ((image.
width() - x) * bpp);
3415 offset = (y * bpl) + (x * bpp);
3426 if (vgImg == VG_INVALID_HANDLE)
3432 vgDestroyImage(vgImg);
3456 if (vgImg == VG_INVALID_HANDLE)
3460 vgDestroyImage(vgImg);
3479 #if !defined(QT_SHIVAVG) 3501 if (vgImg == VG_INVALID_HANDLE)
3522 for (
int i = 0; i < dataCount; ++i) {
3524 transform.
translate(drawingData[i].x, drawingData[i].y);
3525 transform.
rotate(drawingData[i].rotation);
3529 QRectF sr(drawingData[i].sourceLeft, drawingData[i].sourceTop,
3530 drawingData[i].width, drawingData[i].height);
3538 for (j = 0; j < cachedSources.
size(); ++j) {
3539 if (cachedSources[j] == src)
3542 if (j < cachedSources.
size()) {
3543 child = cachedImages[j];
3545 child = vgChildImage
3547 cachedImages.
append(child);
3548 cachedSources.
append(src);
3552 VGfloat scaleX = drawingData[i].
scaleX;
3553 VGfloat scaleY = drawingData[i].
scaleY;
3555 -0.5 * scaleY * sr.
height());
3556 transform.
scale(scaleX, scaleY);
3557 d->
setTransform(VG_MATRIX_IMAGE_USER_TO_SURFACE, transform);
3559 if ((hints & QPainter::OpaqueHint) == 0) {
3561 if (opacity != 1.0f) {
3567 values[3] = opacity;
3582 for (
int i = 0; i < cachedImages.
size(); ++i)
3583 vgDestroyImage(cachedImages[i]);
3600 #if !defined(QVG_NO_DRAW_GLYPHS) 3602 QVGFontCache::Iterator
it =
d_ptr->fontCache.find(engine);
3603 if (it !=
d_ptr->fontCache.end()) {
3605 d_ptr->fontCache.erase(it);
3610 #if !defined(QVG_NO_DRAW_GLYPHS) 3612 QVGFontGlyphCache::QVGFontGlyphCache()
3614 font = vgCreateFont(0);
3615 scaleX = scaleY = 0.0;
3616 invertedGlyphs =
false;
3617 memset(cachedGlyphsMask, 0,
sizeof(cachedGlyphsMask));
3620 QVGFontGlyphCache::~QVGFontGlyphCache()
3622 if (font != VG_INVALID_HANDLE)
3623 vgDestroyFont(font);
3626 void QVGFontGlyphCache::setScaleFromText(
const QFont &font,
QFontEngine *fontEngine)
3631 scaleX = scaleY =
static_cast<VGfloat
>(pixelSize / emSquare);
3639 VGfloat escapement[2];
3643 memset(&metrics, 0,
sizeof(metrics));
3644 while (count-- > 0) {
3648 if ((cachedGlyphsMask[glyph / 32] & (1 << (glyph % 32))) != 0)
3650 cachedGlyphsMask[glyph / 32] |= (1 << (glyph % 32));
3651 }
else if (cachedGlyphs.contains(glyph)) {
3654 cachedGlyphs.insert(glyph);
3656 #if !defined(QVG_NO_IMAGE_GLYPHS) 3659 VGImage vgImage = VG_INVALID_HANDLE;
3661 if (!scaledImage.
isNull()) {
3663 vgImage = vgCreateImage(VG_A_8, scaledImage.
width(), scaledImage.
height(), VG_IMAGE_QUALITY_FASTER);
3667 vgImage = vgCreateImage(VG_A_8, img.
width(), img.
height(), VG_IMAGE_QUALITY_FASTER);
3671 vgImage = vgCreateImage(VG_sARGB_8888_PRE, img.
width(), img.
height(), VG_IMAGE_QUALITY_FASTER);
3675 origin[0] = -metrics.
x.
toReal();
3676 origin[1] = -metrics.
y.
toReal();
3679 vgSetGlyphToImage(font, glyph, vgImage, origin, escapement);
3680 vgDestroyImage(vgImage);
3690 vgPath = VG_INVALID_HANDLE;
3696 vgSetGlyphToPath(font, glyph, vgPath, VG_FALSE, origin, escapement);
3697 vgDestroyPath(vgPath);
3698 #endif // !defined(QVG_NO_IMAGE_GLYPHS) 3702 #endif // !defined(QVG_NO_DRAW_GLYPHS) 3706 #if !defined(QVG_NO_DRAW_GLYPHS) 3747 #if !defined(QVG_NO_DRAW_GLYPHS) 3751 QVGFontCache::ConstIterator
it = d->fontCache.constFind(fontEngine);
3752 QVGFontGlyphCache *glyphCache;
3753 if (it != d->fontCache.constEnd()) {
3754 glyphCache = it.value();
3757 glyphCache =
new QSymbianVGFontGlyphCache();
3759 glyphCache =
new QVGFontGlyphCache();
3761 if (glyphCache->font == VG_INVALID_HANDLE) {
3762 qWarning(
"QVGPaintEngine::drawTextItem: OpenVG fonts are not supported by the OpenVG engine");
3766 glyphCache->setScaleFromText(font, fontEngine);
3767 d->fontCache.insert(fontEngine, glyphCache);
3768 if (!d->fontEngineCleaner)
3784 #if defined(QVG_NO_IMAGE_GLYPHS) 3785 glyphTransform.
scale(glyphCache->scaleX, glyphCache->scaleY);
3789 if (glyphCache->invertedGlyphs)
3790 glyphTransform.
scale(1, -1);
3792 d->
setTransform(VG_MATRIX_GLYPH_USER_TO_SURFACE, glyphTransform);
3795 glyphCache->cacheGlyphs(d, fontEngine, glyphs, numGlyphs);
3800 for (
int i = 1; i < numGlyphs; ++i) {
3801 adjustments_x[i-1] = (positions[i].
x - positions[i-1].
x).round().toReal();
3802 adjustments_y[i-1] = (positions[i].
y - positions[i-1].
y).round().toReal();
3809 vgSetfv(VG_GLYPH_ORIGIN, 2, origin);
3812 #if !defined(QVG_NO_IMAGE_GLYPHS) 3822 vgDrawGlyphs(glyphCache->font, numGlyphs, (VGuint*)glyphs,
3823 adjustments_x.
data(), adjustments_y.
data(), VG_FILL_PATH, VG_TRUE);
3848 restoreState(d->
dirty);
3864 #if !defined(QVG_NO_DRAW_GLYPHS) 3867 vgSeti(VG_SCISSORING, VG_FALSE);
3868 vgSeti(VG_MASKING, VG_FALSE);
3878 QPaintEngine::DirtyFlags dirty = d->
dirty;
3890 vgSetPaint(d->
penPaint, VG_STROKE_PATH);
3896 #if !defined(QT_SHIVAVG) 3927 brushOriginChanged();
3935 compositionModeChanged();
3937 renderHintsChanged();
3946 clipEnabledChanged();
3949 #if defined(QVG_SCISSOR_CLIP) 3966 values[0] = color.
redF();
3967 values[1] = color.
greenF();
3968 values[2] = color.
blueF();
3969 values[3] = color.
alphaF();
3970 vgSetfv(VG_CLEAR_COLOR, 4, values);
3980 for (
int i = 0; i < rects.
size(); ++i) {
3988 #if !defined(QVG_NO_SINGLE_CONTEXT) && !defined(QT_NO_EGL) 4001 this->screenSize = screenSize;
4013 const QRect& rect,
const QPoint& topLeft,
int opacity)
4015 if (image == VG_INVALID_HANDLE)
4021 if (opacity >= 255) {
4024 vgSetPixels(rect.
x(), y, image, sr.
x(),
4033 child = vgChildImage
4040 int y = screenSize.height() - (rect.
bottom() + 1);
4041 transform.
translate(rect.
x() - 0.5f, y - 0.5f);
4042 d->
setTransform(VG_MATRIX_IMAGE_USER_TO_SURFACE, transform);
4050 values[3] = ((VGfloat)opacity) / 255.0f;
4051 vgSetParameterfv(d->
opacityPaint, VG_PAINT_COLOR, 4, values);
4065 vgDestroyImage(child);
4072 coords[0] = rect.
x();
4073 coords[1] = rect.
y();
4074 coords[2] = rect.
x() + rect.
width();
4075 coords[3] = coords[1];
4076 coords[4] = coords[2];
4077 coords[5] = rect.
y() + rect.
height();
4078 coords[6] = coords[0];
4079 coords[7] = coords[5];
4080 #if !defined(QVG_NO_MODIFY_PATH) 4081 vgModifyPathCoords(d->
rectPath, 0, 4, coords);
4082 vgDrawPath(d->
rectPath, VG_FILL_PATH);
4085 VGPath rectPath = vgCreatePath
4086 (VG_PATH_FORMAT_STANDARD,
4092 VG_PATH_CAPABILITY_ALL);
4093 static VGubyte
const segments[5] = {
4100 vgAppendPathData(rectPath, 5, segments, coords);
4101 vgDrawPath(rectPath, VG_FILL_PATH);
4102 vgDestroyPath(rectPath);
4114 values[0] = color.
redF();
4115 values[1] = color.
greenF();
4116 values[2] = color.
blueF();
4117 values[3] = color.
alphaF();
4118 vgSetfv(VG_CLEAR_COLOR, 4, values);
4124 vgClear(r.
x(), screenSize.height() - r.
y() - r.
height(),
4128 for (
int i = 0; i < rects.
size(); ++i) {
4130 vgClear(r.
x(), screenSize.height() - r.
y() - r.
height(),
4137 VGfloat devh = screenSize.
height();
4141 d->
setTransform(VG_MATRIX_PATH_USER_TO_SURFACE, viewport);
4151 for (
int i = 0; i < rects.
size(); ++i)
4163 VGImage vgImage = VG_INVALID_HANDLE;
4176 VGfloat devh = screenSize.height();
4181 d->
setTransform(VG_MATRIX_IMAGE_USER_TO_SURFACE, transform);
4185 if (vgImage != VG_INVALID_HANDLE) {
4186 vgDrawImage(vgImage);
4191 vgImage = vgCreateImage
4193 VG_IMAGE_QUALITY_FASTER);
4194 if (vgImage == VG_INVALID_HANDLE)
4201 vgDrawImage(vgImage);
4202 vgDestroyImage(vgImage);
4209 int count = rects.
count();
4213 int height = screenSize.height();
4214 for (
int i = 0; i < count; ++i) {
4215 params[i * 4 + 0] = rects[i].x();
4216 params[i * 4 + 1] = height - rects[i].y() - rects[i].height();
4217 params[i * 4 + 2] = rects[i].width();
4218 params[i * 4 + 3] = rects[i].height();
4221 vgSetiv(VG_SCISSOR_RECTS, count * 4, params.
data());
4222 vgSeti(VG_SCISSORING, VG_TRUE);
4231 vgSeti(VG_SCISSORING, VG_FALSE);
4237 #endif // !QVG_NO_SINGLE_CONTEXT && !QT_NO_EGL 4247 return VG_sARGB_8888_PRE;
4249 return VG_sXRGB_8888;
4251 return VG_sARGB_8888;
4255 return VG_sARGB_4444;
4259 return VG_sARGB_8888;
4264 #include "qpaintengine_vg.moc"
virtual void drawPoints(const QPointF *points, int pointCount)
Draws the first pointCount points in the buffer points.
The QPainter class performs low-level painting on widgets and other paint devices.
The QColor class provides colors based on RGB, HSV or CMYK values.
QPointF bottomRight() const
Returns the position of the rectangle's bottom-right corner.
The QPainterPath::Element class specifies the position and type of a subpath.
const T * constData() const
void startCompositing(const QSize &screenSize)
QImage toImage() const
Converts the pixmap to a QImage.
bool isEmpty() const
Returns true if either there are no elements in this path, or if the only element is a MoveToElement;...
ElementType
This enum describes the types of elements used to connect vertices in subpaths.
QT_DEPRECATED int numRects() const
Returns the number of rectangles that will be returned in rects().
qreal scaleY
the vertical scale of the target rectangle.
Format
The following image formats are available in Qt.
qreal y() const
Returns the y-coordinate of the rectangle's top edge.
qreal right() const
Returns the x-coordinate of the rectangle's right edge.
qreal alphaF() const
Returns the alpha color component of this color.
VGImageFormat qt_vg_image_to_vg_format(QImage::Format format)
bool isNull() const
Returns true if the rectangle is a null rectangle, otherwise returns false.
virtual QImage alphaMapForGlyph(glyph_t)
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
#define QT_END_NAMESPACE
This macro expands to.
const QColor & color() const
Returns the brush color.
void stroke(VGPath path, const QPen &pen)
void drawEllipse(const QRectF &r)
Reimplement this function to draw the largest ellipse that can be contained within rectangle rect...
QFontEngine * fontEngine() const
QPaintDevice * paintDevice() const
Returns the device that this engine is painting on, if painting is active; otherwise returns 0...
virtual void drawPath(const QPainterPath &path)
The default implementation ignores the path and does nothing.
void setBrushTransform(const QBrush &brush, VGMatrixMode mode)
The QLine class provides a two-dimensional vector using integer precision.
QPainter::RenderHints renderHints
qreal greenF() const
Returns the green color component of this color.
VGPath painterPathToVGPath(const QPainterPath &path)
T * data() const
Returns the value of the pointer referenced by this object.
void beginDataAccess() const
const QGradient * gradient() const
Returns the gradient describing this brush.
QPaintEngine::DirtyFlags savedDirty
QPainter::CompositionMode composition_mode
#define it(className, varName)
Qt::BrushStyle qbrush_style(const QBrush &b)
bool canVgWritePixels(const QImage &image) const
QSize toSize() const
Returns an integer based copy of this size.
QFixedPoint * glyphPositions
The QPainterPath class provides a container for painting operations, enabling graphical shapes to be ...
int count(const T &t) const
Returns the number of occurrences of value in the vector.
VGImageQuality imageQuality
void setPenParams(const QPen &pen)
void setTransform(const QTransform &)
Sets matrix as an explicit transformation matrix on the current brush.
qreal x2() const
Returns the x-coordinate of the line's end point.
void setCapStyle(Qt::PenCapStyle pcs)
Sets the pen's cap style to the given style.
Qt::PenStyle style() const
Returns the pen style.
bool isDefaultClipRect(const QRect &rect)
QScopedPointer< QPixmapFilter > blurFilter
QPointF p1() const
Returns the line's start point.
bool isNull() const
Returns true if it is a null image, otherwise returns false.
T & first()
Returns a reference to the first item in the vector.
void fill(uint pixel)
Fills the entire image with the given pixelValue.
virtual VGImage createPermanentImage(VGImageFormat format, VGint width, VGint height, VGbitfield allowedQuality)
The QConicalGradient class is used in combination with QBrush to specify a conical gradient brush...
QTransform transform() const
Returns the matrix in the current paint engine state.
static VGImage toVGImageWithOpacitySubRect(const QImage &image, qreal opacity, const QRect &sr)
qreal y2() const
Returns the y-coordinate of the line's end point.
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...
virtual void drawPixmapFragments(const QPainter::PixmapFragment *fragments, int fragmentCount, const QPixmap &pixmap, QPainter::PixmapFragmentHints hints)
void ensurePen(const QPen &pen)
The QPointF class defines a point in the plane using floating point precision.
QRect intersect(const QRect &r) const
Use intersected(rectangle) instead.
qreal left() const
Returns the x-coordinate of the rectangle's left edge.
void drawRoundedRect(const QRectF &rect, qreal xrad, qreal yrad, Qt::SizeMode mode)
VGPaintType setBrush(VGPaint paint, const QBrush &brush, VGMatrixMode mode, VGPaintType prevPaintType)
QPointF topLeft() const
Returns the position of the rectangle's top-left corner.
bool isLineTo() const
Returns true if the element is a line, otherwise returns false.
static int bytesPerPixel(QImage::Format format)
int byteCount() const
Returns the number of bytes occupied by the image data.
QColor color() const
Returns the color of this pen's brush.
QRect translated(int dx, int dy) const
Returns a copy of the rectangle that is translated dx along the x axis and dy along the y axis...
void qt_draw_helper(QPainterPrivate *p, const QPainterPath &path, QPainterPrivate::DrawOperation operation)
int width() const
Returns the width of the rectangle.
virtual uint flags() const
void qt_vg_drawVGImage(QPainter *painter, const QPointF &pos, VGImage vgImg)
QVGPaintEnginePrivate * d_ptr
bool hasAlphaChannel() const
Returns true if the image has a format that respects the alpha channel, otherwise returns false...
static VGImage toVGImageWithOpacity(const QImage &image, qreal opacity)
virtual void draw(const QVectorPath &path)
int bytesPerLine() const
Returns the number of bytes per image scanline.
QRect intersected(const QRect &other) const
Returns the intersection of this rectangle and the given rectangle.
QRect boundingRect() const
Returns the bounding rectangle of this region.
QPointF bottomLeft() const
Returns the position of the rectangle's bottom-left corner.
int height() const
Returns the height of the rectangle.
void setTransform(VGMatrixMode mode, const QTransform &transform)
virtual ~QVGCompositionHelper()
The QRadialGradient class is used in combination with QBrush to specify a radial gradient brush...
static QImage colorizeBitmap(const QImage &image, const QColor &color)
qreal y
the y coordinate of the element's position.
int bottom() const
Returns the y-coordinate of the rectangle's bottom edge.
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 opacity
the opacity of the target rectangle, where 0.0 is fully transparent and 1.0 is fully opaque...
The QHash class is a template class that provides a hash-table-based dictionary.
void clip(const QVectorPath &path, Qt::ClipOperation op)
Type type() const
Reimplement this function to return the paint engine Type.
Q_DECL_CONSTEXPR T qAbs(const T &t)
The QObject class is the base class of all Qt objects.
Q_GUI_EXPORT QString extensions()
QTransform transform() const
Returns the current transformation matrix for the brush.
void setState(QPainterState *s)
The QPen class defines how a QPainter should draw lines and outlines of shapes.
QPolygon toPolygon() const
Creates and returns a QPolygon by converting each QPointF to a QPoint.
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...
const QPainterPath::ElementType * elements() const
void endDataAccess(bool readOnly=false) const
int y1() const
Returns the y-coordinate of the line's start point.
void setBlendMode(VGBlendMode mode)
void setRenderingQuality(VGRenderingQuality mode)
QVector< qreal > dashPattern() const
Returns the dash pattern of this pen.
void drawCursorPixmap(const QPixmap &pixmap, const QPoint &offset)
const QPainterPath::Element & elementAt(int i) const
Returns the element at the given index in the painter path.
int rectCount() const
Returns the number of rectangles that will be returned in rects().
Format format() const
Returns the format of the image.
void stroke(const QVectorPath &path, const QPen &pen)
qreal x() const
Returns the x-coordinate of this point.
QObject * sender() const
Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; othe...
virtual void fillRect(const QRectF &rect, const QBrush &brush)
bool begin(QPaintDevice *)
Begins painting the paint device and returns true if successful; otherwise returns false...
void setImageQuality(VGImageQuality mode)
void drawRects(const QRect *rects, int rectCount)
The default implementation converts the first rectCount rectangles in the buffer rects to a QRectF an...
Qt::ClipOperation clipOperation
The QLineF class provides a two-dimensional vector using floating point precision.
QFuture< T > mapped(const Sequence &sequence, MapFunction function)
Q_GUI_EXPORT QImage qt_imageForBrush(int style, bool invert)
void drawPath(const QPainterPath &path)
The default implementation ignores the path and does nothing.
QRectF controlPointRect() const
QGradientStops stops() const
Returns the stop points for this gradient.
virtual void stroke(const QVectorPath &path, const QPen &pen)
PixelType pixelType() const
bool clearRect(const QRectF &rect, const QColor &color)
QVGPaintEnginePrivate * vgPrivate()
void setScissor(const QRegion ®ion)
QPainter * painter() const
Returns the paint engine's painter.
#define QT_BEGIN_NAMESPACE
This macro expands to.
The QRectF class defines a rectangle in the plane using floating point precision. ...
QVGPaintEnginePrivate(QVGPaintEngine *q_ptr)
virtual QPixmapFilter * pixmapFilter(int, const QPixmapFilter *)
virtual VGImage toVGImage()
void destroyed(QObject *=0)
This signal is emitted immediately before the object obj is destroyed, and can not be blocked...
QPolygonF toFillPolygon(const QMatrix &matrix=QMatrix()) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
static float pixelSize(const QFontDef &request, int dpi)
QBrush qpen_brush(const QPen &p)
bool isCosmetic() const
Returns true if the pen is cosmetic; otherwise returns false.
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
bool needsBrushEmulation() const
QScopedPointer< QPixmapFilter > convolutionFilter
void systemStateChanged()
bool isEmpty() const
Returns true if the region is empty; otherwise returns false.
Q_STATIC_INLINE_FUNCTION uint PREMUL(uint x)
static const QCssKnownValue positions[NumKnownPositionModes - 1]
void drawStaticTextItem(QStaticTextItem *staticTextItem)
Qt::PenJoinStyle joinStyle() const
Returns the pen's join style.
void brushOriginChanged()
void drawPoints(const QPointF *points, int pointCount)
Draws the first pointCount points in the buffer points.
bool hasExtendedRadialGradientPen
qreal height() const
Returns the height of the rectangle.
QSize size() const
Returns the size of the rectangle.
QRegion intersect(const QRegion &r) const
Use intersected(r) instead.
qreal y1() const
Returns the y-coordinate of the line's start point.
void getGlyphPositions(const QGlyphLayout &glyphs, const QTransform &matrix, QTextItem::RenderFlags flags, QVarLengthArray< glyph_t > &glyphs_out, QVarLengthArray< QFixedPoint > &positions)
bool isNull() const
Returns true if both the x and y coordinates are set to 0, otherwise returns false.
static bool qt_vg_pathToRect(const QPainterPath &path, QRectF *rect)
void ensurePathTransform()
Q_CORE_EXPORT void qWarning(const char *,...)
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.
static const char * data(const QByteArray &arr)
QTransform imageTransform
bool needsEmulation(const QBrush &brush) const
void drawTextItem(const QPointF &p, const QTextItem &textItem)
This function draws the text item textItem at position p.
qreal width() const
Returns the width of the rectangle.
QPaintEngine * paintEngine() const
Returns the paint engine that the painter is currently operating on if the painter is active; otherwi...
void setupColorRamp(const QGradient *grad, VGPaint paint)
The QRegion class specifies a clip region for a painter.
bool begin(QPaintDevice *pdev)
Reimplement this function to initialise your paint engine when painting is to start on the paint devi...
void setImageMode(VGImageMode mode)
virtual void setState(QPainterState *s)
void clipEnabledChanged()
int pixelSize() const
Returns the pixel size of the matched window system font.
QBrush brush() const
Returns the brush used to fill strokes generated with this pen.
int depth() const
Returns the depth of the image.
virtual glyph_metrics_t boundingBox(const QGlyphLayout &glyphs)=0
Qt::FillRule fillRule() const
Returns the painter path's currently set fill rule.
Qt::BrushStyle style() const
Returns the brush style.
QPixmap texture() const
Returns the custom brush pattern, or a null pixmap if no custom brush pattern has been set...
Q_OPENVG_EXPORT QVGPaintEngine * qt_vg_create_paint_engine(void)
bool isOpaque() const
Returns true if the brush is fully opaque otherwise false.
const uchar * constBits() const
Returns a pointer to the first pixel data.
QScopedPointer< QPixmapFilter > dropShadowFilter
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...
VGRenderingQuality renderingQuality
QPointF start() const
Returns the start point of this linear gradient in logical coordinates.
The QFontInfo class provides general information about fonts.
virtual void getUnscaledGlyph(glyph_t glyph, QPainterPath *path, glyph_metrics_t *metrics)
void fillBackground(const QRegion ®ion, const QBrush &brush)
QRect toRect() const
Returns a QRect based on the values of this rectangle.
bool hasWindingFill() const
void reset(T *other=0)
Deletes the existing object it is pointing to if any, and sets its pointer to other.
void ensureBrush(const QBrush &brush)
void fill(const QVectorPath &path, const QBrush &brush)
const QPainterPath convertToPainterPath() const
const T & at(int i) const
Returns the item at index position i in the vector.
QSize size() const
Returns the size of the image, i.
Spread
Specifies how the area outside the gradient area should be filled.
bool isDefaultClipRegion(const QRegion ®ion)
void draw(VGPath path, const QPen &pen, const QBrush &brush, VGint rule=VG_EVEN_ODD)
const uchar * constScanLine(int) const
Returns a pointer to the pixel data at the scanline with index i.
bool end()
Reimplement this function to finish painting on the current paint device.
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...
const QBrush & brush() const
Returns the painter's current brush.
QRegion unite(const QRegion &r) const
Use united(r) instead.
QScopedPointer< QPixmapFilter > colorizeFilter
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...
bool needsEmulation() const
The QBrush class defines the fill pattern of shapes drawn by QPainter.
static QByteArray prototype(const QList< QByteArray > ¶meterTypes, const QList< QByteArray > ¶meterNames, bool *ok)
static QVGImagePool * instance()
static VGImage toVGImage(const QImage &image, Qt::ImageConversionFlags flags=Qt::AutoColor)
int width() const
Returns the width of the image.
QScopedPointer< QPaintEnginePrivate > d_ptr
#define Q_DECLARE_PUBLIC(Class)
QImage convertToFormat(Format f, Qt::ImageConversionFlags flags=Qt::AutoColor) const Q_REQUIRED_RESULT
Returns a copy of the image in the given format.
void fontEngineDestroyed()
void restoreState(QPaintEngine::DirtyFlags dirty)
virtual Properties properties() const
virtual void drawRoundedRect(const QRectF &rect, qreal xrad, qreal yrad, Qt::SizeMode mode)
void setAlphaF(qreal alpha)
Sets the alpha of this color to alpha.
QPixmapFilter * pixmapFilter(int type, const QPixmapFilter *prototype)
Type type() const
Returns the type of gradient.
void ensureMask(QVGPaintEngine *engine, int width, int height)
ushort alpha
Returns the alpha color component of this color.
The QLinearGradient class is used in combination with QBrush to specify a linear gradient brush...
The QFont class specifies a font used for drawing text.
int y() const
Returns the y-coordinate of the rectangle's top edge.
The QGradient class is used in combination with QBrush to specify gradient fills. ...
qreal x() const
Returns the x-coordinate of the rectangle's left edge.
This class is used in conjunction with the QPainter::drawPixmapFragments() function to specify how a ...
qreal scaleX
the horizontal scale of the target rectangle.
The QPixmapFilter class provides the basic functionality for pixmap filter classes.
qreal miterLimit() const
Returns the miter limit of the pen.
void qt_vg_drawVGImageStencil(QPainter *painter, const QPointF &pos, VGImage vgImg, const QBrush &brush)
QRegion defaultClipRegion()
void renderHintsChanged()
void beginNativePainting()
qreal redF() const
Returns the red color component of this color.
int x() const
Returns the x-coordinate of the rectangle's left edge.
void drawPixmapFragments(const QPainter::PixmapFragment *drawingData, int dataCount, const QPixmap &pixmap, QFlags< QPainter::PixmapFragmentHint > hints)
The QPoint class defines a point in the plane using integer precision.
QVector< QRect > rects() const
Returns an array of non-overlapping rectangles that make up the region.
Q_GUI_EXPORT bool qt_isExtendedRadialGradient(const QBrush &brush)
void setBrush(const QBrush &brush)
Sets the painter's brush to the given brush.
static bool clipTransformIsSimple(const QTransform &transform)
const qreal * points() const
QPointF p2() const
Returns the line's end point.
bool isMoveTo() const
Returns true if the element is moving the current position, otherwise returns false.
int height() const
Returns the height.
qreal widthF() const
Returns the pen width with floating point precision.
qreal blueF() const
Returns the blue color component of this color.
The QRect class defines a rectangle in the plane using integer precision.
void modifyMask(QVGPaintEngine *engine, VGMaskOperation op, const QRegion ®ion)
Spread spread() const
Returns the spread method use by this gradient.
static VGImage toVGImageSubRect(const QImage &image, const QRect &sr, Qt::ImageConversionFlags flags=Qt::AutoColor)
bool isNull() const
Returns true if both the x and y coordinates are set to +0.
bool hasImplicitClose() const
int height() const
Returns the height of the image.
QSizeF size() const
Returns the size of the rectangle.
int y() const
Returns the y coordinate of this point.
qreal x
the x coordinate of the element's position.
void drawImage(const QRectF &targetRect, const QImage &image, const QRectF &sourceRect, Qt::ImageConversionFlags flags=Qt::AutoColor)
qreal y() const
Returns the y-coordinate of this point.
QPointF center() const
Returns the center of this radial gradient in logical coordinates.
The QPixmap class is an off-screen image representation that can be used as a paint device...
static const QTextHtmlElement elements[Html_NumElements]
Q_GUI_EXPORT bool qt_scaleForTransform(const QTransform &transform, qreal *scale)
virtual QImage * buffer()
void fillRect(const QRectF &rect, const QBrush &brush)
qreal top() const
Returns the y-coordinate of the rectangle's top edge.
qreal dashOffset() const
Returns the dash offset for the pen.
VGPath roundedRectPath(const QRectF &rect, qreal xRadius, qreal yRadius, Qt::SizeMode mode)
bool hasExtendedRadialGradientBrush
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.
void draw(const QVectorPath &path)
void invertPixels(InvertMode=InvertRgb)
Inverts all pixel values in the image.
Q_GUI_EXPORT QPainterPath qt_painterPathFromVectorPath(const QVectorPath &path)
int elementCount() const
Returns the number of path elements in the painter path.
void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr)
Reimplement this function to draw the part of the pm specified by the sr rectangle in the given r...
The QFlags class provides a type-safe way of storing OR-combinations of enum values.
int y2() const
Returns the y-coordinate of the line's end point.
int x() const
Returns the x coordinate of this point.
virtual void drawRects(const QRect *rects, int rectCount)
The default implementation converts the first rectCount rectangles in the buffer rects to a QRectF an...
void fill(VGPath path, const QBrush &brush, VGint rule=VG_EVEN_ODD)
QPaintEngine::DirtyFlags dirty
void setOpacity(qreal opacity)
Sets the opacity of the painter to opacity.
QRgb rgba() const
Returns the RGB value of the color, including its alpha.
qreal bottom() const
Returns the y-coordinate of the rectangle's bottom edge.
QTransform brushTransform
The QTextItem class provides all the information required to draw text in a custom paint engine...
bool isValid() const
Returns true if the rectangle is valid, otherwise returns false.
QPointF topRight() const
Returns the position of the rectangle's top-right corner.
Qt::PenCapStyle capStyle() const
Returns the pen's cap style.
qreal x1() const
Returns the x-coordinate of the line's start point.
int x1() const
Returns the x-coordinate of the line's start point.
static void drawVGImage(QVGPaintEnginePrivate *d, const QRectF &r, VGImage vgImg, const QSize &imageSize, const QRectF &sr)
Qt::PenStyle qpen_style(const QPen &p)
static void fillBackgroundRect(const QRect &rect, QVGPaintEnginePrivate *d)
static const qreal aliasedCoordinateDelta
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
VGPath vectorPathToVGPath(const QVectorPath &path)
void updateTransform(QPaintDevice *pdev)
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.
QImage & imageRef()
Returns a reference to the image that is potentially using some native buffer internally.
QPainterState * createState(QPainterState *orig) const
virtual void detachImageFromPool()
static void drawImageTiled(QVGPaintEnginePrivate *d, const QRectF &r, const QImage &image, const QRectF &sr=QRectF())
void fillRegion(const QRegion ®ion, const QColor &color, const QSize &surfaceSize)
virtual void drawEllipse(const QRectF &r)
Reimplement this function to draw the largest ellipse that can be contained within rectangle rect...
uchar * scanLine(int)
Returns a pointer to the pixel data at the scanline with index i.
void blitWindow(VGImage image, const QSize &imageSize, const QRect &rect, const QPoint &topLeft, int opacity)
void setFillRule(VGint mode)
QVGPainterState * state()
bool needsPenEmulation() const
QVGFontEngineCleaner(QVGPaintEnginePrivate *d)
QScopedPointer< QPainterPrivate > d_ptr
QPoint topLeft() const
Returns the position of the rectangle's top-left corner.
virtual void clip(const QVectorPath &path, Qt::ClipOperation op)=0
bool drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs, const QFont &font, QFontEngine *fontEngine, const QPointF &p, const QFixedPoint *positions)
QPixmapData * pixmapData() const
virtual void drawTextItem(const QPointF &p, const QTextItem &textItem)
This function draws the text item textItem at position p.
void compositionModeChanged()