mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
Adds comments to Stroke tool for drawing lines.
This commit is contained in:
parent
e819503cc5
commit
cd560012e1
@ -97,11 +97,13 @@
|
|||||||
linePixels = pskl.PixelUtils.getLinePixels(col, this.startCol, row, this.startRow);
|
linePixels = pskl.PixelUtils.getLinePixels(col, this.startCol, row, this.startRow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//draw the square ends of the line
|
||||||
pskl.PixelUtils.resizePixel(linePixels[0].col, linePixels[0].row, penSize)
|
pskl.PixelUtils.resizePixel(linePixels[0].col, linePixels[0].row, penSize)
|
||||||
.forEach(function (point) {targetFrame.setPixel(point[0], point[1], color);});
|
.forEach(function (point) {targetFrame.setPixel(point[0], point[1], color);});
|
||||||
pskl.PixelUtils.resizePixel(linePixels[linePixels.length - 1].col, linePixels[linePixels.length - 1].row, penSize)
|
pskl.PixelUtils.resizePixel(linePixels[linePixels.length - 1].col, linePixels[linePixels.length - 1].row, penSize)
|
||||||
.forEach(function (point) {targetFrame.setPixel(point[0], point[1],color);});
|
.forEach(function (point) {targetFrame.setPixel(point[0], point[1],color);});
|
||||||
|
|
||||||
|
//for each step along the line, draw an x centered on that pixel of size penSize
|
||||||
linePixels.forEach(function (point) {
|
linePixels.forEach(function (point) {
|
||||||
for (var i = 0; i < penSize; i++) {
|
for (var i = 0; i < penSize; i++) {
|
||||||
targetFrame.setPixel(
|
targetFrame.setPixel(
|
||||||
@ -110,6 +112,7 @@
|
|||||||
targetFrame.setPixel(
|
targetFrame.setPixel(
|
||||||
point.col - Math.floor(penSize / 2) + i, point.row + Math.ceil(penSize / 2) - i - 1, color
|
point.col - Math.floor(penSize / 2) + i, point.row + Math.ceil(penSize / 2) - i - 1, color
|
||||||
);
|
);
|
||||||
|
//draw an additional x directly next to the first to prevent unwanted dithering
|
||||||
if (i !== 0) {
|
if (i !== 0) {
|
||||||
targetFrame.setPixel(
|
targetFrame.setPixel(
|
||||||
point.col - Math.floor(penSize / 2) + i, point.row - Math.floor(penSize / 2) + i - 1, color
|
point.col - Math.floor(penSize / 2) + i, point.row - Math.floor(penSize / 2) + i - 1, color
|
||||||
|
Loading…
Reference in New Issue
Block a user