/**
* Construct an image from an ImageProducer object.
*/
public ToolkitImage(ImageProducer is) {
source = is;
if (is instanceof InputStreamImageSource) {
src = (InputStreamImageSource) is;
}
}
java类java.awt.image.ImageProducer的实例源码
ToolkitImage.java 文件源码
项目:openjdk9
阅读 23
收藏 0
点赞 0
评论 0
ComponentOperator.java 文件源码
项目:openjdk9
阅读 25
收藏 0
点赞 0
评论 0
/**
* Maps {@code Component.createImage(ImageProducer)} through queue
*/
public Image createImage(final ImageProducer imageProducer) {
return (runMapping(new MapAction<Image>("createImage") {
@Override
public Image map() {
return getSource().createImage(imageProducer);
}
}));
}
Component.java 文件源码
项目:Java8CN
阅读 30
收藏 0
点赞 0
评论 0
/**
* Creates an image from the specified image producer.
* @param producer the image producer
* @return the image produced
* @since JDK1.0
*/
public Image createImage(ImageProducer producer) {
ComponentPeer peer = this.peer;
if ((peer != null) && ! (peer instanceof LightweightPeer)) {
return peer.createImage(producer);
}
return getToolkit().createImage(producer);
}
SimpleBeanInfo.java 文件源码
项目:Java8CN
阅读 30
收藏 0
点赞 0
评论 0
/**
* This is a utility method to help in loading icon images.
* It takes the name of a resource file associated with the
* current object's class file and loads an image object
* from that file. Typically images will be GIFs.
* <p>
* @param resourceName A pathname relative to the directory
* holding the class file of the current class. For example,
* "wombat.gif".
* @return an image object. May be null if the load failed.
*/
public Image loadImage(final String resourceName) {
try {
final URL url = getClass().getResource(resourceName);
if (url != null) {
final ImageProducer ip = (ImageProducer) url.getContent();
if (ip != null) {
return Toolkit.getDefaultToolkit().createImage(ip);
}
}
} catch (final Exception ignored) {
}
return null;
}
ScreenCapture.java 文件源码
项目:melon
阅读 30
收藏 0
点赞 0
评论 0
protected void do_button_actionPerformed(ActionEvent e) {
try {
Robot robot = new Robot();// 创建Robot对象
Toolkit toolkit = Toolkit.getDefaultToolkit();// 获得Toolkit对象
Rectangle area = new Rectangle(toolkit.getScreenSize());// 设置截取区域为全屏
// 将BufferedImage转换成Image
BufferedImage bufferedImage = robot.createScreenCapture(area);
ImageProducer producer = bufferedImage.getSource();
Image image = toolkit.createImage(producer);
imageLabel.setIcon(new ImageIcon(image));// 显示图片
} catch (AWTException e1) {
e1.printStackTrace();
}
}
GenericImageSinglePassIterator.java 文件源码
项目:pumpernickel
阅读 21
收藏 0
点赞 0
评论 0
/** Returns a <code>GenericImageSinglePassIterator</code> that is
* either a <code>IntPixelIterator</code> or a <code>BytePixelIterator</code>.
* @param image the image to iterate over.
* @param iteratorType one of these 8 BufferedImage types:
* TYPE_INT_ARGB, TYPE_INT_ARGB_PRE, TYPE_INT_RGB, TYPE_INT_BGR,
* TYPE_3BYTE_BGR, TYPE_BYTE_GRAY, TYPE_4BYTE_ABGR, TYPE_4BYTE_ABGR_PRE.
* @return a <code>GenericImageSinglePassIterator</code> for the image provided.
*/
public static GenericImageSinglePassIterator get(Image image,int iteratorType) {
if(!(iteratorType==BufferedImage.TYPE_INT_ARGB ||
iteratorType==BufferedImage.TYPE_INT_ARGB_PRE ||
iteratorType==BufferedImage.TYPE_INT_RGB ||
iteratorType==BufferedImage.TYPE_INT_BGR ||
iteratorType==BufferedImage.TYPE_3BYTE_BGR ||
iteratorType==BufferedImage.TYPE_BYTE_GRAY ||
iteratorType==BufferedImage.TYPE_4BYTE_ABGR ||
iteratorType==BufferedImage.TYPE_4BYTE_ABGR_PRE)) {
throw new IllegalArgumentException("illegal iterator type: "+iteratorType);
}
final ImageProducer producer = image.getSource();
final Consumer consumer = new Consumer(producer, iteratorType);
// ImageProducer.startProduction often starts its own thread, but it's not
// required to. Sometimes in my testing a BufferedImage would make
// this a blocking call. So to be safe this call should be in its
// own thread:
Thread productionThread = new Thread("GenericImageSinglePassIterator: Production Thread") {
@Override
public void run() {
producer.startProduction(consumer);
}
};
productionThread.start();
return consumer.getPixelIterator();
}
Component.java 文件源码
项目:jdk8u_jdk
阅读 27
收藏 0
点赞 0
评论 0
/**
* Creates an image from the specified image producer.
* @param producer the image producer
* @return the image produced
* @since JDK1.0
*/
public Image createImage(ImageProducer producer) {
ComponentPeer peer = this.peer;
if ((peer != null) && ! (peer instanceof LightweightPeer)) {
return peer.createImage(producer);
}
return getToolkit().createImage(producer);
}
SimpleBeanInfo.java 文件源码
项目:jdk8u_jdk
阅读 32
收藏 0
点赞 0
评论 0
/**
* This is a utility method to help in loading icon images.
* It takes the name of a resource file associated with the
* current object's class file and loads an image object
* from that file. Typically images will be GIFs.
* <p>
* @param resourceName A pathname relative to the directory
* holding the class file of the current class. For example,
* "wombat.gif".
* @return an image object. May be null if the load failed.
*/
public Image loadImage(final String resourceName) {
try {
final URL url = getClass().getResource(resourceName);
if (url != null) {
final ImageProducer ip = (ImageProducer) url.getContent();
if (ip != null) {
return Toolkit.getDefaultToolkit().createImage(ip);
}
}
} catch (final Exception ignored) {
}
return null;
}
ToolkitImage.java 文件源码
项目:jdk8u_jdk
阅读 27
收藏 0
点赞 0
评论 0
/**
* Construct an image from an ImageProducer object.
*/
public ToolkitImage(ImageProducer is) {
source = is;
if (is instanceof InputStreamImageSource) {
src = (InputStreamImageSource) is;
}
}
Component.java 文件源码
项目:lookaside_java-1.8.0-openjdk
阅读 23
收藏 0
点赞 0
评论 0
/**
* Creates an image from the specified image producer.
* @param producer the image producer
* @return the image produced
* @since JDK1.0
*/
public Image createImage(ImageProducer producer) {
ComponentPeer peer = this.peer;
if ((peer != null) && ! (peer instanceof LightweightPeer)) {
return peer.createImage(producer);
}
return getToolkit().createImage(producer);
}