GSoC/GCI Archive
Google Code-in 2012 Copyleft Games Group

PySoy: Load RGBA Texture

completed by: Matt Habel

mentors: Amaury Medeiros, Arc Riley, Tony Young, David Czech, Mayank Singh

We use Cairo to load PNG and SVG files into soy.textures.Texture, however Cairo uses a strange "BGRA" internal storage format which we need to copy into an OpenGL texture for rendering. This is an ideal use of Orc: a src and dst array, nested loops, and copying individual bytes.

Write a new function in Orc to copy the A (Alpha) component, then RGB values multiplied by (255/A) since they're provided with the alpha already applied. This new function should go in libsoy/src/textures/Texture.orc and then get called from libsoy/src/textures/Texture.gs within the _copySurface method for RGBA surfaces.

While working on this task you should join and remain in #PySoy on Freenode to get help, feedback, and guidance from mentors and other developers. Code updates which may affect your work are also announced here as they happen.

When you've done, commit your work and post the resulting changeset url to this task.