@@ -718,6 +718,21 @@ ImagingUnpackBGRA15(UINT8 *out, const UINT8 *in, int pixels) {
718
718
}
719
719
}
720
720
721
+ void
722
+ ImagingUnpackBGRA15Z (UINT8 * out , const UINT8 * in , int pixels ) {
723
+ int i , pixel ;
724
+ /* RGB, rearranged channels, 5/5/5/1 bits per pixel, inverted alpha */
725
+ for (i = 0 ; i < pixels ; i ++ ) {
726
+ pixel = in [0 ] + (in [1 ] << 8 );
727
+ out [B ] = (pixel & 31 ) * 255 / 31 ;
728
+ out [G ] = ((pixel >> 5 ) & 31 ) * 255 / 31 ;
729
+ out [R ] = ((pixel >> 10 ) & 31 ) * 255 / 31 ;
730
+ out [A ] = ~((pixel >> 15 ) * 255 );
731
+ out += 4 ;
732
+ in += 2 ;
733
+ }
734
+ }
735
+
721
736
void
722
737
ImagingUnpackRGB16 (UINT8 * out , const UINT8 * in , int pixels ) {
723
738
int i , pixel ;
@@ -1538,7 +1553,7 @@ static struct {
1538
1553
1539
1554
/* flags: "I" inverted data; "R" reversed bit order; "B" big
1540
1555
endian byte order (default is little endian); "L" line
1541
- interleave, "S" signed, "F" floating point */
1556
+ interleave, "S" signed, "F" floating point, "Z" inverted alpha */
1542
1557
1543
1558
/* exception: rawmodes "I" and "F" are always native endian byte order */
1544
1559
@@ -1646,6 +1661,7 @@ static struct {
1646
1661
{"RGBA" , "RGBA;L" , 32 , unpackRGBAL },
1647
1662
{"RGBA" , "RGBA;15" , 16 , ImagingUnpackRGBA15 },
1648
1663
{"RGBA" , "BGRA;15" , 16 , ImagingUnpackBGRA15 },
1664
+ {"RGBA" , "BGRA;15Z" , 16 , ImagingUnpackBGRA15Z },
1649
1665
{"RGBA" , "RGBA;4B" , 16 , ImagingUnpackRGBA4B },
1650
1666
{"RGBA" , "RGBA;16L" , 64 , unpackRGBA16L },
1651
1667
{"RGBA" , "RGBA;16B" , 64 , unpackRGBA16B },
0 commit comments