![]() Y = GetGadgetAttribute(0, #PB_Canvas_MouseY) X = GetGadgetAttribute(0, #PB_Canvas_MouseX) If EventType() = #PB_EventType_LeftButtonDown Or (EventType() = #PB_EventType_MouseMove And GetGadgetAttribute(0, #PB_Canvas_Buttons) & #PB_Canvas_LeftButton) RedoRandomAlphaDrawing(#workingAlphaImageNum) If CreateImage(#workingAlphaImageNum, #canvasW, #canvasH, 32, #White) create working image with alpha (32-bit) this is the 'shadow canvas' where real drawing takes place If OpenWindow(0, 0, 0, #canvasW + 20, #canvasH + 20, "Test Canvas RGBA (alpha in 24bit) v0.2", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)ĬanvasGadget(0, 10, 10, #canvasW, #canvasH, #PB_Canvas_Container) SetGadgetAttribute(0, #PB_Canvas_Image, ImageID(#workingAlphaImageNum)) If IsImage(imageNum) And StartDrawing(ImageOutput(imageNum))īox(0, 0, OutputWidth(), OutputHeight(), #White)īox(29, 49, 222, 222, RGBA(240, 240, 240, 0)) make an area with less alpha to show later blending Procedure redoRandomAlphaDrawing(imageNum) #workingAlphaImageNum = 1 Also known as the 'shadow canvas'. ![]() Interactions with the actual canvas is used to reference information on the 'shadow canvas' to obtain RGBA info. ![]() Drawing is done to the working alpha image that acts as a 'shadow canvas'. Code: Select all Demnstration of RGBA interaction with a 'shadow canvas' by using a working image with alpha.
0 Comments
Leave a Reply. |