Blob Blame Raw
#ifndef HELI_ANIMATION_H
#define HELI_ANIMATION_H


#include "common.h"
#include "framebuffer.h"


typedef struct _Animation *Animation;


int imageLoad(const char *path, int *outWidth, int *outHeight, unsigned char **outPixels);
int imageLoadFromMemory(const void *data, int size, int *outWidth, int *outHeight, unsigned char **outPixels);
int imageSave(const char *path, int width, int height, const void *pixels);
unsigned int imageToGLTexture(int width, int height, const void *pixels, int wrap);
unsigned int imageToGLTextureEx(int width, int height, const void *pixels, int horWrap, int vertWrap, int smooth, int mipMap);
int imageToExistingGLTexture(unsigned int texid, int width, int height, const void *pixels);
int imageFromGLTexture(unsigned int texid, int *outWidth, int *outHeight, unsigned char **outPixels);
int imageFromViewport(int *outWidth, int *outHeight, unsigned char **outPixels);
int viewportSave(const char *path);

unsigned int pixelGet(const void *pixel);
void pixelSet(void *pixel, unsigned int colorCode);
unsigned int imageGetPixel(int width, int height, const void *pixels, int x, int y);
void imageSetPixel(int width, int height, void *pixels, int x, int y, unsigned int colorCode);


Animation createAnimation(const char *path);
Animation createAnimationEx(const char *path, int smooth, int horWrap, int vertWrap);
Animation createAnimationFromGLTexId(unsigned int texid);
Animation createAnimationFromImage(int width, int height, const void *pixels, int wrap);
Animation createAnimationFromImageEx(int width, int height, const void *pixels, int horWrap, int vertWrap, int smooth, int mipMap);
Animation createAnimationFromFramebuffer(Framebuffer framebuffer);
Animation createAnimationFromViewport();
Animation createAnimationFromViewportEx(int horWrap, int vertWrap, int smooth, int mipMap);
Animation createAnimationEmpty();
void animationDestroy(Animation animation);

Animation animationClone(Animation animation);
Animation animationCloneEx(Animation animation, int start, int count);

unsigned int animationGetGLTexId(Animation animation);
unsigned int animationGetFrameGLTexId(Animation animation, int frame);
void animationGLTexIdSetOwnership(unsigned int texid, int own);

int animationGetFramesCount(Animation animation);
void animationInsert(Animation animation, int index, Animation other);
void animationInsertEx(Animation animation, int index, Animation other, int start, int count);
void animationRemove(Animation animation, int start, int count);
void animationClear(Animation animation);

double animationGetFps(Animation animation);
void animationSetFps(Animation animation, double fps);

int animationIsPlaying(Animation animation);
void animationPlay(Animation animation);
void animationPause(Animation animation);

void animationAddTime(Animation animation, double time);

int animationGetLoop(Animation animation);
void animationSetLoop(Animation animation, int loop);

double animationGetPos(Animation animation);
void animationSetPos(Animation animation, double pos);
int animationGetFrame(Animation animation);
void animationSetFrame(Animation animation, int frame);
void animationNextFrame(Animation animation);


#endif