Created
February 19, 2016 15:42
-
-
Save kashimAstro/c26b3245d003e8acb5cb to your computer and use it in GitHub Desktop.
pseudocode floyd steinberg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
per ogni y dall'alto in basso | |
per ogni x da sinistra a destra | |
vecchio_pixel := pixel[x][y] | |
nuovo_pixel := trova_il_colore_della_tavolozza_più_vicino(vecchio_pixel) | |
pixel[x][y] := nuovo_pixel | |
quant_errore := vecchio_pixel - nuovo_pixel | |
pixel[x+1][y] := pixel[x+1][y] + 7/16 * quant_errore | |
pixel[x-1][y+1] := pixel[x-1][y+1] + 3/16 * quant_errore | |
pixel[x][y+1] := pixel[x][y+1] + 5/16 * quant_errore | |
pixel[x+1][y+1] := pixel[x+1][y+1] + 1/16 * quant_errore | |
//8BIT | |
trova_il_colore_della_tavolozza_più_vicino(vecchio_pixel) = (vecchio_pixel + 128) / 256 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment