[cairo] Pixmaps and colortables
Kees Kling
ckling at upcmail.nl
Wed Jul 4 01:33:17 PDT 2012
Hi,
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());
dataset->getPixelData(buffer);
Cairo::RefPtr<Cairo::ImageSurface> sfc =
Cairo::ImageSurface::create(buffer,Cairo::FORMAT_A8,
dataset->GetRasterXSize(),
dataset->GetRasterYSize(), dataset->GetRasterXSize());
cr->set_source(sfc,0,0);
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
Regards
Kees Kling
More information about the cairo
mailing list