I tried the StretchBlt_ method before but using an ImageGadget()
However, nothing shows up.
Here, I'm trying to get the #ball image to appear in the #canvas ..
Code: Select all
Enumeration
#win
#canvasgadget
#ball
#canvas
EndEnumeration
CreateImage(#ball,16,16)
CreateImage(#canvas,256,256)
UseImage(#ball)
*hdcSource=StartDrawing(ImageOutput())
Box(0,0,26,26,RGB(255,255,255))
DrawingMode(4)
Circle(8,8,7,RGB(20,10,95))
StopDrawing()
UseImage(#canvas)
*hdcDest=StartDrawing(ImageOutput())
Box(0,0,256,256,RGB(50,70,90))
StopDrawing()
StretchBlt_(*hdcDest,0,0,256,256,*hdcSource,0,0,16,16,#SRCCOPY)
#wflags=#PB_Window_SystemMenu |#PB_Window_TitleBar
OpenWindow(#win,50,160,280,280,#wflags,"StretchBlt example")
CreateGadgetList(WindowID())
ImageGadget(#canvasgadget,8,8,256,256,UseImage(#canvas),#PB_Image_Border)
Repeat
ev=WaitWindowEvent()
Until ev=#PB_EventCloseWindow
End
Any ideas?
EDIT
Resolved by drawing the ball to the canvas then using StretchBlt_ to stretch the image within the canvas.
StretchBlt_ fails when trying to stretch an image from a different source.
Now working ...
Code: Select all
Enumeration
#win
#canvasgadget
#ball
#canvas
EndEnumeration
CreateImage(#ball,16,16)
CreateImage(#canvas,256,256)
UseImage(#ball)
hdcSource=StartDrawing(ImageOutput())
Box(0,0,26,26,RGB(255,255,255))
DrawingMode(4)
Circle(8,8,7,RGB(20,10,95))
StopDrawing()
UseImage(#canvas)
hDC=StartDrawing(ImageOutput())
Box(0,0,256,256,RGB(50,70,90))
DrawImage(UseImage(#ball),0,0)
result=StretchBlt_(hDC,0,0,256,256,hDC,0,0,16,16,#SRCCOPY)
StopDrawing()
;- gui
#wflags=#PB_Window_SystemMenu |#PB_Window_TitleBar
OpenWindow(#win,50,160,280,280,#wflags,"StretchBlt example")
CreateGadgetList(WindowID())
ImageGadget(#canvasgadget,8,8,256,256,UseImage(#canvas),#PB_Image_Border)
;- main
Repeat
ev=WaitWindowEvent()
Until ev=#PB_EventCloseWindow
End
Thankyou for your assistance.
Much appreciated as always.