[Top]
Image
Image.X
|
Method Image.X.encode_truecolor_masks()
- Method
encode_truecolor_masks
-
string Image.X.encode_truecolor(object image, int bpp, int alignbits, int swapbytes, int rbits, int rshift, int gbits, int gshift, int bbits, int bshift)
string Image.X.encode_truecolor_masks(object image, int bpp, int alignbits, int swapbytes, int rmask, int gmask, int bmask)
string Image.X.encode_truecolor(object image, int bpp, int alignbits, int swapbytes, int rbits, int rshift, int gbits, int gshift, int bbits, int bshift, object ct)
string Image.X.encode_truecolor_masks(object image, int bpp, int alignbits, int swapbytes, int rmask, int gmask, int bmask, object ct)
- Description
-
-
Pack an image into a truecolor string. You will get a string
of packed red, green and blue bits;
ie:
encode_truecolor(img, 12,32, 0, 3,5, 4,0, 3,8)
will give (aligned to even 32 bits for each row):
0bbbrrr0 gggg0bbb rrr0gggg 0bbb...
<--pixel 1--><--pixel 2--> <--3-->
10987654 32101098 76543210 1098... <- bit position
<-><-> <-->
| | +--- 4,0: 4 bits green shifted 0 bits
| +-------- 3,5: 3 bits red shifted 5 bits
+----------- 3,8: 3 bits blue shifted 8 bits
The above call is equal to
encode_truecolor_masks(img, 12,32, 0, 224, 15, 768)
and
encode_truecolor(img, 12,32, 0, 3,5,4,0,3,8, colortable(1<<3,1<<4,1<<3)).
The latter gives possibility to use dither algorithms,
but is slightly slower.
- Parameter image
-
-
the image object to encode
- Parameter bpp
-
-
bits per pixel, how many bits each pixel should take
- Parameter alignbits
-
-
the number of even bits each line should be padded to
- Parameter rbits
-
- Parameter gbits
-
- Parameter bbits
-
-
bits for each basecolor
- Parameter rshift
-
- Parameter gshift
-
- Parameter bshift
-
-
leftshifts for each basecolor
- Parameter rmask
-
- Parameter gmask
-
- Parameter bmask
-
-
masks for each basecolor (xbits and gbits are calculated from this),
needs to be massive (no zeroes among the ones in the mask).
- Parameter ct
-
-
colortable object (for dithering, or whatever)
- Parameter swapbytes
-
-
swap bytes for bpp==16,24,32,
swaps bits in the bytes if bpp==1,
for change of byte/bitorder between client and server.
|