mirror of
https://github.com/wiidev/usbloadergx.git
synced 2024-12-23 10:21:55 +01:00
*Added Grayscalefunction to the GuiImage Class
*Added svnrev.c to ignore list to avoid conflicts
This commit is contained in:
parent
4147f980dc
commit
45f2cb9704
File diff suppressed because one or more lines are too long
@ -636,6 +636,8 @@ class GuiImage : public GuiElement
|
||||
//!\param y Y coordinate
|
||||
//!\param color Pixel color
|
||||
void SetPixel(int x, int y, GXColor color);
|
||||
//!Sets the image to grayscale
|
||||
void SetGrayscale(void);
|
||||
//!Directly modifies the image data to create a color-striped effect
|
||||
//!Alters the RGB values by the specified amount
|
||||
//!\param s Amount to increment/decrement the RGB values in the image
|
||||
|
@ -288,6 +288,29 @@ void GuiImage::SetPixel(int x, int y, GXColor color)
|
||||
*(image+offset+33) = color.b;
|
||||
}
|
||||
|
||||
void GuiImage::SetGrayscale(void)
|
||||
{
|
||||
LOCK(this);
|
||||
GXColor color;
|
||||
u32 offset, gray;
|
||||
|
||||
for(int x = 0; x < width; x++) {
|
||||
for(int y = 0; y < height; y++) {
|
||||
offset = (((y >> 2)<<4)*this->GetWidth()) + ((x >> 2)<<6) + (((y%4 << 2) + x%4 ) << 1);
|
||||
color.r = *(image+offset+1);
|
||||
color.g = *(image+offset+32);
|
||||
color.b = *(image+offset+33);
|
||||
|
||||
gray = (77*color.r + 150*color.g + 28*color.b)/255;
|
||||
|
||||
*(image+offset+1) = gray;
|
||||
*(image+offset+32) = gray;
|
||||
*(image+offset+33) = gray;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GuiImage::SetStripe(int s)
|
||||
{
|
||||
LOCK(this);
|
||||
|
Loading…
Reference in New Issue
Block a user