It is currently Fri Jan 15, 2021 7:09 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Disabled ButtonImageGadget() not shown OK with JPG files
PostPosted: Sat Oct 24, 2020 12:50 am 
Offline
Enthusiast
Enthusiast

Joined: Fri Jun 05, 2020 12:47 am
Posts: 128
Code:
OpenWindow(0,200,200,200,200,"Test",#PB_Window_ScreenCentered|#PB_Window_SystemMenu)

UseJPEGImageDecoder():UsePNGImageDecoder()

i=LoadImage(-1,OpenFileRequester("Choose an JPG or PNG file","","",0))

ButtonImageGadget(0,0,0,80,80,ImageID(i))
ButtonImageGadget(1,100,0,80,80,ImageID(i))
DisableGadget(1,1)

Repeat
   event=WaitWindowEvent()
Until event=#PB_Event_CloseWindow


If a ImageButton is disabled with a PNG image, the image is shown in grey color. But a JPG image-button disabled, is shown... a mess.

Tested only in Windows.


Top
 Profile  
Reply with quote  
 Post subject: Re: Disabled ButtonImageGadget() not shown OK with JPG files
PostPosted: Sat Oct 24, 2020 2:55 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sat May 05, 2007 5:31 pm
Posts: 770
Location: Linz, Austria
The image needs to be 32bit...
Code:
OpenWindow(0,200,200,200,200,"Test",#PB_Window_ScreenCentered|#PB_Window_SystemMenu)

; UseJPEGImageDecoder():UsePNGImageDecoder()
; i=LoadImage(-1,OpenFileRequester("Choose an JPG or PNG file","","",0))

depth = 32;24;

i=CreateImage(#PB_Any, 40, 40, depth, #PB_Image_Transparent)
StartDrawing(ImageOutput(i))
  DrawingMode(#PB_2DDrawing_AllChannels)
  Box(10, 10, 20, 20, RGBA(255, 0, 0, 255))
  Circle(10, 10, 10, RGBA(0, 0, 255, 255))
StopDrawing()

ButtonImageGadget(0,0,0,80,80,ImageID(i))
ButtonImageGadget(1,100,0,80,80,ImageID(i))
DisableGadget(1,1)

Repeat
   event=WaitWindowEvent()
Until event=#PB_Event_CloseWindow

_________________
Et cetera is my worst enemy


Top
 Profile  
Reply with quote  
 Post subject: Re: Disabled ButtonImageGadget() not shown OK with JPG files
PostPosted: Sat Oct 24, 2020 6:59 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sun Apr 05, 2020 11:28 am
Posts: 411
Location: Pandora
Hi, no, this works different
Not a bug

Code:
OpenWindow(0,200,200,200,200,"Test",#PB_Window_ScreenCentered|#PB_Window_SystemMenu)

UseJPEGImageDecoder()
UsePNGImageDecoder()

path$=OpenFileRequester("Choose an JPG or PNG file","","",0)
If path$="" : End : EndIf
i=LoadImage(#PB_Any,path$)

ResizeImage(i, 80, 80)

ii=CreateImage(#PB_Any, 80, 80, 32)
StartDrawing(ImageOutput(ii))
DrawingMode(#PB_2DDrawing_AllChannels)
DrawAlphaImage(ImageID(i), 0, 0)
StopDrawing()

ButtonImageGadget(0,0,0,80,80,ImageID(ii))
ButtonImageGadget(1,100,0,80,80,ImageID(ii))
DisableGadget(1,1)

Repeat
  event=WaitWindowEvent()
Until event=#PB_Event_CloseWindow


Or with colored background, this is recommended
Code:
OpenWindow(0,200,200,200,200,"Test",#PB_Window_ScreenCentered|#PB_Window_SystemMenu)

UseJPEGImageDecoder()
UsePNGImageDecoder()

path$=OpenFileRequester("Choose an JPG or PNG file","","",0)
If path$="" : End : EndIf
i=LoadImage(#PB_Any,path$)

ResizeImage(i, 80, 80)

ii=CreateImage(#PB_Any, 80, 80, 32, #White)
StartDrawing(ImageOutput(ii))
DrawAlphaImage(ImageID(i), 0, 0)
StopDrawing()

ButtonImageGadget(0,0,0,80,80,ImageID(ii))
ButtonImageGadget(1,100,0,80,80,ImageID(ii))
DisableGadget(1,1)

Repeat
  event=WaitWindowEvent()
Until event=#PB_Event_CloseWindow

_________________
地球上の平和


Top
 Profile  
Reply with quote  
 Post subject: Re: Disabled ButtonImageGadget() not shown OK with JPG files
PostPosted: Sat Oct 24, 2020 11:54 pm 
Offline
Enthusiast
Enthusiast

Joined: Fri Jun 05, 2020 12:47 am
Posts: 128
Thx!


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye