Lisp HUG Maillist Archive

Transparency in button images?

Hi everyone,

I have a toolbar and instead of using regular buttons i want to have images instead, from looking at some of the examples that ship with LWW5.1 and from looking at the documentation it seems the only way to have images with transparency is by using BMP files with 256 colors and specifying :transparent-index-color on the call to read-external-image, is this so? Before this i tried loading a PNG file but got some error when i tried putting them on the toolbar buttons.

Thank for the help,

Alex Paes

Re: Transparency in button images?

To workaround this problem, I use this :

(defun read-and-convert-png-image (port file)
  (let ((ext (read-external-image file)))
    (when-let (buffer (slot-value ext Œgp::data))
      (when (> (length buffer) 0) ;this is just to avoid corrupted files
        (setf (slot-value ext Œgp::type) nil)
        (convert-external-image port ext)))))

It works for me (on lwm5.1)

Best

Denis


Le 6/04/10 18:59, « [NOM] » <[ADRESSE]> a écrit :

> Hi everyone,
> 
> I have a toolbar and instead of using regular buttons i want to have images
> instead, from looking at some of the examples that ship with LWW5.1 and from
> looking at the documentation it seems the only way to have images with
> transparency is by using BMP files with 256 colors and specifying
> :transparent-index-color on the call to read-external-image, is this so?
> Before this i tried loading a PNG file but got some error when i tried putting
> them on the toolbar buttons.
> 
> Thank for the help,
> 
> Alex Paes
> 


-------------------------------------------------------
Denis Pousseur
70 rue de Wansijn
1180 Bruxelles, Belgique

Tel : 32 (0)2 219 31 09
Mail :  denis.pousseur@gmail.com
-------------------------------------------------------



Re: Transparency in button images?

Hi Dennis,

Thank you for your code sample, i will see how i can integrate this with my application.

Cheers,

Alex Paes

On Tue, Apr 6, 2010 at 6:14 PM, Denis Pousseur <denis.pousseur@gmail.com> wrote:
To workaround this problem, I use this :

(defun read-and-convert-png-image (port file)
 (let ((ext (read-external-image file)))
   (when-let (buffer (slot-value ext Œgp::data))
     (when (> (length buffer) 0) ;this is just to avoid corrupted files
       (setf (slot-value ext Œgp::type) nil)
       (convert-external-image port ext)))))

It works for me (on lwm5.1)

Best

Denis


Le 6/04/10 18:59, « [NOM] » <[ADRESSE]> a écrit :

> Hi everyone,
>
> I have a toolbar and instead of using regular buttons i want to have images
> instead, from looking at some of the examples that ship with LWW5.1 and from
> looking at the documentation it seems the only way to have images with
> transparency is by using BMP files with 256 colors and specifying
> :transparent-index-color on the call to read-external-image, is this so?
> Before this i tried loading a PNG file but got some error when i tried putting
> them on the toolbar buttons.
>
> Thank for the help,
>
> Alex Paes
>


-------------------------------------------------------
Denis Pousseur
70 rue de Wansijn
1180 Bruxelles, Belgique

Tel : 32 (0)2 219 31 09
Mail :  denis.pousseur@gmail.com
-------------------------------------------------------



Updated at: 2020-12-10 08:39 UTC