Exemplo n.º 1
0
void bmp_write_header(bmp_structp bmp)
{
	if (_is_big_endian())
		bmp_header_swap_endianess(&bmp->header);

	bmp->write_fn(bmp, (uint8_t*)&bmp->header.magic, sizeof(uint8_t) * 2);
	bmp->write_fn(bmp, (uint8_t*)&bmp->header.filesz, sizeof(uint32_t));
	bmp->write_fn(bmp, (uint8_t*)&bmp->header.creator1, sizeof(uint16_t));
	bmp->write_fn(bmp, (uint8_t*)&bmp->header.creator2, sizeof(uint16_t));
	bmp->write_fn(bmp, (uint8_t*)&bmp->header.offset, sizeof(uint32_t));
}
Exemplo n.º 2
0
static void
bmp_write_header(bmpfile_t *bmp, FILE *fp)
{
  bmp_header_t header = bmp->header;

  if (_is_big_endian()) bmp_header_swap_endianess(&header);

  fwrite(header.magic, sizeof(header.magic), 1, fp);
  fwrite(&(header.filesz), sizeof(uint32_t), 1, fp);
  fwrite(&(header.creator1), sizeof(uint16_t), 1, fp);
  fwrite(&(header.creator2), sizeof(uint16_t), 1, fp);
  fwrite(&(header.offset), sizeof(uint32_t), 1, fp);
}