Skip to content

humansinput/txcairo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

TXCairo

TXCairo is a module adding image loading and blitting support to TXLin. This module is implemented using Cairo (hence the name).

Installation (on macOS)

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 installer

Copy the header into /Library/Developer/TXLin/include:

$ sudo cp TXCairo.h /Library/Developer/TXLin/include/

Installation (on Linux)

Install Cairo:

$ sudo apt-get install libcairo2-dev -y

Copy TXCairo.h into /usr/include:

$ sudo cp TXCairo.h /usr/include/

Usage

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.

BMP support

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.

About

Image rendering module for TXLin implemented using Cairo graphics library.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors