SetViewPort Clipping

BlitzMax Forums/BlitzMax Programming/SetViewPort Clipping

Nigel Brown(Posted 2011) [#1]
I am loading a large .png and then using GrabPixmap() to cut the image up into smaller sprites. The png file is larger than my visible screen area, and GrabPixMap() returns a block of corrupt data from the areas that are not visible.

I am guessing that the .png is not being plotted to the graphics buffer beyond the visible screen area? I though that extending the Viewport to the .png width and height before plotting would fix this but it does not.

Has anyone else come across this problem before, I have spent a few hours looking for a solution and have found nothing so far.


matibee(Posted 2011) [#2]
Instead of drawing and grabbing, would PixmapWindow() be more useful?


Zeke(Posted 2011) [#3]
how about pixmapwindow()


Nigel Brown(Posted 2011) [#4]
Thanks I will give it a go, hope it deals with transparency as I am using .png format with Alpha.

(edit)
Works like a dream, does exactly what it says on the packet including transparency. Thanks again.

Global screen:TImage = LoadImage( screen.png" )
Local pixmap:TPixmap = PixmapWindow( LockImage:TPixmap( screen, 0 ), x, y, w, h )
SavePixmapPNG( pixmap, "cutout.png", 0 )


Last edited 2011


ImaginaryHuman(Posted 2011) [#5]
The backbuffer is only the size of the screen resolution, you can't draw outside of it.


ImaginaryHuman(Posted 2011) [#6]
But you could render-to-texture to a larger texture.