/**
* For the given input color, return the color that this color
* will map to in an offscreen image created by the given Component
*/
public static int getOffscreenEquivalent(int color, Component obs) {
Image im = obs.createImage(1, 1);
Graphics2D g = (Graphics2D) im.getGraphics();
g.setColor(new java.awt.Color(color));
g.fillRect(0, 0, 1, 1);
g.dispose();
int[] bg = new int[1];
PixelGrabber pg = new PixelGrabber(im, 0, 0, 1, 1, bg, 0, 1);
try {
pg.grabPixels();
}
catch (InterruptedException ex) {
logger.error("", ex);
}
return bg[0];
}
TransparentFilter.java 文件源码
java
阅读 29
收藏 0
点赞 0
评论 0
项目:VASSAL-src
作者:
评论列表
文章目录