ColorRGB a = new ColorRGB(0,0,0); ColorRGB b = a; a.r = 255;
/** * Gets the ImageJ {@link ColorRGB} corresponding to the given AWT * {@link Color}. * * @param color {@link Color} to be translated * @return the corresponding ImageJ RGB color */ public static ColorRGB getColorRGB(final Color color) { if (color == null) return null; return new ColorRGB(color.getRed(), color.getGreen(), color.getBlue()); }
final int green = Integer.parseInt(hexColor.substring(3, 5), 16); final int blue = Integer.parseInt(hexColor.substring(5, 7), 16); return new ColorRGB(red, green, blue);
final int green = Integer.parseInt(hexColor.substring(3, 5), 16); final int blue = Integer.parseInt(hexColor.substring(5, 7), 16); return new ColorRGB(red, green, blue);
final int b255 = (int) Math.round(b01 * 255); return new ColorRGB(r255, g255, b255);
final int b255 = (int) Math.round(b01 * 255); return new ColorRGB(r255, g255, b255);
final int g = Integer.parseInt(colorMatcher.group(2)); final int b = Integer.parseInt(colorMatcher.group(3)); textColor = new ColorRGB(r, g, b);
@Override public void load() { super.load(); fgValues = decode(fgValuesString); bgValues = decode(bgValuesString); int r,g,b; r = Prefs.getInt(getClass(), LAST_FG_RED, 255); g = Prefs.getInt(getClass(), LAST_FG_GREEN, 255); b = Prefs.getInt(getClass(), LAST_FG_BLUE, 255); lastFgColor = new ColorRGB(r,g,b); r = Prefs.getInt(getClass(), LAST_BG_RED, 0); g = Prefs.getInt(getClass(), LAST_BG_GREEN, 0); b = Prefs.getInt(getClass(), LAST_BG_BLUE, 0); lastBgColor = new ColorRGB(r,g,b); }
@Test public void testGetARGB() { assertEquals(255 * 256 * 256 * 256 + 256 * 256 + 2 * 256 + 3, new ColorRGB(1, 2, 3).getARGB()); }
@Test public void testToString() { assertEquals("1,2,3", new ColorRGB("1,2,3").toString()); }
@Test public void testGetAlpha() { assertEquals(255, new ColorRGB(1, 2, 3).getAlpha()); }
return new ColorRGB(r, g, b);