177 int last = -32768,
count = 0;
178 long packed_size = 1;
180 switch ( compress_type ) {
184 if (*frame != last ||
count > 255) {
185 if (packed_size + 3 >= max)
196 *save++ = (
ubyte)last;
203 *save++ = (
ubyte)last;
215 if (packed_size + 3 >= max)
226 *save++ = (
ubyte)last;
233 *save++ = (
ubyte)last;
247 for (i=1; i <
size; i++ ) {
249 if ( *frame != last ) {
252 if (packed_size + 2 >= max)
256 *save++ = (
ubyte)last;
263 *save++ = (
ubyte)last;
275 if (
count == 127 ) {
278 *save++ = (
ubyte)last;
286 if (packed_size + 2 >= max)
290 *save++ = (
ubyte)last;
297 *save++ = (
ubyte)last;
302 Assert(packed_size == (save-dest_start) );
328 int pixel, last = -32768,
count = 0,
i;
329 long packed_size = 1;
331 switch ( compress_type ) {
335 if (*frame != *frame2++)
340 if (pixel != last ||
count > 255) {
341 if (packed_size + 3 >= max)
352 *save++ = (
ubyte)last;
359 *save++ = (
ubyte)last;
371 if (packed_size + 3 >= max)
382 *save++ = (
ubyte)last;
389 *save++ = (
ubyte)(last);
401 if (*frame++ != *frame2++)
409 if (*frame != *frame2++)
414 if ( pixel != last ) {
417 if (packed_size + 2 >= max)
421 *save++ = (
ubyte)last;
428 *save++ = (
ubyte)last;
440 if (
count == 127 ) {
443 *save++ = (
ubyte)last;
451 if (packed_size + 2 >= max)
455 *save++ = (
ubyte)last;
462 *save++ = (
ubyte)last;
467 Assert(packed_size == (save-dest_start) );
504 int pixel_size = (bpp / 8);
523 if (pixel_size > 2) {
532 if (pixel_size > 2) {
538 memcpy(&bit_24, pixel,
sizeof(
int));
540 if (pixel_size == 4) {
557 memcpy(data, &bit_24, pixel_size);
561 memcpy(data, &bit_16, pixel_size);
588 int pixel_size = (bpp / 8);
607 if (pixel_size > 2) {
616 if (pixel_size > 2) {
622 memcpy(&bit_24, pixel,
sizeof(
int));
624 if (pixel_size == 4) {
638 for (idx=0; idx<
count; idx++) {
642 memcpy(data + (idx * pixel_size), &bit_24, pixel_size);
646 memcpy(data + (idx * pixel_size), &bit_16, pixel_size);
650 *(data +
idx) = bit_8;
655 return (pixel_size * count);
673 int pixel_size = (bpp / 8);
675 if ( pal_translate == NULL ) {
688 stuffed =
unpack_pixel(ai, frame, pal_translate[value], aabitmap, bpp);
723 stuffed =
unpack_pixel(ai, frame, pal_translate[value], aabitmap, bpp);
731 count = value & (~STD_RLE_CODE);
758 stuffed =
unpack_pixel(ai, frame, pal_translate[value], aabitmap, bpp);
764 stuffed = pixel_size;
791 stuffed = count * pixel_size;
806 stuffed =
unpack_pixel(ai, frame, pal_translate[value], aabitmap, bpp);
811 stuffed = pixel_size;
817 count = value & (~STD_RLE_CODE);
833 stuffed = pixel_size *
count;
863 int pixel_size = (bpp / 8);
865 if ( pal_translate == NULL ) {
879 stuffed =
unpack_pixel(ai, frame, pal_translate[value], aabitmap, bpp);
918 stuffed =
unpack_pixel(ai, frame, pal_translate[value], aabitmap, bpp);
926 count = value & (~STD_RLE_CODE);
955 stuffed =
unpack_pixel(ai, frame, pal_translate[value], aabitmap, bpp);
960 stuffed = pixel_size;
989 stuffed = pixel_size *
count;
1005 stuffed =
unpack_pixel(ai, frame, pal_translate[value], aabitmap, bpp);
1010 stuffed = pixel_size;
1016 count = value & (~STD_RLE_CODE);
1033 stuffed = pixel_size *
count;
1055 int i, xparent_found = 0;
1058 for ( i = 0; i < 256; i++ ) {
1062 if ( xparent_found ) {
int unpack_frame_from_file(anim_instance *ai, ubyte *frame, int size, ubyte *pal_translate, int aabitmap, int bpp)
Unpack frame from file.
GLsizei const GLfloat * value
#define PACKING_METHOD_STD_RLE
void anim_set_palette(anim *ptr)
Set animation palette.
int pack_key_frame(ubyte *frame, ubyte *save, long size, long max, int compress_type)
Pack key frame.
ubyte palette_translation[256]
unsigned char anim_instance_get_byte(anim_instance *ai, int offset)
void free_anim_instance(anim_instance *inst)
void BM_SELECT_TEX_FORMAT()
Sets bm_set_components and bm_get_components to reference texture format functions.
#define BMP_AABITMAP
antialiased bitmap
GLdouble GLdouble GLdouble r
void(* bm_set_components)(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a)
Functional pointer that references any of the bm_set_components functions.
int unpack_pixel(anim_instance *ai, ubyte *data, ubyte pix, int aabitmap, int bpp)
Unpack a pixel given the passed index and the anim_instance's palette.
GLboolean GLboolean GLboolean GLboolean a
void convert_24_to_16(int bit_24, ushort *bit_16)
Convert a 24 bit value to a 16 bit value.
#define PACKING_METHOD_RLE
ubyte * unpack_frame(anim_instance *ai, ubyte *ptr, ubyte *frame, int size, ubyte *pal_translate, int aabitmap, int bpp)
Unpack frame.
int bm_create(int bpp, int w, int h, void *data, int flags)
GLboolean GLboolean GLboolean b
ubyte * anim_get_next_raw_buffer(anim_instance *inst, int xlate_pal, int aabitmap, int bpp)
#define PACKING_METHOD_STD_RLE_KEY
int unpack_pixel_count(anim_instance *ai, ubyte *data, ubyte pix, int count=0, int aabitmap=0, int bpp=8)
Unpack a pixel given the passed index and the anim_instance's palette.
GLenum GLsizei GLenum GLenum const GLvoid * data
int anim_instance_is_streamed(anim_instance *ai)
#define PACKING_METHOD_RLE_KEY
anim_instance * init_anim_instance(anim *ptr, int bpp)
int anim_get_next_frame(anim_instance *inst)
int bm_unload(int handle, int clear_render_targets, bool nodebug)
Unloads a bitmap's data, but not the bitmap info.
GLclampf GLclampf GLclampf alpha
const int transparent_code
int pack_frame(ubyte *frame, ubyte *frame2, ubyte *save, long size, long max, int compress_type)
Pack frame.
void anim_check_for_palette_change(anim_instance *instance)