java.awt.color.ColorSpace#fromCIEXYZ ( )源码实例Demo

下面列出了java.awt.color.ColorSpace#fromCIEXYZ ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: hottub   文件: Color.java
/**
 * Returns a <code>float</code> array containing only the color
 * components of the <code>Color</code> in the
 * <code>ColorSpace</code> specified by the <code>cspace</code>
 * parameter. If <code>compArray</code> is <code>null</code>, an array
 * with length equal to the number of components in
 * <code>cspace</code> is created for the return value.  Otherwise,
 * <code>compArray</code> must have at least this length, and it is
 * filled in with the components and returned.
 * @param cspace a specified <code>ColorSpace</code>
 * @param compArray an array that this method fills with the color
 *          components of this <code>Color</code> in the specified
 *          <code>ColorSpace</code>
 * @return the color components in a <code>float</code> array.
 */
public float[] getColorComponents(ColorSpace cspace, float[] compArray) {
    if (cs == null) {
        cs = ColorSpace.getInstance(ColorSpace.CS_sRGB);
    }
    float f[];
    if (fvalue == null) {
        f = new float[3];
        f[0] = ((float)getRed())/255f;
        f[1] = ((float)getGreen())/255f;
        f[2] = ((float)getBlue())/255f;
    } else {
        f = fvalue;
    }
    float tmp[] = cs.toCIEXYZ(f);
    float tmpout[] = cspace.fromCIEXYZ(tmp);
    if (compArray == null) {
        return tmpout;
    }
    for (int i = 0 ; i < tmpout.length ; i++) {
        compArray[i] = tmpout[i];
    }
    return compArray;
}
 
源代码2 项目: TencentKona-8   文件: Color.java
/**
 * Returns a <code>float</code> array containing only the color
 * components of the <code>Color</code> in the
 * <code>ColorSpace</code> specified by the <code>cspace</code>
 * parameter. If <code>compArray</code> is <code>null</code>, an array
 * with length equal to the number of components in
 * <code>cspace</code> is created for the return value.  Otherwise,
 * <code>compArray</code> must have at least this length, and it is
 * filled in with the components and returned.
 * @param cspace a specified <code>ColorSpace</code>
 * @param compArray an array that this method fills with the color
 *          components of this <code>Color</code> in the specified
 *          <code>ColorSpace</code>
 * @return the color components in a <code>float</code> array.
 */
public float[] getColorComponents(ColorSpace cspace, float[] compArray) {
    if (cs == null) {
        cs = ColorSpace.getInstance(ColorSpace.CS_sRGB);
    }
    float f[];
    if (fvalue == null) {
        f = new float[3];
        f[0] = ((float)getRed())/255f;
        f[1] = ((float)getGreen())/255f;
        f[2] = ((float)getBlue())/255f;
    } else {
        f = fvalue;
    }
    float tmp[] = cs.toCIEXYZ(f);
    float tmpout[] = cspace.fromCIEXYZ(tmp);
    if (compArray == null) {
        return tmpout;
    }
    for (int i = 0 ; i < tmpout.length ; i++) {
        compArray[i] = tmpout[i];
    }
    return compArray;
}
 
源代码3 项目: openjdk-jdk9   文件: Color.java
/**
 * Returns a {@code float} array containing only the color
 * components of the {@code Color} in the
 * {@code ColorSpace} specified by the {@code cspace}
 * parameter. If {@code compArray} is {@code null}, an array
 * with length equal to the number of components in
 * {@code cspace} is created for the return value.  Otherwise,
 * {@code compArray} must have at least this length, and it is
 * filled in with the components and returned.
 * @param cspace a specified {@code ColorSpace}
 * @param compArray an array that this method fills with the color
 *          components of this {@code Color} in the specified
 *          {@code ColorSpace}
 * @return the color components in a {@code float} array.
 */
public float[] getColorComponents(ColorSpace cspace, float[] compArray) {
    if (cs == null) {
        cs = ColorSpace.getInstance(ColorSpace.CS_sRGB);
    }
    float f[];
    if (fvalue == null) {
        f = new float[3];
        f[0] = ((float)getRed())/255f;
        f[1] = ((float)getGreen())/255f;
        f[2] = ((float)getBlue())/255f;
    } else {
        f = fvalue;
    }
    float tmp[] = cs.toCIEXYZ(f);
    float tmpout[] = cspace.fromCIEXYZ(tmp);
    if (compArray == null) {
        return tmpout;
    }
    for (int i = 0 ; i < tmpout.length ; i++) {
        compArray[i] = tmpout[i];
    }
    return compArray;
}
 
源代码4 项目: JDKSourceCode1.8   文件: Color.java
/**
 * Returns a <code>float</code> array containing only the color
 * components of the <code>Color</code> in the
 * <code>ColorSpace</code> specified by the <code>cspace</code>
 * parameter. If <code>compArray</code> is <code>null</code>, an array
 * with length equal to the number of components in
 * <code>cspace</code> is created for the return value.  Otherwise,
 * <code>compArray</code> must have at least this length, and it is
 * filled in with the components and returned.
 * @param cspace a specified <code>ColorSpace</code>
 * @param compArray an array that this method fills with the color
 *          components of this <code>Color</code> in the specified
 *          <code>ColorSpace</code>
 * @return the color components in a <code>float</code> array.
 */
public float[] getColorComponents(ColorSpace cspace, float[] compArray) {
    if (cs == null) {
        cs = ColorSpace.getInstance(ColorSpace.CS_sRGB);
    }
    float f[];
    if (fvalue == null) {
        f = new float[3];
        f[0] = ((float)getRed())/255f;
        f[1] = ((float)getGreen())/255f;
        f[2] = ((float)getBlue())/255f;
    } else {
        f = fvalue;
    }
    float tmp[] = cs.toCIEXYZ(f);
    float tmpout[] = cspace.fromCIEXYZ(tmp);
    if (compArray == null) {
        return tmpout;
    }
    for (int i = 0 ; i < tmpout.length ; i++) {
        compArray[i] = tmpout[i];
    }
    return compArray;
}
 
源代码5 项目: openjdk-8   文件: Color.java
/**
 * Returns a <code>float</code> array containing only the color
 * components of the <code>Color</code> in the
 * <code>ColorSpace</code> specified by the <code>cspace</code>
 * parameter. If <code>compArray</code> is <code>null</code>, an array
 * with length equal to the number of components in
 * <code>cspace</code> is created for the return value.  Otherwise,
 * <code>compArray</code> must have at least this length, and it is
 * filled in with the components and returned.
 * @param cspace a specified <code>ColorSpace</code>
 * @param compArray an array that this method fills with the color
 *          components of this <code>Color</code> in the specified
 *          <code>ColorSpace</code>
 * @return the color components in a <code>float</code> array.
 */
public float[] getColorComponents(ColorSpace cspace, float[] compArray) {
    if (cs == null) {
        cs = ColorSpace.getInstance(ColorSpace.CS_sRGB);
    }
    float f[];
    if (fvalue == null) {
        f = new float[3];
        f[0] = ((float)getRed())/255f;
        f[1] = ((float)getGreen())/255f;
        f[2] = ((float)getBlue())/255f;
    } else {
        f = fvalue;
    }
    float tmp[] = cs.toCIEXYZ(f);
    float tmpout[] = cspace.fromCIEXYZ(tmp);
    if (compArray == null) {
        return tmpout;
    }
    for (int i = 0 ; i < tmpout.length ; i++) {
        compArray[i] = tmpout[i];
    }
    return compArray;
}
 
源代码6 项目: openjdk-jdk8u-backup   文件: Color.java
/**
 * Returns a <code>float</code> array containing only the color
 * components of the <code>Color</code> in the
 * <code>ColorSpace</code> specified by the <code>cspace</code>
 * parameter. If <code>compArray</code> is <code>null</code>, an array
 * with length equal to the number of components in
 * <code>cspace</code> is created for the return value.  Otherwise,
 * <code>compArray</code> must have at least this length, and it is
 * filled in with the components and returned.
 * @param cspace a specified <code>ColorSpace</code>
 * @param compArray an array that this method fills with the color
 *          components of this <code>Color</code> in the specified
 *          <code>ColorSpace</code>
 * @return the color components in a <code>float</code> array.
 */
public float[] getColorComponents(ColorSpace cspace, float[] compArray) {
    if (cs == null) {
        cs = ColorSpace.getInstance(ColorSpace.CS_sRGB);
    }
    float f[];
    if (fvalue == null) {
        f = new float[3];
        f[0] = ((float)getRed())/255f;
        f[1] = ((float)getGreen())/255f;
        f[2] = ((float)getBlue())/255f;
    } else {
        f = fvalue;
    }
    float tmp[] = cs.toCIEXYZ(f);
    float tmpout[] = cspace.fromCIEXYZ(tmp);
    if (compArray == null) {
        return tmpout;
    }
    for (int i = 0 ; i < tmpout.length ; i++) {
        compArray[i] = tmpout[i];
    }
    return compArray;
}
 
源代码7 项目: jdk8u-dev-jdk   文件: Color.java
/**
 * Returns a <code>float</code> array containing only the color
 * components of the <code>Color</code> in the
 * <code>ColorSpace</code> specified by the <code>cspace</code>
 * parameter. If <code>compArray</code> is <code>null</code>, an array
 * with length equal to the number of components in
 * <code>cspace</code> is created for the return value.  Otherwise,
 * <code>compArray</code> must have at least this length, and it is
 * filled in with the components and returned.
 * @param cspace a specified <code>ColorSpace</code>
 * @param compArray an array that this method fills with the color
 *          components of this <code>Color</code> in the specified
 *          <code>ColorSpace</code>
 * @return the color components in a <code>float</code> array.
 */
public float[] getColorComponents(ColorSpace cspace, float[] compArray) {
    if (cs == null) {
        cs = ColorSpace.getInstance(ColorSpace.CS_sRGB);
    }
    float f[];
    if (fvalue == null) {
        f = new float[3];
        f[0] = ((float)getRed())/255f;
        f[1] = ((float)getGreen())/255f;
        f[2] = ((float)getBlue())/255f;
    } else {
        f = fvalue;
    }
    float tmp[] = cs.toCIEXYZ(f);
    float tmpout[] = cspace.fromCIEXYZ(tmp);
    if (compArray == null) {
        return tmpout;
    }
    for (int i = 0 ; i < tmpout.length ; i++) {
        compArray[i] = tmpout[i];
    }
    return compArray;
}
 
源代码8 项目: openjdk-jdk8u   文件: Color.java
/**
 * Returns a <code>float</code> array containing only the color
 * components of the <code>Color</code> in the
 * <code>ColorSpace</code> specified by the <code>cspace</code>
 * parameter. If <code>compArray</code> is <code>null</code>, an array
 * with length equal to the number of components in
 * <code>cspace</code> is created for the return value.  Otherwise,
 * <code>compArray</code> must have at least this length, and it is
 * filled in with the components and returned.
 * @param cspace a specified <code>ColorSpace</code>
 * @param compArray an array that this method fills with the color
 *          components of this <code>Color</code> in the specified
 *          <code>ColorSpace</code>
 * @return the color components in a <code>float</code> array.
 */
public float[] getColorComponents(ColorSpace cspace, float[] compArray) {
    if (cs == null) {
        cs = ColorSpace.getInstance(ColorSpace.CS_sRGB);
    }
    float f[];
    if (fvalue == null) {
        f = new float[3];
        f[0] = ((float)getRed())/255f;
        f[1] = ((float)getGreen())/255f;
        f[2] = ((float)getBlue())/255f;
    } else {
        f = fvalue;
    }
    float tmp[] = cs.toCIEXYZ(f);
    float tmpout[] = cspace.fromCIEXYZ(tmp);
    if (compArray == null) {
        return tmpout;
    }
    for (int i = 0 ; i < tmpout.length ; i++) {
        compArray[i] = tmpout[i];
    }
    return compArray;
}
 
源代码9 项目: openjdk-8-source   文件: DataConversionTests.java
public void runTest(Object ctx, int numReps) {
    final Context ictx = (Context) ctx;
    final ColorSpace cs = ictx.cs;

    final float[] val = ictx.cie;
    do {
        try {
            cs.fromCIEXYZ(val);
        } catch (Exception e) {
            e.printStackTrace();
        }
    } while (--numReps >= 0);
}
 
源代码10 项目: openjdk-jdk9   文件: Color.java
/**
 * Returns a {@code float} array containing the color and alpha
 * components of the {@code Color}, in the
 * {@code ColorSpace} specified by the {@code cspace}
 * parameter.  If {@code compArray} is {@code null}, an
 * array with length equal to the number of components in
 * {@code cspace} plus one is created for the return value.
 * Otherwise, {@code compArray} must have at least this
 * length, and it is filled in with the components and returned.
 * @param cspace a specified {@code ColorSpace}
 * @param compArray an array that this method fills with the
 *          color and alpha components of this {@code Color} in
 *          the specified {@code ColorSpace} and returns
 * @return the color and alpha components in a {@code float}
 *          array.
 */
public float[] getComponents(ColorSpace cspace, float[] compArray) {
    if (cs == null) {
        cs = ColorSpace.getInstance(ColorSpace.CS_sRGB);
    }
    float f[];
    if (fvalue == null) {
        f = new float[3];
        f[0] = ((float)getRed())/255f;
        f[1] = ((float)getGreen())/255f;
        f[2] = ((float)getBlue())/255f;
    } else {
        f = fvalue;
    }
    float tmp[] = cs.toCIEXYZ(f);
    float tmpout[] = cspace.fromCIEXYZ(tmp);
    if (compArray == null) {
        compArray = new float[tmpout.length + 1];
    }
    for (int i = 0 ; i < tmpout.length ; i++) {
        compArray[i] = tmpout[i];
    }
    if (fvalue == null) {
        compArray[tmpout.length] = ((float)getAlpha())/255f;
    } else {
        compArray[tmpout.length] = falpha;
    }
    return compArray;
}
 
源代码11 项目: Java8CN   文件: Color.java
/**
 * Returns a <code>float</code> array containing the color and alpha
 * components of the <code>Color</code>, in the
 * <code>ColorSpace</code> specified by the <code>cspace</code>
 * parameter.  If <code>compArray</code> is <code>null</code>, an
 * array with length equal to the number of components in
 * <code>cspace</code> plus one is created for the return value.
 * Otherwise, <code>compArray</code> must have at least this
 * length, and it is filled in with the components and returned.
 * @param cspace a specified <code>ColorSpace</code>
 * @param compArray an array that this method fills with the
 *          color and alpha components of this <code>Color</code> in
 *          the specified <code>ColorSpace</code> and returns
 * @return the color and alpha components in a <code>float</code>
 *          array.
 */
public float[] getComponents(ColorSpace cspace, float[] compArray) {
    if (cs == null) {
        cs = ColorSpace.getInstance(ColorSpace.CS_sRGB);
    }
    float f[];
    if (fvalue == null) {
        f = new float[3];
        f[0] = ((float)getRed())/255f;
        f[1] = ((float)getGreen())/255f;
        f[2] = ((float)getBlue())/255f;
    } else {
        f = fvalue;
    }
    float tmp[] = cs.toCIEXYZ(f);
    float tmpout[] = cspace.fromCIEXYZ(tmp);
    if (compArray == null) {
        compArray = new float[tmpout.length + 1];
    }
    for (int i = 0 ; i < tmpout.length ; i++) {
        compArray[i] = tmpout[i];
    }
    if (fvalue == null) {
        compArray[tmpout.length] = ((float)getAlpha())/255f;
    } else {
        compArray[tmpout.length] = falpha;
    }
    return compArray;
}
 
源代码12 项目: jdk8u-jdk   文件: Color.java
/**
 * Returns a <code>float</code> array containing the color and alpha
 * components of the <code>Color</code>, in the
 * <code>ColorSpace</code> specified by the <code>cspace</code>
 * parameter.  If <code>compArray</code> is <code>null</code>, an
 * array with length equal to the number of components in
 * <code>cspace</code> plus one is created for the return value.
 * Otherwise, <code>compArray</code> must have at least this
 * length, and it is filled in with the components and returned.
 * @param cspace a specified <code>ColorSpace</code>
 * @param compArray an array that this method fills with the
 *          color and alpha components of this <code>Color</code> in
 *          the specified <code>ColorSpace</code> and returns
 * @return the color and alpha components in a <code>float</code>
 *          array.
 */
public float[] getComponents(ColorSpace cspace, float[] compArray) {
    if (cs == null) {
        cs = ColorSpace.getInstance(ColorSpace.CS_sRGB);
    }
    float f[];
    if (fvalue == null) {
        f = new float[3];
        f[0] = ((float)getRed())/255f;
        f[1] = ((float)getGreen())/255f;
        f[2] = ((float)getBlue())/255f;
    } else {
        f = fvalue;
    }
    float tmp[] = cs.toCIEXYZ(f);
    float tmpout[] = cspace.fromCIEXYZ(tmp);
    if (compArray == null) {
        compArray = new float[tmpout.length + 1];
    }
    for (int i = 0 ; i < tmpout.length ; i++) {
        compArray[i] = tmpout[i];
    }
    if (fvalue == null) {
        compArray[tmpout.length] = ((float)getAlpha())/255f;
    } else {
        compArray[tmpout.length] = falpha;
    }
    return compArray;
}
 
源代码13 项目: openjdk-8   文件: Color.java
/**
 * Returns a <code>float</code> array containing the color and alpha
 * components of the <code>Color</code>, in the
 * <code>ColorSpace</code> specified by the <code>cspace</code>
 * parameter.  If <code>compArray</code> is <code>null</code>, an
 * array with length equal to the number of components in
 * <code>cspace</code> plus one is created for the return value.
 * Otherwise, <code>compArray</code> must have at least this
 * length, and it is filled in with the components and returned.
 * @param cspace a specified <code>ColorSpace</code>
 * @param compArray an array that this method fills with the
 *          color and alpha components of this <code>Color</code> in
 *          the specified <code>ColorSpace</code> and returns
 * @return the color and alpha components in a <code>float</code>
 *          array.
 */
public float[] getComponents(ColorSpace cspace, float[] compArray) {
    if (cs == null) {
        cs = ColorSpace.getInstance(ColorSpace.CS_sRGB);
    }
    float f[];
    if (fvalue == null) {
        f = new float[3];
        f[0] = ((float)getRed())/255f;
        f[1] = ((float)getGreen())/255f;
        f[2] = ((float)getBlue())/255f;
    } else {
        f = fvalue;
    }
    float tmp[] = cs.toCIEXYZ(f);
    float tmpout[] = cspace.fromCIEXYZ(tmp);
    if (compArray == null) {
        compArray = new float[tmpout.length + 1];
    }
    for (int i = 0 ; i < tmpout.length ; i++) {
        compArray[i] = tmpout[i];
    }
    if (fvalue == null) {
        compArray[tmpout.length] = ((float)getAlpha())/255f;
    } else {
        compArray[tmpout.length] = falpha;
    }
    return compArray;
}
 
源代码14 项目: jdk8u60   文件: DataConversionTests.java
public void runTest(Object ctx, int numReps) {
    final Context ictx = (Context) ctx;
    final ColorSpace cs = ictx.cs;

    final float[] val = ictx.cie;
    do {
        try {
            cs.fromCIEXYZ(val);
        } catch (Exception e) {
            e.printStackTrace();
        }
    } while (--numReps >= 0);
}
 
源代码15 项目: jdk8u_jdk   文件: DataConversionTests.java
public void runTest(Object ctx, int numReps) {
    final Context ictx = (Context) ctx;
    final ColorSpace cs = ictx.cs;

    final float[] val = ictx.cie;
    do {
        try {
            cs.fromCIEXYZ(val);
        } catch (Exception e) {
            e.printStackTrace();
        }
    } while (--numReps >= 0);
}
 
源代码16 项目: openjdk-jdk8u-backup   文件: Color.java
/**
 * Returns a <code>float</code> array containing the color and alpha
 * components of the <code>Color</code>, in the
 * <code>ColorSpace</code> specified by the <code>cspace</code>
 * parameter.  If <code>compArray</code> is <code>null</code>, an
 * array with length equal to the number of components in
 * <code>cspace</code> plus one is created for the return value.
 * Otherwise, <code>compArray</code> must have at least this
 * length, and it is filled in with the components and returned.
 * @param cspace a specified <code>ColorSpace</code>
 * @param compArray an array that this method fills with the
 *          color and alpha components of this <code>Color</code> in
 *          the specified <code>ColorSpace</code> and returns
 * @return the color and alpha components in a <code>float</code>
 *          array.
 */
