Changeset 2772
- Timestamp:
- Aug 26, 2008, 1:39:15 AM (15 years ago)
- Location:
- libpipi/trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
libpipi/trunk/pipi/codec/imlib.c
r2756 r2772 40 40 img = pipi_new(imlib_image_get_width(), imlib_image_get_height()); 41 41 42 img->p[PIPI_PIXELS_RGBA 32].pixels = imlib_image_get_data();43 img->p[PIPI_PIXELS_RGBA 32].w = img->w;44 img->p[PIPI_PIXELS_RGBA 32].h = img->h;45 img->p[PIPI_PIXELS_RGBA 32].pitch = 4 * img->w;46 img->p[PIPI_PIXELS_RGBA 32].bpp = 32;47 img->p[PIPI_PIXELS_RGBA 32].bytes = 4 * img->w * img->h;48 img->last_modified = PIPI_PIXELS_RGBA 32;42 img->p[PIPI_PIXELS_RGBA_C].pixels = imlib_image_get_data(); 43 img->p[PIPI_PIXELS_RGBA_C].w = img->w; 44 img->p[PIPI_PIXELS_RGBA_C].h = img->h; 45 img->p[PIPI_PIXELS_RGBA_C].pitch = 4 * img->w; 46 img->p[PIPI_PIXELS_RGBA_C].bpp = 32; 47 img->p[PIPI_PIXELS_RGBA_C].bytes = 4 * img->w * img->h; 48 img->last_modified = PIPI_PIXELS_RGBA_C; 49 49 50 50 img->codec_priv = (void *)priv; 51 img->codec_format = PIPI_PIXELS_RGBA 32;51 img->codec_format = PIPI_PIXELS_RGBA_C; 52 52 53 53 img->wrap = 0; … … 74 74 75 75 /* FIXME: check pitch differences here */ 76 if(img->last_modified == PIPI_PIXELS_RGBA 32)76 if(img->last_modified == PIPI_PIXELS_RGBA_C) 77 77 { 78 memcpy(data, img->p[PIPI_PIXELS_RGBA 32].pixels,78 memcpy(data, img->p[PIPI_PIXELS_RGBA_C].pixels, 79 79 4 * img->w * img->h); 80 free(img->p[PIPI_PIXELS_RGBA 32].pixels);80 free(img->p[PIPI_PIXELS_RGBA_C].pixels); 81 81 } 82 82 83 img->p[PIPI_PIXELS_RGBA 32].pixels = data;84 img->p[PIPI_PIXELS_RGBA 32].w = imlib_image_get_width();85 img->p[PIPI_PIXELS_RGBA 32].h = imlib_image_get_height();86 img->p[PIPI_PIXELS_RGBA 32].pitch = 4 * imlib_image_get_width();87 img->p[PIPI_PIXELS_RGBA 32].bpp = 32;88 img->p[PIPI_PIXELS_RGBA 32].bytes = 4 * img->w * img->h;83 img->p[PIPI_PIXELS_RGBA_C].pixels = data; 84 img->p[PIPI_PIXELS_RGBA_C].w = imlib_image_get_width(); 85 img->p[PIPI_PIXELS_RGBA_C].h = imlib_image_get_height(); 86 img->p[PIPI_PIXELS_RGBA_C].pitch = 4 * imlib_image_get_width(); 87 img->p[PIPI_PIXELS_RGBA_C].bpp = 32; 88 img->p[PIPI_PIXELS_RGBA_C].bytes = 4 * img->w * img->h; 89 89 90 90 img->codec_priv = (void *)priv; 91 img->codec_format = PIPI_PIXELS_RGBA 32;91 img->codec_format = PIPI_PIXELS_RGBA_C; 92 92 93 93 img->wrap = 0; -
libpipi/trunk/pipi/codec/opencv.c
r2756 r2772 42 42 img = pipi_new(priv->width, priv->height); 43 43 44 img->p[PIPI_PIXELS_BGR 24].pixels = priv->imageData;45 img->p[PIPI_PIXELS_BGR 24].w = priv->width;46 img->p[PIPI_PIXELS_BGR 24].h = priv->height;47 img->p[PIPI_PIXELS_BGR 24].pitch = priv->widthStep;48 img->p[PIPI_PIXELS_BGR 24].bpp = 24;49 img->p[PIPI_PIXELS_BGR 24].bytes = 3 * img->w * img->h;50 img->last_modified = PIPI_PIXELS_BGR 24;44 img->p[PIPI_PIXELS_BGR_C].pixels = priv->imageData; 45 img->p[PIPI_PIXELS_BGR_C].w = priv->width; 46 img->p[PIPI_PIXELS_BGR_C].h = priv->height; 47 img->p[PIPI_PIXELS_BGR_C].pitch = priv->widthStep; 48 img->p[PIPI_PIXELS_BGR_C].bpp = 24; 49 img->p[PIPI_PIXELS_BGR_C].bytes = 3 * img->w * img->h; 50 img->last_modified = PIPI_PIXELS_BGR_C; 51 51 52 52 img->codec_priv = (void *)priv; 53 img->codec_format = PIPI_PIXELS_BGR 24;53 img->codec_format = PIPI_PIXELS_BGR_C; 54 54 55 55 img->wrap = 0; … … 74 74 75 75 /* FIXME: check pitch differences here */ 76 if(img->last_modified == PIPI_PIXELS_BGR 24)76 if(img->last_modified == PIPI_PIXELS_BGR_C) 77 77 { 78 memcpy(priv->imageData, img->p[PIPI_PIXELS_BGR 24].pixels,78 memcpy(priv->imageData, img->p[PIPI_PIXELS_BGR_C].pixels, 79 79 3 * img->w * img->h); 80 free(img->p[PIPI_PIXELS_BGR 24].pixels);80 free(img->p[PIPI_PIXELS_BGR_C].pixels); 81 81 } 82 82 83 img->p[PIPI_PIXELS_BGR 24].pixels = priv->imageData;84 img->p[PIPI_PIXELS_BGR 24].w = priv->width;85 img->p[PIPI_PIXELS_BGR 24].h = priv->height;86 img->p[PIPI_PIXELS_BGR 24].pitch = priv->widthStep;87 img->p[PIPI_PIXELS_BGR 24].bpp = 24;88 img->p[PIPI_PIXELS_BGR 24].bytes = 3 * img->w * img->h;83 img->p[PIPI_PIXELS_BGR_C].pixels = priv->imageData; 84 img->p[PIPI_PIXELS_BGR_C].w = priv->width; 85 img->p[PIPI_PIXELS_BGR_C].h = priv->height; 86 img->p[PIPI_PIXELS_BGR_C].pitch = priv->widthStep; 87 img->p[PIPI_PIXELS_BGR_C].bpp = 24; 88 img->p[PIPI_PIXELS_BGR_C].bytes = 3 * img->w * img->h; 89 89 90 90 img->codec_priv = (void *)priv; 91 img->codec_format = PIPI_PIXELS_BGR 24;91 img->codec_format = PIPI_PIXELS_BGR_C; 92 92 93 93 img->wrap = 0; -
libpipi/trunk/pipi/codec/sdl.c
r2756 r2772 49 49 img = pipi_new(priv->w, priv->h); 50 50 51 img->p[PIPI_PIXELS_RGBA 32].pixels = priv->pixels;52 img->p[PIPI_PIXELS_RGBA 32].w = priv->w;53 img->p[PIPI_PIXELS_RGBA 32].h = priv->h;54 img->p[PIPI_PIXELS_RGBA 32].pitch = priv->pitch;55 img->p[PIPI_PIXELS_RGBA 32].bpp = 32;56 img->p[PIPI_PIXELS_RGBA 32].bytes = 4 * img->w * img->h;57 img->last_modified = PIPI_PIXELS_RGBA 32;51 img->p[PIPI_PIXELS_RGBA_C].pixels = priv->pixels; 52 img->p[PIPI_PIXELS_RGBA_C].w = priv->w; 53 img->p[PIPI_PIXELS_RGBA_C].h = priv->h; 54 img->p[PIPI_PIXELS_RGBA_C].pitch = priv->pitch; 55 img->p[PIPI_PIXELS_RGBA_C].bpp = 32; 56 img->p[PIPI_PIXELS_RGBA_C].bytes = 4 * img->w * img->h; 57 img->last_modified = PIPI_PIXELS_RGBA_C; 58 58 59 59 img->codec_priv = (void *)priv; 60 img->codec_format = PIPI_PIXELS_RGBA 32;60 img->codec_format = PIPI_PIXELS_RGBA_C; 61 61 62 62 img->wrap = 0; … … 78 78 79 79 /* FIXME: check pitch differences here */ 80 if(img->last_modified == PIPI_PIXELS_RGBA 32)80 if(img->last_modified == PIPI_PIXELS_RGBA_C) 81 81 { 82 memcpy(priv->pixels, img->p[PIPI_PIXELS_RGBA 32].pixels,82 memcpy(priv->pixels, img->p[PIPI_PIXELS_RGBA_C].pixels, 83 83 priv->pitch * priv->h); 84 free(img->p[PIPI_PIXELS_RGBA 32].pixels);84 free(img->p[PIPI_PIXELS_RGBA_C].pixels); 85 85 } 86 86 87 img->p[PIPI_PIXELS_RGBA 32].pixels = priv->pixels;88 img->p[PIPI_PIXELS_RGBA 32].w = priv->w;89 img->p[PIPI_PIXELS_RGBA 32].h = priv->h;90 img->p[PIPI_PIXELS_RGBA 32].pitch = priv->pitch;91 img->p[PIPI_PIXELS_RGBA 32].bpp = 32;92 img->p[PIPI_PIXELS_RGBA 32].bytes = 4 * img->w * img->h;87 img->p[PIPI_PIXELS_RGBA_C].pixels = priv->pixels; 88 img->p[PIPI_PIXELS_RGBA_C].w = priv->w; 89 img->p[PIPI_PIXELS_RGBA_C].h = priv->h; 90 img->p[PIPI_PIXELS_RGBA_C].pitch = priv->pitch; 91 img->p[PIPI_PIXELS_RGBA_C].bpp = 32; 92 img->p[PIPI_PIXELS_RGBA_C].bytes = 4 * img->w * img->h; 93 93 94 94 img->codec_priv = (void *)priv; 95 img->codec_format = PIPI_PIXELS_RGBA 32;95 img->codec_format = PIPI_PIXELS_RGBA_C; 96 96 97 97 img->wrap = 0; -
libpipi/trunk/pipi/paint/floodfill.c
r2717 r2772 79 79 80 80 81 if(src->last_modified == PIPI_PIXELS_RGBA 32) {81 if(src->last_modified == PIPI_PIXELS_RGBA_C) { 82 82 uint32_t *dstdata; 83 83 unsigned char nr, ng, nb, na; 84 84 85 85 /* Get ARGB32 pointer */ 86 dstp = pipi_getpixels(dst, PIPI_PIXELS_RGBA 32);86 dstp = pipi_getpixels(dst, PIPI_PIXELS_RGBA_C); 87 87 dstdata = (uint32_t *)dstp->pixels; 88 88 -
libpipi/trunk/pipi/pipi.h
r2767 r2772 44 44 PIPI_PIXELS_UNINITIALISED = -1, 45 45 46 PIPI_PIXELS_RGBA 32= 0,47 PIPI_PIXELS_BGR 24= 1,46 PIPI_PIXELS_RGBA_C = 0, 47 PIPI_PIXELS_BGR_C = 1, 48 48 PIPI_PIXELS_RGBA_F = 2, 49 49 PIPI_PIXELS_Y_F = 3, 50 50 51 PIPI_PIXELS_MAX = 4 51 PIPI_PIXELS_MASK_C = 4, 52 53 PIPI_PIXELS_MAX = 5 52 54 } 53 55 pipi_format_t; -
libpipi/trunk/pipi/pixels.c
r2768 r2772 50 50 51 51 /* Preliminary conversions */ 52 if(img->last_modified == PIPI_PIXELS_RGBA 3252 if(img->last_modified == PIPI_PIXELS_RGBA_C 53 53 && type == PIPI_PIXELS_Y_F) 54 54 pipi_getpixels(img, PIPI_PIXELS_RGBA_F); 55 else if(img->last_modified == PIPI_PIXELS_BGR 2455 else if(img->last_modified == PIPI_PIXELS_BGR_C 56 56 && type == PIPI_PIXELS_Y_F) 57 57 pipi_getpixels(img, PIPI_PIXELS_RGBA_F); 58 58 else if(img->last_modified == PIPI_PIXELS_Y_F 59 && type == PIPI_PIXELS_RGBA 32)59 && type == PIPI_PIXELS_RGBA_C) 60 60 pipi_getpixels(img, PIPI_PIXELS_RGBA_F); 61 61 else if(img->last_modified == PIPI_PIXELS_Y_F 62 && type == PIPI_PIXELS_BGR 24)62 && type == PIPI_PIXELS_BGR_C) 63 63 pipi_getpixels(img, PIPI_PIXELS_RGBA_F); 64 64 … … 68 68 switch(type) 69 69 { 70 case PIPI_PIXELS_RGBA 32:70 case PIPI_PIXELS_RGBA_C: 71 71 bytes = img->w * img->h * 4 * sizeof(uint8_t); 72 72 bpp = 4 * sizeof(uint8_t); 73 73 break; 74 case PIPI_PIXELS_BGR 24:74 case PIPI_PIXELS_BGR_C: 75 75 bytes = img->w * img->h * 3 * sizeof(uint8_t); 76 76 bpp = 3 * sizeof(uint8_t); … … 96 96 97 97 /* Convert pixels */ 98 if(img->last_modified == PIPI_PIXELS_RGBA 3298 if(img->last_modified == PIPI_PIXELS_RGBA_C 99 99 && type == PIPI_PIXELS_RGBA_F) 100 100 { 101 uint8_t *src = (uint8_t *)img->p[PIPI_PIXELS_RGBA 32].pixels;101 uint8_t *src = (uint8_t *)img->p[PIPI_PIXELS_RGBA_C].pixels; 102 102 float *dest = (float *)img->p[type].pixels; 103 103 … … 110 110 = u8tof32(src[4 * (y * img->w + x) + i]); 111 111 } 112 else if(img->last_modified == PIPI_PIXELS_BGR 24112 else if(img->last_modified == PIPI_PIXELS_BGR_C 113 113 && type == PIPI_PIXELS_RGBA_F) 114 114 { 115 uint8_t *src = (uint8_t *)img->p[PIPI_PIXELS_BGR 24].pixels;115 uint8_t *src = (uint8_t *)img->p[PIPI_PIXELS_BGR_C].pixels; 116 116 float *dest = (float *)img->p[type].pixels; 117 117 … … 131 131 } 132 132 else if(img->last_modified == PIPI_PIXELS_RGBA_F 133 && type == PIPI_PIXELS_RGBA 32)133 && type == PIPI_PIXELS_RGBA_C) 134 134 { 135 135 float *src = (float *)img->p[PIPI_PIXELS_RGBA_F].pixels; … … 167 167 } 168 168 else if(img->last_modified == PIPI_PIXELS_RGBA_F 169 && type == PIPI_PIXELS_BGR 24)169 && type == PIPI_PIXELS_BGR_C) 170 170 { 171 171 float *src = (float *)img->p[PIPI_PIXELS_RGBA_F].pixels; -
libpipi/trunk/test/u8tof32tou8.c
r2621 r2772 36 36 img2 = pipi_load("mona.png"); 37 37 38 pix1 = pipi_getpixels(img1, PIPI_PIXELS_RGBA 32);38 pix1 = pipi_getpixels(img1, PIPI_PIXELS_RGBA_C); 39 39 data1 = (uint32_t *)pix1->pixels; 40 40 41 41 pipi_getpixels(img2, PIPI_PIXELS_RGBA_F); 42 pix2 = pipi_getpixels(img2, PIPI_PIXELS_RGBA 32);42 pix2 = pipi_getpixels(img2, PIPI_PIXELS_RGBA_C); 43 43 data2 = (uint32_t *)pix2->pixels; 44 44
Note: See TracChangeset
for help on using the changeset viewer.