TXCairo is a module adding image loading and blitting support to TXLin. This module is implemented using Cairo (hence the name).
Install Cairo via MacPorts:
$ sudo port install cairo
$ sudo port deactivate libiconv -f # this needs to be done ONLY if you've been using the installerCopy the header into /Library/Developer/TXLin/include:
$ sudo cp TXCairo.h /Library/Developer/TXLin/include/Install Cairo:
$ sudo apt-get install libcairo2-dev -yCopy TXCairo.h into /usr/include:
$ sudo cp TXCairo.h /usr/include/CURRENTLY, ONLY PNG IMAGES ARE SUPPORTED
There is one function responsible for loading PNGs and rendering them - txBlitPNG.
Declaration:
bool txBlitPNG(const char* pngIn, HDC dcOut = txDC(), unsigned x = 0, unsigned y = 0)Arguments:
-
const char* pngIn- full path to the PNG file to be loaded. Example:/Users/tim/Pictures/cats/maru.png. -
HDC dcOut(optional) - the surface descriptor pointing to the surface where the picture shall be rendered. -
unsigned x(optional),unsigned y(also optional) - the coordinates of the top left corner of the picture on the surface.
Returns:
true on success, false on failure.
Example:
See demo.cxx for an example and build-demo.sh for build instructions.
There is a function for that, too:
bool txBlitBMP(const char* bmpIn, HDC dcOut = txDC(), unsigned x = 0, unsigned y = 0)Arguments:
-
const char* bmpIn- full path to the BMP file to be loaded. -
HDC dcOut(optional) - the surface descriptor pointing to the surface where the picture shall be rendered. -
unsigned x(optional),unsigned y(also optional) - the coordinates of the top left corner of the picture on the surface.
Returns:
true on success, false on failure.
TXLin License: http://meow.roveramd.com/archives/LICENSE.TXLIN