From 359dc891733f904774c40cd194968b2d155d6b1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?SAEZ=20Th=C3=A9o?= <theo.saez@etu.univ-amu.fr> Date: Wed, 21 May 2025 18:10:42 +0200 Subject: [PATCH] =?UTF-8?q?Ajout=20de=20la=20m=C3=A9thode=20invert=20?= =?UTF-8?q?=C3=A0=20la=20classe=20ByteGrayColor=20pour=20inverser=20les=20?= =?UTF-8?q?niveaux=20de=20gris?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/ByteGrayColor.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/ByteGrayColor.java b/src/main/java/ByteGrayColor.java index c1dc9e6..da536f0 100644 --- a/src/main/java/ByteGrayColor.java +++ b/src/main/java/ByteGrayColor.java @@ -40,12 +40,16 @@ public class ByteGrayColor implements GrayColor { return new Color(component, component, component, OPACITY); } - @Override public int compareTo(GrayColor o) { return Double.compare(this.getLuminosity(), o.getLuminosity()); } + @Override + public GrayColor invert() { + return new ByteGrayColor(MAXIMUM_GRAY_LEVEL - this.grayLevel); + } + @Override public boolean equals(Object o) { if (this == o) return true; -- GitLab