Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

strokedPath error #189

Open
abu-irrational opened this issue Jan 8, 2024 · 1 comment
Open

strokedPath error #189

abu-irrational opened this issue Jan 8, 2024 · 1 comment
Labels

Comments

@abu-irrational
Copy link

Here is a BL::Path made of a simple BL::Arc of 120 degrees.
Then, from this Path I build a strokedPath with a given width (thickness)
immagine

As you can see, the stroked-path (p2) has a strange glitch, and it is made of 40 vertices (against 7 vertices of path p1).
Here's a test:
// ------------------------------------------------------------------
BLImage render(const BLContextCreateInfo& cci) {
BLImage img(256, 256, BL_FORMAT_PRGB32);
BLContext ctx(img, cci);

ctx.clearAll();

BLPath p1;

double r = 100.0;
double PI=3.1415;

double r1=r/5*4;
BLArc xa = BLArc(r,0,r1,r1,PI*2/3,PI*2/3);
p1.addArc(xa);

// create a dummyContext
//  it requires a minimal dummyImage, too
//  or you won't be able to set options  (--> error INVALID_STATE)
BLImage dummyImage = BLImage(1,1, BL_FORMAT_A8); 

BLContext dummyCtx( dummyImage );
dummyCtx.setStrokeWidth(r/6);

BLStrokeOptions opt;
BLPath p2;
p2.addStrokedPath(p1,dummyCtx.strokeOptions(),blDefaultApproximationOptions);

ctx.setTransform({1,0,0,1,100,100});
ctx.strokePath(p2, BLRgba32(0xFFFFFF00));

printf("p1 size is %ld\n", p1.size());
printf("p2 size is %ld\n", p2.size());

return img;
}

@kobalicek
Copy link
Member

This is unfortunately a limitation of the current stroker (stroking twice just makes it visible).

This should be resolved by the new stroke, which is not ready atm.

@kobalicek kobalicek added the bug label Feb 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants