diff --git a/.gradle/8.3/executionHistory/executionHistory.bin b/.gradle/8.3/executionHistory/executionHistory.bin index 4c09734e80535018bbf9d2b1ad9a0c3cb9a27605..a961ad0e67d90fc85258438171ff3b6e2f974433 100644 Binary files a/.gradle/8.3/executionHistory/executionHistory.bin and b/.gradle/8.3/executionHistory/executionHistory.bin differ diff --git a/.gradle/8.3/executionHistory/executionHistory.lock b/.gradle/8.3/executionHistory/executionHistory.lock index f7b2731606aaa5353aabe838d00caa16d1497dec..bf42d53b29121a5cfabaac3f3a2f916581e29eff 100644 Binary files a/.gradle/8.3/executionHistory/executionHistory.lock and b/.gradle/8.3/executionHistory/executionHistory.lock differ diff --git a/.gradle/8.3/fileHashes/fileHashes.bin b/.gradle/8.3/fileHashes/fileHashes.bin index 84c2b0b37dbcfa90364b9bb4194ab33a96a9d660..fa0d4ab4409c4e1e76333533a9859c49e6af2b09 100644 Binary files a/.gradle/8.3/fileHashes/fileHashes.bin and b/.gradle/8.3/fileHashes/fileHashes.bin differ diff --git a/.gradle/8.3/fileHashes/fileHashes.lock b/.gradle/8.3/fileHashes/fileHashes.lock index d0a48fcb769b646e7ab09643af4d92149fe0c906..67c410e01011f77864d811ea4c5f24d2471f59aa 100644 Binary files a/.gradle/8.3/fileHashes/fileHashes.lock and b/.gradle/8.3/fileHashes/fileHashes.lock differ diff --git a/.gradle/8.3/fileHashes/resourceHashesCache.bin b/.gradle/8.3/fileHashes/resourceHashesCache.bin index 5a514c6b0fd10fa3e758bece3f8c7281237db262..deda70f184b2e0be479d66e4e7cd9b4ad53ac3ca 100644 Binary files a/.gradle/8.3/fileHashes/resourceHashesCache.bin and b/.gradle/8.3/fileHashes/resourceHashesCache.bin differ diff --git a/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/.gradle/buildOutputCleanup/buildOutputCleanup.lock index d3665b8232e30ff4afdb940ece04f1b36d972342..4e20c9867ab8cd2448397783b9e5e04e2969d1d5 100644 Binary files a/.gradle/buildOutputCleanup/buildOutputCleanup.lock and b/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ diff --git a/.gradle/file-system.probe b/.gradle/file-system.probe index 9848bf6e6f325606c86f6bb4984b73defa6aa40f..4ecf2fcf0eda6c2bd7b22ab6127cc614e366a7a7 100644 Binary files a/.gradle/file-system.probe and b/.gradle/file-system.probe differ diff --git a/build/classes/java/main/ByteGrayColor.class b/build/classes/java/main/ByteGrayColor.class index 126083fce5e53f408dad6b09d446c069ef7318d4..39eaff9280e6d1d02460283b0dcb447cdac940d4 100644 Binary files a/build/classes/java/main/ByteGrayColor.class and b/build/classes/java/main/ByteGrayColor.class differ diff --git a/build/classes/java/main/Display.class b/build/classes/java/main/Display.class index 110a55669800a2300474066767cecfb03d8e9da0..e9c86b389ac6510f760bbf93a43bbc944380f879 100644 Binary files a/build/classes/java/main/Display.class and b/build/classes/java/main/Display.class differ diff --git a/build/classes/java/main/GrayColor.class b/build/classes/java/main/GrayColor.class index f7fb828ba595eec50c7afb4b59a2e7a2cb79a6a7..13062a00e498c06e82f40228441d6129427776ac 100644 Binary files a/build/classes/java/main/GrayColor.class and b/build/classes/java/main/GrayColor.class differ diff --git a/build/classes/java/main/GrayImage.class b/build/classes/java/main/GrayImage.class index bdd9153d6c1bed3e57124d0740c4daf2614df92c..dc884e6254327473d95c0d431abcbd4f20b40a31 100644 Binary files a/build/classes/java/main/GrayImage.class and b/build/classes/java/main/GrayImage.class differ diff --git a/build/classes/java/main/Image.class b/build/classes/java/main/Image.class index fdb7630a7db7c4292605fce74d6fdc2e641a8471..29ecc16a6b59e6d0c8c1281de4b9c13c7791969f 100644 Binary files a/build/classes/java/main/Image.class and b/build/classes/java/main/Image.class differ diff --git a/build/classes/java/main/Main.class b/build/classes/java/main/Main.class index be5ec1bd9cb66a8b9ab24610b987d9bc69cadce9..a5a0df4b3cf06a7c754ddc0dcfb84a0aea8457b4 100644 Binary files a/build/classes/java/main/Main.class and b/build/classes/java/main/Main.class differ diff --git a/build/classes/java/main/MatrixGrayImage.class b/build/classes/java/main/MatrixGrayImage.class index da6c0593fafc6cd615525ba67c5bedf93cc07000..088b833f614d319e600a5b107d28b6221a265bf1 100644 Binary files a/build/classes/java/main/MatrixGrayImage.class and b/build/classes/java/main/MatrixGrayImage.class differ diff --git a/build/classes/java/test/ByteGrayColorTest.class b/build/classes/java/test/ByteGrayColorTest.class index 7556924d6bc34420123ce8d612d06fd1f04287b6..6802794cc34e23aef8aeb46d23fbbce83cdd55e9 100644 Binary files a/build/classes/java/test/ByteGrayColorTest.class and b/build/classes/java/test/ByteGrayColorTest.class differ diff --git a/build/classes/java/test/MatrixGrayImageTest.class b/build/classes/java/test/MatrixGrayImageTest.class index b585a7502e445dd74c819447c9f0d3afe3fb3caa..d9afd2fe640e160c5ca56d09bfcacc63b3dee9e9 100644 Binary files a/build/classes/java/test/MatrixGrayImageTest.class and b/build/classes/java/test/MatrixGrayImageTest.class differ diff --git a/build/tmp/compileJava/compileTransaction/stash-dir/ByteGrayColor.class.uniqueId0 b/build/tmp/compileJava/compileTransaction/stash-dir/ByteGrayColor.class.uniqueId0 new file mode 100644 index 0000000000000000000000000000000000000000..f0c57570df32bb84561dea7513709fa2a995428c Binary files /dev/null and b/build/tmp/compileJava/compileTransaction/stash-dir/ByteGrayColor.class.uniqueId0 differ diff --git a/build/tmp/compileJava/compileTransaction/stash-dir/MatrixGrayImage.class.uniqueId1 b/build/tmp/compileJava/compileTransaction/stash-dir/MatrixGrayImage.class.uniqueId1 new file mode 100644 index 0000000000000000000000000000000000000000..088b833f614d319e600a5b107d28b6221a265bf1 Binary files /dev/null and b/build/tmp/compileJava/compileTransaction/stash-dir/MatrixGrayImage.class.uniqueId1 differ diff --git a/build/tmp/compileJava/previous-compilation-data.bin b/build/tmp/compileJava/previous-compilation-data.bin index 8110babfc9e7bf411fbd952a1f90934cfb8c21d2..07cfb6a09c5fd32b68e8181006ad3ddc4eca79d5 100644 Binary files a/build/tmp/compileJava/previous-compilation-data.bin and b/build/tmp/compileJava/previous-compilation-data.bin differ diff --git a/build/tmp/compileTestJava/compileTransaction/stash-dir/ByteGrayColorTest.class.uniqueId0 b/build/tmp/compileTestJava/compileTransaction/stash-dir/ByteGrayColorTest.class.uniqueId0 new file mode 100644 index 0000000000000000000000000000000000000000..de13ef7b15dff4a05842f80cdd48f9a894f03547 Binary files /dev/null and b/build/tmp/compileTestJava/compileTransaction/stash-dir/ByteGrayColorTest.class.uniqueId0 differ diff --git a/build/tmp/compileTestJava/compileTransaction/stash-dir/MatrixGrayImageTest.class.uniqueId1 b/build/tmp/compileTestJava/compileTransaction/stash-dir/MatrixGrayImageTest.class.uniqueId1 new file mode 100644 index 0000000000000000000000000000000000000000..d9afd2fe640e160c5ca56d09bfcacc63b3dee9e9 Binary files /dev/null and b/build/tmp/compileTestJava/compileTransaction/stash-dir/MatrixGrayImageTest.class.uniqueId1 differ diff --git a/build/tmp/compileTestJava/previous-compilation-data.bin b/build/tmp/compileTestJava/previous-compilation-data.bin index e32845ff307bac0bf5db4077b0c64ea0cc259a22..74887d5d8df6645dc54d411c80580d4d4d62f8d2 100644 Binary files a/build/tmp/compileTestJava/previous-compilation-data.bin and b/build/tmp/compileTestJava/previous-compilation-data.bin differ diff --git a/src/main/java/ByteGrayColor.java b/src/main/java/ByteGrayColor.java index c3e784b77e7ca29d6f935511a4edeb930551d765..c1dc9e68eab895f3057e79febd5e2f26a274c0dd 100644 --- a/src/main/java/ByteGrayColor.java +++ b/src/main/java/ByteGrayColor.java @@ -10,7 +10,8 @@ public class ByteGrayColor implements GrayColor { private static final int MAXIMUM_GRAY_LEVEL = 255; private static final int OPACITY = 1; - // TODO : add static ByteGrayColors WHITE and BLACK + public static final ByteGrayColor BLACK = new ByteGrayColor(MAXIMUM_GRAY_LEVEL); + public static final ByteGrayColor WHITE = new ByteGrayColor(MINIMUM_GRAY_LEVEL); private final int grayLevel; @@ -20,19 +21,17 @@ public class ByteGrayColor implements GrayColor { } public ByteGrayColor(int grayLevel) { - // TODO : Corriger l'initialisation de la propriété grayLevel de l'instance. - this.grayLevel = 0; + this.grayLevel = grayLevel; } public ByteGrayColor(double luminosity) { - // TODO : Corriger l'initialisation de la propriété grayLevel de l'instance. - this.grayLevel = 0; + this.grayLevel = (int) (luminosity * MAXIMUM_GRAY_LEVEL); } + @Override public double getLuminosity() { - // TODO : Retourner la luminosité de la couleur (entre 0 noir et 1 blanc) - return 0; + return this.grayLevel / (double) MAXIMUM_GRAY_LEVEL; } @Override @@ -44,8 +43,7 @@ public class ByteGrayColor implements GrayColor { @Override public int compareTo(GrayColor o) { - // TODO : Retourner la différence de niveau de gris. - return 0; + return Double.compare(this.getLuminosity(), o.getLuminosity()); } @Override diff --git a/src/test/java/ByteGrayColorTest.java b/src/test/java/ByteGrayColorTest.java index 673439d65e012beea036d99e7d44ec29c712e0d6..b84e655dce59cb5917852f0809e612ac98ac74cc 100644 --- a/src/test/java/ByteGrayColorTest.java +++ b/src/test/java/ByteGrayColorTest.java @@ -5,7 +5,6 @@ import static org.assertj.core.api.Assertions.*; public class ByteGrayColorTest { @Test - @Disabled public void testGetLuminosity_whenColorCreatedWithGrayLevel(){ ByteGrayColor black = new ByteGrayColor(0); ByteGrayColor white = new ByteGrayColor(255); @@ -14,7 +13,6 @@ public class ByteGrayColorTest { } @Test - @Disabled public void testGetLuminosity_whenColorCreatedWithLuminosity(){ ByteGrayColor color1 = new ByteGrayColor(.25); ByteGrayColor color2 = new ByteGrayColor(.75); @@ -23,7 +21,6 @@ public class ByteGrayColorTest { } @Test - @Disabled public void testCompareTo_whenColorsCreatedWithGrayLevel(){ ByteGrayColor color1 = new ByteGrayColor(100); ByteGrayColor color2 = new ByteGrayColor(150); @@ -38,7 +35,6 @@ public class ByteGrayColorTest { } @Test - @Disabled public void testCompareTo_whenColorsCreatedWithLuminosity(){ ByteGrayColor color1 = new ByteGrayColor(0.20); ByteGrayColor color2 = new ByteGrayColor(0.60); @@ -53,7 +49,6 @@ public class ByteGrayColorTest { } @Test - @Disabled public void testCompareTo_whenColorsCreatedWithLuminosityAndGrayLevel(){ ByteGrayColor color1 = new ByteGrayColor(0.); ByteGrayColor color2 = new ByteGrayColor(150);