~ubuntu-branches/ubuntu/quantal/python-imaging/quantal-updates

« back to all changes in this revision

Viewing changes to libImaging/Pack.c

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2009-11-20 19:22:59 UTC
  • mfrom: (2.1.6 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091120192259-cmnfui5tv2jtq4xu
Tags: 1.1.7-1
New upstream version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 * The Python Imaging Library.
3
 
 * $Id: Pack.c 2763 2006-06-22 21:43:28Z fredrik $
 
3
 * $Id$
4
4
 *
5
5
 * code to pack raw data
6
6
 *
287
287
    }
288
288
}
289
289
 
 
290
void
 
291
ImagingPackBGRA(UINT8* out, const UINT8* in, int pixels)
 
292
{
 
293
    int i;
 
294
    /* BGRX, reversed bytes with right padding */
 
295
    for (i = 0; i < pixels; i++) {
 
296
        out[0] = in[B];
 
297
        out[1] = in[G];
 
298
        out[2] = in[R];
 
299
        out[3] = in[A];
 
300
        out += 4; in += 4;
 
301
    }
 
302
}
 
303
 
 
304
void
 
305
ImagingPackABGR(UINT8* out, const UINT8* in, int pixels)
 
306
{
 
307
    int i;
 
308
    /* XBGR, reversed bytes with left padding */
 
309
    for (i = 0; i < pixels; i++) {
 
310
        out[0] = in[A];
 
311
        out[1] = in[B];
 
312
        out[2] = in[G];
 
313
        out[3] = in[R];
 
314
        out += 4; in += 4;
 
315
    }
 
316
}
 
317
 
290
318
static void
291
319
packRGBL(UINT8* out, const UINT8* in, int pixels)
292
320
{
460
488
    {"RGBA",    "RGBA",         32,     copy4},
461
489
    {"RGBA",    "RGBA;L",       32,     packRGBXL},
462
490
    {"RGBA",    "RGB",          24,     ImagingPackRGB},
 
491
    {"RGBA",    "BGR",          24,     ImagingPackBGR},
 
492
    {"RGBA",    "BGRA",         32,     ImagingPackBGRA},
 
493
    {"RGBA",    "ABGR",         32,     ImagingPackABGR},
463
494
    {"RGBA",    "R",            8,      band0},
464
495
    {"RGBA",    "G",            8,      band1},
465
496
    {"RGBA",    "B",            8,      band2},
469
500
    {"RGBX",    "RGBX",         32,     copy4},
470
501
    {"RGBX",    "RGBX;L",       32,     packRGBXL},
471
502
    {"RGBX",    "RGB",          32,     ImagingPackRGB},
 
503
    {"RGBX",    "BGR",          32,     ImagingPackBGR},
 
504
    {"RGBX",    "BGRX",         32,     ImagingPackBGRX},
 
505
    {"RGBX",    "XBGR",         32,     ImagingPackXBGR},
472
506
    {"RGBX",    "R",            8,      band0},
473
507
    {"RGBX",    "G",            8,      band1},
474
508
    {"RGBX",    "B",            8,      band2},
506
540
    /* storage modes */
507
541
    {"I;16",    "I;16",         16,     copy2},
508
542
    {"I;16B",   "I;16B",        16,     copy2},
 
543
    {"I;16L",   "I;16L",        16,     copy2},
509
544
    {"BGR;15",  "BGR;15",       16,     copy2},
510
545
    {"BGR;16",  "BGR;16",       16,     copy2},
511
546
    {"BGR;24",  "BGR;24",       24,     copy3},