Here is a way to draw a bitmap of any size with a transparent color, it should work drawing over bitmaps or patterns.
Code: Select all
;Draw bitmap setting a transparent color
;Ref : [url]http://msdn.microsoft.com/library/en-us/shellcc/platform/commctls/imagelist/reflist.asp[/url]
;this example draws a 200x200 256 colors bitmap at 0,0 coord in the window
;black (0,0,0) is set as the transparent color
;change the includebinary with your own bitmap (200x200 256 color)
;Justin 02/03
;structure
ptst.PAINTSTRUCT
global ptst,himglist
;CREATE IMAGE LIST
;200x200 imglist 256 colors, 1 img
;transparent=black
hbimglist=CatchImage(0,?limglist)
himglist=ImageList_Create_(200,200,#ILC_COLOR8|#ILC_MASK,1,0)
ImageList_AddMasked_(himglist,hbimglist,rgb(0,0,0)) ;set transparent color
;window procedure
procedure windowproc(hwnd,msg,wparam,lparam)
retval=#PB_ProcessPureBasicEvents
select msg
case #WM_PAINT ;DRAW IMAGE
hdc=beginpaint_(hwnd,@ptst)
ImageList_Draw_(himglist,0,hdc,0,0,#ILD_TRANSPARENT)
endpaint_(hwnd,@ptst)
retval=0
endselect
procedurereturn retval
endprocedure
;WINDOW
OpenWindow(0,150,70,552,352,#PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_TitleBar,"Window1")
SetWindowCallback(@windowproc())
;EVENT LOOP
Repeat
until WaitWindowEvent()=#PB_EventCloseWindow
;free imglist
ImageList_Destroy_(himglist)
end
limglist : includebinary "yourimage.bmp"