From: Anthony R. J. B. <an...@su...> - 2001-10-29 21:28:21
|
Yeah, my initial thought was that setting the context color before creating an image would do it, but no... it might not be a bad way to have it work in the future, though... On Mon, Oct 29, 2001 at 08:37:41PM +0000, Tom Gilbert wrote: > * Anthony R. J. Ball (an...@su...) wrote: > > > > Hello... I'm using imlib2 (with the perl module) > > and I was just wondering how I would go about changing > > the default color when an image is created. I.E. instead > > of black have new image be blue or, more importantly, > > transparent. The only way I have managed to get a transparent > > image so far is to load an existing one and scale it to > > my needs, but there must be a better way... > > There is no way to do this, but I agree that there should be. Especially > creating a transparent image. Right now, you can do something like > this: (excerpt modified from geist) > > Imlib_Image im; > DATA8 atab[256]; > Imlib_Color_Modifier cm; > > im = imlib_create_image(w, h); > imlib_context_set_image(im); > imlib_image_set_has_alpha(1); > memset(atab, 0, sizeof(atab)); > cm = imlib_create_color_modifier(); > imlib_context_set_color_modifier(cm); > imlib_set_color_modifier_tables(NULL, NULL, NULL, atab); > imlib_apply_color_modifier_to_rectangle(0, 0, w, h); > > You might prefer to use giblib, using that, the code above looks like: > > Imlib_Image im; > DATA8 atab[256]; > > im = imlib_create_image(w, h); > gib_imlib_image_set_has_alpha(im, 1); > memset(atab, 0, sizeof(atab)); > gib_imlib_apply_color_modifier_to_rectangle(im, 0, 0, w, h, > NULL, NULL, NULL, atab); > > Tom. > -- > .^. .-------------------------------------------------------. > /V\ | Tom Gilbert, London, England | http://linuxbrit.co.uk | > /( )\ | Open Source/UNIX consultant | to...@li... | > ^^-^^ `-------------------------------------------------------' > > _______________________________________________ > enlightenment-devel mailing list > enl...@li... > https://lists.sourceforge.net/lists/listinfo/enlightenment-devel -- ___ __ __ __ _ _ ____ _ _ ____ ____ / __)( )( ) /__\( \/ )( ___) ( \( )( ___)(_ _) \__ \ )(__)( /(__)\\ / )__) ) ( )__) )( (___/(______)(__)(__)\/ (____)()(_)\_)(____) (__) If practice makes perfect, and nobody's perfect, why practice? |