From 3784480d3bb6b85db73bfe2b1d2773b5e14bde2b Mon Sep 17 00:00:00 2001 From: sam Date: Sat, 23 Aug 2008 13:07:24 +0000 Subject: [PATCH] * Add a new image flag, u8, which indicates whether the image samples come from an 8-bpp source. git-svn-id: file:///srv/caca.zoy.org/var/lib/svn/libpipi/trunk@2756 92316355-f0b4-4df1-b90c-862c8a59935f --- pipi/codec/imlib.c | 6 ++++++ pipi/codec/opencv.c | 6 ++++++ pipi/codec/sdl.c | 6 ++++++ pipi/pipi.c | 4 ++++ pipi/pipi_internals.h | 7 ++++++- 5 files changed, 28 insertions(+), 1 deletion(-) diff --git a/pipi/codec/imlib.c b/pipi/codec/imlib.c index 85343c8..45c5d35 100644 --- a/pipi/codec/imlib.c +++ b/pipi/codec/imlib.c @@ -50,6 +50,9 @@ pipi_image_t *pipi_load_imlib2(const char *name) img->codec_priv = (void *)priv; img->codec_format = PIPI_PIXELS_RGBA32; + img->wrap = 0; + img->u8 = 1; + return img; } @@ -86,6 +89,9 @@ void pipi_save_imlib2(pipi_image_t *img, const char *name) img->codec_priv = (void *)priv; img->codec_format = PIPI_PIXELS_RGBA32; + + img->wrap = 0; + img->u8 = 1; } pipi_getpixels(img, img->codec_format); diff --git a/pipi/codec/opencv.c b/pipi/codec/opencv.c index 1086aaf..1b212cf 100644 --- a/pipi/codec/opencv.c +++ b/pipi/codec/opencv.c @@ -52,6 +52,9 @@ pipi_image_t *pipi_load_opencv(const char *name) img->codec_priv = (void *)priv; img->codec_format = PIPI_PIXELS_BGR24; + img->wrap = 0; + img->u8 = 1; + return img; } @@ -86,6 +89,9 @@ void pipi_save_opencv(pipi_image_t *img, const char *name) img->codec_priv = (void *)priv; img->codec_format = PIPI_PIXELS_BGR24; + + img->wrap = 0; + img->u8 = 1; } pipi_getpixels(img, img->codec_format); diff --git a/pipi/codec/sdl.c b/pipi/codec/sdl.c index 906c87b..f096194 100644 --- a/pipi/codec/sdl.c +++ b/pipi/codec/sdl.c @@ -59,6 +59,9 @@ pipi_image_t *pipi_load_sdl(const char *name) img->codec_priv = (void *)priv; img->codec_format = PIPI_PIXELS_RGBA32; + img->wrap = 0; + img->u8 = 1; + return img; } @@ -90,6 +93,9 @@ void pipi_save_sdl(pipi_image_t *img, const char *name) img->codec_priv = (void *)priv; img->codec_format = PIPI_PIXELS_RGBA32; + + img->wrap = 0; + img->u8 = 1; } pipi_getpixels(img, img->codec_format); diff --git a/pipi/pipi.c b/pipi/pipi.c index cadc891..083d781 100644 --- a/pipi/pipi.c +++ b/pipi/pipi.c @@ -50,6 +50,9 @@ pipi_image_t *pipi_new(int w, int h) img->last_modified = PIPI_PIXELS_UNINITIALISED; img->codec_format = PIPI_PIXELS_UNINITIALISED; + img->wrap = 0; + img->u8 = 1; + return img; } @@ -59,6 +62,7 @@ pipi_image_t *pipi_copy(pipi_image_t *src) /* Copy properties */ dst->wrap = src->wrap; + dst->u8 = src->u8; /* Copy pixels, if any */ if(src->last_modified != PIPI_PIXELS_UNINITIALISED) diff --git a/pipi/pipi_internals.h b/pipi/pipi_internals.h index 4f917eb..cc77665 100644 --- a/pipi/pipi_internals.h +++ b/pipi/pipi_internals.h @@ -25,7 +25,12 @@ struct pipi_image { int w, h, pitch; - int wrap; + + /* A list of internal image flags. + * wrap: should filters wrap around at edges? + * u8: are the image samples still 8-bit per channel? */ + int wrap, u8; + pipi_format_t codec_format, last_modified; /* List of all possible pixel formats */