mirror of
https://github.com/badvision/lawless-legends.git
synced 2025-02-20 21:29:13 +00:00
Adjusted dithering coefficients and color algorithms
This commit is contained in:
parent
64a0a56d9e
commit
70477e2be9
@ -77,14 +77,14 @@ public abstract class Palette {
|
||||
}
|
||||
|
||||
public static double distance(int c1[], int c2[]) {
|
||||
double rmean = ( c1[0] + c2[0] ) / 2.0;
|
||||
double rmean = ( c1[0] + c2[0] ) / 512.0;
|
||||
double r = c1[0] - c2[0];
|
||||
double g = c1[1] - c2[1];
|
||||
double b = c1[2] - c2[2];
|
||||
double weightR = 2.0 + rmean/256.0;
|
||||
double weightG = 4.0;
|
||||
double weightB = 2.0 + (255.0-rmean)/256.0;
|
||||
return Math.sqrt(weightR*(r*r) + weightG*(g*g) + weightB*(b*b)) / 1.73167;
|
||||
double weightR = 2.0 + rmean;
|
||||
double weightG = 2.0;
|
||||
double weightB = 3.0 - rmean;
|
||||
return Math.sqrt(weightR*(r*r) + weightG*(g*g) + weightB*(b*b)) / 1.5275;
|
||||
}
|
||||
|
||||
public static double distance_linear(int color[], int test[]) {
|
||||
|
@ -329,7 +329,7 @@ public class ImageConversionWizardController implements Initializable {
|
||||
0, 3, 5, 1, 0,
|
||||
0, 0, 0, 0, 0
|
||||
);
|
||||
setDivisor(17);
|
||||
setDivisor(19);
|
||||
}
|
||||
|
||||
@FXML
|
||||
@ -339,8 +339,7 @@ public class ImageConversionWizardController implements Initializable {
|
||||
0, 0, 3, 2, 0,
|
||||
0, 0, 0, 0, 0
|
||||
);
|
||||
// setDivisor(8);
|
||||
setDivisor(10);
|
||||
setDivisor(11);
|
||||
}
|
||||
|
||||
@FXML
|
||||
@ -350,7 +349,7 @@ public class ImageConversionWizardController implements Initializable {
|
||||
3, 5, 7, 5, 3,
|
||||
1, 3, 5, 3, 1
|
||||
);
|
||||
setDivisor(50);
|
||||
setDivisor(57);
|
||||
}
|
||||
|
||||
@FXML
|
||||
@ -360,7 +359,7 @@ public class ImageConversionWizardController implements Initializable {
|
||||
2, 4, 8, 4, 2,
|
||||
1, 2, 4, 2, 1
|
||||
);
|
||||
setDivisor(44);
|
||||
setDivisor(50);
|
||||
}
|
||||
|
||||
@FXML
|
||||
@ -370,7 +369,7 @@ public class ImageConversionWizardController implements Initializable {
|
||||
0, 1, 1, 1, 0,
|
||||
0, 0, 1, 0, 0
|
||||
);
|
||||
setDivisor(7);
|
||||
setDivisor(9);
|
||||
}
|
||||
|
||||
@FXML
|
||||
@ -380,8 +379,7 @@ public class ImageConversionWizardController implements Initializable {
|
||||
2, 4, 8, 4, 2,
|
||||
0, 0, 0, 0, 0
|
||||
);
|
||||
setDivisor(34);
|
||||
// setDivisor(32);
|
||||
setDivisor(40);
|
||||
}
|
||||
|
||||
@FXML
|
||||
@ -391,7 +389,7 @@ public class ImageConversionWizardController implements Initializable {
|
||||
2, 4, 5, 4, 2,
|
||||
0, 2, 3, 2, 0
|
||||
);
|
||||
setDivisor(34);
|
||||
setDivisor(37);
|
||||
}
|
||||
|
||||
@FXML
|
||||
@ -401,7 +399,7 @@ public class ImageConversionWizardController implements Initializable {
|
||||
1, 2, 3, 2, 1,
|
||||
0, 0, 0, 0, 0
|
||||
);
|
||||
setDivisor(18);
|
||||
setDivisor(19);
|
||||
}
|
||||
|
||||
@FXML
|
||||
|
@ -202,11 +202,11 @@ public class ImageDitheringTest {
|
||||
};
|
||||
}
|
||||
|
||||
private void configureBrendanDither(ImageDitherEngine ditherEngine) {
|
||||
private void configureSierraLite(ImageDitherEngine ditherEngine) {
|
||||
int[][] coefficients = new int[][]{
|
||||
{0, 8, 0}, {0, 16, 4}, {0, 32, 8}, {32, 16, 4}, {24, 8, 0}};
|
||||
{0, 0, 0}, {0, 1, 0}, {0, 1, 0}, {2, 0, 0}, {0, 0, 0}};
|
||||
ditherEngine.setCoefficients(coefficients);
|
||||
ditherEngine.setDivisor(240);
|
||||
ditherEngine.setDivisor(5);
|
||||
}
|
||||
|
||||
private void fillColor(WritableImage img, Color color) {
|
||||
@ -219,7 +219,7 @@ public class ImageDitheringTest {
|
||||
|
||||
private WritableImage getTestConversion(ImageDitherEngine dither, WritableImage source) {
|
||||
dither.setSourceImage(source);
|
||||
configureBrendanDither(dither);
|
||||
configureSierraLite(dither);
|
||||
dither.dither(true);
|
||||
return dither.getPreviewImage();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user