Code: Select all
If OpenWindow(0, 0, 0, 300,300, "Test Canvas RGBA (alpha in 24bit)", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
c.i = 0
c1.i = 0
b1.i = RGBA(Random(255),Random(105), 0, 100)
b2.i = RGBA(0, Random(255), Random(105), 100)
CanvasGadget(0, 10, 10, 280, 280, #PB_Canvas_Container)
If StartDrawing(CanvasOutput(0))
DrawingMode(#PB_2DDrawing_AlphaBlend)
Box(30, 50, 150, 150 ,b1)
Box(100, 120, 150, 150 ,b2)
DrawingMode(#PB_2DDrawing_AllChannels)
c = Point(120,140)
DrawText(10, 10, Str(b1),RGBA(255,255,255,255),b1)
DrawText(100, 10, Str(b2),RGBA(255,255,255,255),b2)
DrawText(190, 10, Str(c),RGBA(255,255,255,255),c)
Box(130, 145, 5, 5 ,c)
StopDrawing()
EndIf
;#########################################################
If OpenWindow(1, WindowX(0) + 330,WindowY(0) , 300,300, "Test ImageGadget 32bit", #PB_Window_SystemMenu)
If CreateImage(1,280, 280 ,32,#PB_Image_Transparent)
StartDrawing(ImageOutput(1))
DrawingMode(#PB_2DDrawing_AlphaBlend)
Box(30, 50, 150, 150 ,b1)
Box(100, 120, 150, 150 ,b2)
DrawingMode(#PB_2DDrawing_AllChannels)
c1 = Point(130,140)
DrawText(10, 10, Str(b1),RGBA(255,255,255,255),b1)
DrawText(100, 10, Str(b2),RGBA(255,255,255,255),b2)
DrawText(190, 10, Str(c1),RGBA(255,255,255,255),c1)
StopDrawing()
ImageGadget(1, 10, 10, 280, 280, ImageID(1))
EndIf
EndIf
Repeat
Event = WaitWindowEvent()
If Event = #PB_Event_Gadget
Select EventGadget()
Case 0
If EventType() = #PB_EventType_LeftButtonDown Or (EventType() = #PB_EventType_MouseMove And GetGadgetAttribute(0, #PB_Canvas_Buttons) & #PB_Canvas_LeftButton)
If StartDrawing(CanvasOutput(0))
x = GetGadgetAttribute(0, #PB_Canvas_MouseX)
y = GetGadgetAttribute(0, #PB_Canvas_MouseY)
c = Point(x,y)
DrawText(10, 20, Space(20),#White,#White)
DrawText(10, 20, Str(c),#White,c)
StopDrawing()
EndIf
EndIf
EndSelect
EndIf
Until Event = #PB_Event_CloseWindow
EndIf