gadget-weather-station/bmp-swap/main.c
2023-03-16 09:58:01 +01:00

34 lines
936 B
C

#include <stdint.h>
#include <stdio.h>
#include "stormy.c"
int main(void)
{
uint16_t *x;
int i;
x = gimp_image.pixel_data;
printf("static const struct {\n"
" unsigned int width;\n"
" unsigned int height;\n"
" unsigned int bytes_per_pixel; /* 2:RGB16, 3:RGB, 4:RGBA */ \n"
" char *comment;\n"
" unsigned char pixel_data[48 * 48 * 2 + 4];\n"
"} stormy = {\n"
" 48, 48, 2,\n"
" (char*) 0,\n");
printf("\n\"");
for (i = 0; i < sizeof(gimp_image.pixel_data); i+=2)
{
x = gimp_image.pixel_data + i;
printf("\\x%02x\\x%02x", (uint8_t)(((*x >> 8) & 0xFF)), (uint8_t)((*x & 0xFF)));
if ((i + 2)% 16 == 0)
printf("\"\n\"");
}
printf("\",\n");
printf("};\n");
printf(" const unsigned char *img_stormy = stormy.pixel_data;\n");
return 0;
}