Skip to content

Commit 89723d6

Browse files
committed
Removes redundant code for #43
1 parent bbf0247 commit 89723d6

1 file changed

Lines changed: 2 additions & 9 deletions

File tree

src/milchreis/imageprocessing/Knitting.java

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package milchreis.imageprocessing;
22

3+
import milchreis.imageprocessing.utils.Tools;
34
import processing.core.PGraphics;
45
import processing.core.PImage;
56

@@ -46,7 +47,7 @@ private static PImage apply(PImage image, int size, float threshold, int foregro
4647
for (int y = 0; y < canvas.height; y += size + gap) {
4748

4849
int color = image.get(x + size / 2, y + size / 2);
49-
float sum = getGray(color);
50+
float sum = Tools.getGrey(color) / 255.0f;
5051

5152
if (inColor) {
5253
canvas.stroke(color);
@@ -67,12 +68,4 @@ private static PImage apply(PImage image, int size, float threshold, int foregro
6768
return canvas.get();
6869
}
6970

70-
private static float getGray(int color) {
71-
return (
72-
0.2125f * (color >> 16 & 0xff)
73-
+ 0.7154f * (color >> 8 & 0xff)
74-
+ 0.0721f * (color & 0xff)
75-
) / 255.0f;
76-
}
77-
7871
}

0 commit comments

Comments
 (0)