Where can I find a simple graphics C library for w

2019-06-21 08:39发布

I need a simple graphics C library to use on a device where I will be writing directly to the frame.

The frame is located in regular memory. There is no graphics acceleration hardware.

Nothing fancy. I just want to be able to draw lines, circles, OSD stuff like strings as well.

It would be nice to have functions that use good, lean algorithms (my CPU is an ARM9 running at 400MHz).

What are some recommendations for this?

7条回答
淡お忘
2楼-- · 2019-06-21 09:24

For very simple needs (lines, circles, polygons, text) I have always just made my own. Check out bresenham's algorithm for lines and circles, Wu's modifications for antialiasing on circles and lines.

Gimp will output C code for images, which is what I do for fonts, and drawing them is pretty easy. I have used anti-aliasing (gimp --> grayscale, use the grayscale value as the alpha), but haven't done proportional fonts. They aren't much harder, and can make the display a bit nicer, but I haven't needed them yet.

Polygons are simply multiple lines, and filled polygons are quite fun to implement.

It's not a lot of work, and you'll grow from the experience.

If, however, you decide you want to render SVG or some other complex vector language, then a library is in order. But for simple things, this isn't complex.

-Adam

查看更多
登录 后发表回答