draw 2 more pixels on each side of trigon

This commit is contained in:
iLLiCiTiT 2021-06-12 12:29:56 +02:00
parent 5208583d8f
commit fbea4e4f9d

View file

@ -741,6 +741,10 @@ class QtColorTriangle(QtWidgets.QWidget):
gdelta = (rc.g - g) / xdist
bdelta = (rc.b - b) / xdist
# Draw 2 more pixels on left side for smoothing
for x in range(lxi - 2, lxi):
buf.setPixel(x, y, QtGui.qRgb(int(r), int(g), int(b)))
# Inner loop 2. Draws the line from left to right.
for x in range(lxi, rxi):
buf.setPixel(x, y, QtGui.qRgb(int(r), int(g), int(b)))
@ -748,6 +752,10 @@ class QtColorTriangle(QtWidgets.QWidget):
g += gdelta
b += bdelta
# Draw 2 more pixels on right side for smoothing
for x in range(rxi, rxi + 3):
buf.setPixel(x, y, QtGui.qRgb(int(r), int(g), int(b)))
def _radius_at(self, pos, rect):
mousexdist = pos.x() - float(rect.center().x())
mouseydist = pos.y() - float(rect.center().y())