本文整理汇总了Java中java.awt.image.ColorModel.getColorSpace方法的典型用法代码示例。如果您正苦于以下问题:Java ColorModel.getColorSpace方法的具体用法?Java ColorModel.getColorSpace怎么用?Java ColorModel.getColorSpace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.image.ColorModel
的用法示例。
在下文中一共展示了ColorModel.getColorSpace方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSrcCSType
import java.awt.image.ColorModel; //导入方法依赖的package包/类
private int getSrcCSType(ColorModel cm) {
int retval = JPEG.JCS_UNKNOWN;
if (cm != null) {
boolean alpha = cm.hasAlpha();
ColorSpace cs = cm.getColorSpace();
switch (cs.getType()) {
case ColorSpace.TYPE_GRAY:
retval = JPEG.JCS_GRAYSCALE;
break;
case ColorSpace.TYPE_RGB:
if (alpha) {
retval = JPEG.JCS_RGBA;
} else {
retval = JPEG.JCS_RGB;
}
break;
case ColorSpace.TYPE_YCbCr:
if (alpha) {
retval = JPEG.JCS_YCbCrA;
} else {
retval = JPEG.JCS_YCbCr;
}
break;
case ColorSpace.TYPE_3CLR:
if (cs == JPEG.JCS.getYCC()) {
if (alpha) {
retval = JPEG.JCS_YCCA;
} else {
retval = JPEG.JCS_YCC;
}
}
case ColorSpace.TYPE_CMYK:
retval = JPEG.JCS_CMYK;
break;
}
}
return retval;
}
示例2: getDestCSType
import java.awt.image.ColorModel; //导入方法依赖的package包/类
private int getDestCSType(ImageTypeSpecifier destType) {
ColorModel cm = destType.getColorModel();
boolean alpha = cm.hasAlpha();
ColorSpace cs = cm.getColorSpace();
int retval = JPEG.JCS_UNKNOWN;
switch (cs.getType()) {
case ColorSpace.TYPE_GRAY:
retval = JPEG.JCS_GRAYSCALE;
break;
case ColorSpace.TYPE_RGB:
if (alpha) {
retval = JPEG.JCS_RGBA;
} else {
retval = JPEG.JCS_RGB;
}
break;
case ColorSpace.TYPE_YCbCr:
if (alpha) {
retval = JPEG.JCS_YCbCrA;
} else {
retval = JPEG.JCS_YCbCr;
}
break;
case ColorSpace.TYPE_3CLR:
if (cs == JPEG.JCS.getYCC()) {
if (alpha) {
retval = JPEG.JCS_YCCA;
} else {
retval = JPEG.JCS_YCC;
}
}
case ColorSpace.TYPE_CMYK:
retval = JPEG.JCS_CMYK;
break;
}
return retval;
}
示例3: getDefaultDestCSType
import java.awt.image.ColorModel; //导入方法依赖的package包/类
private int getDefaultDestCSType(ColorModel cm) {
int retval = JPEG.JCS_UNKNOWN;
if (cm != null) {
boolean alpha = cm.hasAlpha();
ColorSpace cs = cm.getColorSpace();
switch (cs.getType()) {
case ColorSpace.TYPE_GRAY:
retval = JPEG.JCS_GRAYSCALE;
break;
case ColorSpace.TYPE_RGB:
if (alpha) {
retval = JPEG.JCS_YCbCrA;
} else {
retval = JPEG.JCS_YCbCr;
}
break;
case ColorSpace.TYPE_YCbCr:
if (alpha) {
retval = JPEG.JCS_YCbCrA;
} else {
retval = JPEG.JCS_YCbCr;
}
break;
case ColorSpace.TYPE_3CLR:
if (cs == JPEG.JCS.getYCC()) {
if (alpha) {
retval = JPEG.JCS_YCCA;
} else {
retval = JPEG.JCS_YCC;
}
}
case ColorSpace.TYPE_CMYK:
retval = JPEG.JCS_YCCK;
break;
}
}
return retval;
}
示例4: getSrcCSType
import java.awt.image.ColorModel; //导入方法依赖的package包/类
private int getSrcCSType(ColorModel cm) {
int retval = JPEG.JCS_UNKNOWN;
if (cm != null) {
boolean alpha = cm.hasAlpha();
ColorSpace cs = cm.getColorSpace();
switch (cs.getType()) {
case ColorSpace.TYPE_GRAY:
retval = JPEG.JCS_GRAYSCALE;
break;
case ColorSpace.TYPE_RGB:
if (alpha) {
retval = JPEG.JCS_RGBA;
} else {
retval = JPEG.JCS_RGB;
}
break;
case ColorSpace.TYPE_YCbCr:
if (alpha) {
retval = JPEG.JCS_YCbCrA;
} else {
retval = JPEG.JCS_YCbCr;
}
break;
case ColorSpace.TYPE_3CLR:
if (cs == JPEG.JCS.getYCC()) {
if (alpha) {
retval = JPEG.JCS_YCCA;
} else {
retval = JPEG.JCS_YCC;
}
}
break;
case ColorSpace.TYPE_CMYK:
retval = JPEG.JCS_CMYK;
break;
}
}
return retval;
}
示例5: getDestCSType
import java.awt.image.ColorModel; //导入方法依赖的package包/类
private int getDestCSType(ImageTypeSpecifier destType) {
ColorModel cm = destType.getColorModel();
boolean alpha = cm.hasAlpha();
ColorSpace cs = cm.getColorSpace();
int retval = JPEG.JCS_UNKNOWN;
switch (cs.getType()) {
case ColorSpace.TYPE_GRAY:
retval = JPEG.JCS_GRAYSCALE;
break;
case ColorSpace.TYPE_RGB:
if (alpha) {
retval = JPEG.JCS_RGBA;
} else {
retval = JPEG.JCS_RGB;
}
break;
case ColorSpace.TYPE_YCbCr:
if (alpha) {
retval = JPEG.JCS_YCbCrA;
} else {
retval = JPEG.JCS_YCbCr;
}
break;
case ColorSpace.TYPE_3CLR:
if (cs == JPEG.JCS.getYCC()) {
if (alpha) {
retval = JPEG.JCS_YCCA;
} else {
retval = JPEG.JCS_YCC;
}
}
break;
case ColorSpace.TYPE_CMYK:
retval = JPEG.JCS_CMYK;
break;
}
return retval;
}
示例6: getDefaultDestCSType
import java.awt.image.ColorModel; //导入方法依赖的package包/类
private int getDefaultDestCSType(ColorModel cm) {
int retval = JPEG.JCS_UNKNOWN;
if (cm != null) {
boolean alpha = cm.hasAlpha();
ColorSpace cs = cm.getColorSpace();
switch (cs.getType()) {
case ColorSpace.TYPE_GRAY:
retval = JPEG.JCS_GRAYSCALE;
break;
case ColorSpace.TYPE_RGB:
if (alpha) {
retval = JPEG.JCS_YCbCrA;
} else {
retval = JPEG.JCS_YCbCr;
}
break;
case ColorSpace.TYPE_YCbCr:
if (alpha) {
retval = JPEG.JCS_YCbCrA;
} else {
retval = JPEG.JCS_YCbCr;
}
break;
case ColorSpace.TYPE_3CLR:
if (cs == JPEG.JCS.getYCC()) {
if (alpha) {
retval = JPEG.JCS_YCCA;
} else {
retval = JPEG.JCS_YCC;
}
}
break;
case ColorSpace.TYPE_CMYK:
retval = JPEG.JCS_YCCK;
break;
}
}
return retval;
}
示例7: analyseAndSetOpenGLParameters
import java.awt.image.ColorModel; //导入方法依赖的package包/类
/**
* Analyes the specified image and sets the proper openGLImage-values.
* @return <code>true</code> if the image foramt has successfully detected.
*/
public boolean analyseAndSetOpenGLParameters() {
boolean retValue = true;
String errorString = "";
try {
switch(image.getType()) {
case BufferedImage.TYPE_4BYTE_ABGR:
openGLImageFormat= GL2.GL_RGBA;
openGLImageType = GL2.GL_UNSIGNED_INT_8_8_8_8; // OK!
openGLImageInternalFormat = GL2.GL_RGBA;
break;
case BufferedImage.TYPE_3BYTE_BGR:
openGLImageFormat= GL2.GL_BGR;
openGLImageType = GL2.GL_UNSIGNED_BYTE;
openGLImageInternalFormat = GL2.GL_RGB;
break;
case BufferedImage.TYPE_BYTE_GRAY:
openGLImageFormat= GL2.GL_LUMINANCE;
openGLImageType = GL2.GL_UNSIGNED_BYTE;
openGLImageInternalFormat = GL2.GL_LUMINANCE;
break;
case BufferedImage.TYPE_CUSTOM:
ColorModel colorModel = image.getColorModel();
ColorSpace colorSpace = colorModel.getColorSpace();
if(colorSpace.getType()==ColorSpace.TYPE_GRAY) {
if(colorModel.hasAlpha()==true) {
openGLImageFormat= GL2.GL_LUMINANCE_ALPHA;
openGLImageType = GL2.GL_UNSIGNED_BYTE;
openGLImageInternalFormat = GL2.GL_LUMINANCE_ALPHA;
}
else {
openGLImageFormat= GL2.GL_LUMINANCE;
openGLImageType = GL2.GL_UNSIGNED_BYTE;
openGLImageInternalFormat = GL2.GL_LUMINANCE;
}
}
else {
errorString = "Unsupported image format."+
"\nURL="+textureBaseURL+textureURL+"\n";
retValue = false;
}
break;
}
}
catch(Throwable t) {
errorString = "Exception during image analyzing."+
"\nURL="+textureBaseURL+textureURL+"\n"+t.getMessage();
retValue = false;
}
if(!errorString.isEmpty()){
StatusPrinter.print("ERROR", errorString, Texture.class);
}
return retValue;
}