grabImage help

BlitzMax Forums/BlitzMax Beginners Area/grabImage help

sandav(Posted 2006) [#1]
Is there anyway to use the grabImage function to store an image larger than the viewport? from what i can tell DrawImage doesn't draw anything past viewport boundries so grabImage wont pick it up. are there any ways around this?

thanks for any help


Mordax_Praetorian(Posted 2006) [#2]
Really, it depends upon what you are using Grab Image to do

More details would be useful


Dreamora(Posted 2006) [#3]
The only ways around that is using pixmaps and filling it manually, loading an image from that pixmap afterwards (yepp you can loadimage from pixmap :-) )


But normally you will run into a different problem: Todays screens have 1280x1024 ... so for an image the graphiccard will need to support 2048x2048 textures (GeForce 5 or Radeon 9200+, don't know how much Intel support) and at least 32MB of VRAM, as an image is a texture and falls under those restrictions given by the graphic card and VRAM.


H&K(Posted 2006) [#4]
Make the viewport bigger, grab the image, make the viewport smaller again.


sandav(Posted 2006) [#5]
what I'm trying to do is convert an array of images (that happens to be larger than the screen) into a single image. so I have the array draw out on the backbuffer and then use grabImage, but when I move the image over I get black around the edges where there should be more image.
Its for the terrain of a marioesque platformer. the resolution I'm using is only 320*200

I tried changing the viewport size, but it seems not to work, perhaps I'm doing it wrong though


Dreamora(Posted 2006) [#6]
Any reason not using TPixmap and copy the other "images" (loaded as pixmaps as well) into a manually created pixmap?

Thats much faster than using GrabImage as grabimage will create a pixmap from the grabbed and will make an image out of it again. (as well, loading such an image strip has its restrictions as well. You can't load an arbitary large strip as TImage anyway, TImage is restricted by your graphic card capabilities and the one of the target system)


ImaginaryHuman(Posted 2006) [#7]
Open in a higher resolution so you can see and grab several screens worth?


sandav(Posted 2006) [#8]
It gets the whole thing if I increase the resolution, but creates other problems, and doesn't seem very practacle.

the main reasons I wasn't using pixmaps was because I'm using the ImagesCollide function to check when the character has hit the ground or a wall. and because all the tiles for my map are saved in a single png which is separated with loadAnimImage and as far as I can tell theres no equivalent for pixmaps.

here's the relevant bit of code to give a better idea of what I'm talking about

SetViewport(0,0,X_Dimension*16,Y_Dimension*16) 'X_dimension is the number of tiles wide the map is
mapImage = CreateImage(X_Dimension*16,Y_Dimension*16,3) 
For Local _x% = 0 To X_Dimension
	For Local _y% = 0 To Y_Dimension
		DrawImage(tiles , _x * 16, _y * 16,map1[_x, _y , 0])  
	Next
Next	
GrabImage(mapImage, 0, 0 , 0)



Dreamora(Posted 2006) [#9]
And where is the problem?

I'm talking about the combining process, not the drawing process or usage later. Thats a totally different thing.

But that small command there reminds me of the "lazy ass" solution to your problem:

Create an image with as many frames as you need them.
Load all images that shall come in there as pixmaps and then:

Use TImage s method called SetPixmap(index:int,pixmap:TPixmap) to put all your frames in.

No need to draw or do anything more at all :-)