本文整理汇总了Java中java.awt.image.ImageProducer.startProduction方法的典型用法代码示例。如果您正苦于以下问题:Java ImageProducer.startProduction方法的具体用法?Java ImageProducer.startProduction怎么用?Java ImageProducer.startProduction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.image.ImageProducer
的用法示例。
在下文中一共展示了ImageProducer.startProduction方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: get
import java.awt.image.ImageProducer; //导入方法依赖的package包/类
/** 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();
}
示例2: createImage
import java.awt.image.ImageProducer; //导入方法依赖的package包/类
public Image createImage(ImageProducer producer)
{
ImageConverter conv = new ImageConverter();
producer.startProduction(conv);
Image image = conv.getImage();
return image;
}
示例3: startProduction
import java.awt.image.ImageProducer; //导入方法依赖的package包/类
public void startProduction(ImageConsumer ic)
{
ImageProducer ip = getRealSource();
if (ip == null)
{
ic.setDimensions(1, 1);
ic.imageComplete(ImageConsumer.SINGLEFRAMEDONE);
}
else
{
ip.startProduction(ic);
}
}
示例4: ImageLoader
import java.awt.image.ImageProducer; //导入方法依赖的package包/类
/** This constructs an ImageLoader. As soon as an ImageLoader is constructed
* the <code>ImageProducer</code> is asked to start producing data. (However
* constructing this object will not block waiting on the image data.)
*
* @param p the source of this image
* @param c an optional <code>Cancellable</code> object.
* @param changeListener an optional <code>ChangeListener</code>. This will be notified
* when a change occurs. It can be added here in the constructor because loading the image
* begins immediately; depending on how <code>ImageProducer.startProduction</code> is implemented
* this <i>may</i> be a blocking call so the <code>ChangeListener</code> needs to be added
* before the loading begins
* @param description an optional description that may be useful for debugging
*/
public ImageLoader(ImageProducer p,Cancellable c,ChangeListener changeListener,String description) {
cancellable = c;
producer = p;
addChangeListener(changeListener);
consumer = new InnerImageConsumer();
p.startProduction(consumer);
this.description = description;
}