compiled bitmap's format

Started by
0 comments, last by Tuan 24 years, 4 months ago
Could anyone show me what is the compiled bitmap's format to get the fastest blitting?
Thanx.
Advertisement
Do you actually mean 'compiled bitmaps' or 'Runtime Length Encoded' (RLE) bitmaps?

- An RLE bitmap, is a form of compression, but I believe that when using them, you can speed up your bliting (i think). It gets its compression by only storing pixels that are different from the one next to it.

- A compiled bitmap, is one that you converted to pure code and is including into your make file. It will usually be an ASM file for greater speed. This function will work only in 8bit mode I believe. You can download the read the original article for this at
http://www.xgames3d.com/articles/csprite/areadcsp.htm

Hope this helped.

code:
int Compile_Sprite_WASM (sprite_ptr the_sprite, char *spritename) {  int i, x, y, offset, offset1, offset2, offset3, bitmap_offset;  FILE *outfile;  char byte1, byte2, byte3, byte4;  char *filename;  unsigned char *bitmap;  filename = strdup(spritename);  strcat(filename, ".ASM");  if((outfile = fopen(filename,"wt")) == NULL){    printf("Could not open output file %s\n", filename);    return(1);  };  fprintf(outfile,".386p\n");  fprintf(outfile," NAME %s\n", spritename);  fprintf(outfile,"DGROUP GROUP CONST,CONST2,_DATA,_BSS\n");  fprintf(outfile,"_TEXT SEGMENT PARA PUBLIC USE32 'CODE'\n");  fprintf(outfile," ASSUME CS:_TEXT ,DS  : DGROUP,SS  : DGROUP\n");  for (i=0; i < the_sprite->num_frames; i++) fprintf(outfile," PUBLIC %s_%d_\n", spritename, i);  for (i=0; i < the_sprite->num_frames; i++) {    fprintf(outfile,"%s_%d_: push ECX\n", spritename, i);    fprintf(outfile," mov ECX,EDX\n");    fprintf(outfile," shl ECX,08H\n");    fprintf(outfile," shl EDX,06H\n");    fprintf(outfile," add EBX,ECX\n");    fprintf(outfile," add EDX,EBX\n");    fprintf(outfile," add EAX,EDX\n");     bitmap_offset = 0;    bitmap = the_sprite->frames;<P>    for (y = 0; y < the_sprite->height; y++) {<BR>      offset = y * 320;<BR>      x = 0;<P>      while (x < the_sprite->width) {<BR>        if (*(bitmap + bitmap_offset) != 0) {<BR>          byte1 = *(bitmap + bitmap_offset);<BR>          offset1 = offset;<BR>          bitmap_offset++;<BR>          offset++;<BR>          x++;<BR>          if ((*(bitmap + bitmap_offset) != 0) && (x < the_sprite->width)) {<BR>            byte2 = *(bitmap + bitmap_offset);<BR>            offset2 = offset;<BR>            bitmap_offset++;<BR>            offset++;<BR>            x++;<BR>            if ((*(bitmap + bitmap_offset) != 0) && (x < the_sprite->width)) {<BR>              byte3 = *(bitmap + bitmap_offset);<BR>              offset3 = offset;<BR>              bitmap_offset++;<BR>              offset++;<BR>              x++;<BR>              if ((*(bitmap + bitmap_offset) != 0) && (x < the_sprite->width)) {<BR>                byte4 = *(bitmap + bitmap_offset);<BR>                fprintf(outfile," mov dword ptr +0x%x[EAX],0x%02x%02x%02x%02xH\n", offset1, byte4, byte3, byte2, byte1);<BR>              }<BR>              else {<BR>                fprintf(outfile," mov word ptr +0x%x[EAX],0x%02x%02xH\n", offset1, byte2, byte1);<BR>                fprintf(outfile," mov byte ptr +0x%x[EAX],0x%02xH\n", offset3, byte3);<BR>              }<BR>            }<BR>            else {<BR>              fprintf(outfile," mov word ptr +0x%x[EAX],0x%02x%02xH\n", offset1, byte2, byte1);<BR>            } <BR>          }<BR>          else {<BR>            fprintf(outfile," mov byte ptr +0x%x[EAX],0x%02xH\n", offset1, byte1);<BR>          }<BR>        }<BR>        else {<BR>          bitmap_offset++; <BR>          offset++;<BR>          x++;<BR>        }<BR>      }; // end while x<BR>    }; // end for y<BR>    fprintf(outfile," pop ECX\n");<BR>    fprintf(outfile," ret\n");<BR>    fprintf(outfile," nop\n");<BR>  }; // end for frames<P>  fprintf(outfile,"_TEXT ENDS\n\n");<BR>  fprintf(outfile,"CONST SEGMENT DWORD PUBLIC USE32 'DATA'\n");<BR>  fprintf(outfile,"CONST ENDS\n\n");<BR>  fprintf(outfile,"CONST2 SEGMENT DWORD PUBLIC USE32 'DATA'\n");<BR>  fprintf(outfile,"CONST2 ENDS\n\n");<BR>  fprintf(outfile,"_DATA SEGMENT DWORD PUBLIC USE32 'DATA'\n");<BR>  fprintf(outfile,"_DATA ENDS\n\n");<BR>  fprintf(outfile,"_BSS SEGMENT DWORD PUBLIC USE32 'BSS'\n");<BR>  fprintf(outfile,"_BSS ENDS\n\n");<BR>  fprintf(outfile," END");<BR>  fclose(outfile);<BR>  return(0);<BR>};<P></pre><HR></BLOCKQUOTE><P><p>[This message has been edited by Gromit (edited December 03, 1999).]

William Reiach - Human Extrodinaire

Marlene and Me


This topic is closed to new replies.

Advertisement