[Liboil] rgb2rgba not working ?

Stephane Fillod f8cfe at free.fr
Sun Dec 10 04:16:40 PST 2006


Sat, Dec 09, 2006 at 10:07:54PM +0100, salsaman skribis:
> Hi,
> I just started using liboil as an optional library for my the project I
> develop, LiVES (http://lives.sourceforge.net).
> 
> I am using liboil 0.3.10, and rgb2rgba seems not to work.
> 
> The code in question is:
> 
>    oil_rgb2rgba(dest,src,width*height);
> 
> dest and src are both correctly sized unsigned char *, and width and
> height are both correct. However dest is not touched at all. Other oil
> functions work OK.
> 
> I am wondering if this is a known issue.

Works fine here:


#include <liboil/liboil.h>
#include <stdio.h>

unsigned char src[6] = { 0x11, 0x22, 0x33, 0xaa, 0xbb, 0xcc };
unsigned char dest[8];

int main(int argc, char *argv[])
{
  oil_init();

  printf("RGB: %x-%x-%x    %x-%x-%x\n",
	  src[0],src[1],src[2],src[3],src[4],src[5]);
  printf("RGBA:%02x-%02x-%02x-%02x %02x-%02x-%02x-%02x\n\n",
	  dest[0],dest[1],dest[2],dest[3],dest[4],dest[5],dest[6],dest[7]);

  oil_rgb2rgba (dest, src, 2);

  printf("RGB: %x-%x-%x    %x-%x-%x\n",
	  src[0],src[1],src[2],src[3],src[4],src[5]);
  printf("RGBA:%02x-%02x-%02x-%02x %02x-%02x-%02x-%02x\n",
	  dest[0],dest[1],dest[2],dest[3],dest[4],dest[5],dest[6],dest[7]);

  return 0;
}

RGB: 11-22-33    aa-bb-cc
RGBA:00-00-00-00 00-00-00-00

RGB: 11-22-33    aa-bb-cc
RGBA:11-22-33-ff aa-bb-cc-ff

-- 
Stephane


More information about the Liboil mailing list