Changeset 2633 for libpipi/trunk/pipi/pixels.c
- Timestamp:
- Aug 2, 2008, 2:01:08 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libpipi/trunk/pipi/pixels.c
r2630 r2633 63 63 bytes = img->w * img->h * 4 * sizeof(float); 64 64 break; 65 case PIPI_PIXELS_Y_F: 66 bytes = img->w * img->h * sizeof(float); 67 break; 65 68 default: 66 69 return NULL; … … 177 180 } 178 181 } 182 else if(img->last_modified == PIPI_PIXELS_Y_F 183 && type == PIPI_PIXELS_RGBA_F) 184 { 185 float *src = (float *)img->p[PIPI_PIXELS_Y_F].pixels; 186 float *dest = (float *)img->p[PIPI_PIXELS_RGBA_F].pixels; 187 188 init_tables(); 189 190 for(y = 0; y < img->h; y++) 191 for(x = 0; x < img->w; x++) 192 { 193 float p = src[y * img->w + x]; 194 dest[4 * (y * img->w + x)] = p; 195 dest[4 * (y * img->w + x) + 1] = p; 196 dest[4 * (y * img->w + x) + 2] = p; 197 dest[4 * (y * img->w + x) + 3] = 1.0; 198 } 199 } 200 else if(img->last_modified == PIPI_PIXELS_RGBA_F 201 && type == PIPI_PIXELS_Y_F) 202 { 203 float *src = (float *)img->p[PIPI_PIXELS_RGBA_F].pixels; 204 float *dest = (float *)img->p[PIPI_PIXELS_Y_F].pixels; 205 206 init_tables(); 207 208 for(y = 0; y < img->h; y++) 209 for(x = 0; x < img->w; x++) 210 { 211 float p = 0.; 212 p += 0.299 * src[4 * (y * img->w + x)]; 213 p += 0.587 * src[4 * (y * img->w + x) + 1]; 214 p += 0.114 * src[4 * (y * img->w + x) + 2]; 215 dest[y * img->w + x] = p; 216 } 217 } 179 218 else 180 219 {
Note: See TracChangeset
for help on using the changeset viewer.