mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-11 13:17:00 -04:00
added desaturate function for making greyed out icons
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@793 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -30,3 +30,15 @@ void saturate(Image& image, int amount) {
|
||||
pix += 3;
|
||||
}
|
||||
}
|
||||
|
||||
void desaturate(Image& image) {
|
||||
Byte* pix = image.GetData();
|
||||
Byte* end = pix + image.GetWidth() * image.GetHeight() * 3;
|
||||
while (pix != end) {
|
||||
int r = pix[0], g = pix[1], b = pix[2];
|
||||
pix[0] = (r+r+g+b) / 4;
|
||||
pix[1] = (g+r+g+b) / 4;
|
||||
pix[2] = (b+r+g+b) / 4;
|
||||
pix += 3;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user