From afe47def28b3e9bdb1486e410319e3d145559265 Mon Sep 17 00:00:00 2001 From: KIU Shueng Chuan Date: Sat, 12 Jun 2021 14:05:47 +0800 Subject: [PATCH 1/2] fix ScatterPlot render issues on PyQt6 6.1 --- pyqtgraph/graphicsItems/ScatterPlotItem.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyqtgraph/graphicsItems/ScatterPlotItem.py b/pyqtgraph/graphicsItems/ScatterPlotItem.py index 0a397980..7ae0e372 100644 --- a/pyqtgraph/graphicsItems/ScatterPlotItem.py +++ b/pyqtgraph/graphicsItems/ScatterPlotItem.py @@ -120,7 +120,7 @@ def renderSymbol(symbol, size, pen, brush, device=None): penPxWidth = max(math.ceil(pen.widthF()), 1) if device is None: device = QtGui.QImage(int(size+penPxWidth), int(size+penPxWidth), QtGui.QImage.Format.Format_ARGB32) - device.fill(0) + device.fill(QtCore.Qt.GlobalColor.transparent) p = QtGui.QPainter(device) try: p.setRenderHint(p.RenderHint.Antialiasing) From 98a020d1bb74709b0e57be24c2261ee6c2d04722 Mon Sep 17 00:00:00 2001 From: KIU Shueng Chuan Date: Sat, 12 Jun 2021 20:25:28 +0800 Subject: [PATCH 2/2] ROI.py::renderShapeMask : fix little-endian assumption --- pyqtgraph/graphicsItems/ROI.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pyqtgraph/graphicsItems/ROI.py b/pyqtgraph/graphicsItems/ROI.py index 16b26700..f58042f0 100644 --- a/pyqtgraph/graphicsItems/ROI.py +++ b/pyqtgraph/graphicsItems/ROI.py @@ -23,6 +23,7 @@ from .GraphicsObject import GraphicsObject from .UIGraphicsItem import UIGraphicsItem from .. import getConfigOption import warnings +import sys translate = QtCore.QCoreApplication.translate @@ -1287,7 +1288,7 @@ class ROI(GraphicsObject): return np.empty((width, height), dtype=float) im = QtGui.QImage(width, height, QtGui.QImage.Format.Format_ARGB32) - im.fill(0x0) + im.fill(QtCore.Qt.GlobalColor.transparent) p = QtGui.QPainter(im) p.setPen(fn.mkPen(None)) p.setBrush(fn.mkBrush('w')) @@ -1297,8 +1298,9 @@ class ROI(GraphicsObject): p.translate(-bounds.topLeft()) p.drawPath(shape) p.end() - mask = fn.imageToArray(im, transpose=True)[:,:,0].astype(float) / 255. - return mask + cidx = 0 if sys.byteorder == 'little' else 3 + mask = fn.qimage_to_ndarray(im)[...,cidx].T + return mask.astype(float) / 255 def getGlobalTransform(self, relativeTo=None): """Return global transformation (rotation angle+translation) required to move