Author | 
 Topic: Transparent images in dialogue box  (Read 322 times) | 
 
 
 | 
 
 
JB91
 New Member
 
  member is offline
  
 
  
    
    
 Gender:   
Posts: 47 
 | 
  | 
Transparent images in dialogue box 
« Thread started 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
 | 
 
 | 
  Logged
 | 
               
             
            
             
             | 
           
         
         | 
       
     
     | 
   
 
DDRM
 Administrator
 
  member is offline
  
 
  
    
    
 Gender:   
Posts: 321 
 | 
  | 
Re: Transparent images in dialogue box 
« Reply #1 on: Mar 11th, 2017, 9:11pm » | 
 | 
 
 
 
Hi Josh,
  I found a page here:
  http://stackoverflow.com/questions/3988484/how-to-load-a-png-resource-into-picture-control-on-a-dialog-box
  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
 | 
 
 | 
  Logged
 | 
               
             
            
             
             | 
           
         
         | 
       
     
     | 
   
 
David Williams
 Developer
  member is offline
  
  meh 
    
    
 Gender:   
Posts: 452 
 | 
  | 
Re: Transparent images in dialogue box 
« Reply #2 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.
 | 
 
 | 
  Logged
 | 
               
             
            
             
             | 
           
         
         | 
       
     
     | 
   
 
JB91
 New Member
 
  member is offline
  
 
  
    
    
 Gender:   
Posts: 47 
 | 
  | 
Re: Transparent images in dialogue box 
« Reply #3 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...
  http://bbcbasic.conforums.com/index.cgi?action=display&board=ui&num=1489341301&start=0#1489334581
  Thanks, Josh
 | 
 
 | 
  Logged
 | 
               
             
            
             
             | 
           
         
         | 
       
     
     | 
   
 
KenDown
 Full Member
 
  member is offline
  
 
  
    
    
  
Posts: 181 
 | 
  | 
Re: Transparent images in dialogue box 
« Reply #4 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.
 | 
 
 | 
  Logged
 | 
               
             
            
             
             | 
           
         
         | 
       
     
     | 
   
 
 
 |