本文整理汇总了Java中java.awt.color.ColorSpace.fromCIEXYZ方法的典型用法代码示例。如果您正苦于以下问题:Java ColorSpace.fromCIEXYZ方法的具体用法?Java ColorSpace.fromCIEXYZ怎么用?Java ColorSpace.fromCIEXYZ使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.color.ColorSpace
的用法示例。
在下文中一共展示了ColorSpace.fromCIEXYZ方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getColorComponents
import java.awt.color.ColorSpace; //导入方法依赖的package包/类
/**
* 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;
}
示例2: getColorComponents
import java.awt.color.ColorSpace; //导入方法依赖的package包/类
/**
* 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: runTest
import java.awt.color.ColorSpace; //导入方法依赖的package包/类
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);
}
示例4: getComponents
import java.awt.color.ColorSpace; //导入方法依赖的package包/类
/**
* 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;
}
示例5: getComponents
import java.awt.color.ColorSpace; //导入方法依赖的package包/类
/**
* 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;
}