BBC BASIC for Windows
Programming >> User Interface >> Transparent images in dialogue box http://bb4w.conforums.com/index.cgi?board=ui&action=display&num=1489267069 Transparent images in dialogue box
Post by JB91 on Mar 11th, 2017, 8:17pm
Hello,
The main help documentation describes how to display a bitmap image in a dialogue box, however, it cannot seem to display images with a transparent background properly.
How could you adapt the code to display a transparent image?
Thanks, Josh
Re: Transparent images in dialogue box
Post by DDRM on Mar 11th, 2017, 9:11pm
that might be useful. It suggests that it should be possible using a 32 BPP bitmap with transparency data - is that what you have tried?
You might be better asking Richard, on the crossplatform conforum - he has absented himself from this one. Your best bet here is probably David Williams - David, any thoughts?
Best wishes,
D
Re: Transparent images in dialogue box
Post by David Williams on Mar 12th, 2017, 03:07am
I have no experience with programming Windows dialogue boxes or windowed applications. I agree that it would be worthwhile asking Richard.
Re: Transparent images in dialogue box
Post by JB91 on Mar 17th, 2017, 6:09pm
Quote:
It suggests that it should be possible using a 32 BPP bitmap with transparency data - is that what you have tried?
Only certain types of .bmp files seem to work with the LoadImage SYS call I have been using:
Code:
SYS "LoadImage", 0, "image.bmp", 0, cx%, cy%, LR_LOADFROMFILE TO hbitmap%
But I'm not too sure which types of .bmp files work.
However, here is a link to a solution from Richard over on the other forum...
Thanks, Josh
Re: Transparent images in dialogue box
Post by KenDown on Mar 22nd, 2017, 5:48pm
I don't know how you are generating your images. I know that when I use the Gimp and tell it to save a .bmp image, it comes up with half a dozen different options, only one of which works with BBC BASIC (or perhaps, with Windows). The trouble is that I can't remember what the preferred options are - I must write them down next time I do it - but a bit of experimenting will get you there in the end.
Oh, and the easiest way of producing a transparent image is to create a new layer from visible, then make the lower layer invisible (click on the eye symbol up on top right) and delete the areas in the top layer that you want to be invisible.