diff options
author | Sjoerd Mullender <sjoerd@acm.org> | 1993-10-11 12:54:31 (GMT) |
---|---|---|
committer | Sjoerd Mullender <sjoerd@acm.org> | 1993-10-11 12:54:31 (GMT) |
commit | a9c3c22c33762699b362e7598268442fd2df9eb6 (patch) | |
tree | 7ff6bdfb7228abf0a566b6d3215a383796bd5cbf /Modules/imageop.c | |
parent | 35fe6ec4cf6e192829a5bd28c080761157258e3e (diff) | |
download | cpython-a9c3c22c33762699b362e7598268442fd2df9eb6.zip cpython-a9c3c22c33762699b362e7598268442fd2df9eb6.tar.gz cpython-a9c3c22c33762699b362e7598268442fd2df9eb6.tar.bz2 |
* Extended X interface: pixmap objects, colormap objects visual objects,
image objects, and lots of new methods.
* Added counting of allocations and deallocations of builtin types if
COUNT_ALLOCS is defined. Had to move calls to NEWREF down in some
files.
* Bug fix in sorting lists.
Diffstat (limited to 'Modules/imageop.c')
-rw-r--r-- | Modules/imageop.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Modules/imageop.c b/Modules/imageop.c index 40940cb..841ec1b 100644 --- a/Modules/imageop.c +++ b/Modules/imageop.c @@ -542,9 +542,15 @@ imageop_rgb2rgb8(self, args) for ( i=0; i < nlen; i++ ) { /* Bits in source: aaaaaaaa BBbbbbbb GGGggggg RRRrrrrr */ value = *cp++; +#if 0 r = (value >> 5) & 7; g = (value >> 13) & 7; b = (value >> 22) & 3; +#else + r = (int) ((value & 0xff) / 255. * 7. + .5); + g = (int) (((value >> 8) & 0xff) / 255. * 7. + .5); + b = (int) (((value >> 16) & 0xff) / 255. * 3. + .5); +#endif nvalue = (r<<5) | (b<<3) | g; *ncp++ = nvalue; } |