@STARGÅTE: Thanks for your help. For some reason I became confused about the default drawing option (that doesn't modify the alpha channel). It was actually necessary to modify the alpha channel and set my drawing colors by including the alpha values. I forgot that the default alpha value of zero is actually transparent.
I incorporated your tips into the previous code with comments
Code:
Enumeration
;windows
#windowMain = 0
;gadgets
#results_img = 0
;images
#transparentImage = 0
#compositeImage
EndEnumeration
#screenWidth = 500
#screenHeight = 500
OpenWindow(#windowMain, 0, 0, #screenWidth, #screenHeight, "Test", #PB_Window_SystemMenu)
CreateImage(#transparentImage, #screenWidth, #screenHeight, 32 | #PB_Image_Transparent)
StartDrawing(ImageOutput(#transparentImage))
;draw by combining alpha layer and color layer based on RGBA value
DrawingMode(#PB_2DDrawing_AlphaBlend)
LineXY(OutputWidth(), 0, 0, OutputHeight(), RGBA($FF,$FF, 0, $FF)) ;yellow with no transparency
StopDrawing()
CreateImage(#compositeImage, #screenWidth, #screenHeight, 32)
StartDrawing(ImageOutput(#compositeImage))
;draw by combining alpha layer and color layer based on RGBA value
DrawingMode(#PB_2DDrawing_AlphaBlend)
Box(0, 0, OutputWidth(), OutputHeight(), RGBA($FF, 0, 0, $FF)) ;red with no transparency
;overlay image
DrawImage(ImageID(#transparentImage), 0, 0)
LineXY(0, 0, OutputWidth(), OutputHeight(), RGBA(0, $FF, 0, $FF)) ;green with no transparency
StopDrawing()
ImageGadget(#results_img, 0, 0, #screenWidth, #screenHeight, ImageID(#compositeImage))
Repeat: Until WaitWindowEvent() = #PB_Event_CloseWindow