Frame from an Animated Image?

BlitzMax Forums/BlitzMax Programming/Frame from an Animated Image?

Sean Doherty(Posted 2006) [#1]
How do I get a frame out of an animated image?

local pTImage:TImage
pTImage = pTAnimatedImage.Frame(1)


I can't seem to find any help on the topic?

Thanks


Sean Doherty(Posted 2006) [#2]
Frame seems to cast to TImageFrame. I can't use TImageFrame because I have to render with clipping. IE. DrawImageRect.

If there a way to assign an ImageFrame to an Image?


GfK(Posted 2006) [#3]
One way of doing it:
http://www.blitzbasic.com/codearcs/codearcs.php?code=1687

Another way - could load just the frame you need with LoadAnimImage. Depends on the effect you're trying to achieve, I suppose...


Sean Doherty(Posted 2006) [#4]
Hmm, any other ways?


Dreamora(Posted 2006) [#5]
ptImage.Frames[i].pixmap when I remember correctly.
This then can be loaded to become its own image.

But DrawImageRect does not clip anything (thats what it did in B3D but not in BM), it resizes the image or better the quad and thats supported on the imageframe draw method as well when it has not changed.


Sean Doherty(Posted 2006) [#6]
If that is the case, how can I click images for doing things like scroll boxes?

Aslo,

What does TImageFrame.Draw do?

there is no help on the args, only,

TImageFrame.Draw(x0,y0, x1, y,1 t0, tx, ty)

Thanks


Dreamora(Posted 2006) [#7]
It is not documented because it is not officially "exported" to the user. You can use it but at your own risk in case it might change at some point. What it expects is the rect within which the texture shall appear (x0,y0 - x1,y1) and the texture coordinates to use. (UV coordinates)


What kind of scroll boxes do you mean?
If you need something like the old Blitz "DrawImageRect", there are functions in the code archives that will give you this functionality. I know of at least two in there. (I called mine DrawImageArea to prevent confusion)

To use those you would just load the image through loadimage instead of loadanimimage and then draw the part of the image you need.


Sean Doherty(Posted 2006) [#8]
TImage..frames[1].pixmap does not seem to be correct?


tonyg(Posted 2006) [#9]
Not really sure what you're trying to do but this takes the second 'cell' in an animimage and loads it into a single image.
Graphics 640 , 480
Local animimage:TImage = LoadAnimImage("animstrip5.png" , 32 , 32 , 0 , 5)
Local image : TImage = LoadImage(animimage.pixmaps[1])
DrawImage image , 0 , 0
Flip
WaitKey()

This is the important bit
Local image : TImage = LoadImage(animimage.pixmaps[n])

where n is the the cell (e.g. 0 is first, 1 is second) you want to load.