GrabPixmap problem
BlitzMax Forums/BlitzMax Programming/GrabPixmap problem
| ||
Hello, I'm trying to use a pixmap to grabs the pixels of a certain area and draw it somewhere on the window (using DrawPixmap), but there's a problem. When I try to have the camera draw something that's off the screen(at a position of 1000, 20 when a window is 640 x 480) it doesn't draw it. I figured out that it's because the images are off screen, so it isn't drawn, is there a function to tell blitz max to draw images even if they're off screen ? Last edited 2012 |
| ||
No, if you want to use grabpixmap then the parameters must be within the confines of the screen. |
| ||
Darn. Could I maybe change the viewport ? |
| ||
You can change the draw origin, grab multiple images and copy them into one big pixmap. This is the [UNTESTED AND APPROXIMATE] code for grabbing 4x 640x480 pixmaps and combining them into one 1280,960 pixmap..cls SetOrigin 0,0 DrawScene() pixmap0:TPixmap = GrabPixmap() cls SetOrigin 640,0 DrawScene() pixmap1:TPixmap = GrabPixmap() cls SetOrigin 0,480 DrawScene() pixmap2:TPixmap = GrabPixmap() cls SetOrigin 640,480 DrawScene() pixmap3:TPixmap = GrabPixmap() bigPixmap:TPixmap = CreatePixmap( 1280, 960 ) for local x:int = 0 to 639 for local y:Int = 0 to 479 writepixel( bigPixmap, x, y, readpixel( pixmap0, x, y ) ) writepixel( bigPixmap, x + 640, y, readpixel( pixmap1, x, y ) ) writepixel( bigPixmap, x, y + 480, readpixel( pixmap2, x, y ) ) writepixel( bigPixmap, x + 640, y + 480, readpixel( pixmap3, x, y ) ) next next savepixmap( bigpixmap ) |
| ||
Any reason you wouldn't just use pixmap.paste()? |
| ||
Any reason you wouldn't just use pixmap.paste()? Yup. Sadly only API ignorance :D |
| ||
How do I use Pixmap.paste() ? EDIT: And how would that fix my camera problem? Last edited 2012 |
| ||
See what you've done Gfk :) Pixmap.paste would only replace the for/next pixel copying loops at the end of my example code. I'm guessing there are no special optimisations in the pixmap paste routine and it's simply doing the same for/next loops internally. The rest of the code which draws the scene multiple times at different origins and stores the results, is very likely to be the solution to your "camera problem". That is, if you really have a camera problem-- you have a great track record of asking for solutions to problems that don't exist. Re-reading your initial post I'm guessing you want to draw some kind of windowed view into your tiled world. In which case the problem is nothing to with grabpixmap. |
| ||
Okay, thanks for the help guys ! |