Canvas and Grabpixmap. How?

BlitzMax Forums/BlitzMax Beginners Area/Canvas and Grabpixmap. How?

Takuan(Posted 2006) [#1]
Hi,
got a little problem here.

I want to save a part of an image:

Load Image->Drawimage->grabpixmap->savepixmapPNG

My problem:
I cant grab the whole image if only a part is drawn inside the canvas.
Any suggestions please?


ImaginaryHuman(Posted 2006) [#2]
You don't need to draw it to save part of it, and can avoid making it an image.

How about:

LoadPixmap() to load the whole image
CreateStaticPixmap() to define a static pixmap within the pixmap you loaded
SavePixmapPNG() the static pixmap


tonyg(Posted 2006) [#3]
PixmapWindow?


Takuan(Posted 2006) [#4]
Uh? Sry, i was a little tired. Stupid me. Thank you, i will use PixmapWindow;)

Anyway, played with Angel Daniels suggestion and now i am curious how that would work.
Any ideas how to get a byte pointer to a pixmap?
Tried to use a Bank but that didnt work.


ImaginaryHuman(Posted 2006) [#5]
PixmapPixelPtr() returns the byte pointer of the top left corner.

Use (X*BytesPerPixel)+(Y*PixmapPitch(px))

to get the top left corner address.

PixmapWindow is the same thing I think, so long as it doesn't copy the pixmap area to a new pixmap, which you don't need to do.


Takuan(Posted 2006) [#6]
Roger that, thank you:)