MCPcopy Create free account
hub / github.com/buggins/coolreader / Dither2BitColor

Function Dither2BitColor

crengine/src/lvdrawbuf.cpp:156–172  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

154}
155
156lUInt32 Dither2BitColor( lUInt32 color, lUInt32 x, lUInt32 y )
157{
158 int cl = ((((color>>16) & 255) + ((color>>8) & 255) + ((color) & 255)) * (256/3)) >> 8;
159 if (cl<5)
160 return 0;
161 else if (cl>=250)
162 return 3;
163 //int d = dither_2bpp_4x4[(x&3) | ( (y&3) << 2 )] - 1;
164 int d = dither_2bpp_8x8[(x&7) | ( (y&7) << 3 )] - 1;
165
166 cl = ( cl + d - 32 );
167 if (cl<5)
168 return 0;
169 else if (cl>=250)
170 return 3;
171 return (cl >> 6) & 3;
172}
173
174lUInt32 Dither1BitColor( lUInt32 color, lUInt32 x, lUInt32 y )
175{

Callers 1

OnLineDecodedMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected