Changeset 2821 for libcaca/trunk/src/common-image.c
- Timestamp:
- Sep 27, 2008, 3:12:46 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcaca/trunk/src/common-image.c
r2436 r2821 24 24 #endif 25 25 26 #include "c ucul.h"26 #include "caca.h" 27 27 28 28 #include "common-image.h" 29 29 30 30 #if !defined(USE_IMLIB2) 31 static unsigned int u32fread(c ucul_file_t *);32 static unsigned int u16fread(c ucul_file_t *);33 static unsigned int u8fread(c ucul_file_t *);31 static unsigned int u32fread(caca_file_t *); 32 static unsigned int u16fread(caca_file_t *); 33 static unsigned int u8fread(caca_file_t *); 34 34 #endif 35 35 … … 62 62 depth = 4; 63 63 64 /* Create the libc uculdither */65 im->dither = c ucul_create_dither(bpp, im->w, im->h, depth * im->w,64 /* Create the libcaca dither */ 65 im->dither = caca_create_dither(bpp, im->w, im->h, depth * im->w, 66 66 rmask, gmask, bmask, amask); 67 67 if(!im->dither) … … 78 78 unsigned int red[256], green[256], blue[256], alpha[256]; 79 79 unsigned int i, colors, offset, tmp, planes; 80 c ucul_file_t *f;81 82 f = c ucul_file_open(name, "rb");80 caca_file_t *f; 81 82 f = caca_file_open(name, "rb"); 83 83 if(!f) 84 84 { … … 89 89 if(u16fread(f) != 0x4d42) 90 90 { 91 c ucul_file_close(f);91 caca_file_close(f); 92 92 free(im); 93 93 return NULL; … … 111 111 if(tmp != 0) 112 112 { 113 c ucul_file_close(f);113 caca_file_close(f); 114 114 free(im); 115 115 return NULL; … … 150 150 else 151 151 { 152 c ucul_file_close(f);152 caca_file_close(f); 153 153 free(im); 154 154 return NULL; … … 164 164 if(!im->w || im->w > 0x10000 || !im->h || im->h > 0x10000 || planes != 1) 165 165 { 166 c ucul_file_close(f);166 caca_file_close(f); 167 167 free(im); 168 168 return NULL; … … 173 173 if(!im->pixels) 174 174 { 175 c ucul_file_close(f);175 caca_file_close(f); 176 176 free(im); 177 177 return NULL; … … 209 209 default: 210 210 /* Works for 8bpp, but also for 16, 24 etc. */ 211 c ucul_file_read(f, im->pixels + im->w * i * depth,211 caca_file_read(f, im->pixels + im->w * i * depth, 212 212 im->w * depth); 213 213 /* Pad reads to 4 bytes */ … … 241 241 } 242 242 243 c ucul_file_close(f);244 245 /* Create the libc uculdither */246 im->dither = c ucul_create_dither(bpp, im->w, im->h, depth * im->w,243 caca_file_close(f); 244 245 /* Create the libcaca dither */ 246 im->dither = caca_create_dither(bpp, im->w, im->h, depth * im->w, 247 247 rmask, gmask, bmask, amask); 248 248 if(!im->dither) … … 254 254 255 255 if(bpp == 8) 256 c ucul_set_dither_palette(im->dither, red, green, blue, alpha);256 caca_set_dither_palette(im->dither, red, green, blue, alpha); 257 257 #endif 258 258 … … 268 268 free(im->pixels); 269 269 #endif 270 c ucul_free_dither(im->dither);270 caca_free_dither(im->dither); 271 271 } 272 272 273 273 #if !defined(USE_IMLIB2) 274 static unsigned int u32fread(c ucul_file_t * f)274 static unsigned int u32fread(caca_file_t * f) 275 275 { 276 276 uint8_t buffer[4]; 277 c ucul_file_read(f, buffer, 4);277 caca_file_read(f, buffer, 4); 278 278 return ((unsigned int)buffer[3] << 24) | ((unsigned int)buffer[2] << 16) 279 279 | ((unsigned int)buffer[1] << 8) | ((unsigned int)buffer[0]); 280 280 } 281 281 282 static unsigned int u16fread(c ucul_file_t * f)282 static unsigned int u16fread(caca_file_t * f) 283 283 { 284 284 uint8_t buffer[2]; 285 c ucul_file_read(f, buffer, 2);285 caca_file_read(f, buffer, 2); 286 286 return ((unsigned int)buffer[1] << 8) | ((unsigned int)buffer[0]); 287 287 } 288 288 289 static unsigned int u8fread(c ucul_file_t * f)289 static unsigned int u8fread(caca_file_t * f) 290 290 { 291 291 uint8_t buffer; 292 c ucul_file_read(f, &buffer, 1);292 caca_file_read(f, &buffer, 1); 293 293 return (unsigned int)buffer; 294 294 }
Note: See TracChangeset
for help on using the changeset viewer.