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

Function Dither1BitColor

crengine/src/lvdrawbuf.cpp:174–190  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

172}
173
174lUInt32 Dither1BitColor( lUInt32 color, lUInt32 x, lUInt32 y )
175{
176 int cl = ((((color>>16) & 255) + ((color>>8) & 255) + ((color) & 255)) * (256/3)) >> 8;
177 if (cl<16)
178 return 0;
179 else if (cl>=240)
180 return 1;
181 //int d = dither_2bpp_4x4[(x&3) | ( (y&3) << 2 )] - 1;
182 int d = dither_2bpp_8x8[(x&7) | ( (y&7) << 3 )] - 1;
183
184 cl = ( cl + d - 32 );
185 if (cl<5)
186 return 0;
187 else if (cl>=250)
188 return 1;
189 return (cl >> 7) & 1;
190}
191
192static lUInt8 revByteBits1( lUInt8 b )
193{

Callers 1

OnLineDecodedMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected