node-pureimage icon indicating copy to clipboard operation
node-pureimage copied to clipboard

Rendered path rounding some lines?

Open Templarian opened this issue 3 years ago • 1 comments

Expected Behaviour

image

Actual Behaviour

ctx.imageSmoothingEnabled = true; ctx.imageSmoothingEnabled = false;
image image

Steps To Reproduce

  1. Code snippet below, but I'm not sure why it's not rendering the corners. ctx.imageSmoothingEnabled = false; made the path wider, but still left the corners rendering incorrectly.

Any Relevant Code Snippets

const image = PImage.make(24, 24);
const ctx = image.getContext('2d');
ctx.fillStyle = 'black';
ctx.beginPath();
ctx.moveTo(20, 20);
ctx.lineTo(2, 20);
ctx.lineTo(2, 19);
ctx.lineTo(1, 19);
ctx.lineTo(1, 1);
ctx.lineTo(21, 1);
ctx.lineTo(21, 19);
ctx.lineTo(20, 19);
ctx.closePath();
ctx.fill();

Platform

OS: Windows 11 Node Version: 16.14 NPM Version: 8.3.1 PureImage Version: 0.3.14

Any Additional Info

Putting through a larger set of icons shows issues. These render fine with the native Path2D API. As does the example snippet above.

memory-table-22-22

Templarian avatar Aug 28 '22 07:08 Templarian

I just pushed back a patch that hopefully fixes this for you. It was due to the minimum bounds of the polygon being slightly too small in some cases, so the bottom line could be not draw. This is should be fixed now. Please test the latest from head and confirm it works, then I'll publish an updated version.

joshmarinacci avatar Sep 26 '22 21:09 joshmarinacci