pytroll / aggdraw

Python package wrapping AGG2 drawing functionality

Home Page:https://aggdraw.readthedocs.io/en/latest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

is there a way to draw squircle (rectangle with rounded edges) ?

ahmed4end opened this issue · comments

is there a way to draw squircle (rectangle with rounded edges) ?

Do you have more details on your question? For example...what is a squircle?

@djhoese squircle is a rectangle with rounded edges

This is not the answer you are looking for, but I don't think I (one of the maintainers of this project) know exactly. I've done the bare minimum to keep this library available, but don't actually know how to do most things with it. Here are the methods you can call from the Draw object:

aggdraw/aggdraw.cxx

Lines 1735 to 1750 in bd751fc

{"line", (PyCFunction) draw_line, METH_VARARGS, draw_line_doc},
{"polygon", (PyCFunction) draw_polygon, METH_VARARGS, draw_polygon_doc},
{"rectangle", (PyCFunction) draw_rectangle, METH_VARARGS, draw_rectangle_doc},
#if defined(HAVE_FREETYPE2)
{"text", (PyCFunction) draw_text, METH_VARARGS, draw_text_doc},
{"textsize", (PyCFunction) draw_textsize, METH_VARARGS, draw_textsize_doc},
#endif
{"path", (PyCFunction) draw_path, METH_VARARGS, draw_path_doc},
{"symbol", (PyCFunction) draw_symbol, METH_VARARGS, draw_symbol_doc},
{"arc", (PyCFunction) draw_arc, METH_VARARGS, draw_arc_doc},
{"chord", (PyCFunction) draw_chord, METH_VARARGS, draw_chord_doc},
{"ellipse", (PyCFunction) draw_ellipse, METH_VARARGS, draw_ellipse_doc},
{"pieslice", (PyCFunction) draw_pieslice, METH_VARARGS, draw_pieslice_doc},

So you can create a rectangle directly from this or you could use a Symbol to define an SVG element: https://aggdraw.readthedocs.io/en/latest/#aggdraw.Symbol
You could also look at the various Pen options for how the line joins should be done:
https://aggdraw.readthedocs.io/en/latest/#aggdraw.Pen

Last resort, you can define the exact line paths yourself.

Side note: I don't remember why, but the Draw methods aren't showing up in the docs, sorry.

@djhoese cool, i will mess around with funcs to create it, thanks for keeping the awesome lib alive ♥