FloydSteinbergDither.cpp File Reference
Go to the source code of this file.
Classes | |
| struct | RGBTriple |
| struct | RGBPalette |
| struct | RGBImage |
| struct | PalettizedImage |
Defines | |
| #define | plus_truncate_uchar(a, b) |
| #define | compute_disperse(channel) |
Functions | |
| static unsigned char | FindNearestColor (RGBTriple color, RGBPalette palette) |
| PalettizedImage | FloydSteinbergDitherer (RGBImage image, RGBPalette palette) |
Define Documentation
| #define plus_truncate_uchar | ( | a, | |||
| b | ) |
Value:
if (((int)(a)) + (b) < 0) \ (a) = 0; \ else if (((int)(a)) + (b) > 255) \ (a) = 255; \ else \ (a) += (b);
Definition at line 30 of file FloydSteinbergDither.cpp.
| #define compute_disperse | ( | channel | ) |
Value:
error = ((int)(currentPixel->channel)) - palette.table[index].channel; \ if (x + 1 < image.width && image.pixels[(x+1) + (y+0)*image.width].A>0) { \ plus_truncate_uchar(image.pixels[(x+1) + (y+0)*image.width].channel, (error*7) >> 4); \ } \ if (y + 1 < image.height) { \ if (x - 1 > 0 && image.pixels[(x-1) + (y+1)*image.width].A>0) { \ plus_truncate_uchar(image.pixels[(x-1) + (y+1)*image.width].channel, (error*3) >> 4); \ } \ if (image.pixels[(x+0) + (y+1)*image.width].A>0) { \ plus_truncate_uchar(image.pixels[(x+0) + (y+1)*image.width].channel, (error*5) >> 4); \ }\ if (x + 1 < image.width && image.pixels[(x+1) + (y+1)*image.width].A>0) { \ plus_truncate_uchar(image.pixels[(x+1) + (y+1)*image.width].channel, (error*1) >> 4); \ } \ }
Definition at line 57 of file FloydSteinbergDither.cpp.
Function Documentation
| static unsigned char FindNearestColor | ( | RGBTriple | color, | |
| RGBPalette | palette | |||
| ) | [static] |
Definition at line 40 of file FloydSteinbergDither.cpp.
| PalettizedImage FloydSteinbergDitherer | ( | RGBImage | image, | |
| RGBPalette | palette | |||
| ) |
Definition at line 75 of file FloydSteinbergDither.cpp.
Reproduction/republishing of any material on this site without permission is strictly prohibited.
