Canvas and Grabpixmap. How?
BlitzMax Forums/BlitzMax Beginners Area/Canvas and Grabpixmap. How?
| ||
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? |
| ||
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 |
| ||
PixmapWindow? |
| ||
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. |
| ||
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. |
| ||
Roger that, thank you:) |