X-Git-Url: http://www2.svjatoslav.eu/gitweb/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Feu%2Fsvjatoslav%2Fsixth%2Fe3d%2Frenderer%2Fraster%2FColor.java;h=0743cf07c6e30027c76ba4fb54cf64f82f4f6908;hb=894f2f20d7e88516bde7fb0d6db5cf6da91637a6;hp=125ef6e1bf6b7269f3f8ea54e2e192ee75df7639;hpb=6213716671ccab6b7256de41838e1f5401ce173c;p=sixth-3d.git diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/Color.java b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/Color.java index 125ef6e..0743cf0 100644 --- a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/Color.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/Color.java @@ -1,12 +1,7 @@ /* - * Sixth - System for data storage, computation, exploration and interaction. - * Copyright ©2012-2016, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 3 of the GNU Lesser General Public License - * or later as published by the Free Software Foundation. + * Sixth 3D engine. Author: Svjatoslav Agejenko. + * This project is released under Creative Commons Zero (CC0) license. */ - package eu.svjatoslav.sixth.e3d.renderer.raster; public final class Color { @@ -20,13 +15,25 @@ public final class Color { public static final Color PURPLE = new Color(255, 0, 255, 255); public static final Color TRANSPARENT = new Color(0, 0, 0, 0); - public final int r, g, b; + /** + * Red component. 0-255. + */ + public final int r; + + /** + * Green component. 0-255. + */ + public final int g; + + /** + * Blue component. 0-255. + */ + public final int b; /** - *
-     * 255 is opaque.
-     * 0 is transparent.
-     * 
+ * Alpha component. + * 0 - transparent. + * 255 - opaque. */ public int a; @@ -45,14 +52,14 @@ public final class Color { } /** - *
-     *     Supported formats are:
-     *
-     *     RGB
-     *     RGBA
-     *     RRGGBB
-     *     RRGGBBAA
-     * 
+ * @param colorHexCode color code in hex format. + * Supported formats are: + *
+     *                     RGB
+     *                     RGBA
+     *                     RRGGBB
+     *                     RRGGBBAA
+     *                     
*/ public Color(String colorHexCode) { switch (colorHexCode.length()) { @@ -135,4 +142,25 @@ public final class Color { return toAwtColor().getRGB(); } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + Color color = (Color) o; + + if (r != color.r) return false; + if (g != color.g) return false; + if (b != color.b) return false; + return a == color.a; + } + + @Override + public int hashCode() { + int result = r; + result = 31 * result + g; + result = 31 * result + b; + result = 31 * result + a; + return result; + } }