本文整理匯總了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;
}