Do I need to do anything special to be able to display a layer with a png brush containing transparent areas properly?
The computer on the desk is supposed to light up when the mouse pointer is over it. Which it does, but the area around
it is also affected. I've simply used a curves modifier in gimp to the relevant portion on the image and isolated it from the background. But almost looks as if the alpha layer is carrying that information with it even though I cut out the area around it.
This is what I get:
https://drive.google.com/file/d/1sW1CZj ... sp=sharing
And this is a screengrab (in order to show the transparent area properly) of the png I am trying to display:
https://drive.google.com/file/d/1rYGfdp ... sp=sharing
What's going on here?
Problem with PNG with alpha channel
Re: Problem with PNG with alpha channel
Maybe you're not loading the alpha-channel in your Hollywood script; or maybe you're not saving it correctly in GIMP.
If you upload the image with the transparency to Google Drive and paste some lines from your script (the code that you are using to load and display that image), then I (or someone else here) should be able to figure out what's going wrong.
If you upload the image with the transparency to Google Drive and paste some lines from your script (the code that you are using to load and display that image), then I (or someone else here) should be able to figure out what's going wrong.
Re: Problem with PNG with alpha channel
Okay, thanks.
Here's the image:
https://drive.google.com/file/d/18twPcx ... sp=sharing
This is the relevant code:
I didn't notice any options for adding an alpha layer in the documentation when using layers. But I am just learning so I might have missed a whole bunch of things.
Here's the image:
https://drive.google.com/file/d/18twPcx ... sp=sharing
This is the relevant code:
Code: Select all
Function p_Stage01()
SetMusicVolume(2, VolMus)
@BGPIC 2, "Stage01.jpg"
@MUSIC 2, "Ambience_01.ogg"
@BRUSH 1, "terminal_hilight.png"
DisplayBGPic(2)
PlayMusic(2, 0)
MakeButton(1, #SIMPLEBUTTON, 20, 250, 120, 120, {OnMouseOver = p_Stage01EventFunc, OnMouseDown = p_Stage01EventFunc, OnMouseOut = p_Stage01EventFunc})
/* InstallEventHandler({OnMouseOver, OnMouseOut, OnMouseDown = p_Stage01EventFunc}) -------- Redundant*/
EndFunction
Function p_Stage01EventFunc(msg)
Switch msg.action
Case "OnMouseOver":
/* DisplayBrush(1, 0, 209, {LoadAlpha = True}) --- Removed */
InsertLayer(1, #BRUSH, 1, 0, 208, TRUE)
ShowLayer(1)
PlaySample(1, {Volume = VolSnd})
Case "OnMouseOut":
HideLayer(1)
Case "OnMouseDown":
PlaySample(2, {Volume = VolSnd})
StopMusic(2)
HideLayer(1)
Stage = 0
p_MainMenu()
EndSwitch
EndFunction
Re: Problem with PNG with alpha channel
PowerBook 5.2 MorphOS 3.15
PowerBook 5.8 MorphOS 3.15
Amiga 1200 BPPC/BVision AOS4.1 FE
PowerBook 5.8 MorphOS 3.15
Amiga 1200 BPPC/BVision AOS4.1 FE
Re: Problem with PNG with alpha channel
Beautiful! Thank you so much!emeck wrote: ↑Sat Feb 13, 2021 8:50 am Hello
Try withCode: Select all
@BRUSH 1, "terminal_hilight.png", {LoadAlpha = True}
Re: Problem with PNG with alpha channel
Notice also that if it still fails even after LoadAlpha=true, then problem is likely how you have saved the png. I myself have several times ran into this problem where code works right but I have saved the image file itself wrong way. In Gimpfor example it has this checkbox on pngs that needs to be checked to save that alpha channel info.
Re: Problem with PNG with alpha channel
And also, you might be able to use SetLayerTransparency() command to do some trick as well.
That to use your current image as an example.
You could make it have double the amount of light it now has.
Then when you show it on OnMouseOver, you could also add SetLayerTransparency(1, 126)
and then when OnMouseDown, you could SetLayerTransparency(1, 0)
this way you could be using same image to have two different highlights. First one would be the OnMouseOver which would be showing the picture with halftransparency, making it look like having half the light.
Then on OnMouseDown you would show the image without any transparency (0) which would look like it is brighter than the previous transparency level.
This way in case you want different amounts of highlight, you can have them without having more than one image.
That to use your current image as an example.
You could make it have double the amount of light it now has.
Then when you show it on OnMouseOver, you could also add SetLayerTransparency(1, 126)
and then when OnMouseDown, you could SetLayerTransparency(1, 0)
this way you could be using same image to have two different highlights. First one would be the OnMouseOver which would be showing the picture with halftransparency, making it look like having half the light.
Then on OnMouseDown you would show the image without any transparency (0) which would look like it is brighter than the previous transparency level.
This way in case you want different amounts of highlight, you can have them without having more than one image.