Quote:
Originally Posted by yunhaid
hi, soctt.
i used your code in translate mono8 to mono4, in fact, i want to translate mono8 to mono2, how can i modify this code? thank you.
{
// Get Mono 8 pixel and add error distribution
origGrey = *p + errorRight + errors[x+1];
// Convert pixel to Mono 4, clip < 0 and > Mono 4
if (origGrey <= 0) {
grey = 0;
} else if (origGrey >= 0x00ff) {
grey = 0x00ff; // No error for white of 255
} else {
grey = origGrey & 0x00f0;
}
// Put Mono 4 pixel with distributed error back
*p = grey;
// Calculate error
error = origGrey - grey;
// Distribute error
errorRight = (error * 7) >> 4;
errors[x] += (error * 3) >> 4;
errors[x+1] = ((error * 5) >> 4) + errDownRight;
errDownRight = error >> 4;
}
|
Unfortunately Scotty has
ceased all development to the iLiad due to several hardware malfunctions.