y-a-v-a / node-gd

🎨 GD graphics library (libgd) C++ bindings for Node.js.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to antialiasing the polygon

MrMaxorz opened this issue · comments

Screen Shot 2565-08-23 at 15 38 59

When I draw polygon it has edges. I want to antialias polygon's boundary edge.
How to antialiasing or do something to make polygon's corners smooth?

Hi I have taken a look in https://github.com/libgd/libgd/ but I cannot find code there that would suggest a way to round those corners. There might be a way to turn on anti-aliasing so the edges of the line are more smooth. As far as I can see in this code from libgd, you should set an anti-aliased color and then use that in drawing:
https://github.com/libgd/libgd/blob/167ea1f4f0003f3e9f7ca1e586189e99cf33d47f/src/gd.c#L3910
The equivalent in node-gd can be found here: https://github.com/y-a-v-a/node-gd/blob/master/docs/index.md#gdimagesetantialiasedcolor

Regards,
Vincent

Thanks for your response.
I'll try setting an anti-aliased color I'll review how it works or not.