GetGadgetAttribute(#canvas, #PB_Canvas_Imag
Posted: Tue Oct 30, 2018 4:59 pm
I wish to take the image from a canvas gadget, crop it, save it as a separate image and eventually print it.
My code [within a much longer program] is something like this:
The trouble is that GetGadgetAttribute() returns an image ID but GrabImage() requires an image number. Thus I need the inverse of the ImageID() function, which I would have thought was impossible. How should I proceed?
My code [within a much longer program] is something like this:
Code: Select all
#canvas = 1
StartDrawing(PrinterOutput())
imageID = GetGadgetAttribute(#canvas, #PB_Canvas_Image) ; #canvas is the gadget number for my canvas gadget
imageCropped = GrabImage(image, #PB_Any, 200, 250, 20, 25) ; Last 4 numbers define the cropping area
DrawImage(ImageID(imageCropped), 0, 0)
StopDrawing()