Saving canvas image?

BlitzMax Forums/BlitzMax GUI Programming/Saving canvas image?

This is probobly really simple, and i'm probobly missing something right infront of me, but I can't seem to figure out how to save the image within a canvas to a bitmap/pixmap.

Any help on this is appreciated.

grabpixmap?

How would that work with a canvas?

edit: Also, i'm not 'loading' an image into the canvas. I'm rendering to the canvas.

When you setgraphics canvasgraphics and draw whatever it is you draw then use grabpixmap command.
SuperStrict
Local MyWindow:TGadget=CreateWindow("Canvas Example", 200,200,320,240)
Local MyCanvas:TGadget=CreateCanvas(10,10,290,140,MyWindow)
Local mypixmap:TPixmap
Repeat
  WaitEvent()
  Select EventID()
  Case EVENT_WINDOWCLOSE
     End
  Case EVENT_GADGETPAINT
    SetGraphics CanvasGraphics (MyCanvas)
    DrawRect  20,20,50,80
  mypixmap=GrabPixmap(0,0,GadgetWidth(mycanvas),GadgetHeight(mycanvas))
	Flip
   End Select
  If mypixmap SavePixmapPNG(mypixmap,"test.png")
Forever


You are the man! Thanks a lot.