A NewB.
In the following code when I display a ImageGadget that has a 32 bit image depth, all my Canvas container gadgets are greyed-out.
I do not think this is normal, this may be a bug, but I am a newb and the mistake maybe because of my lack of Purebasic knowledge.
Please run and review the code that I posted and explain to me what my mistake is, or give pointers on where to find the answer.
Thanks in advance.
If this is a bug, could an administrator please move this topic to the appropriate bug report.
Thanks again for any assistants.
Note: I only tested the code on PureBasic6.00 Beta 7(x86).
Code: Select all
EnableExplicit
Procedure.i OtherImage(imgW.i, imgH.i, imgD.i = 24)
Protected img = CreateImage(#PB_Any, imgW, imgH, imgD)
If IsImage(img)
StartDrawing(ImageOutput(img))
Box(0, 0, imgW, imgH, $ECE9D8)
DrawingMode(#PB_2DDrawing_Gradient)
BackColor(RGB(255, 0, 0))
FrontColor(RGB(128, 0, 0))
CircularGradient(40,40, 40)
Circle(50, 50, 16)
DrawRotatedText(13, 2, "Other", 315, RGB(255, 0, 0))
DrawRotatedText(70, 58, "Image", 315, RGB(255, 0, 0))
StopDrawing()
Else
MessageRequester("OtherImage Error", "variable img is not a valid image object", #PB_MessageRequester_Ok|#PB_MessageRequester_Warning)
EndIf
ProcedureReturn img
EndProcedure
If OpenWindow(0, 0, 0, 500, 400, "Test Canvas Container and ImageGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
;SetWindowColor(0, RGB(240, 255, 255)); un-comment this line, then only image with depth 32 is greyed-out on Canvas
Define loadedImg
Define imgFileName.s = #PB_Compiler_Home + "examples\sources\Data\PureBasic.bmp"
CanvasGadget(#PB_Any, 0, 0, 300, 400, #PB_Canvas_Container) ; comment line and all ImageGadgets are displayed
TextGadget(#PB_Any, 5, 0, 390, 25, "Canvas Container Gadgets", #PB_Text_Border|#PB_Text_Center)
loadedImg = LoadImage(#PB_Any, imgFileName)
If IsImage(loadedImg)
ImageGadget(#PB_Any, 50, 40, 200, 100, ImageID(loadedImg)) ; image depth 24 bits
EndIf
ImageGadget(#PB_Any, 10, 150, 200, 100, ImageID(OtherImage(100, 100))) ; image depth 24 bits
; Comment the following line and Canvas gadgets are Not greyed-out
ImageGadget(#PB_Any, 150, 260, 200, 100, ImageID(OtherImage(100, 100, 32))) ; image depth 32 bits
CloseGadgetList() ; comment this line and CanvasGadget line, then all Gadgets are shown correctly (eliminate the Canvas Container)
; Other MainWindow gadgets
TextGadget(#PB_Any, 305, 25, 190, 25, "MainWindow Other Gadgets", #PB_Text_Border|#PB_Text_Center)
; Comment SetWindowColor line and the Canvas ImageGadet that has a image depth of 32 bits, then
; un-comment the following line and the Canvas gadgets will be greyed-out as well. Mysterious behavior.
;ImageGadget(#PB_Any, 310, 260, 200, 100, ImageID(OtherImage(100, 100, 32))) ; image depth 32 bits
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf