Java Code Examples for java.awt.color.ColorSpace#fromRGB()

The following examples show how to use java.awt.color.ColorSpace#fromRGB() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DataConversionTests.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
public void runTest(Object ctx, int numReps) {
    final Context ictx = (Context) ctx;
    final ColorSpace cs = ictx.cs;

    final float[] rgb = ictx.rgb;
    do {
        try {
            cs.fromRGB(rgb);
        } catch (Exception e) {
            e.printStackTrace();
        }
    } while (--numReps >= 0);
}
 
Example 2
Source File: DataConversionTests.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public void runTest(Object ctx, int numReps) {
    final Context ictx = (Context) ctx;
    final ColorSpace cs = ictx.cs;

    final float[] rgb = ictx.rgb;
    do {
        try {
            cs.fromRGB(rgb);
        } catch (Exception e) {
            e.printStackTrace();
        }
    } while (--numReps >= 0);
}
 
Example 3
Source File: DataConversionTests.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public void runTest(Object ctx, int numReps) {
    final Context ictx = (Context) ctx;
    final ColorSpace cs = ictx.cs;

    final float[] rgb = ictx.rgb;
    do {
        try {
            cs.fromRGB(rgb);
        } catch (Exception e) {
            e.printStackTrace();
        }
    } while (--numReps >= 0);
}
 
Example 4
Source File: DataConversionTests.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void runTest(Object ctx, int numReps) {
    final Context ictx = (Context) ctx;
    final ColorSpace cs = ictx.cs;

    final float[] rgb = ictx.rgb;
    do {
        try {
            cs.fromRGB(rgb);
        } catch (Exception e) {
            e.printStackTrace();
        }
    } while (--numReps >= 0);
}
 
Example 5
Source File: DataConversionTests.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public void runTest(Object ctx, int numReps) {
    final Context ictx = (Context) ctx;
    final ColorSpace cs = ictx.cs;

    final float[] rgb = ictx.rgb;
    do {
        try {
            cs.fromRGB(rgb);
        } catch (Exception e) {
            e.printStackTrace();
        }
    } while (--numReps >= 0);
}
 
Example 6
Source File: DataConversionTests.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void runTest(Object ctx, int numReps) {
    final Context ictx = (Context) ctx;
    final ColorSpace cs = ictx.cs;

    final float[] rgb = ictx.rgb;
    do {
        try {
            cs.fromRGB(rgb);
        } catch (Exception e) {
            e.printStackTrace();
        }
    } while (--numReps >= 0);
}
 
Example 7
Source File: DataConversionTests.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void runTest(Object ctx, int numReps) {
    final Context ictx = (Context) ctx;
    final ColorSpace cs = ictx.cs;

    final float[] rgb = ictx.rgb;
    do {
        try {
            cs.fromRGB(rgb);
        } catch (Exception e) {
            e.printStackTrace();
        }
    } while (--numReps >= 0);
}
 
Example 8
Source File: DataConversionTests.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public void runTest(Object ctx, int numReps) {
    final Context ictx = (Context) ctx;
    final ColorSpace cs = ictx.cs;

    final float[] rgb = ictx.rgb;
    do {
        try {
            cs.fromRGB(rgb);
        } catch (Exception e) {
            e.printStackTrace();
        }
    } while (--numReps >= 0);
}
 
Example 9
Source File: DataConversionTests.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public void runTest(Object ctx, int numReps) {
    final Context ictx = (Context) ctx;
    final ColorSpace cs = ictx.cs;

    final float[] rgb = ictx.rgb;
    do {
        try {
            cs.fromRGB(rgb);
        } catch (Exception e) {
            e.printStackTrace();
        }
    } while (--numReps >= 0);
}
 
Example 10
Source File: DataConversionTests.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public void runTest(Object ctx, int numReps) {
    final Context ictx = (Context) ctx;
    final ColorSpace cs = ictx.cs;

    final float[] rgb = ictx.rgb;
    do {
        try {
            cs.fromRGB(rgb);
        } catch (Exception e) {
            e.printStackTrace();
        }
    } while (--numReps >= 0);
}
 
Example 11
Source File: DataConversionTests.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
public void runTest(Object ctx, int numReps) {
    final Context ictx = (Context) ctx;
    final ColorSpace cs = ictx.cs;

    final float[] rgb = ictx.rgb;
    do {
        try {
            cs.fromRGB(rgb);
        } catch (Exception e) {
            e.printStackTrace();
        }
    } while (--numReps >= 0);
}
 
Example 12
Source File: DataConversionTests.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void runTest(Object ctx, int numReps) {
    final Context ictx = (Context) ctx;
    final ColorSpace cs = ictx.cs;

    final float[] rgb = ictx.rgb;
    do {
        try {
            cs.fromRGB(rgb);
        } catch (Exception e) {
            e.printStackTrace();
        }
    } while (--numReps >= 0);
}
 
Example 13
Source File: DataConversionTests.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void runTest(Object ctx, int numReps) {
    final Context ictx = (Context) ctx;
    final ColorSpace cs = ictx.cs;

    final float[] rgb = ictx.rgb;
    do {
        try {
            cs.fromRGB(rgb);
        } catch (Exception e) {
            e.printStackTrace();
        }
    } while (--numReps >= 0);
}
 
Example 14
Source File: HSVColorSpace.java    From biojava with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * @param hsv
 * @return
 * @see java.awt.color.ColorSpace#toCIEXYZ(float[])
 */
@Override
public float[] toCIEXYZ(float[] hsv) {
	float[] rgb = this.toRGB(hsv);
	ColorSpace CIEXYZcs = ColorSpace.getInstance(CS_CIEXYZ);
	return CIEXYZcs.fromRGB(rgb);
}
 
Example 15
Source File: RtfTransferableData.java    From consulo with Apache License 2.0 5 votes vote down vote up
private static int[] getAdjustedColorComponents(Color color) {
  if (SystemInfo.isMac) {
    // on Mac OS color components are expected in Apple's 'Generic RGB' color space
    ColorSpace genericRgbSpace = MacOSApplicationProvider.getInstance().getGenericRgbColorSpace();
    if (genericRgbSpace != null) {
      float[] components = genericRgbSpace.fromRGB(color.getRGBColorComponents(null));
      return new int[] {
              colorComponentFloatToInt(components[0]),
              colorComponentFloatToInt(components[1]),
              colorComponentFloatToInt(components[2])
      };
    }
  }
  return new int[] {color.getRed(), color.getGreen(), color.getBlue()};
}