[cairo] Pixmaps and colortables

Kees Kling ckling at upcmail.nl
Wed Jul 4 01:33:17 PDT 2012


I'm using cairo with Gtkmm and I need to display images from in memory 
data. Searched a lot, but can't find the correct functions

Here a snippet of my example code, which doesn't work;

unsigned char* buffer = (unsigned char*) CPLMalloc(sizeof(char) * 
dataset->GetRasterXSize() *
             dataset->GetRasterYSize() * dataset->GetRasterCount());


Cairo::RefPtr<Cairo::ImageSurface> sfc = 
dataset->GetRasterYSize(), dataset->GetRasterXSize());

buffer is just a char array, filled from the dataset. Result is a 
greyscaled but correct image. I need a color image and colors must be 
specified in a colortable , and I need full access to that table.

Is there a way to do it


Kees Kling

More information about the cairo mailing list