public float[] getComponents(ColorSpace cspace, float[] compArray) {
    if (cs == null) {
        cs = ColorSpace.getInstance(ColorSpace.CS_sRGB);
    }
    float f[];
    if (fvalue == null) {
        f = new float[3];
        f[0] = ((float)getRed())/255f;
        f[1] = ((float)getGreen())/255f;
        f[2] = ((float)getBlue())/255f;
    } else {
        f = fvalue;
    }
    float tmp[] = cs.toCIEXYZ(f);
    float tmpout[] = cspace.fromCIEXYZ(tmp);
    if (compArray == null) {
        compArray = new float[tmpout.length + 1];
    }
    for (int i = 0 ; i < tmpout.length ; i++) {
        compArray[i] = tmpout[i];
    }
    if (fvalue == null) {
        compArray[tmpout.length] = ((float)getAlpha())/255f;
    } else {
        compArray[tmpout.length] = falpha;
    }
    return compArray;
}
 
源代码17 项目: MyBox   文件: ColorConversion.java
public static float[] toSRGB(int colorSpace, float[] rgb) {
    ColorSpace cs = ColorSpace.getInstance(colorSpace);
    float[] xyz = cs.toCIEXYZ(rgb);
    cs = ColorSpace.getInstance(ColorSpace.CS_sRGB);
    float[] srgb = cs.fromCIEXYZ(xyz);
    return srgb;
}
 
源代码18 项目: jdk8u-jdk   文件: DataConversionTests.java
public void runTest(Object ctx, int numReps) {
    final Context ictx = (Context) ctx;
    final ColorSpace cs = ictx.cs;

    final float[] val = ictx.cie;
    do {
        try {
            cs.fromCIEXYZ(val);
        } catch (Exception e) {
            e.printStackTrace();
        }
    } while (--numReps >= 0);
}
 
源代码19 项目: sambox   文件: PDDeviceCMYK.java
@Override
protected BufferedImage toRGBImageAWT(WritableRaster raster, ColorSpace colorSpace)
{
    if (usePureJavaCMYKConversion)
    {
        BufferedImage dest = new BufferedImage(raster.getWidth(), raster.getHeight(),
                BufferedImage.TYPE_INT_RGB);
        ColorSpace destCS = dest.getColorModel().getColorSpace();
        WritableRaster destRaster = dest.getRaster();
        float[] srcValues = new float[4];
        float[] lastValues = new float[] { -1.0f, -1.0f, -1.0f, -1.0f };
        float[] destValues = new float[3];
        int width = raster.getWidth();
        int startX = raster.getMinX();
        int height = raster.getHeight();
        int startY = raster.getMinY();
        for (int x = startX; x < width + startX; x++)
        {
            for (int y = startY; y < height + startY; y++)
            {
                raster.getPixel(x, y, srcValues);
                // check if the last value can be reused
                if (!Arrays.equals(lastValues, srcValues))
                {
                    for (int k = 0; k < 4; k++)
                    {
                        lastValues[k] = srcValues[k];
                        srcValues[k] = srcValues[k] / 255f;
                    }
                    // use CIEXYZ as intermediate format to optimize the color conversion
                    destValues = destCS.fromCIEXYZ(colorSpace.toCIEXYZ(srcValues));
                    for (int k = 0; k < destValues.length; k++)
                    {
                        destValues[k] = destValues[k] * 255f;
                    }
                }
                destRaster.setPixel(x, y, destValues);
            }
        }
        return dest;
    }
    else
    {
        return super.toRGBImageAWT(raster, colorSpace);
    }
}
 
源代码20 项目: MyBox   文件: CIEData.java
public static double[] convert(ColorSpace cs, CIEData d) {
    double[] xyz = ColorBase.array(d.getRelativeX(), d.getRelativeY(), d.getRelativeZ());
    float[] fxyz = cs.fromCIEXYZ(ColorBase.arrayFloat(xyz));
    double[] outputs = clipRGB(arrayDouble(fxyz));
    return outputs;
}