diff options
Diffstat (limited to 'libs/freeimage/src/FreeImage/Halftoning.cpp')
-rw-r--r-- | libs/freeimage/src/FreeImage/Halftoning.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/libs/freeimage/src/FreeImage/Halftoning.cpp b/libs/freeimage/src/FreeImage/Halftoning.cpp index 19195ad27a..dd261e12f0 100644 --- a/libs/freeimage/src/FreeImage/Halftoning.cpp +++ b/libs/freeimage/src/FreeImage/Halftoning.cpp @@ -40,7 +40,7 @@ static FIBITMAP* FloydSteinberg(FIBITMAP *dib) { int seed = 0; int x, y, p, pixel, threshold, error; int width, height, pitch; - BYTE *bits, *new_bits; + uint8_t *bits, *new_bits; FIBITMAP *new_dib = NULL; // allocate a 8-bit DIB @@ -66,7 +66,7 @@ static FIBITMAP* FloydSteinberg(FIBITMAP *dib) { pixel = bits[0] + error; p = (pixel > threshold) ? WHITE : BLACK; error = pixel - p; - new_bits[0] = (BYTE)p; + new_bits[0] = (uint8_t)p; } // right border error = 0; @@ -78,7 +78,7 @@ static FIBITMAP* FloydSteinberg(FIBITMAP *dib) { pixel = bits[width-1] + error; p = (pixel > threshold) ? WHITE : BLACK; error = pixel - p; - new_bits[width-1] = (BYTE)p; + new_bits[width-1] = (uint8_t)p; } // top border bits = FreeImage_GetBits(dib); @@ -89,7 +89,7 @@ static FIBITMAP* FloydSteinberg(FIBITMAP *dib) { pixel = bits[x] + error; p = (pixel > threshold) ? WHITE : BLACK; error = pixel - p; - new_bits[x] = (BYTE)p; + new_bits[x] = (uint8_t)p; lerr[x] = INITERR(bits[x], p); } @@ -161,7 +161,7 @@ static int dithervalue(int x, int y, int size) { static FIBITMAP* OrderedDispersedDot(FIBITMAP *dib, int order) { int x, y; int width, height; - BYTE *bits, *new_bits; + uint8_t *bits, *new_bits; FIBITMAP *new_dib = NULL; // allocate a 8-bit DIB @@ -172,10 +172,10 @@ static FIBITMAP* OrderedDispersedDot(FIBITMAP *dib, int order) { // build the dithering matrix int l = (1 << order); // square of dither matrix order; the dimensions of the matrix - BYTE *matrix = (BYTE*)malloc(l*l * sizeof(BYTE)); + uint8_t *matrix = (uint8_t*)malloc(l*l * sizeof(uint8_t)); for(int i = 0; i < l*l; i++) { // according to "Purdue University: Digital Image Processing Laboratory: Image Halftoning, April 30th, 2006 - matrix[i] = (BYTE)( 255 * (((double)dithervalue(i / l, i % l, order) + 0.5) / (l*l)) ); + matrix[i] = (uint8_t)( 255 * (((double)dithervalue(i / l, i % l, order) + 0.5) / (l*l)) ); } // perform the dithering @@ -251,7 +251,7 @@ static FIBITMAP* OrderedClusteredDot(FIBITMAP *dib, int order) { int x, y, pixel; int width, height; - BYTE *bits, *new_bits; + uint8_t *bits, *new_bits; FIBITMAP *new_dib = NULL; // allocate a 8-bit DIB @@ -378,9 +378,9 @@ FreeImage_Dither(FIBITMAP *dib, FREE_IMAGE_DITHER algorithm) { // Build a greyscale palette (needed by threshold) RGBQUAD *grey_pal = FreeImage_GetPalette(dib8); for(int i = 0; i < 256; i++) { - grey_pal[i].rgbRed = (BYTE)i; - grey_pal[i].rgbGreen = (BYTE)i; - grey_pal[i].rgbBlue = (BYTE)i; + grey_pal[i].rgbRed = (uint8_t)i; + grey_pal[i].rgbGreen = (uint8_t)i; + grey_pal[i].rgbBlue = (uint8_t)i; } // Convert to 1-bit @@ -397,7 +397,7 @@ FreeImage_Dither(FIBITMAP *dib, FREE_IMAGE_DITHER algorithm) { // Thresholding function // FIBITMAP * DLL_CALLCONV -FreeImage_Threshold(FIBITMAP *dib, BYTE T) { +FreeImage_Threshold(FIBITMAP *dib, uint8_t T) { FIBITMAP *dib8 = NULL; if(!FreeImage_HasPixels(dib)) return NULL; @@ -449,8 +449,8 @@ FreeImage_Threshold(FIBITMAP *dib, BYTE T) { // Perform the thresholding // for(int y = 0; y < height; y++) { - BYTE *bits8 = FreeImage_GetScanLine(dib8, y); - BYTE *bits1 = FreeImage_GetScanLine(new_dib, y); + uint8_t *bits8 = FreeImage_GetScanLine(dib8, y); + uint8_t *bits1 = FreeImage_GetScanLine(new_dib, y); for(int x = 0; x < width; x++) { if(bits8[x] < T) { // Set bit(x, y) to 0 |