本文整理汇总了Java中javax.imageio.spi.ImageWriterSpi.createWriterInstance方法的典型用法代码示例。如果您正苦于以下问题:Java ImageWriterSpi.createWriterInstance方法的具体用法?Java ImageWriterSpi.createWriterInstance怎么用?Java ImageWriterSpi.createWriterInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.imageio.spi.ImageWriterSpi
的用法示例。
在下文中一共展示了ImageWriterSpi.createWriterInstance方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: next
import javax.imageio.spi.ImageWriterSpi; //导入方法依赖的package包/类
public ImageWriter next() {
ImageWriterSpi spi = null;
try {
spi = iter.next();
return spi.createWriterInstance();
} catch (IOException e) {
// Deregister the spi in this case, but only as a writerSpi
theRegistry.deregisterServiceProvider(spi, ImageWriterSpi.class);
}
return null;
}
示例2: next
import javax.imageio.spi.ImageWriterSpi; //导入方法依赖的package包/类
public ImageWriter next()
{
try
{
ImageWriterSpi spi = it.next();
return (writerExtension == null
? spi.createWriterInstance()
: spi.createWriterInstance(writerExtension));
}
catch (IOException e)
{
return null;
}
}
示例3: Context
import javax.imageio.spi.ImageWriterSpi; //导入方法依赖的package包/类
Context(TestEnvironment env, Result result, int testType) {
super(env, result);
String content = (String)env.getModifier(contentList);
if (content == null) {
content = CONTENT_BLANK;
}
// REMIND: add option for non-opaque images
image = createBufferedImage(size, size, content, false);
result.setUnits(size*size);
result.setUnitName("pixel");
if (testType == TEST_IMAGEIO || testType == TEST_IMAGEWRITER) {
ImageWriterSpi writerspi =
(ImageWriterSpi)env.getModifier(imageioWriteFormatList);
format = writerspi.getFileSuffixes()[0].toLowerCase();
if (testType == TEST_IMAGEWRITER) {
try {
writer = writerspi.createWriterInstance();
} catch (IOException e) {
System.err.println("error creating writer");
e.printStackTrace();
}
if (env.isEnabled(installListenerTog)) {
writer.addIIOWriteProgressListener(
new WriteProgressListener());
}
}
if (format.equals("wbmp")) {
// REMIND: this is a hack to create an image that the
// WBMPImageWriter can handle (a better approach
// would involve checking the ImageTypeSpecifier
// of the writer's default image param)
BufferedImage newimg =
new BufferedImage(size, size,
BufferedImage.TYPE_BYTE_BINARY);
Graphics g = newimg.createGraphics();
g.drawImage(image, 0, 0, null);
g.dispose();
image = newimg;
}
} else { // testType == TEST_JPEGCODEC
format = "jpeg";
}
initOutput();
}