当前位置: 首页>>代码示例>>Java>>正文


Java ImageUtil类代码示例

本文整理汇总了Java中org.xhtmlrenderer.util.ImageUtil的典型用法代码示例。如果您正苦于以下问题:Java ImageUtil类的具体用法?Java ImageUtil怎么用?Java ImageUtil使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ImageUtil类属于org.xhtmlrenderer.util包,在下文中一共展示了ImageUtil类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getImageResource

import org.xhtmlrenderer.util.ImageUtil; //导入依赖的package包/类
@Override
public ImageResource getImageResource(String uri) {
	if (ImageUtil.isEmbeddedBase64Image(uri)) {
		return loadEmbeddedBase64ImageResource(uri);
	} else {
		uri = resolveURI(uri);
		try {
			Texture tex = ToolKit.get().getApplication().getAssetManager().loadTexture(new TextureKey(uri));
			return new ImageResource(uri, new XHTMLFSImage(tex.getImage(), this, uri));
		} catch (AssetNotFoundException anfe) {
			XRLog.exception(String.format("Image at URI %s not found", uri));
		} catch (Exception e) {
			XRLog.exception(String.format("Failed to load %s", uri), e);
		}
		return new ImageResource(uri, new XHTMLFSImage(getMissingImage(), this, uri));
	}
}
 
开发者ID:rockfireredmoon,项目名称:icetone,代码行数:18,代码来源:XHTMLUserAgent.java

示例2: prepareLayout

import org.xhtmlrenderer.util.ImageUtil; //导入依赖的package包/类
private void prepareLayout() {
	outputImage = ImageUtil.createCompatibleBufferedImage(DEFAULT_DOTS_PER_POINT, DEFAULT_DOTS_PER_POINT);
	outputDevice = new Java2DOutputDevice(outputImage);
	sharedContext = getSharedContext();

	setDocument(doc, null, new XhtmlNamespaceHandler());
	layout(this.width);
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:9,代码来源:CustomJava2DRenderer.java

示例3: loadEmbeddedBase64ImageResource

import org.xhtmlrenderer.util.ImageUtil; //导入依赖的package包/类
private ImageResource loadEmbeddedBase64ImageResource(final String uri) {
	byte[] image = ImageUtil.getEmbeddedBase64Image(uri);
	if (image != null) {
		return createImageResource(null, new ByteArrayInputStream(image));
	}
	return new ImageResource(null, null);
}
 
开发者ID:rockfireredmoon,项目名称:icetone,代码行数:8,代码来源:XHTMLUserAgent.java

示例4: loadEmbeddedBase64ImageResource

import org.xhtmlrenderer.util.ImageUtil; //导入依赖的package包/类
private ImageResource loadEmbeddedBase64ImageResource(final String uri) {
    byte[] image = ImageUtil.getEmbeddedBase64Image(uri);
    if (image != null) {
        return createImageResource(null, new ByteArrayInputStream(image));
    }
    return new ImageResource(null, null);
}
 
开发者ID:rockfireredmoon,项目名称:icetone,代码行数:8,代码来源:NaiveUserAgent.java

示例5: run

import org.xhtmlrenderer.util.ImageUtil; //导入依赖的package包/类
public void run() {
    try {
        while (true) {
            final ImageLoadItem loadItem = queue.getTask();

            if (ImageLoadQueue.isKillSwitch(loadItem)) {
                break;
            }
            final ImageResource ir = ImageResourceLoader.loadImageResourceFromUri(loadItem._uri);
            FSImage awtfsImage = ir.getImage();
            BufferedImage newImg = (BufferedImage) ((AWTFSImage) awtfsImage).getImage();
            XRLog.load(Level.FINE, this + ", loaded " + loadItem._uri);

            loadItem._imageResourceLoader.loaded(ir, newImg.getWidth(), newImg.getHeight());
            final boolean wasScaled;
            if (loadItem.haveTargetDimensions() && !ir.hasDimensions(loadItem._targetWidth, loadItem._targetHeight)) {
                XRLog.load(Level.FINE, this + ", scaling " + loadItem._uri + " to " + loadItem._targetWidth + ", " + loadItem._targetHeight);
                newImg = ImageUtil.getScaledInstance(newImg, loadItem._targetWidth, loadItem._targetHeight);
                ImageResource sir = new ImageResource(ir.getImageUri(), AWTFSImage.createImage(newImg));
                loadItem._imageResourceLoader.loaded(sir, newImg.getWidth(), newImg.getHeight());
                wasScaled = true;
            } else {
                wasScaled = false;
            }

            // msfImage belongs to the Swing AWT thread
            final BufferedImage newImg1 = newImg;
            EventQueue.invokeLater(new Runnable() {
                public void run() {
                    loadItem._mfsImage.setImage(loadItem._uri, newImg1, wasScaled);
                }
            });
        }
    } catch (InterruptedException e) {
        //
    }
}
 
开发者ID:TechnicPack,项目名称:LauncherV3,代码行数:38,代码来源:ImageLoadWorker.java

示例6: loadEmbeddedBase64ImageResource

import org.xhtmlrenderer.util.ImageUtil; //导入依赖的package包/类
public static ImageResource loadEmbeddedBase64ImageResource(final String uri) {
    BufferedImage bufferedImage = ImageUtil.loadEmbeddedBase64Image(uri);
    if (bufferedImage != null) {
        FSImage image = AWTFSImage.createImage(bufferedImage);
        return new ImageResource(null, image);
    } else {
        return new ImageResource(null, null);
    }
}
 
开发者ID:TechnicPack,项目名称:LauncherV3,代码行数:10,代码来源:DiscoverResourceLoader.java

示例7: createImageResource

import org.xhtmlrenderer.util.ImageUtil; //导入依赖的package包/类
public static ImageResource createImageResource(final String uri, final BufferedImage img) {
    if (img == null) {
        return new ImageResource(uri, AWTFSImage.createImage(ImageUtil.createTransparentImage(10, 10)));
    } else {
        return new ImageResource(uri, AWTFSImage.createImage(ImageUtil.makeCompatible(img)));
    }
}
 
开发者ID:TechnicPack,项目名称:LauncherV3,代码行数:8,代码来源:DiscoverResourceLoader.java


注:本文中的org.xhtmlrenderer.util.ImageUtil类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。