LoadImage() vs LoadanimImage()

BlitzPlus Forums/BlitzPlus Programming/LoadImage() vs LoadanimImage()

DNielsen(Posted 2004) [#1]
@all,
Something does not make sense.

Why would I use LoadAnimImage() instead of LoadImage() ?? They both return a pointer to the graphics, and since DisplayImage() is used in BOTH cases to show ANY given frame, why is LoadAnimImage() better than simply LoadImage()?? I don't get it, someone please help?


soja(Posted 2004) [#2]
They both do essentially the same job, with the exception that you can specify a particular frame to draw with DrawImage if you use LoadAnimImage.

As a general rule, use LoadImage for a single image, and use LoadAnimImage for a single image that is made up of multiple frames (like different states of a character running, for example). You would then be able to call DrawImage with a frame of 0, then 1, then 2, then 3 (for a 4-frame image) to simulate your character running. Alternatively, you could use LoadImage 4 times, then call DrawImage 4 times, but LoadAnimImage works better in loops and such (for the programmer).

Did I thoroughly confuse you with my dodgy explanation? =)


DNielsen(Posted 2004) [#3]
@Soja
haha thanks a million for making this CLEAR to an idiot such as myself :-D


DNielsen(Posted 2004) [#4]
@Soja
Which file types do LoadImage() support? .BMP .PNG ? and what does LoadAnimImage() support?? When I use LoadImage() for a path for a file, it loads fine, when I change the command to LoadAnimImage() (but with same filename and path) I get a FILE NOT FOUND error!! ???


Regular K(Posted 2004) [#5]
im pretty sure they support all the regular file types (not positive): bmp, png, jpg, gif


Hotcakes(Posted 2004) [#6]
LoadAnimImage will give errors if you are trying to read past the end of the image ie the number of frames you specified does not fit into the total dimensions of the image.


DNielsen(Posted 2004) [#7]
@iumop ap!sdn w,I 'aw d|aH
YOU are correct!! Because my filesize in incorrect (does not have 80 frames) and I try to use LoadAnimImage() with a value of 80 frames, the LoadAnimImage() *FAILS* - but it fails saying the file does not EXIST!

@BlitzSupport
Is this not an error? I mean, the file in question DOES indeed exist, but is of incorrect size according to the frame number. Should LoadAnimImage() not come up with another error message than "File does not exist" ??? such as "Incorrect number of frames specified" ??