Hello,
i would like to load some images and make them "clickable". I'm not talking about "Button", but loaded 32 bit images blitted onto a window.
In the SDK example there is an example that shows how to do this with GIF images.
Any other way to create a clickable (or other events like mouse over) image?
Thank you
The ImageButtons example is not limited to GIF. It loads any type of image for which a datatypes class exists.
The bitmap.image class is not limited to loading picture files, either. It takes several different types of input data.
Thank you, Thomas.
P.S.
I tested and used your Fade example, and it's very nice and quite fast.
I tried to use Png insted of gif, but the transparent area is visible.
There's a way to hide the transparent area using Png in Image Button?
@AmigaBlitter
You need to set BITMAP_Masking to TRUE when creating the bitmap.image to make it use the alpha channel.
If it's the button border that you want to make invisible you should also set BUTTON_BevelStyle to BVS_NONE and BUTTON_Transparent to TRUE on the button.gadget object.
@salass00
i already use these settings in button and image setup:
@AmigaBlitter
Are you sure that your PNG file has a valid alpha channel? If it's a CLUT image with colour 0 as transparent you will want to use BITMAP_Transparent tag instead of BITMAP_Masking.
Also maybe you should clarify what you mean by "hide the transparent area"? I assumed you meant that you wanted the standard window background to show through in these areas but maybe it's something else that you want to happen?
[quote]Also maybe you should clarify what you mean by "hide the transparent area"?/quote]
For transparent area i mean what is commonly used for sprite. Someone refer to it as "alpha channel", someone else as "transparent blitting".
Btw, using BITMAP_Transparent, TRUE, doesn't works either
@AmigaBlitter
The question I asked wasn't what a transparent area is. I am perfectly aware of what that is. What I asked was what exactly you mean when you say want to "hide" them.
Also since you don't seem to be sure what pixel format your PNG image is in maybe you could upload it somewhere so I could look at it, as well as a screenshot of what it looks like currently when used in your program?
Here's the link for the png image. I used Photoshop to create it. Could you suggest a good software that create the images in the right format?
https://skydrive.live.com/redir?resid=62EE0EAB9E6886C5%21733
As you can see, the image i tried to load in the button is a circular object (a ball). But i get a white rectangular border around it.
I tried with different Software to generate the PNG, but the results are always the same. Using GIMP i get a black border around the ball.
@AmigaBlitter
It's a 32-bit PNG alright so it has an alpha channel but currently it's set to fully opaque so it doesn't do any good.
Someone who is more familiar with GIMP might be able to tell you how to use it to edit the alpha channel of your PNG file. Since the pixels that should be fully transparent seem to be all white you could probably use that to create a very rough first alpha channel. After that you probably want to set some of the edge pixels to be semi-transparent rather than fully opaque to get a kind of antialias effect on the edges.
Thank you salass00.
However this is rather strange. I always used this format in Windows and had no problem with every Adobe software. Dunno why i cannot set the alpha properly this time.
Fixed now. It works properly.
Somehow i modified (without realizing it) the creation of a new image (Photoshop/Gimp) with background color, instead of transparent color as it should be.