Method Image.X.encode_truecolor_masks()
- Method encode_truecolor_masks
encode_truecolor(stringobjectimage,intbpp,intalignbits,intswapbytes,intrbits,intrshift,intgbits,intgshift,intbbits,intbshift)
encode_truecolor_masks(stringobjectimage,intbpp,intalignbits,intswapbytes,intrmask,intgmask,intbmask)
encode_truecolor(stringobjectimage,intbpp,intalignbits,intswapbytes,intrbits,intrshift,intgbits,intgshift,intbbits,intbshift,objectct)
encode_truecolor_masks(stringobjectimage,intbpp,intalignbits,intswapbytes,intrmask,intgmask,intbmask,objectct)- 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 bitsThe 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.