mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-25 16:26:18 +00:00
Separate dither matrix per color channel
This commit is contained in:
parent
76a1deb882
commit
4c91c4a7d9
1 changed files with 18 additions and 4 deletions
|
@ -359,13 +359,27 @@ void dividSize (CBitmap &bitmap)
|
|||
}
|
||||
}
|
||||
|
||||
const int bayerDiv8[4][4] = {
|
||||
const int bayerDiv8R[4][4] = {
|
||||
7, 3, 6, 2,
|
||||
1, 5, 0, 4,
|
||||
6, 2, 7, 3,
|
||||
0, 4, 1, 5,
|
||||
};
|
||||
|
||||
const int bayerDiv8G[4][4] = {
|
||||
0, 4, 1, 5,
|
||||
6, 2, 7, 3,
|
||||
1, 5, 0, 4,
|
||||
7, 3, 6, 2,
|
||||
};
|
||||
|
||||
const int bayerDiv8B[4][4] = {
|
||||
5, 1, 4, 0,
|
||||
3, 7, 2, 6,
|
||||
4, 0, 5, 1,
|
||||
2, 6, 3, 7,
|
||||
};
|
||||
|
||||
// ***************************************************************************
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
|
@ -618,9 +632,9 @@ int main(int argc, char **argv)
|
|||
for (uint32 i = 0; i < rgba.size(); i += 4)
|
||||
{
|
||||
NLMISC::CRGBA &c = reinterpret_cast<NLMISC::CRGBA &>(rgba[i]);
|
||||
c.R = (uint8)std::min(255, (int)c.R + bayerDiv8[x % 4][y % 4]);
|
||||
c.G = (uint8)std::min(255, (int)c.G + bayerDiv8[x % 4][y % 4]);
|
||||
c.B = (uint8)std::min(255, (int)c.B + bayerDiv8[x % 4][y % 4]);
|
||||
c.R = (uint8)std::min(255, (int)c.R + bayerDiv8R[x % 4][y % 4]);
|
||||
c.G = (uint8)std::min(255, (int)c.G + bayerDiv8G[x % 4][y % 4]);
|
||||
c.B = (uint8)std::min(255, (int)c.B + bayerDiv8B[x % 4][y % 4]);
|
||||
++x;
|
||||
x %= w;
|
||||
if (x == 0)
|
||||
|
|
Loading…
Reference in a new issue