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

need a pen that does not scale #29

Closed
Wiladams opened this issue May 6, 2019 · 2 comments
Closed

need a pen that does not scale #29

Wiladams opened this issue May 6, 2019 · 2 comments

Comments

@Wiladams
Copy link

Wiladams commented May 6, 2019

I have been trying to draw some graphics that are designed for a unit 1x1 and then scaled to the appropriate size at runtime. The challenge I have is the pen needs to be a hairline pen (one pixel wide no matter the scaling). Right now, the pen will scale with the scaling of the graphic, and I don't see a way to specify 'no-scaling' for the pen.

One way I've found is to specify a strokeWidth that is a fraction of the intended size, so it almost looks right, but that's not ideal as the x and y scaling will be applied differently, and I don't know at design time what scale something is going to have.

Is there a way to more accurately controle the stroke in this way?

@kobalicek
Copy link
Member

kobalicek commented May 6, 2019

Yes this is supported through TransformOrder property:

blContextSetStrokeTransformOrder(context, BL_STROKE_TRANSFORM_ORDER_BEFORE);

I believe it does exactly what you would expect, it changes the order of transformation so the input is transformed before the stroke path is calculated.

@Wiladams
Copy link
Author

Wiladams commented May 6, 2019

Just tried this. Works like a charm! Now that I know this, I'll explore some of the other transformation stuff. In particular the ones on images, paths, and patterns.

@Wiladams Wiladams closed this as completed May 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants