I can't remember ClanLib 3.0 API, but for ClanLib 4.0 you can't do that automatically.
However there can be workarounds
1. Create a GLSL shader to convert the image to greyscale. This is quite tricky, for various reasons. If interested, the HSVSprite does something similar
2. Manually convert the image (in ClanLib 4.0 speak)
Code:
clan::PixelBuffer pixels(filename);
(pixels should be in rgba8 format)
clan::Size size = pixels.get_size();
for (int ycnt=0; ycny < size.height; ycnt++)
{
unsigned int *ptr = pixels.get_line_uint32(ycnt);
for (int xcnt = 0; xcnt < size.width; xcnt++, ptr++)
{
unsigned char *cptr = (unsigned char *)(ptr);
// NOTE -- I cannot remember the RGBA order in ClanLib 3.0, so these maybe cptr[1], cptr[2] and cptr[3]
int colour = ( cptr[0] + cptr[1] + cptr[2] ) / 6;
cptr[0] = colour;
cptr[1] = colour;
cptr[2] = colour;
}
}
clan::Image image(canvas, pixels, size);
Btw, nobody uses these forums any more.
Bookmarks