本文整理汇总了Java中java.awt.image.IndexColorModel.getAlpha方法的典型用法代码示例。如果您正苦于以下问题:Java IndexColorModel.getAlpha方法的具体用法?Java IndexColorModel.getAlpha怎么用?Java IndexColorModel.getAlpha使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.image.IndexColorModel
的用法示例。
在下文中一共展示了IndexColorModel.getAlpha方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import java.awt.image.IndexColorModel; //导入方法依赖的package包/类
public static void main(String args[]) {
IndexColorModel cm =
new IndexColorModel(8, 1, new byte[]{(byte) 128}, new byte[]{(byte) 128}, new byte[]{(byte) 128});
cm.getTransparency();
cm.getComponentSize();
cm.isAlphaPremultiplied();
cm.hasAlpha();
cm.isAlphaPremultiplied();
cm.getTransferType();
cm.getPixelSize();
cm.getComponentSize();
cm.getNumComponents();
cm.getNumColorComponents();
cm.getRed(20);
cm.getGreen(20);
cm.getBlue(20);
cm.getAlpha(20);
cm.getRGB(20);
cm.isAlphaPremultiplied();
}
示例2: loadTexture
import java.awt.image.IndexColorModel; //导入方法依赖的package包/类
private void loadTexture(int js, int jt) {
int ks = js*(_ls-1);
int kt = jt*(_lt-1);
int ls = min(_ls,_ns-ks);
int lt = min(_lt,_nt-kt);
if (_axis==Axis.X) {
_f.get12(lt,ls,kt,ks,_kxmin,_floats);
} else if (_axis==Axis.Y) {
_f.get13(lt,ls,kt,_kymin,ks,_floats);
} else if (_axis==Axis.Z) {
_f.get23(lt,ls,_kzmin,kt,ks,_floats);
}
float fscale = 255.0f/(_clipMax-_clipMin);
float fshift = _clipMin;
IndexColorModel icm = _colorMap.getColorModel();
for (int is=0; is<ls; ++is) {
for (int it=0; it<lt; ++it) {
float fi = (_floats[is][it]-fshift)*fscale;
if (fi<0.0f)
fi = 0.0f;
if (fi>255.0f)
fi = 255.0f;
int i = (int)(fi+0.5f);
int r = icm.getRed(i);
int g = icm.getGreen(i);
int b = icm.getBlue(i);
int a = icm.getAlpha(i);
int p = (r&0xff)|((g&0xff)<<8)|((b&0xff)<<16)|((a&0xff)<<24);
_pixels.put(is+it*_ls,p);
}
}
glPixelStorei(GL_UNPACK_ALIGNMENT,1);
GlTextureName tn = _tn[jt][js];
glBindTexture(GL_TEXTURE_2D,tn.name());
glTexSubImage2D(
GL_TEXTURE_2D,0,0,0,_ls,_lt,GL_RGBA,GL_UNSIGNED_BYTE,_pixels);
glBindTexture(GL_TEXTURE_2D,0);
}