|
@@ -50,14 +50,18 @@ pipi_image_t *pipi_load_oric(char const *name) |
|
|
0xff, 0xff, 0xff, 0xff, |
|
|
0xff, 0xff, 0xff, 0xff, |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
uint8_t screen[WIDTH * HEIGHT / 6]; |
|
|
|
|
|
pipi_image_t *img; |
|
|
pipi_image_t *img; |
|
|
pipi_pixels_t *p; |
|
|
pipi_pixels_t *p; |
|
|
uint8_t *data; |
|
|
|
|
|
|
|
|
uint8_t *screen, *data; |
|
|
int x, y, i; |
|
|
int x, y, i; |
|
|
|
|
|
|
|
|
|
|
|
screen = malloc(WIDTH * HEIGHT / 6); |
|
|
|
|
|
|
|
|
if(read_screen(name, screen) < 0) |
|
|
if(read_screen(name, screen) < 0) |
|
|
|
|
|
{ |
|
|
|
|
|
free(screen); |
|
|
return NULL; |
|
|
return NULL; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
img = pipi_new(WIDTH, HEIGHT); |
|
|
img = pipi_new(WIDTH, HEIGHT); |
|
|
p = pipi_getpixels(img, PIPI_PIXELS_RGBA_C); |
|
|
p = pipi_getpixels(img, PIPI_PIXELS_RGBA_C); |
|
@@ -99,6 +103,8 @@ pipi_image_t *pipi_load_oric(char const *name) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
free(screen); |
|
|
|
|
|
|
|
|
img->codec_priv = NULL; |
|
|
img->codec_priv = NULL; |
|
|
|
|
|
|
|
|
img->wrap = 0; |
|
|
img->wrap = 0; |
|
@@ -109,10 +115,10 @@ pipi_image_t *pipi_load_oric(char const *name) |
|
|
|
|
|
|
|
|
int pipi_save_oric(pipi_image_t *img, char const *name) |
|
|
int pipi_save_oric(pipi_image_t *img, char const *name) |
|
|
{ |
|
|
{ |
|
|
uint8_t screen[WIDTH * HEIGHT / 6]; |
|
|
|
|
|
pipi_image_t *tmp = NULL; |
|
|
pipi_image_t *tmp = NULL; |
|
|
pipi_pixels_t *p; |
|
|
pipi_pixels_t *p; |
|
|
float *data; |
|
|
float *data; |
|
|
|
|
|
uint8_t *screen; |
|
|
FILE *fp; |
|
|
FILE *fp; |
|
|
size_t len; |
|
|
size_t len; |
|
|
|
|
|
|
|
@@ -140,13 +146,19 @@ int pipi_save_oric(pipi_image_t *img, char const *name) |
|
|
else |
|
|
else |
|
|
p = pipi_getpixels(img, PIPI_PIXELS_RGBA_F); |
|
|
p = pipi_getpixels(img, PIPI_PIXELS_RGBA_F); |
|
|
data = p->pixels; |
|
|
data = p->pixels; |
|
|
|
|
|
screen = malloc(WIDTH * HEIGHT / 6); |
|
|
write_screen(data, screen); |
|
|
write_screen(data, screen); |
|
|
if(tmp) |
|
|
if(tmp) |
|
|
|
|
|
{ |
|
|
|
|
|
free(screen); |
|
|
pipi_free(tmp); |
|
|
pipi_free(tmp); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
fwrite(screen, 1, WIDTH * HEIGHT / 6, fp); |
|
|
fwrite(screen, 1, WIDTH * HEIGHT / 6, fp); |
|
|
fclose(fp); |
|
|
fclose(fp); |
|
|
|
|
|
|
|
|
|
|
|
free(screen); |
|
|
|
|
|
|
|
|
return 0; |
|
|
return 0; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|