def polyLine(self, state: PolyLine): LOG.debug(state) p = self._paint(self.surface) p.setPen(QPen(rgb_to_qcolor(state.penColor))) set_rop2(state.rop2, p) polygon = QPolygon() polygon.append(QPoint(state.x0, state.y0)) for (x, y) in state.points: polygon.append(QPoint(x, y)) p.drawPolyline(polygon) self._end(p)
def polygonSc(self, state: PolygonSc): LOG.debug(state) p = self._paint(self.surface) p.setBrush(QBrush(rgb_to_qcolor(state.brushColor))) set_rop2(state.rop2, p) polygon = QPolygon() polygon.append(QPoint(state.x0, state.y0)) for (x, y) in state.points: polygon.append(QPoint(x, y)) p.drawPolygon(polygon, _fill[state.fillMode]) self._end(p)
def polygonCb(self, state: PolygonCb): LOG.debug(state) p = self._paint(self.surface) self._brush(state.brush) p.brush().setColor(rgb_to_qcolor(state.fg)) p.setBackground(QBrush(rgb_to_qcolor(state.bg))) set_rop2(state.rop2, p) # Handle background mode. if state.brush.style in [BrushStyle.PATTERN, BrushStyle.HATCHED]: p.setBackgroundMode(Qt.TransparentMode if state.bgMode == BACKMODE_TRANSPARENT else Qt.OpaqueMode) polygon = QPolygon() polygon.append(QPoint(state.x0, state.y0)) for (x, y) in state.points: polygon.append(QPoint(x, y)) p.drawPolygon(polygon, _fill[state.fillMode]) self._end(p)