diff --git a/examples/edd.c b/examples/edd.c index 7e54958..7d54273 100644 --- a/examples/edd.c +++ b/examples/edd.c @@ -49,7 +49,7 @@ int main(int argc, char *argv[]) /* Load image, convert it to grayscale, dither it with Floyd-Steinberg */ img = pipi_load(argv[1]); - pipi_set_colorspace(img, PIPI_PIXELS_Y_F); + pipi_set_colorspace(img, PIPI_PIXELS_Y_F32); gauss = pipi_gaussian_blur(img, sigma); kernel = pipi_load("ediff:fs"); dither = pipi_dither_ediff(img, kernel, PIPI_SCAN_RASTER); diff --git a/examples/img2rubik.c b/examples/img2rubik.c index db45f67..7c6e735 100644 --- a/examples/img2rubik.c +++ b/examples/img2rubik.c @@ -34,7 +34,7 @@ int main(int argc, char *argv[]) pipi_image_t *src = pipi_load(argv[1]); pipi_image_t *dst = pipi_reduce(src, NCOLORS, mypal); - pipi_pixels_t *p = pipi_get_pixels(dst, PIPI_PIXELS_RGBA_F); + pipi_pixels_t *p = pipi_get_pixels(dst, PIPI_PIXELS_RGBA_F32); float *data = (float *)p->pixels; w = p->w; h = p->h; diff --git a/pipi-php/php_pipi.c b/pipi-php/php_pipi.c index 9f80536..dc7f0b4 100644 --- a/pipi-php/php_pipi.c +++ b/pipi-php/php_pipi.c @@ -150,11 +150,11 @@ PHP_MINIT_FUNCTION(pipi) { REGISTER_LONG_CONSTANT("PIPI_SCAN_RASTER", PIPI_SCAN_RASTER, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("PIPI_SCAN_SERPENTINE", PIPI_SCAN_SERPENTINE, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("PIPI_PIXELS_UNINITIALISED", PIPI_PIXELS_UNINITIALISED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PIPI_PIXELS_RGBA_C", PIPI_PIXELS_RGBA_C, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PIPI_PIXELS_BGR_C", PIPI_PIXELS_BGR_C, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PIPI_PIXELS_RGBA_F", PIPI_PIXELS_RGBA_F, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PIPI_PIXELS_Y_F", PIPI_PIXELS_Y_F, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PIPI_PIXELS_MASK_C", PIPI_PIXELS_MASK_C, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PIPI_PIXELS_RGBA_U8", PIPI_PIXELS_RGBA_U8, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PIPI_PIXELS_BGR_U8", PIPI_PIXELS_BGR_U8, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PIPI_PIXELS_RGBA_F32", PIPI_PIXELS_RGBA_F32, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PIPI_PIXELS_Y_F32", PIPI_PIXELS_Y_F32, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PIPI_PIXELS_MASK_U8", PIPI_PIXELS_MASK_U8, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("PIPI_PIXELS_MAX", PIPI_PIXELS_MAX, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("PIPI_COLOR_R", PIPI_COLOR_R, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("PIPI_COLOR_G", PIPI_COLOR_G, CONST_CS | CONST_PERSISTENT); diff --git a/pipi/analysis/histogram.c b/pipi/analysis/histogram.c index ce61735..1bafe42 100644 --- a/pipi/analysis/histogram.c +++ b/pipi/analysis/histogram.c @@ -43,7 +43,7 @@ int pipi_get_image_histogram(pipi_image_t *img, pipi_histogram_t*h, int flags) if(!h) return -1; - p = pipi_get_pixels(img, PIPI_PIXELS_RGBA_C); + p = pipi_get_pixels(img, PIPI_PIXELS_RGBA_U8); data = (uint8_t *)p->pixels; memset(h->a, 0, 256*(sizeof(unsigned int))); memset(h->r, 0, 256*(sizeof(unsigned int))); diff --git a/pipi/analysis/measure.c b/pipi/analysis/measure.c index 7658dc7..545f838 100644 --- a/pipi/analysis/measure.c +++ b/pipi/analysis/measure.c @@ -42,11 +42,11 @@ double pipi_measure_msd(pipi_image_t *i1, pipi_image_t *i2) f2 = i2->last_modified; /* FIXME: this is not right */ - pipi_get_pixels(i1, PIPI_PIXELS_Y_F); - pipi_get_pixels(i2, PIPI_PIXELS_Y_F); + pipi_get_pixels(i1, PIPI_PIXELS_Y_F32); + pipi_get_pixels(i2, PIPI_PIXELS_Y_F32); - p1 = (float *)i1->p[PIPI_PIXELS_Y_F].pixels; - p2 = (float *)i2->p[PIPI_PIXELS_Y_F].pixels; + p1 = (float *)i1->p[PIPI_PIXELS_Y_F32].pixels; + p2 = (float *)i2->p[PIPI_PIXELS_Y_F32].pixels; for(y = 0; y < h; y++) for(x = 0; x < w; x++) diff --git a/pipi/codec/coreimage.m b/pipi/codec/coreimage.m index ba35827..353fa09 100644 --- a/pipi/codec/coreimage.m +++ b/pipi/codec/coreimage.m @@ -47,19 +47,19 @@ pipi_image_t *pipi_load_coreimage(const char *name) pipi_image_t *img; img = pipi_new(w, h); - img->p[PIPI_PIXELS_RGBA_C].w = w; - img->p[PIPI_PIXELS_RGBA_C].h = h; - img->p[PIPI_PIXELS_RGBA_C].pitch = ([myImage bytesPerRow]/8) * img->w; - img->p[PIPI_PIXELS_RGBA_C].bpp = [myImage bitsPerPixel]; - img->p[PIPI_PIXELS_RGBA_C].bytes = ([myImage bitsPerPixel]/8) * img->w * img->h; - img->last_modified = PIPI_PIXELS_RGBA_C; + img->p[PIPI_PIXELS_RGBA_U8].w = w; + img->p[PIPI_PIXELS_RGBA_U8].h = h; + img->p[PIPI_PIXELS_RGBA_U8].pitch = ([myImage bytesPerRow]/8) * img->w; + img->p[PIPI_PIXELS_RGBA_U8].bpp = [myImage bitsPerPixel]; + img->p[PIPI_PIXELS_RGBA_U8].bytes = ([myImage bitsPerPixel]/8) * img->w * img->h; + img->last_modified = PIPI_PIXELS_RGBA_U8; /* CoreImage feeds us with BGRA while we need RGBA, so convert it. * We also need to get a pitch==(w*bpp) in order to pipi to opper properly. */ - int pitch = (img->p[PIPI_PIXELS_RGBA_C].bpp/8); + int pitch = (img->p[PIPI_PIXELS_RGBA_U8].bpp/8); unsigned char *tmp = (unsigned char*)malloc(h*w*pitch); unsigned char *orig = (unsigned char*)[myImage bitmapData]; int x, y, k=0, o=0, a=[myImage bytesPerRow] - (w*([myImage bitsPerPixel]/8)); @@ -87,8 +87,8 @@ pipi_image_t *pipi_load_coreimage(const char *name) } o+=a; } - img->p[PIPI_PIXELS_RGBA_C].pixels = tmp; - img->p[PIPI_PIXELS_RGBA_C].pitch = w*([myImage bitsPerPixel]/8); + img->p[PIPI_PIXELS_RGBA_U8].pixels = tmp; + img->p[PIPI_PIXELS_RGBA_U8].pitch = w*([myImage bitsPerPixel]/8); @@ -97,7 +97,7 @@ pipi_image_t *pipi_load_coreimage(const char *name) struct pipi_codec_coreimage *infos = (struct pipi_codec_coreimage *) img->codec_priv; infos->format = [myImage bitmapFormat]; - pipi_pixels_t *p = pipi_get_pixels(img, PIPI_PIXELS_RGBA_C); + pipi_pixels_t *p = pipi_get_pixels(img, PIPI_PIXELS_RGBA_U8); img->codec_free = pipi_free_coreimage; @@ -109,7 +109,7 @@ pipi_image_t *pipi_load_coreimage(const char *name) int pipi_save_coreimage(pipi_image_t *img, const char *name) { NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init]; - pipi_pixels_t *p = pipi_get_pixels(img, PIPI_PIXELS_RGBA_C); + pipi_pixels_t *p = pipi_get_pixels(img, PIPI_PIXELS_RGBA_U8); int i; char *data = p->pixels; diff --git a/pipi/codec/gdi.c b/pipi/codec/gdi.c index de42e63..d80eab1 100644 --- a/pipi/codec/gdi.c +++ b/pipi/codec/gdi.c @@ -53,7 +53,7 @@ pipi_image_t *pipi_load_gdi(const char *name) } img = pipi_new(binfo.bmiHeader.biWidth, binfo.bmiHeader.biHeight); - p = pipi_get_pixels(img, PIPI_PIXELS_RGBA_C); + p = pipi_get_pixels(img, PIPI_PIXELS_RGBA_U8); data = p->pixels; binfo.bmiHeader.biBitCount = 32; @@ -94,7 +94,7 @@ int pipi_save_gdi(pipi_image_t *img, const char *name) uint8_t *data; int x, y, padding; - p = pipi_get_pixels(img, PIPI_PIXELS_RGBA_C); + p = pipi_get_pixels(img, PIPI_PIXELS_RGBA_U8); data = p->pixels; padding = ((img->w * 3) + 3) / 4 * 4 - img->w * 3; diff --git a/pipi/codec/gdiplus.cpp b/pipi/codec/gdiplus.cpp index 9a526b1..efd0460 100755 --- a/pipi/codec/gdiplus.cpp +++ b/pipi/codec/gdiplus.cpp @@ -65,7 +65,7 @@ extern "C" pipi_image_t *pipi_load_gdiplus(const char *name) } pipi_image_t *img = pipi_new(b->GetWidth(), b->GetHeight()); - pipi_pixels_t *p = pipi_get_pixels(img, PIPI_PIXELS_RGBA_C); + pipi_pixels_t *p = pipi_get_pixels(img, PIPI_PIXELS_RGBA_U8); memcpy(p->pixels, bdata.Scan0, bdata.Width * bdata.Height * 4); b->UnlockBits(&bdata); @@ -138,7 +138,7 @@ extern "C" int pipi_save_gdiplus(pipi_image_t *img, const char *name) return -1; } - pipi_pixels_t *p = pipi_get_pixels(img, PIPI_PIXELS_RGBA_C); + pipi_pixels_t *p = pipi_get_pixels(img, PIPI_PIXELS_RGBA_U8); memcpy(bdata.Scan0, p->pixels, bdata.Width * bdata.Height * 4); b->UnlockBits(&bdata); diff --git a/pipi/codec/imlib.c b/pipi/codec/imlib.c index bac691c..f229512 100644 --- a/pipi/codec/imlib.c +++ b/pipi/codec/imlib.c @@ -47,16 +47,16 @@ pipi_image_t *pipi_load_imlib2(const char *name) img = pipi_new(imlib_image_get_width(), imlib_image_get_height()); - img->p[PIPI_PIXELS_RGBA_C].pixels = imlib_image_get_data(); - img->p[PIPI_PIXELS_RGBA_C].w = img->w; - img->p[PIPI_PIXELS_RGBA_C].h = img->h; - img->p[PIPI_PIXELS_RGBA_C].pitch = 4 * img->w; - img->p[PIPI_PIXELS_RGBA_C].bpp = 32; - img->p[PIPI_PIXELS_RGBA_C].bytes = 4 * img->w * img->h; - img->last_modified = PIPI_PIXELS_RGBA_C; + img->p[PIPI_PIXELS_RGBA_U8].pixels = imlib_image_get_data(); + img->p[PIPI_PIXELS_RGBA_U8].w = img->w; + img->p[PIPI_PIXELS_RGBA_U8].h = img->h; + img->p[PIPI_PIXELS_RGBA_U8].pitch = 4 * img->w; + img->p[PIPI_PIXELS_RGBA_U8].bpp = 32; + img->p[PIPI_PIXELS_RGBA_U8].bytes = 4 * img->w * img->h; + img->last_modified = PIPI_PIXELS_RGBA_U8; img->codec_priv = (void *)priv; - img->codec_format = PIPI_PIXELS_RGBA_C; + img->codec_format = PIPI_PIXELS_RGBA_U8; img->codec_free = pipi_free_imlib2; img->wrap = 0; @@ -76,22 +76,22 @@ int pipi_save_imlib2(pipi_image_t *img, const char *name) data = imlib_image_get_data(); /* FIXME: check pitch differences here */ - if(img->last_modified == PIPI_PIXELS_RGBA_C) + if(img->last_modified == PIPI_PIXELS_RGBA_U8) { - memcpy(data, img->p[PIPI_PIXELS_RGBA_C].pixels, + memcpy(data, img->p[PIPI_PIXELS_RGBA_U8].pixels, 4 * img->w * img->h); - free(img->p[PIPI_PIXELS_RGBA_C].pixels); + free(img->p[PIPI_PIXELS_RGBA_U8].pixels); } - img->p[PIPI_PIXELS_RGBA_C].pixels = data; - img->p[PIPI_PIXELS_RGBA_C].w = imlib_image_get_width(); - img->p[PIPI_PIXELS_RGBA_C].h = imlib_image_get_height(); - img->p[PIPI_PIXELS_RGBA_C].pitch = 4 * imlib_image_get_width(); - img->p[PIPI_PIXELS_RGBA_C].bpp = 32; - img->p[PIPI_PIXELS_RGBA_C].bytes = 4 * img->w * img->h; + img->p[PIPI_PIXELS_RGBA_U8].pixels = data; + img->p[PIPI_PIXELS_RGBA_U8].w = imlib_image_get_width(); + img->p[PIPI_PIXELS_RGBA_U8].h = imlib_image_get_height(); + img->p[PIPI_PIXELS_RGBA_U8].pitch = 4 * imlib_image_get_width(); + img->p[PIPI_PIXELS_RGBA_U8].bpp = 32; + img->p[PIPI_PIXELS_RGBA_U8].bytes = 4 * img->w * img->h; img->codec_priv = (void *)priv; - img->codec_format = PIPI_PIXELS_RGBA_C; + img->codec_format = PIPI_PIXELS_RGBA_U8; img->codec_free = pipi_free_imlib2; img->wrap = 0; diff --git a/pipi/codec/modular/jpeg.c b/pipi/codec/modular/jpeg.c index b319766..ffb2716 100644 --- a/pipi/codec/modular/jpeg.c +++ b/pipi/codec/modular/jpeg.c @@ -112,16 +112,16 @@ pipi_image_t *pipi_load_jpeg(const char *name) img = pipi_new(cinfo.output_width, cinfo.output_height); - img->p[PIPI_PIXELS_RGBA_C].pixels = image; - img->p[PIPI_PIXELS_RGBA_C].w = cinfo.output_width; - img->p[PIPI_PIXELS_RGBA_C].h = cinfo.output_height; - img->p[PIPI_PIXELS_RGBA_C].pitch = cinfo.output_width*4; - img->p[PIPI_PIXELS_RGBA_C].bpp = 24; - img->p[PIPI_PIXELS_RGBA_C].bytes = 4 * img->w * img->h; - img->last_modified = PIPI_PIXELS_RGBA_C; + img->p[PIPI_PIXELS_RGBA_U8].pixels = image; + img->p[PIPI_PIXELS_RGBA_U8].w = cinfo.output_width; + img->p[PIPI_PIXELS_RGBA_U8].h = cinfo.output_height; + img->p[PIPI_PIXELS_RGBA_U8].pitch = cinfo.output_width*4; + img->p[PIPI_PIXELS_RGBA_U8].bpp = 24; + img->p[PIPI_PIXELS_RGBA_U8].bytes = 4 * img->w * img->h; + img->last_modified = PIPI_PIXELS_RGBA_U8; img->codec_priv = (void *)&cinfo; - img->codec_format = PIPI_PIXELS_RGBA_C; + img->codec_format = PIPI_PIXELS_RGBA_U8; img->codec_free = pipi_free_jpeg; img->wrap = 0; @@ -143,7 +143,7 @@ int pipi_save_jpeg(pipi_image_t *img, const char *name) unsigned char *data = NULL; unsigned char *line = NULL; - pipi_pixels_t *pixels = pipi_get_pixels(img, PIPI_PIXELS_RGBA_C); + pipi_pixels_t *pixels = pipi_get_pixels(img, PIPI_PIXELS_RGBA_U8); if (!pixels) return 0; @@ -212,8 +212,8 @@ end: static int pipi_free_jpeg(pipi_image_t *img) { - if(img->p[PIPI_PIXELS_RGBA_C].pixels) - free(img->p[PIPI_PIXELS_RGBA_C].pixels); + if(img->p[PIPI_PIXELS_RGBA_U8].pixels) + free(img->p[PIPI_PIXELS_RGBA_U8].pixels); return 0; } diff --git a/pipi/codec/opencv.c b/pipi/codec/opencv.c index 01da834..a896c64 100644 --- a/pipi/codec/opencv.c +++ b/pipi/codec/opencv.c @@ -43,16 +43,16 @@ pipi_image_t *pipi_load_opencv(const char *name) img = pipi_new(priv->width, priv->height); - img->p[PIPI_PIXELS_BGR_C].pixels = priv->imageData; - img->p[PIPI_PIXELS_BGR_C].w = priv->width; - img->p[PIPI_PIXELS_BGR_C].h = priv->height; - img->p[PIPI_PIXELS_BGR_C].pitch = priv->widthStep; - img->p[PIPI_PIXELS_BGR_C].bpp = 24; - img->p[PIPI_PIXELS_BGR_C].bytes = 3 * img->w * img->h; - img->last_modified = PIPI_PIXELS_BGR_C; + img->p[PIPI_PIXELS_BGR_U8].pixels = priv->imageData; + img->p[PIPI_PIXELS_BGR_U8].w = priv->width; + img->p[PIPI_PIXELS_BGR_U8].h = priv->height; + img->p[PIPI_PIXELS_BGR_U8].pitch = priv->widthStep; + img->p[PIPI_PIXELS_BGR_U8].bpp = 24; + img->p[PIPI_PIXELS_BGR_U8].bytes = 3 * img->w * img->h; + img->last_modified = PIPI_PIXELS_BGR_U8; img->codec_priv = (void *)priv; - img->codec_format = PIPI_PIXELS_BGR_C; + img->codec_format = PIPI_PIXELS_BGR_U8; img->codec_free = pipi_free_opencv; img->wrap = 0; @@ -69,22 +69,22 @@ int pipi_save_opencv(pipi_image_t *img, const char *name) IPL_DEPTH_8U, 3); /* FIXME: check pitch differences here */ - if(img->last_modified == PIPI_PIXELS_BGR_C) + if(img->last_modified == PIPI_PIXELS_BGR_U8) { - memcpy(priv->imageData, img->p[PIPI_PIXELS_BGR_C].pixels, + memcpy(priv->imageData, img->p[PIPI_PIXELS_BGR_U8].pixels, 3 * img->w * img->h); - free(img->p[PIPI_PIXELS_BGR_C].pixels); + free(img->p[PIPI_PIXELS_BGR_U8].pixels); } - img->p[PIPI_PIXELS_BGR_C].pixels = priv->imageData; - img->p[PIPI_PIXELS_BGR_C].w = priv->width; - img->p[PIPI_PIXELS_BGR_C].h = priv->height; - img->p[PIPI_PIXELS_BGR_C].pitch = priv->widthStep; - img->p[PIPI_PIXELS_BGR_C].bpp = 24; - img->p[PIPI_PIXELS_BGR_C].bytes = 3 * img->w * img->h; + img->p[PIPI_PIXELS_BGR_U8].pixels = priv->imageData; + img->p[PIPI_PIXELS_BGR_U8].w = priv->width; + img->p[PIPI_PIXELS_BGR_U8].h = priv->height; + img->p[PIPI_PIXELS_BGR_U8].pitch = priv->widthStep; + img->p[PIPI_PIXELS_BGR_U8].bpp = 24; + img->p[PIPI_PIXELS_BGR_U8].bytes = 3 * img->w * img->h; img->codec_priv = (void *)priv; - img->codec_format = PIPI_PIXELS_BGR_C; + img->codec_format = PIPI_PIXELS_BGR_U8; img->codec_free = pipi_free_opencv; img->wrap = 0; diff --git a/pipi/codec/oric.c b/pipi/codec/oric.c index 79e9857..7298338 100644 --- a/pipi/codec/oric.c +++ b/pipi/codec/oric.c @@ -64,7 +64,7 @@ pipi_image_t *pipi_load_oric(char const *name) } img = pipi_new(WIDTH, HEIGHT); - p = pipi_get_pixels(img, PIPI_PIXELS_RGBA_C); + p = pipi_get_pixels(img, PIPI_PIXELS_RGBA_U8); data = p->pixels; for(y = 0; y < HEIGHT; y++) @@ -144,7 +144,7 @@ int pipi_save_oric(pipi_image_t *img, char const *name) tmp = pipi_resize(img, WIDTH, HEIGHT); else tmp = img; - p = pipi_get_pixels(tmp, PIPI_PIXELS_RGBA_F); + p = pipi_get_pixels(tmp, PIPI_PIXELS_RGBA_F32); data = p->pixels; screen = malloc(WIDTH * HEIGHT / 6); write_screen(data, screen); diff --git a/pipi/codec/sdl.c b/pipi/codec/sdl.c index 7879189..63902cf 100644 --- a/pipi/codec/sdl.c +++ b/pipi/codec/sdl.c @@ -48,16 +48,16 @@ pipi_image_t *pipi_load_sdl(const char *name) img = pipi_new(priv->w, priv->h); - img->p[PIPI_PIXELS_RGBA_C].pixels = priv->pixels; - img->p[PIPI_PIXELS_RGBA_C].w = priv->w; - img->p[PIPI_PIXELS_RGBA_C].h = priv->h; - img->p[PIPI_PIXELS_RGBA_C].pitch = priv->pitch; - img->p[PIPI_PIXELS_RGBA_C].bpp = 32; - img->p[PIPI_PIXELS_RGBA_C].bytes = 4 * img->w * img->h; - img->last_modified = PIPI_PIXELS_RGBA_C; + img->p[PIPI_PIXELS_RGBA_U8].pixels = priv->pixels; + img->p[PIPI_PIXELS_RGBA_U8].w = priv->w; + img->p[PIPI_PIXELS_RGBA_U8].h = priv->h; + img->p[PIPI_PIXELS_RGBA_U8].pitch = priv->pitch; + img->p[PIPI_PIXELS_RGBA_U8].bpp = 32; + img->p[PIPI_PIXELS_RGBA_U8].bytes = 4 * img->w * img->h; + img->last_modified = PIPI_PIXELS_RGBA_U8; img->codec_priv = (void *)priv; - img->codec_format = PIPI_PIXELS_RGBA_C; + img->codec_format = PIPI_PIXELS_RGBA_U8; img->codec_free = pipi_free_sdl; img->wrap = 0; @@ -73,22 +73,22 @@ int pipi_save_sdl(pipi_image_t *img, const char *name) SDL_Surface *priv = create_32bpp_surface(img->w, img->h); /* FIXME: check pitch differences here */ - if(img->last_modified == PIPI_PIXELS_RGBA_C) + if(img->last_modified == PIPI_PIXELS_RGBA_U8) { - memcpy(priv->pixels, img->p[PIPI_PIXELS_RGBA_C].pixels, + memcpy(priv->pixels, img->p[PIPI_PIXELS_RGBA_U8].pixels, priv->pitch * priv->h); - free(img->p[PIPI_PIXELS_RGBA_C].pixels); + free(img->p[PIPI_PIXELS_RGBA_U8].pixels); } - img->p[PIPI_PIXELS_RGBA_C].pixels = priv->pixels; - img->p[PIPI_PIXELS_RGBA_C].w = priv->w; - img->p[PIPI_PIXELS_RGBA_C].h = priv->h; - img->p[PIPI_PIXELS_RGBA_C].pitch = priv->pitch; - img->p[PIPI_PIXELS_RGBA_C].bpp = 32; - img->p[PIPI_PIXELS_RGBA_C].bytes = 4 * img->w * img->h; + img->p[PIPI_PIXELS_RGBA_U8].pixels = priv->pixels; + img->p[PIPI_PIXELS_RGBA_U8].w = priv->w; + img->p[PIPI_PIXELS_RGBA_U8].h = priv->h; + img->p[PIPI_PIXELS_RGBA_U8].pitch = priv->pitch; + img->p[PIPI_PIXELS_RGBA_U8].bpp = 32; + img->p[PIPI_PIXELS_RGBA_U8].bytes = 4 * img->w * img->h; img->codec_priv = (void *)priv; - img->codec_format = PIPI_PIXELS_RGBA_C; + img->codec_format = PIPI_PIXELS_RGBA_U8; img->codec_free = pipi_free_sdl; img->wrap = 0; diff --git a/pipi/combine/mean.c b/pipi/combine/mean.c index 9a8264a..e7efc51 100644 --- a/pipi/combine/mean.c +++ b/pipi/combine/mean.c @@ -37,12 +37,12 @@ pipi_image_t *pipi_mean(pipi_image_t *img1, pipi_image_t *img2) h = img1->h; dst = pipi_new(w, h); - dstp = pipi_get_pixels(dst, PIPI_PIXELS_RGBA_F); + dstp = pipi_get_pixels(dst, PIPI_PIXELS_RGBA_F32); dstdata = (float *)dstp->pixels; - img1p = pipi_get_pixels(img1, PIPI_PIXELS_RGBA_F); + img1p = pipi_get_pixels(img1, PIPI_PIXELS_RGBA_F32); img1data = (float *)img1p->pixels; - img2p = pipi_get_pixels(img2, PIPI_PIXELS_RGBA_F); + img2p = pipi_get_pixels(img2, PIPI_PIXELS_RGBA_F32); img2data = (float *)img2p->pixels; for(y = 0; y < h; y++) diff --git a/pipi/combine/minmax.c b/pipi/combine/minmax.c index 2dd7220..1d9faa0 100644 --- a/pipi/combine/minmax.c +++ b/pipi/combine/minmax.c @@ -37,12 +37,12 @@ pipi_image_t *pipi_min(pipi_image_t *img1, pipi_image_t *img2) h = img1->h; dst = pipi_new(w, h); - dstp = pipi_get_pixels(dst, PIPI_PIXELS_RGBA_F); + dstp = pipi_get_pixels(dst, PIPI_PIXELS_RGBA_F32); dstdata = (float *)dstp->pixels; - img1p = pipi_get_pixels(img1, PIPI_PIXELS_RGBA_F); + img1p = pipi_get_pixels(img1, PIPI_PIXELS_RGBA_F32); img1data = (float *)img1p->pixels; - img2p = pipi_get_pixels(img2, PIPI_PIXELS_RGBA_F); + img2p = pipi_get_pixels(img2, PIPI_PIXELS_RGBA_F32); img2data = (float *)img2p->pixels; for(y = 0; y < h; y++) @@ -86,12 +86,12 @@ pipi_image_t *pipi_max(pipi_image_t *img1, pipi_image_t *img2) h = img1->h; dst = pipi_new(w, h); - dstp = pipi_get_pixels(dst, PIPI_PIXELS_RGBA_F); + dstp = pipi_get_pixels(dst, PIPI_PIXELS_RGBA_F32); dstdata = (float *)dstp->pixels; - img1p = pipi_get_pixels(img1, PIPI_PIXELS_RGBA_F); + img1p = pipi_get_pixels(img1, PIPI_PIXELS_RGBA_F32); img1data = (float *)img1p->pixels; - img2p = pipi_get_pixels(img2, PIPI_PIXELS_RGBA_F); + img2p = pipi_get_pixels(img2, PIPI_PIXELS_RGBA_F32); img2data = (float *)img2p->pixels; for(y = 0; y < h; y++) diff --git a/pipi/combine/mulscreen.c b/pipi/combine/mulscreen.c index fde1c35..af7d730 100644 --- a/pipi/combine/mulscreen.c +++ b/pipi/combine/mulscreen.c @@ -37,12 +37,12 @@ pipi_image_t *pipi_multiply(pipi_image_t *img1, pipi_image_t *img2) h = img1->h; dst = pipi_new(w, h); - dstp = pipi_get_pixels(dst, PIPI_PIXELS_RGBA_F); + dstp = pipi_get_pixels(dst, PIPI_PIXELS_RGBA_F32); dstdata = (float *)dstp->pixels; - img1p = pipi_get_pixels(img1, PIPI_PIXELS_RGBA_F); + img1p = pipi_get_pixels(img1, PIPI_PIXELS_RGBA_F32); img1data = (float *)img1p->pixels; - img2p = pipi_get_pixels(img2, PIPI_PIXELS_RGBA_F); + img2p = pipi_get_pixels(img2, PIPI_PIXELS_RGBA_F32); img2data = (float *)img2p->pixels; for(y = 0; y < h; y++) @@ -86,12 +86,12 @@ pipi_image_t *pipi_divide(pipi_image_t *img1, pipi_image_t *img2) h = img1->h; dst = pipi_new(w, h); - dstp = pipi_get_pixels(dst, PIPI_PIXELS_RGBA_F); + dstp = pipi_get_pixels(dst, PIPI_PIXELS_RGBA_F32); dstdata = (float *)dstp->pixels; - img1p = pipi_get_pixels(img1, PIPI_PIXELS_RGBA_F); + img1p = pipi_get_pixels(img1, PIPI_PIXELS_RGBA_F32); img1data = (float *)img1p->pixels; - img2p = pipi_get_pixels(img2, PIPI_PIXELS_RGBA_F); + img2p = pipi_get_pixels(img2, PIPI_PIXELS_RGBA_F32); img2data = (float *)img2p->pixels; for(y = 0; y < h; y++) @@ -135,12 +135,12 @@ pipi_image_t *pipi_screen(pipi_image_t *img1, pipi_image_t *img2) h = img1->h; dst = pipi_new(w, h); - dstp = pipi_get_pixels(dst, PIPI_PIXELS_RGBA_F); + dstp = pipi_get_pixels(dst, PIPI_PIXELS_RGBA_F32); dstdata = (float *)dstp->pixels; - img1p = pipi_get_pixels(img1, PIPI_PIXELS_RGBA_F); + img1p = pipi_get_pixels(img1, PIPI_PIXELS_RGBA_F32); img1data = (float *)img1p->pixels; - img2p = pipi_get_pixels(img2, PIPI_PIXELS_RGBA_F); + img2p = pipi_get_pixels(img2, PIPI_PIXELS_RGBA_F32); img2data = (float *)img2p->pixels; for(y = 0; y < h; y++) @@ -184,12 +184,12 @@ pipi_image_t *pipi_overlay(pipi_image_t *img1, pipi_image_t *img2) h = img1->h; dst = pipi_new(w, h); - dstp = pipi_get_pixels(dst, PIPI_PIXELS_RGBA_F); + dstp = pipi_get_pixels(dst, PIPI_PIXELS_RGBA_F32); dstdata = (float *)dstp->pixels; - img1p = pipi_get_pixels(img1, PIPI_PIXELS_RGBA_F); + img1p = pipi_get_pixels(img1, PIPI_PIXELS_RGBA_F32); img1data = (float *)img1p->pixels; - img2p = pipi_get_pixels(img2, PIPI_PIXELS_RGBA_F); + img2p = pipi_get_pixels(img2, PIPI_PIXELS_RGBA_F32); img2data = (float *)img2p->pixels; for(y = 0; y < h; y++) diff --git a/pipi/combine/rgb.c b/pipi/combine/rgb.c index 5a771d7..de4c3aa 100644 --- a/pipi/combine/rgb.c +++ b/pipi/combine/rgb.c @@ -37,14 +37,14 @@ pipi_image_t *pipi_rgb(pipi_image_t *i1, pipi_image_t *i2, pipi_image_t *i3) h = i1->h; dst = pipi_new(w, h); - dstp = pipi_get_pixels(dst, PIPI_PIXELS_RGBA_F); + dstp = pipi_get_pixels(dst, PIPI_PIXELS_RGBA_F32); dstdata = (float *)dstp->pixels; - i1p = pipi_get_pixels(i1, PIPI_PIXELS_Y_F); + i1p = pipi_get_pixels(i1, PIPI_PIXELS_Y_F32); i1data = (float *)i1p->pixels; - i2p = pipi_get_pixels(i2, PIPI_PIXELS_Y_F); + i2p = pipi_get_pixels(i2, PIPI_PIXELS_Y_F32); i2data = (float *)i2p->pixels; - i3p = pipi_get_pixels(i3, PIPI_PIXELS_Y_F); + i3p = pipi_get_pixels(i3, PIPI_PIXELS_Y_F32); i3data = (float *)i3p->pixels; for(y = 0; y < h; y++) @@ -72,10 +72,10 @@ pipi_image_t *pipi_red(pipi_image_t *src) h = src->h; dst = pipi_new(w, h); - dstp = pipi_get_pixels(dst, PIPI_PIXELS_Y_F); + dstp = pipi_get_pixels(dst, PIPI_PIXELS_Y_F32); dstdata = (float *)dstp->pixels; - srcp = pipi_get_pixels(src, PIPI_PIXELS_RGBA_F); + srcp = pipi_get_pixels(src, PIPI_PIXELS_RGBA_F32); srcdata = (float *)srcp->pixels; for(y = 0; y < h; y++) @@ -96,10 +96,10 @@ pipi_image_t *pipi_green(pipi_image_t *src) h = src->h; dst = pipi_new(w, h); - dstp = pipi_get_pixels(dst, PIPI_PIXELS_Y_F); + dstp = pipi_get_pixels(dst, PIPI_PIXELS_Y_F32); dstdata = (float *)dstp->pixels; - srcp = pipi_get_pixels(src, PIPI_PIXELS_RGBA_F); + srcp = pipi_get_pixels(src, PIPI_PIXELS_RGBA_F32); srcdata = (float *)srcp->pixels; for(y = 0; y < h; y++) @@ -120,10 +120,10 @@ pipi_image_t *pipi_blue(pipi_image_t *src) h = src->h; dst = pipi_new(w, h); - dstp = pipi_get_pixels(dst, PIPI_PIXELS_Y_F); + dstp = pipi_get_pixels(dst, PIPI_PIXELS_Y_F32); dstdata = (float *)dstp->pixels; - srcp = pipi_get_pixels(src, PIPI_PIXELS_RGBA_F); + srcp = pipi_get_pixels(src, PIPI_PIXELS_RGBA_F32); srcdata = (float *)srcp->pixels; for(y = 0; y < h; y++) diff --git a/pipi/combine/subadd.c b/pipi/combine/subadd.c index 2391340..5441111 100644 --- a/pipi/combine/subadd.c +++ b/pipi/combine/subadd.c @@ -38,12 +38,12 @@ pipi_image_t *pipi_add(pipi_image_t *img1, pipi_image_t *img2) h = img1->h; dst = pipi_new(w, h); - dstp = pipi_get_pixels(dst, PIPI_PIXELS_RGBA_F); + dstp = pipi_get_pixels(dst, PIPI_PIXELS_RGBA_F32); dstdata = (float *)dstp->pixels; - img1p = pipi_get_pixels(img1, PIPI_PIXELS_RGBA_F); + img1p = pipi_get_pixels(img1, PIPI_PIXELS_RGBA_F32); img1data = (float *)img1p->pixels; - img2p = pipi_get_pixels(img2, PIPI_PIXELS_RGBA_F); + img2p = pipi_get_pixels(img2, PIPI_PIXELS_RGBA_F32); img2data = (float *)img2p->pixels; for(y = 0; y < h; y++) @@ -87,12 +87,12 @@ pipi_image_t *pipi_sub(pipi_image_t *img1, pipi_image_t *img2) h = img1->h; dst = pipi_new(w, h); - dstp = pipi_get_pixels(dst, PIPI_PIXELS_RGBA_F); + dstp = pipi_get_pixels(dst, PIPI_PIXELS_RGBA_F32); dstdata = (float *)dstp->pixels; - img1p = pipi_get_pixels(img1, PIPI_PIXELS_RGBA_F); + img1p = pipi_get_pixels(img1, PIPI_PIXELS_RGBA_F32); img1data = (float *)img1p->pixels; - img2p = pipi_get_pixels(img2, PIPI_PIXELS_RGBA_F); + img2p = pipi_get_pixels(img2, PIPI_PIXELS_RGBA_F32); img2data = (float *)img2p->pixels; for(y = 0; y < h; y++) @@ -136,12 +136,12 @@ pipi_image_t *pipi_difference(pipi_image_t *img1, pipi_image_t *img2) h = img1->h; dst = pipi_new(w, h); - dstp = pipi_get_pixels(dst, PIPI_PIXELS_RGBA_F); + dstp = pipi_get_pixels(dst, PIPI_PIXELS_RGBA_F32); dstdata = (float *)dstp->pixels; - img1p = pipi_get_pixels(img1, PIPI_PIXELS_RGBA_F); + img1p = pipi_get_pixels(img1, PIPI_PIXELS_RGBA_F32); img1data = (float *)img1p->pixels; - img2p = pipi_get_pixels(img2, PIPI_PIXELS_RGBA_F); + img2p = pipi_get_pixels(img2, PIPI_PIXELS_RGBA_F32); img2data = (float *)img2p->pixels; for(y = 0; y < h; y++) diff --git a/pipi/context.c b/pipi/context.c index 226982c..a1c8e3b 100644 --- a/pipi/context.c +++ b/pipi/context.c @@ -703,7 +703,7 @@ int pipi_command(pipi_context_t *ctx, char const *cmd, ...) { if(ctx->nimages < 1) return -1; - pipi_get_pixels(ctx->images[ctx->nimages - 1], PIPI_PIXELS_Y_F); + pipi_get_pixels(ctx->images[ctx->nimages - 1], PIPI_PIXELS_Y_F32); } else if(!strcmp(cmd, "free")) { diff --git a/pipi/dither/dbs.c b/pipi/dither/dbs.c index 5bf4e9d..52441e3 100644 --- a/pipi/dither/dbs.c +++ b/pipi/dither/dbs.c @@ -69,20 +69,20 @@ pipi_image_t *pipi_dither_dbs(pipi_image_t *img) memset(changelist, 0, cw * ch * sizeof(int)); src = pipi_copy(img); - pipi_get_pixels(src, PIPI_PIXELS_Y_F); + pipi_get_pixels(src, PIPI_PIXELS_Y_F32); tmp1 = pipi_convolution(src, NN, NN, kernel); - tmp1p = pipi_get_pixels(tmp1, PIPI_PIXELS_Y_F); + tmp1p = pipi_get_pixels(tmp1, PIPI_PIXELS_Y_F32); tmp1data = (float *)tmp1p->pixels; dst = pipi_dither_random(src); - dstp = pipi_get_pixels(dst, PIPI_PIXELS_Y_F); + dstp = pipi_get_pixels(dst, PIPI_PIXELS_Y_F32); dstdata = (float *)dstp->pixels; pipi_free(src); tmp2 = pipi_convolution(dst, NN, NN, kernel); - tmp2p = pipi_get_pixels(tmp2, PIPI_PIXELS_Y_F); + tmp2p = pipi_get_pixels(tmp2, PIPI_PIXELS_Y_F32); tmp2data = (float *)tmp2p->pixels; for(;;) diff --git a/pipi/dither/ediff.c b/pipi/dither/ediff.c index c33ea44..fcba9a0 100644 --- a/pipi/dither/ediff.c +++ b/pipi/dither/ediff.c @@ -41,10 +41,10 @@ pipi_image_t *pipi_dither_ediff(pipi_image_t *img, pipi_image_t *ker, kh = ker->h; dst = pipi_copy(img); - dstp = pipi_get_pixels(dst, PIPI_PIXELS_Y_F); + dstp = pipi_get_pixels(dst, PIPI_PIXELS_Y_F32); dstdata = (float *)dstp->pixels; - kerp = pipi_get_pixels(ker, PIPI_PIXELS_Y_F); + kerp = pipi_get_pixels(ker, PIPI_PIXELS_Y_F32); kerdata = (float *)kerp->pixels; for(kx = 0; kx < kw; kx++) if(kerdata[kx] > 0) diff --git a/pipi/dither/ordered.c b/pipi/dither/ordered.c index 0026f13..6cca7ec 100644 --- a/pipi/dither/ordered.c +++ b/pipi/dither/ordered.c @@ -63,10 +63,10 @@ pipi_image_t *pipi_dither_ordered_ext(pipi_image_t *img, pipi_image_t *kernel, sint = sin(angle * (M_PI / 180)); dst = pipi_copy(img); - dstp = pipi_get_pixels(dst, PIPI_PIXELS_Y_F); + dstp = pipi_get_pixels(dst, PIPI_PIXELS_Y_F32); dstdata = (float *)dstp->pixels; - kernelp = pipi_get_pixels(kernel, PIPI_PIXELS_Y_F); + kernelp = pipi_get_pixels(kernel, PIPI_PIXELS_Y_F32); kerneldata = (float *)kernelp->pixels; for(y = 0; y < h; y++) @@ -112,11 +112,11 @@ pipi_image_t *pipi_order(pipi_image_t *src) h = src->h; epsilon = 1. / (w * h + 1); - srcp = pipi_get_pixels(src, PIPI_PIXELS_Y_F); + srcp = pipi_get_pixels(src, PIPI_PIXELS_Y_F32); srcdata = (float *)srcp->pixels; dst = pipi_new(w, h); - dstp = pipi_get_pixels(dst, PIPI_PIXELS_Y_F); + dstp = pipi_get_pixels(dst, PIPI_PIXELS_Y_F32); dstdata = (float *)dstp->pixels; circle = malloc(w * h * sizeof(dot_t)); diff --git a/pipi/dither/ostromoukhov.c b/pipi/dither/ostromoukhov.c index c98a6e6..8c08ba0 100644 --- a/pipi/dither/ostromoukhov.c +++ b/pipi/dither/ostromoukhov.c @@ -76,7 +76,7 @@ pipi_image_t *pipi_dither_ostromoukhov(pipi_image_t *img, pipi_scan_t scan) h = img->h; dst = pipi_copy(img); - dstp = pipi_get_pixels(dst, PIPI_PIXELS_Y_F); + dstp = pipi_get_pixels(dst, PIPI_PIXELS_Y_F32); dstdata = (float *)dstp->pixels; for(y = 0; y < h; y++) diff --git a/pipi/dither/random.c b/pipi/dither/random.c index dda07d3..f2fd4f4 100644 --- a/pipi/dither/random.c +++ b/pipi/dither/random.c @@ -33,7 +33,7 @@ pipi_image_t *pipi_dither_random(pipi_image_t *img) h = img->h; dst = pipi_copy(img); - dstp = pipi_get_pixels(dst, PIPI_PIXELS_Y_F); + dstp = pipi_get_pixels(dst, PIPI_PIXELS_Y_F32); dstdata = (float *)dstp->pixels; for(y = 0; y < h; y++) diff --git a/pipi/filter/autocontrast.c b/pipi/filter/autocontrast.c index 1e5702f..b495527 100644 --- a/pipi/filter/autocontrast.c +++ b/pipi/filter/autocontrast.c @@ -39,10 +39,10 @@ pipi_image_t *pipi_autocontrast(pipi_image_t *src) w = src->w; h = src->h; - gray = (src->last_modified == PIPI_PIXELS_Y_F); + gray = (src->last_modified == PIPI_PIXELS_Y_F32); - srcp = gray ? pipi_get_pixels(src, PIPI_PIXELS_Y_F) - : pipi_get_pixels(src, PIPI_PIXELS_RGBA_F); + srcp = gray ? pipi_get_pixels(src, PIPI_PIXELS_Y_F32) + : pipi_get_pixels(src, PIPI_PIXELS_RGBA_F32); srcdata = (float *)srcp->pixels; for(y = 0; y < h; y++) @@ -80,8 +80,8 @@ pipi_image_t *pipi_autocontrast(pipi_image_t *src) t = 1. / (max - min); dst = pipi_new(w, h); - dstp = gray ? pipi_get_pixels(dst, PIPI_PIXELS_Y_F) - : pipi_get_pixels(dst, PIPI_PIXELS_RGBA_F); + dstp = gray ? pipi_get_pixels(dst, PIPI_PIXELS_Y_F32) + : pipi_get_pixels(dst, PIPI_PIXELS_RGBA_F32); dstdata = (float *)dstp->pixels; for(y = 0; y < h; y++) diff --git a/pipi/filter/blur.c b/pipi/filter/blur.c index 9aa4209..98af9ca 100644 --- a/pipi/filter/blur.c +++ b/pipi/filter/blur.c @@ -135,14 +135,14 @@ pipi_image_t *pipi_box_blur_ext(pipi_image_t *src, int m, int n) { if(src->wrap) { - if(src->last_modified == PIPI_PIXELS_Y_F) + if(src->last_modified == PIPI_PIXELS_Y_F32) return boxblur_gray_wrap(src, m, n); return boxblur_wrap(src, m, n); } else { - if(src->last_modified == PIPI_PIXELS_Y_F) + if(src->last_modified == PIPI_PIXELS_Y_F32) return boxblur_gray(src, m, n); return boxblur(src, m, n); @@ -163,13 +163,13 @@ static pipi_image_t *T(boxblur)(pipi_image_t *src, int m, int n) h = src->h; size = (2 * m + 1) * (2 * n + 1); - srcp = FLAG_GRAY ? pipi_get_pixels(src, PIPI_PIXELS_Y_F) - : pipi_get_pixels(src, PIPI_PIXELS_RGBA_F); + srcp = FLAG_GRAY ? pipi_get_pixels(src, PIPI_PIXELS_Y_F32) + : pipi_get_pixels(src, PIPI_PIXELS_RGBA_F32); srcdata = (float *)srcp->pixels; dst = pipi_new(w, h); - dstp = FLAG_GRAY ? pipi_get_pixels(dst, PIPI_PIXELS_Y_F) - : pipi_get_pixels(dst, PIPI_PIXELS_RGBA_F); + dstp = FLAG_GRAY ? pipi_get_pixels(dst, PIPI_PIXELS_Y_F32) + : pipi_get_pixels(dst, PIPI_PIXELS_RGBA_F32); dstdata = (float *)dstp->pixels; acc = malloc(w * (FLAG_GRAY ? 1 : 4) * sizeof(double)); diff --git a/pipi/filter/color.c b/pipi/filter/color.c index ada89b6..529faf5 100644 --- a/pipi/filter/color.c +++ b/pipi/filter/color.c @@ -36,15 +36,15 @@ pipi_image_t *pipi_brightness(pipi_image_t *src, double val) w = src->w; h = src->h; - gray = (src->last_modified == PIPI_PIXELS_Y_F); + gray = (src->last_modified == PIPI_PIXELS_Y_F32); - srcp = gray ? pipi_get_pixels(src, PIPI_PIXELS_Y_F) - : pipi_get_pixels(src, PIPI_PIXELS_RGBA_F); + srcp = gray ? pipi_get_pixels(src, PIPI_PIXELS_Y_F32) + : pipi_get_pixels(src, PIPI_PIXELS_RGBA_F32); srcdata = (float *)srcp->pixels; dst = pipi_new(w, h); - dstp = gray ? pipi_get_pixels(dst, PIPI_PIXELS_Y_F) - : pipi_get_pixels(dst, PIPI_PIXELS_RGBA_F); + dstp = gray ? pipi_get_pixels(dst, PIPI_PIXELS_Y_F32) + : pipi_get_pixels(dst, PIPI_PIXELS_RGBA_F32); dstdata = (float *)dstp->pixels; if(val >= 0.0) @@ -117,15 +117,15 @@ pipi_image_t *pipi_contrast(pipi_image_t *src, double val) w = src->w; h = src->h; - gray = (src->last_modified == PIPI_PIXELS_Y_F); + gray = (src->last_modified == PIPI_PIXELS_Y_F32); - srcp = gray ? pipi_get_pixels(src, PIPI_PIXELS_Y_F) - : pipi_get_pixels(src, PIPI_PIXELS_RGBA_F); + srcp = gray ? pipi_get_pixels(src, PIPI_PIXELS_Y_F32) + : pipi_get_pixels(src, PIPI_PIXELS_RGBA_F32); srcdata = (float *)srcp->pixels; dst = pipi_new(w, h); - dstp = gray ? pipi_get_pixels(dst, PIPI_PIXELS_Y_F) - : pipi_get_pixels(dst, PIPI_PIXELS_RGBA_F); + dstp = gray ? pipi_get_pixels(dst, PIPI_PIXELS_Y_F32) + : pipi_get_pixels(dst, PIPI_PIXELS_RGBA_F32); dstdata = (float *)dstp->pixels; if(val >= 0.0) @@ -208,15 +208,15 @@ pipi_image_t *pipi_invert(pipi_image_t *src) w = src->w; h = src->h; - gray = (src->last_modified == PIPI_PIXELS_Y_F); + gray = (src->last_modified == PIPI_PIXELS_Y_F32); - srcp = gray ? pipi_get_pixels(src, PIPI_PIXELS_Y_F) - : pipi_get_pixels(src, PIPI_PIXELS_RGBA_F); + srcp = gray ? pipi_get_pixels(src, PIPI_PIXELS_Y_F32) + : pipi_get_pixels(src, PIPI_PIXELS_RGBA_F32); srcdata = (float *)srcp->pixels; dst = pipi_new(w, h); - dstp = gray ? pipi_get_pixels(dst, PIPI_PIXELS_Y_F) - : pipi_get_pixels(dst, PIPI_PIXELS_RGBA_F); + dstp = gray ? pipi_get_pixels(dst, PIPI_PIXELS_Y_F32) + : pipi_get_pixels(dst, PIPI_PIXELS_RGBA_F32); dstdata = (float *)dstp->pixels; for(y = 0; y < h; y++) @@ -252,15 +252,15 @@ pipi_image_t *pipi_threshold(pipi_image_t *src, double val) w = src->w; h = src->h; - gray = (src->last_modified == PIPI_PIXELS_Y_F); + gray = (src->last_modified == PIPI_PIXELS_Y_F32); - srcp = gray ? pipi_get_pixels(src, PIPI_PIXELS_Y_F) - : pipi_get_pixels(src, PIPI_PIXELS_RGBA_F); + srcp = gray ? pipi_get_pixels(src, PIPI_PIXELS_Y_F32) + : pipi_get_pixels(src, PIPI_PIXELS_RGBA_F32); srcdata = (float *)srcp->pixels; dst = pipi_new(w, h); - dstp = gray ? pipi_get_pixels(dst, PIPI_PIXELS_Y_F) - : pipi_get_pixels(dst, PIPI_PIXELS_RGBA_F); + dstp = gray ? pipi_get_pixels(dst, PIPI_PIXELS_Y_F32) + : pipi_get_pixels(dst, PIPI_PIXELS_RGBA_F32); dstdata = (float *)dstp->pixels; for(y = 0; y < h; y++) diff --git a/pipi/filter/convolution.c b/pipi/filter/convolution.c index d1ae38e..9657a70 100644 --- a/pipi/filter/convolution.c +++ b/pipi/filter/convolution.c @@ -70,7 +70,7 @@ pipi_image_t *pipi_convolution(pipi_image_t *src, int m, int n, double mat[]) if(fabs(p - q) > 0.0001 * 0.0001) { - if(src->last_modified == PIPI_PIXELS_Y_F) + if(src->last_modified == PIPI_PIXELS_Y_F32) { if(src->wrap) return conv_gray_wrap(src, m, n, mat); @@ -96,7 +96,7 @@ pipi_image_t *pipi_convolution(pipi_image_t *src, int m, int n, double mat[]) for(j = 0; j < n; j++) vvec[j] = mat[j * m + besti] / tmp; - if(src->last_modified == PIPI_PIXELS_Y_F) + if(src->last_modified == PIPI_PIXELS_Y_F32) ret = src->wrap ? sepconv_gray_wrap(src, m, hvec, n, vvec) : sepconv_gray(src, m, hvec, n, vvec); else @@ -121,13 +121,13 @@ static pipi_image_t *T(conv)(pipi_image_t *src, int m, int n, double mat[]) w = src->w; h = src->h; - srcp = FLAG_GRAY ? pipi_get_pixels(src, PIPI_PIXELS_Y_F) - : pipi_get_pixels(src, PIPI_PIXELS_RGBA_F); + srcp = FLAG_GRAY ? pipi_get_pixels(src, PIPI_PIXELS_Y_F32) + : pipi_get_pixels(src, PIPI_PIXELS_RGBA_F32); srcdata = (float *)srcp->pixels; dst = pipi_new(w, h); - dstp = FLAG_GRAY ? pipi_get_pixels(dst, PIPI_PIXELS_Y_F) - : pipi_get_pixels(dst, PIPI_PIXELS_RGBA_F); + dstp = FLAG_GRAY ? pipi_get_pixels(dst, PIPI_PIXELS_Y_F32) + : pipi_get_pixels(dst, PIPI_PIXELS_RGBA_F32); dstdata = (float *)dstp->pixels; for(y = 0; y < h; y++) @@ -189,13 +189,13 @@ static pipi_image_t *T(sepconv)(pipi_image_t *src, w = src->w; h = src->h; - srcp = FLAG_GRAY ? pipi_get_pixels(src, PIPI_PIXELS_Y_F) - : pipi_get_pixels(src, PIPI_PIXELS_RGBA_F); + srcp = FLAG_GRAY ? pipi_get_pixels(src, PIPI_PIXELS_Y_F32) + : pipi_get_pixels(src, PIPI_PIXELS_RGBA_F32); srcdata = (float *)srcp->pixels; dst = pipi_new(w, h); - dstp = FLAG_GRAY ? pipi_get_pixels(dst, PIPI_PIXELS_Y_F) - : pipi_get_pixels(dst, PIPI_PIXELS_RGBA_F); + dstp = FLAG_GRAY ? pipi_get_pixels(dst, PIPI_PIXELS_Y_F32) + : pipi_get_pixels(dst, PIPI_PIXELS_RGBA_F32); dstdata = (float *)dstp->pixels; buffer = malloc(w * h * (FLAG_GRAY ? 1 : 4) * sizeof(double)); diff --git a/pipi/filter/dilate.c b/pipi/filter/dilate.c index b6692d0..8868f6d 100644 --- a/pipi/filter/dilate.c +++ b/pipi/filter/dilate.c @@ -40,15 +40,15 @@ pipi_image_t *pipi_dilate(pipi_image_t *src) w = src->w; h = src->h; - gray = (src->last_modified == PIPI_PIXELS_Y_F); + gray = (src->last_modified == PIPI_PIXELS_Y_F32); - srcp = gray ? pipi_get_pixels(src, PIPI_PIXELS_Y_F) - : pipi_get_pixels(src, PIPI_PIXELS_RGBA_F); + srcp = gray ? pipi_get_pixels(src, PIPI_PIXELS_Y_F32) + : pipi_get_pixels(src, PIPI_PIXELS_RGBA_F32); srcdata = (float *)srcp->pixels; dst = pipi_new(w, h); - dstp = gray ? pipi_get_pixels(dst, PIPI_PIXELS_Y_F) - : pipi_get_pixels(dst, PIPI_PIXELS_RGBA_F); + dstp = gray ? pipi_get_pixels(dst, PIPI_PIXELS_Y_F32) + : pipi_get_pixels(dst, PIPI_PIXELS_RGBA_F32); dstdata = (float *)dstp->pixels; for(y = 0; y < h; y++) @@ -109,15 +109,15 @@ pipi_image_t *pipi_erode(pipi_image_t *src) w = src->w; h = src->h; - gray = (src->last_modified == PIPI_PIXELS_Y_F); + gray = (src->last_modified == PIPI_PIXELS_Y_F32); - srcp = gray ? pipi_get_pixels(src, PIPI_PIXELS_Y_F) - : pipi_get_pixels(src, PIPI_PIXELS_RGBA_F); + srcp = gray ? pipi_get_pixels(src, PIPI_PIXELS_Y_F32) + : pipi_get_pixels(src, PIPI_PIXELS_RGBA_F32); srcdata = (float *)srcp->pixels; dst = pipi_new(w, h); - dstp = gray ? pipi_get_pixels(dst, PIPI_PIXELS_Y_F) - : pipi_get_pixels(dst, PIPI_PIXELS_RGBA_F); + dstp = gray ? pipi_get_pixels(dst, PIPI_PIXELS_Y_F32) + : pipi_get_pixels(dst, PIPI_PIXELS_RGBA_F32); dstdata = (float *)dstp->pixels; for(y = 0; y < h; y++) diff --git a/pipi/filter/median.c b/pipi/filter/median.c index 17bd04f..200a435 100644 --- a/pipi/filter/median.c +++ b/pipi/filter/median.c @@ -55,15 +55,15 @@ pipi_image_t *pipi_median_ext(pipi_image_t *src, int rx, int ry) h = src->h; size = (2 * rx + 1) * (2 * ry + 1); - gray = (src->last_modified == PIPI_PIXELS_Y_F); + gray = (src->last_modified == PIPI_PIXELS_Y_F32); - srcp = gray ? pipi_get_pixels(src, PIPI_PIXELS_Y_F) - : pipi_get_pixels(src, PIPI_PIXELS_RGBA_F); + srcp = gray ? pipi_get_pixels(src, PIPI_PIXELS_Y_F32) + : pipi_get_pixels(src, PIPI_PIXELS_RGBA_F32); srcdata = (float *)srcp->pixels; dst = pipi_new(w, h); - dstp = gray ? pipi_get_pixels(dst, PIPI_PIXELS_Y_F) - : pipi_get_pixels(dst, PIPI_PIXELS_RGBA_F); + dstp = gray ? pipi_get_pixels(dst, PIPI_PIXELS_Y_F32) + : pipi_get_pixels(dst, PIPI_PIXELS_RGBA_F32); dstdata = (float *)dstp->pixels; list = malloc(size * (gray ? 1 : 4) * sizeof(double)); diff --git a/pipi/filter/transform.c b/pipi/filter/transform.c index c980806..8129036 100644 --- a/pipi/filter/transform.c +++ b/pipi/filter/transform.c @@ -36,15 +36,15 @@ pipi_image_t *pipi_hflip(pipi_image_t *src) w = src->w; h = src->h; - gray = (src->last_modified == PIPI_PIXELS_Y_F); + gray = (src->last_modified == PIPI_PIXELS_Y_F32); - srcp = gray ? pipi_get_pixels(src, PIPI_PIXELS_Y_F) - : pipi_get_pixels(src, PIPI_PIXELS_RGBA_F); + srcp = gray ? pipi_get_pixels(src, PIPI_PIXELS_Y_F32) + : pipi_get_pixels(src, PIPI_PIXELS_RGBA_F32); srcdata = (float *)srcp->pixels; dst = pipi_new(w, h); - dstp = gray ? pipi_get_pixels(dst, PIPI_PIXELS_Y_F) - : pipi_get_pixels(dst, PIPI_PIXELS_RGBA_F); + dstp = gray ? pipi_get_pixels(dst, PIPI_PIXELS_Y_F32) + : pipi_get_pixels(dst, PIPI_PIXELS_RGBA_F32); dstdata = (float *)dstp->pixels; for(y = 0; y < h; y++) @@ -82,15 +82,15 @@ pipi_image_t *pipi_vflip(pipi_image_t *src) w = src->w; h = src->h; - gray = (src->last_modified == PIPI_PIXELS_Y_F); + gray = (src->last_modified == PIPI_PIXELS_Y_F32); - srcp = gray ? pipi_get_pixels(src, PIPI_PIXELS_Y_F) - : pipi_get_pixels(src, PIPI_PIXELS_RGBA_F); + srcp = gray ? pipi_get_pixels(src, PIPI_PIXELS_Y_F32) + : pipi_get_pixels(src, PIPI_PIXELS_RGBA_F32); srcdata = (float *)srcp->pixels; dst = pipi_new(w, h); - dstp = gray ? pipi_get_pixels(dst, PIPI_PIXELS_Y_F) - : pipi_get_pixels(dst, PIPI_PIXELS_RGBA_F); + dstp = gray ? pipi_get_pixels(dst, PIPI_PIXELS_Y_F32) + : pipi_get_pixels(dst, PIPI_PIXELS_RGBA_F32); dstdata = (float *)dstp->pixels; for(y = 0; y < h; y++) @@ -122,15 +122,15 @@ pipi_image_t *pipi_rotate90(pipi_image_t *src) w = src->w; h = src->h; - gray = (src->last_modified == PIPI_PIXELS_Y_F); + gray = (src->last_modified == PIPI_PIXELS_Y_F32); - srcp = gray ? pipi_get_pixels(src, PIPI_PIXELS_Y_F) - : pipi_get_pixels(src, PIPI_PIXELS_RGBA_F); + srcp = gray ? pipi_get_pixels(src, PIPI_PIXELS_Y_F32) + : pipi_get_pixels(src, PIPI_PIXELS_RGBA_F32); srcdata = (float *)srcp->pixels; dst = pipi_new(h, w); - dstp = gray ? pipi_get_pixels(dst, PIPI_PIXELS_Y_F) - : pipi_get_pixels(dst, PIPI_PIXELS_RGBA_F); + dstp = gray ? pipi_get_pixels(dst, PIPI_PIXELS_Y_F32) + : pipi_get_pixels(dst, PIPI_PIXELS_RGBA_F32); dstdata = (float *)dstp->pixels; for(y = 0; y < h; y++) @@ -168,15 +168,15 @@ pipi_image_t *pipi_rotate180(pipi_image_t *src) w = src->w; h = src->h; - gray = (src->last_modified == PIPI_PIXELS_Y_F); + gray = (src->last_modified == PIPI_PIXELS_Y_F32); - srcp = gray ? pipi_get_pixels(src, PIPI_PIXELS_Y_F) - : pipi_get_pixels(src, PIPI_PIXELS_RGBA_F); + srcp = gray ? pipi_get_pixels(src, PIPI_PIXELS_Y_F32) + : pipi_get_pixels(src, PIPI_PIXELS_RGBA_F32); srcdata = (float *)srcp->pixels; dst = pipi_new(w, h); - dstp = gray ? pipi_get_pixels(dst, PIPI_PIXELS_Y_F) - : pipi_get_pixels(dst, PIPI_PIXELS_RGBA_F); + dstp = gray ? pipi_get_pixels(dst, PIPI_PIXELS_Y_F32) + : pipi_get_pixels(dst, PIPI_PIXELS_RGBA_F32); dstdata = (float *)dstp->pixels; for(y = 0; y < h; y++) @@ -214,15 +214,15 @@ pipi_image_t *pipi_rotate270(pipi_image_t *src) w = src->w; h = src->h; - gray = (src->last_modified == PIPI_PIXELS_Y_F); + gray = (src->last_modified == PIPI_PIXELS_Y_F32); - srcp = gray ? pipi_get_pixels(src, PIPI_PIXELS_Y_F) - : pipi_get_pixels(src, PIPI_PIXELS_RGBA_F); + srcp = gray ? pipi_get_pixels(src, PIPI_PIXELS_Y_F32) + : pipi_get_pixels(src, PIPI_PIXELS_RGBA_F32); srcdata = (float *)srcp->pixels; dst = pipi_new(h, w); - dstp = gray ? pipi_get_pixels(dst, PIPI_PIXELS_Y_F) - : pipi_get_pixels(dst, PIPI_PIXELS_RGBA_F); + dstp = gray ? pipi_get_pixels(dst, PIPI_PIXELS_Y_F32) + : pipi_get_pixels(dst, PIPI_PIXELS_RGBA_F32); dstdata = (float *)dstp->pixels; for(y = 0; y < h; y++) diff --git a/pipi/paint/bezier.c b/pipi/paint/bezier.c index 3ddc223..6b01fa0 100644 --- a/pipi/paint/bezier.c +++ b/pipi/paint/bezier.c @@ -34,7 +34,7 @@ int pipi_draw_bezier4(pipi_image_t *img , int x4, int y4, uint32_t c, int n, int aa) { - if(img->last_modified == PIPI_PIXELS_RGBA_C) + if(img->last_modified == PIPI_PIXELS_RGBA_U8) { float t; float x= x1, y= y1; diff --git a/pipi/paint/floodfill.c b/pipi/paint/floodfill.c index 1512de7..5468526 100644 --- a/pipi/paint/floodfill.c +++ b/pipi/paint/floodfill.c @@ -77,12 +77,12 @@ int pipi_flood_fill(pipi_image_t *src, (px < 0) || (py < 0)) return -1; - if(src->last_modified == PIPI_PIXELS_RGBA_C) { + if(src->last_modified == PIPI_PIXELS_RGBA_U8) { uint32_t *dstdata; unsigned char nr, ng, nb, na; /* Get ARGB32 pointer */ - dstp = pipi_get_pixels(dst, PIPI_PIXELS_RGBA_C); + dstp = pipi_get_pixels(dst, PIPI_PIXELS_RGBA_U8); dstdata = (uint32_t *)dstp->pixels; nr = r*255.0f; @@ -95,12 +95,12 @@ int pipi_flood_fill(pipi_image_t *src, pipi_flood_fill_stack_scanline_u32(dstp, px, py, (na<<24)|(nr<<16)|(ng<<8)|(nb), dstdata[px+py*w]); } else { - int gray = (dst->last_modified == PIPI_PIXELS_Y_F); + int gray = (dst->last_modified == PIPI_PIXELS_Y_F32); float *dstdata; float or, og, ob, oa; - dstp = gray ? pipi_get_pixels(dst, PIPI_PIXELS_Y_F) - : pipi_get_pixels(dst, PIPI_PIXELS_RGBA_F); + dstp = gray ? pipi_get_pixels(dst, PIPI_PIXELS_Y_F32) + : pipi_get_pixels(dst, PIPI_PIXELS_RGBA_F32); dstdata = (float *)dstp->pixels; diff --git a/pipi/paint/line.c b/pipi/paint/line.c index d2c29a0..562a0a2 100644 --- a/pipi/paint/line.c +++ b/pipi/paint/line.c @@ -67,12 +67,12 @@ int pipi_draw_line(pipi_image_t *img , int xa, int ya, int xb, int yb, uint32_t /* No Transparency routine for u32 yet, fallback to float version */ - if(img->last_modified == PIPI_PIXELS_RGBA_C) + if(img->last_modified == PIPI_PIXELS_RGBA_U8) { if(!aa) { uint32_t *dstdata; - dstdata = (uint32_t *)pipi_get_pixels(img, PIPI_PIXELS_RGBA_C)->pixels; + dstdata = (uint32_t *)pipi_get_pixels(img, PIPI_PIXELS_RGBA_U8)->pixels; s.color32 = c; s.buf_u32 = dstdata; s.draw = line_8bit; @@ -80,7 +80,7 @@ int pipi_draw_line(pipi_image_t *img , int xa, int ya, int xb, int yb, uint32_t else { float *dstdata; - dstdata = (float *)pipi_get_pixels(img, PIPI_PIXELS_RGBA_F)->pixels; + dstdata = (float *)pipi_get_pixels(img, PIPI_PIXELS_RGBA_F32)->pixels; s.colorf[2] = ((c&0x00FF0000)>>16)/255.0f; /* XXX FIXME */ s.colorf[1] = ((c&0x0000FF00)>>8)/255.0f; /* XXX FIXME */ s.colorf[0] = (c&0x000000FF)/255.0f; /* XXX FIXME */ @@ -88,10 +88,10 @@ int pipi_draw_line(pipi_image_t *img , int xa, int ya, int xb, int yb, uint32_t s.draw = aaline; } } - else if(img->last_modified == PIPI_PIXELS_Y_F) + else if(img->last_modified == PIPI_PIXELS_Y_F32) { float *dstdata; - dstdata = (float *)pipi_get_pixels(img, PIPI_PIXELS_Y_F)->pixels; + dstdata = (float *)pipi_get_pixels(img, PIPI_PIXELS_Y_F32)->pixels; s.colorf[0] = (c & 0xff) / 255.0f; /* XXX FIXME */ s.buf_f = dstdata; s.draw = aa ? aaline_gray : line_gray; @@ -99,7 +99,7 @@ int pipi_draw_line(pipi_image_t *img , int xa, int ya, int xb, int yb, uint32_t else { float *dstdata; - dstdata = (float *)pipi_get_pixels(img, PIPI_PIXELS_RGBA_F)->pixels; + dstdata = (float *)pipi_get_pixels(img, PIPI_PIXELS_RGBA_F32)->pixels; s.colorf[2] = ((c&0x00FF0000)>>16)/255.0f; /* XXX FIXME */ s.colorf[1] = ((c&0x0000FF00)>>8)/255.0f; /* XXX FIXME */ s.colorf[0] = (c&0x000000FF)/255.0f; /* XXX FIXME */ diff --git a/pipi/paint/tile.c b/pipi/paint/tile.c index a58cf2c..bfc8c81 100644 --- a/pipi/paint/tile.c +++ b/pipi/paint/tile.c @@ -34,10 +34,10 @@ pipi_image_t *pipi_tile(pipi_image_t *tile, int w, int h) th = tile->h; dst = pipi_new(w, h); - dstp = pipi_get_pixels(dst, PIPI_PIXELS_RGBA_F); + dstp = pipi_get_pixels(dst, PIPI_PIXELS_RGBA_F32); dstdata = (float *)dstp->pixels; - tilep = pipi_get_pixels(tile, PIPI_PIXELS_RGBA_F); + tilep = pipi_get_pixels(tile, PIPI_PIXELS_RGBA_F32); tiledata = (float *)tilep->pixels; for(y = 0; y < h; y++) diff --git a/pipi/pipi.h b/pipi/pipi.h index 0ffe521..f44ebc1 100644 --- a/pipi/pipi.h +++ b/pipi/pipi.h @@ -45,18 +45,18 @@ typedef enum pipi_scan_t; /* pipi_format_t: this enum is a list of all possible pixel formats for - * our internal images. RGBA32 is the most usual format when an image has - * just been loaded, but RGBA_F is a lot better for complex operations. */ + * our internal images. RGBA_U8 is the most usual format when an image has + * just been loaded, but RGBA_F32 is a lot better for complex operations. */ typedef enum { PIPI_PIXELS_UNINITIALISED = -1, - PIPI_PIXELS_RGBA_C = 0, - PIPI_PIXELS_BGR_C = 1, - PIPI_PIXELS_RGBA_F = 2, - PIPI_PIXELS_Y_F = 3, + PIPI_PIXELS_RGBA_U8 = 0, + PIPI_PIXELS_BGR_U8 = 1, + PIPI_PIXELS_RGBA_F32 = 2, + PIPI_PIXELS_Y_F32 = 3, - PIPI_PIXELS_MASK_C = 4, + PIPI_PIXELS_MASK_U8 = 4, PIPI_PIXELS_MAX = 5 } diff --git a/pipi/pixels.c b/pipi/pixels.c index 3a978dc..6036aaa 100644 --- a/pipi/pixels.c +++ b/pipi/pixels.c @@ -48,41 +48,41 @@ pipi_pixels_t *pipi_get_pixels(pipi_image_t *img, pipi_format_t type) return &img->p[type]; /* Handle special cases */ - if(type == PIPI_PIXELS_MASK_C) + if(type == PIPI_PIXELS_MASK_U8) return &img->p[type]; /* Preliminary conversions */ - if(img->last_modified == PIPI_PIXELS_RGBA_C - && type == PIPI_PIXELS_Y_F) - pipi_get_pixels(img, PIPI_PIXELS_RGBA_F); - else if(img->last_modified == PIPI_PIXELS_BGR_C - && type == PIPI_PIXELS_Y_F) - pipi_get_pixels(img, PIPI_PIXELS_RGBA_F); - else if(img->last_modified == PIPI_PIXELS_Y_F - && type == PIPI_PIXELS_RGBA_C) - pipi_get_pixels(img, PIPI_PIXELS_RGBA_F); - else if(img->last_modified == PIPI_PIXELS_Y_F - && type == PIPI_PIXELS_BGR_C) - pipi_get_pixels(img, PIPI_PIXELS_RGBA_F); + if(img->last_modified == PIPI_PIXELS_RGBA_U8 + && type == PIPI_PIXELS_Y_F32) + pipi_get_pixels(img, PIPI_PIXELS_RGBA_F32); + else if(img->last_modified == PIPI_PIXELS_BGR_U8 + && type == PIPI_PIXELS_Y_F32) + pipi_get_pixels(img, PIPI_PIXELS_RGBA_F32); + else if(img->last_modified == PIPI_PIXELS_Y_F32 + && type == PIPI_PIXELS_RGBA_U8) + pipi_get_pixels(img, PIPI_PIXELS_RGBA_F32); + else if(img->last_modified == PIPI_PIXELS_Y_F32 + && type == PIPI_PIXELS_BGR_U8) + pipi_get_pixels(img, PIPI_PIXELS_RGBA_F32); /* Allocate pixels if necessary */ if(!img->p[type].pixels) { switch(type) { - case PIPI_PIXELS_RGBA_C: + case PIPI_PIXELS_RGBA_U8: bytes = img->w * img->h * 4 * sizeof(uint8_t); bpp = 4 * sizeof(uint8_t); break; - case PIPI_PIXELS_BGR_C: + case PIPI_PIXELS_BGR_U8: bytes = img->w * img->h * 3 * sizeof(uint8_t); bpp = 3 * sizeof(uint8_t); break; - case PIPI_PIXELS_RGBA_F: + case PIPI_PIXELS_RGBA_F32: bytes = img->w * img->h * 4 * sizeof(float); bpp = 4 * sizeof(float); break; - case PIPI_PIXELS_Y_F: + case PIPI_PIXELS_Y_F32: bytes = img->w * img->h * sizeof(float); bpp = sizeof(float); break; @@ -98,10 +98,10 @@ pipi_pixels_t *pipi_get_pixels(pipi_image_t *img, pipi_format_t type) } /* Convert pixels */ - if(img->last_modified == PIPI_PIXELS_RGBA_C - && type == PIPI_PIXELS_RGBA_F) + if(img->last_modified == PIPI_PIXELS_RGBA_U8 + && type == PIPI_PIXELS_RGBA_F32) { - uint8_t *src = (uint8_t *)img->p[PIPI_PIXELS_RGBA_C].pixels; + uint8_t *src = (uint8_t *)img->p[PIPI_PIXELS_RGBA_U8].pixels; float *dest = (float *)img->p[type].pixels; init_tables(); @@ -112,10 +112,10 @@ pipi_pixels_t *pipi_get_pixels(pipi_image_t *img, pipi_format_t type) dest[4 * (y * img->w + x) + i] = u8tof32(src[4 * (y * img->w + x) + i]); } - else if(img->last_modified == PIPI_PIXELS_BGR_C - && type == PIPI_PIXELS_RGBA_F) + else if(img->last_modified == PIPI_PIXELS_BGR_U8 + && type == PIPI_PIXELS_RGBA_F32) { - uint8_t *src = (uint8_t *)img->p[PIPI_PIXELS_BGR_C].pixels; + uint8_t *src = (uint8_t *)img->p[PIPI_PIXELS_BGR_U8].pixels; float *dest = (float *)img->p[type].pixels; init_tables(); @@ -132,10 +132,10 @@ pipi_pixels_t *pipi_get_pixels(pipi_image_t *img, pipi_format_t type) dest[4 * (y * img->w + x) + 3] = 1.0; } } - else if(img->last_modified == PIPI_PIXELS_RGBA_F - && type == PIPI_PIXELS_RGBA_C) + else if(img->last_modified == PIPI_PIXELS_RGBA_F32 + && type == PIPI_PIXELS_RGBA_U8) { - float *src = (float *)img->p[PIPI_PIXELS_RGBA_F].pixels; + float *src = (float *)img->p[PIPI_PIXELS_RGBA_F32].pixels; uint8_t *dest = (uint8_t *)img->p[type].pixels; init_tables(); @@ -168,10 +168,10 @@ pipi_pixels_t *pipi_get_pixels(pipi_image_t *img, pipi_format_t type) } } } - else if(img->last_modified == PIPI_PIXELS_RGBA_F - && type == PIPI_PIXELS_BGR_C) + else if(img->last_modified == PIPI_PIXELS_RGBA_F32 + && type == PIPI_PIXELS_BGR_U8) { - float *src = (float *)img->p[PIPI_PIXELS_RGBA_F].pixels; + float *src = (float *)img->p[PIPI_PIXELS_RGBA_F32].pixels; uint8_t *dest = (uint8_t *)img->p[type].pixels; init_tables(); @@ -204,11 +204,11 @@ pipi_pixels_t *pipi_get_pixels(pipi_image_t *img, pipi_format_t type) } } } - else if(img->last_modified == PIPI_PIXELS_Y_F - && type == PIPI_PIXELS_RGBA_F) + else if(img->last_modified == PIPI_PIXELS_Y_F32 + && type == PIPI_PIXELS_RGBA_F32) { - float *src = (float *)img->p[PIPI_PIXELS_Y_F].pixels; - float *dest = (float *)img->p[PIPI_PIXELS_RGBA_F].pixels; + float *src = (float *)img->p[PIPI_PIXELS_Y_F32].pixels; + float *dest = (float *)img->p[PIPI_PIXELS_RGBA_F32].pixels; init_tables(); @@ -222,11 +222,11 @@ pipi_pixels_t *pipi_get_pixels(pipi_image_t *img, pipi_format_t type) dest[4 * (y * img->w + x) + 3] = 1.0; } } - else if(img->last_modified == PIPI_PIXELS_RGBA_F - && type == PIPI_PIXELS_Y_F) + else if(img->last_modified == PIPI_PIXELS_RGBA_F32 + && type == PIPI_PIXELS_Y_F32) { - float *src = (float *)img->p[PIPI_PIXELS_RGBA_F].pixels; - float *dest = (float *)img->p[PIPI_PIXELS_Y_F].pixels; + float *src = (float *)img->p[PIPI_PIXELS_RGBA_F32].pixels; + float *dest = (float *)img->p[PIPI_PIXELS_Y_F32].pixels; init_tables(); diff --git a/pipi/quantize/reduce.c b/pipi/quantize/reduce.c index df06bc0..cecc614 100644 --- a/pipi/quantize/reduce.c +++ b/pipi/quantize/reduce.c @@ -378,14 +378,14 @@ pipi_image_t *pipi_reduce(pipi_image_t *src, debug("### PROCESSING IMAGE ###"); debug(""); - srcp = pipi_get_pixels(src, PIPI_PIXELS_RGBA_F); + srcp = pipi_get_pixels(src, PIPI_PIXELS_RGBA_F32); srcdata = (float *)srcp->pixels; w = srcp->w; h = srcp->h; dst = pipi_new(w, h); - dstp = pipi_get_pixels(dst, PIPI_PIXELS_RGBA_F); + dstp = pipi_get_pixels(dst, PIPI_PIXELS_RGBA_F32); dstdata = (float *)dstp->pixels; for(j = 0; j < h; j++) diff --git a/pipi/render/noise.c b/pipi/render/noise.c index f69768e..52419e6 100644 --- a/pipi/render/noise.c +++ b/pipi/render/noise.c @@ -34,7 +34,7 @@ pipi_image_t *pipi_render_random(int w, int h) int x, y, t; ret = pipi_new(w, h); - pix = pipi_get_pixels(ret, PIPI_PIXELS_RGBA_F); + pix = pipi_get_pixels(ret, PIPI_PIXELS_RGBA_F32); data = (float *)pix->pixels; for(y = 0; y < h; y++) diff --git a/pipi/render/screen.c b/pipi/render/screen.c index e2c9d15..6a4e810 100644 --- a/pipi/render/screen.c +++ b/pipi/render/screen.c @@ -23,9 +23,9 @@ #include #include -#ifndef M_PI -# define M_PI 3.14159265358979323846 -#endif +#ifndef M_PI +# define M_PI 3.14159265358979323846 +#endif #include "pipi.h" #include "pipi_internals.h" @@ -44,7 +44,7 @@ pipi_image_t *pipi_render_bayer(int w, int h) ; ret = pipi_new(w, h); - pix = pipi_get_pixels(ret, PIPI_PIXELS_Y_F); + pix = pipi_get_pixels(ret, PIPI_PIXELS_Y_F32); data = (float *)pix->pixels; for(j = 0; j < h; j++) @@ -107,7 +107,7 @@ pipi_image_t *pipi_render_halftone(int w, int h) qsort(circle, w * h, sizeof(dot_t), cmpdot); ret = pipi_new(w * 2, h * 2); - pix = pipi_get_pixels(ret, PIPI_PIXELS_Y_F); + pix = pipi_get_pixels(ret, PIPI_PIXELS_Y_F32); data = (float *)pix->pixels; for(n = 0; n < w * h; n++) diff --git a/pipi/resize.c b/pipi/resize.c index 706fe69..4f4a58c 100644 --- a/pipi/resize.c +++ b/pipi/resize.c @@ -31,11 +31,11 @@ pipi_image_t *pipi_resize(pipi_image_t *src, int w, int h) pipi_pixels_t *srcp, *dstp; int x, y, x0, y0, sw, dw, sh, dh, remy; - srcp = pipi_get_pixels(src, PIPI_PIXELS_RGBA_F); + srcp = pipi_get_pixels(src, PIPI_PIXELS_RGBA_F32); srcdata = (float *)srcp->pixels; dst = pipi_new(w, h); - dstp = pipi_get_pixels(dst, PIPI_PIXELS_RGBA_F); + dstp = pipi_get_pixels(dst, PIPI_PIXELS_RGBA_F32); dstdata = (float *)dstp->pixels; sw = src->w; sh = src->h; diff --git a/pipi/stock.c b/pipi/stock.c index 480ca36..826895f 100644 --- a/pipi/stock.c +++ b/pipi/stock.c @@ -173,7 +173,7 @@ pipi_image_t *pipi_load_stock(char const *name) return NULL; ret = pipi_new(w, h); - pix = pipi_get_pixels(ret, PIPI_PIXELS_Y_F); + pix = pipi_get_pixels(ret, PIPI_PIXELS_Y_F32); memcpy(pix->pixels, ker, w * h * sizeof(float)); return ret; diff --git a/pipi/tiles.c b/pipi/tiles.c index 443428d..acebaa7 100644 --- a/pipi/tiles.c +++ b/pipi/tiles.c @@ -87,12 +87,12 @@ pipi_tile_t *pipi_create_tile(pipi_format_t fmt, int plane) switch(fmt) { - case PIPI_PIXELS_RGBA_C: - case PIPI_PIXELS_BGR_C: + case PIPI_PIXELS_RGBA_U8: + case PIPI_PIXELS_BGR_U8: bytes = sizeof(uint8_t) * TILE_SIZE * TILE_SIZE; break; - case PIPI_PIXELS_RGBA_F: - case PIPI_PIXELS_Y_F: + case PIPI_PIXELS_RGBA_F32: + case PIPI_PIXELS_Y_F32: bytes = sizeof(float) * TILE_SIZE * TILE_SIZE; break; default: diff --git a/test/u8tof32tou8.c b/test/u8tof32tou8.c index 55de574..bb52d50 100644 --- a/test/u8tof32tou8.c +++ b/test/u8tof32tou8.c @@ -34,11 +34,11 @@ int main(int argc, char *argv[]) img1 = pipi_load("mona.png"); img2 = pipi_load("mona.png"); - pix1 = pipi_get_pixels(img1, PIPI_PIXELS_RGBA_C); + pix1 = pipi_get_pixels(img1, PIPI_PIXELS_RGBA_U8); data1 = (uint32_t *)pix1->pixels; - pipi_get_pixels(img2, PIPI_PIXELS_RGBA_F); - pix2 = pipi_get_pixels(img2, PIPI_PIXELS_RGBA_C); + pipi_get_pixels(img2, PIPI_PIXELS_RGBA_F32); + pix2 = pipi_get_pixels(img2, PIPI_PIXELS_RGBA_U8); data2 = (uint32_t *)pix2->pixels; for(y = 0; y < pix1->h; y++)