blend2d / blend2d

2D Vector Graphics Engine Powered by a JIT Compiler

Home Page:https://blend2d.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

close() on path doesn't interact with stroking as expected.

smcallis opened this issue · comments

The close() command on BLPath says that it works like the 'Z' command in SVG and links here. Which indicates that stroking a closed path should join back to the start of the curve. But if I don't manually do a lineTo back to the start, my strokes don't paint fully, which you can see here:

image

Interesting. I couldn't observe this behavior, so I think this would need a snippet that can reproduce it.

For example this fiddle snippet produces the correct output:

BLImage render(const BLContextCreateInfo& cci) {
  BLImage img(500, 500, BL_FORMAT_PRGB32);
  BLContext ctx(img, cci);

  ctx.clearAll();

  BLPath p;
  p.moveTo(200, 100);
  p.lineTo(300, 200);
  p.lineTo(100, 200);
  p.close();

  p.moveTo(200, 300);
  p.lineTo(300, 400);
  p.lineTo(100, 400);
  p.close();

  ctx.strokePath(p, BLRgba32(0xFFFFFFFF));

  return img;
}

I haven't been able to reproduce this so I think it must have been on my end, though I'm not sure exactly how. I'll refile if I come across a reproduction.