git-svn-id: file:///srv/caca.zoy.org/var/lib/svn/libpipi/trunk@2655 92316355-f0b4-4df1-b90c-862c8a59935fremotes/tiles
@@ -27,7 +27,6 @@ int main(int argc, char *argv[]) | |||||
dstname = argv[3]; | dstname = argv[3]; | ||||
img = pipi_load(srcname); | img = pipi_load(srcname); | ||||
pipi_getpixels(img, PIPI_PIXELS_RGBA_F); | |||||
switch(atoi(argv[2])) | switch(atoi(argv[2])) | ||||
{ | { | ||||
@@ -42,7 +41,6 @@ int main(int argc, char *argv[]) | |||||
pipi_free(img); | pipi_free(img); | ||||
pipi_getpixels(newimg, PIPI_PIXELS_RGBA_F); | |||||
pipi_save(newimg, dstname); | pipi_save(newimg, dstname); | ||||
pipi_free(newimg); | pipi_free(newimg); | ||||
@@ -50,7 +50,6 @@ int main(int argc, char *argv[]) | |||||
/* Load image, convert it to grayscale, dither it with Floyd-Steinberg */ | /* Load image, convert it to grayscale, dither it with Floyd-Steinberg */ | ||||
img = pipi_load(argv[1]); | img = pipi_load(argv[1]); | ||||
pipi_getpixels(img, PIPI_PIXELS_RGBA_F); | |||||
pipi_getpixels(img, PIPI_PIXELS_Y_F); | pipi_getpixels(img, PIPI_PIXELS_Y_F); | ||||
gauss = pipi_gaussian_blur(img, sigma); | gauss = pipi_gaussian_blur(img, sigma); | ||||
dither = pipi_floydsteinberg(img); | dither = pipi_floydsteinberg(img); | ||||
@@ -48,6 +48,20 @@ pipi_pixels_t *pipi_getpixels(pipi_image_t *img, pipi_format_t type) | |||||
if(img->last_modified == type) | if(img->last_modified == type) | ||||
return &img->p[type]; | return &img->p[type]; | ||||
/* Preliminary conversions */ | |||||
if(img->last_modified == PIPI_PIXELS_RGBA32 | |||||
&& type == PIPI_PIXELS_Y_F) | |||||
pipi_getpixels(img, PIPI_PIXELS_RGBA_F); | |||||
else if(img->last_modified == PIPI_PIXELS_BGR24 | |||||
&& type == PIPI_PIXELS_Y_F) | |||||
pipi_getpixels(img, PIPI_PIXELS_RGBA_F); | |||||
else if(img->last_modified == PIPI_PIXELS_Y_F | |||||
&& type == PIPI_PIXELS_RGBA32) | |||||
pipi_getpixels(img, PIPI_PIXELS_RGBA_F); | |||||
else if(img->last_modified == PIPI_PIXELS_Y_F | |||||
&& type == PIPI_PIXELS_BGR24) | |||||
pipi_getpixels(img, PIPI_PIXELS_RGBA_F); | |||||
/* Allocate pixels if necessary */ | /* Allocate pixels if necessary */ | ||||
if(!img->p[type].pixels) | if(!img->p[type].pixels) | ||||
{ | { | ||||