本文整理汇总了Java中java.awt.Toolkit.prepareImage方法的典型用法代码示例。如果您正苦于以下问题:Java Toolkit.prepareImage方法的具体用法?Java Toolkit.prepareImage怎么用?Java Toolkit.prepareImage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.Toolkit
的用法示例。
在下文中一共展示了Toolkit.prepareImage方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import java.awt.Toolkit; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
generateImages();
Toolkit toolkit = Toolkit.getDefaultToolkit();
Image image = Toolkit.getDefaultToolkit().getImage(IMAGE_NAME_1X);
LoadImageObserver sizeObserver
= new LoadImageObserver(WIDTH | HEIGHT);
toolkit.prepareImage(image, -1, -1, sizeObserver);
waitForImageLoading(sizeObserver, "The first observer is not called");
LoadImageObserver bitsObserver
= new LoadImageObserver(SOMEBITS | FRAMEBITS | ALLBITS);
BufferedImage buffImage = new BufferedImage(100, 100, BufferedImage.TYPE_INT_RGB);
Graphics2D g2d = (Graphics2D) buffImage.createGraphics();
g2d.scale(2, 2);
g2d.drawImage(image, 0, 0, bitsObserver);
waitForImageLoading(bitsObserver, "The second observer is not called!");
g2d.dispose();
}
示例2: main
import java.awt.Toolkit; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException {
Image img = createTestImage();
Toolkit tk = Toolkit.getDefaultToolkit();
LUTCompareTest o = new LUTCompareTest(img);
tk.prepareImage(img, -1, -1, o);
while(!o.isImageReady()) {
synchronized(lock) {
try {
lock.wait(200);
} catch (InterruptedException e) {
}
}
}
checkResults(img);
}
示例3: testToolkitMultiResolutionImagePrepare
import java.awt.Toolkit; //导入方法依赖的package包/类
static void testToolkitMultiResolutionImagePrepare() throws Exception {
generateImages();
File imageFile = new File(IMAGE_NAME_1X);
String fileName = imageFile.getAbsolutePath();
Image image = Toolkit.getDefaultToolkit().getImage(fileName);
Toolkit toolkit = Toolkit.getDefaultToolkit();
toolkit.prepareImage(image, IMAGE_WIDTH, IMAGE_HEIGHT,
new LoadImageObserver(image));
testToolkitMultiResolutionImageLoad(image);
}