views:

87

answers:

5

I need a simple graphics library that supports the following functionality:

  1. Ability to draw polygons (not just rectangles!) with RGBA colors (i.e., partially transparent),
  2. Ability to load bitmap images,
  3. Ability to read current color of pixel in a given coordinate.

Ideally using JavaScript or Python.

Seems like HTML 5 Canvas can handle #2 and #3 but not #1, whereas SVG can handle #1 and #2 but not #3. Am I missing something (about either of these two)? Or are there other alternatives?

A: 

maybe Raphael - http://raphaeljs.com/reference.html

wuzel109
How does it do #3? It's a very thin wrapper on SVG and VML, so if Raphael can do it, then SVG could already do it.
Ken
+2  A: 

PyGame can do all of those things. OTOH, I don't think it embeds into a GUI too well.

phkahler
A: 

I voted for PyGame, but I would also like to point out that the new QT graphics library seems quite capable. I have not used PyQT with QT4 yet, but I really like PyQT development with QT3.

gomad
A: 

I ended up going with Canvas. The "secret" of polygons is using paths. Thanks, "tur1ng"!

M. Elkstein
A: 

GameJs does that and more - it's similar to the mentioned PyGame.

http://gamejs.org

oberhamsi