>>34
Here is example of Bitmap struct as array:
Here is example of a Bitmap "struct array" as a struct:
struct Bitmap {
char magic[2];
uint32_t crfilesize, dummy, bitmapoffset, bhsize, w, h;
uint16_t bitplanes, bitsperpixel;
uint32_t compression, imagesize, xppm, yppm, numcolors, impcolors;
int32_t colors;
char padding[n]; //pad until STDOFFSET
int32_t pixels;
};
Now if you have a compiler that isn't crap, you can do this:
bitmap = (struct Bitmap){
.magic = "BM",
.crfilesize = FILESIZE,
.bitmapoffset = STDOFFSET,
.bhsize = HEADERINFOSIZE,
.w = DEFWRES,
.h = DEFHRES,
.bitplanes = 1,
.bitsperpixel = BITSPERPIXEL,
.compression = 0,
.imagesize = SIZE,
.xppm = STDPPM,
.yppm = STDPPM,
.numcolors = 256,
.impcolors = 256
};
double off = 0;
uint32_t currframe = 0;
uint32_t i,c,m;
uint32_t x,y,height = bitmap.h, width = bitmap.w;