ajstarks/openvg — pull request #9 by genbattle (2013-08-04 14:47:23+00:00)
Title: Miscellaneous changes

Hey, just thought I'd push some changes I made upstream, mainly for the Go side of things.

The main new features are:
- New function (ImageGo) that takes an image.Image. This allows images already loaded into memory (e.g. from an http POST) to be displayed directly. In the future I'd like to take this a step further and create an openvg.Image object which is stored in Video memory instead of main memory to vastly increase image rendering speed.
- Translation, rotation, scaling, and shearing now also apply to images and text. I debated creating additional functions to set the scaling values for each of these different resource types or using the VG_MATRIX_MODE as an additional parameter for these functions, but decided it was best to keep the API simple by just setting them all to the same value.

Additional fixes/changes:
- Changed all float64 values to float32. As defined in the OpenVG API specification VGfloat is only 32 bits wide, not 64. Using larger float values in Go can lead to an increase in space and processing time used to manipulate the values (especially on something as diminutive as the Pi), but I think it's also important that people using the API realise that they're only getting single-precision float accuracy with OpenVG.
- Removed width and height from the Image() function call in Go; the fact that the image is at some point stored as a Go image.Image means the bounds of the image are available anyway, and if they were set to anything other than the image size they would just cause weirdness when trying to display the image. The Go API now automatically pulls the image size from images and pushes it through to the C API.

I hope you'll find these changes useful and helpful. Let me know if there's any further adjustments or changes you'd like me to make.