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


Java Screenshot.readToBufferedImage方法代码示例

本文整理汇总了Java中com.jogamp.opengl.util.awt.Screenshot.readToBufferedImage方法的典型用法代码示例。如果您正苦于以下问题:Java Screenshot.readToBufferedImage方法的具体用法?Java Screenshot.readToBufferedImage怎么用?Java Screenshot.readToBufferedImage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.jogamp.opengl.util.awt.Screenshot的用法示例。


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

示例1: print

import com.jogamp.opengl.util.awt.Screenshot; //导入方法依赖的package包/类
public int print(Graphics g, PageFormat fmt, int pageNo) {
	if( pageNo>0 ) return NO_SUCH_PAGE;
	Graphics2D g2 = (Graphics2D)g;
	Dimension dim = wwd.getPreferredSize();
	Rectangle r = wwd.getBounds();

	if(r.width>dim.width) r.width = dim.width;
	if(r.height>dim.height) r.height = dim.height;

	org.geomapapp.util.DateFmt df = new org.geomapapp.util.DateFmt();
	int secs = (int)(System.currentTimeMillis()/1000L);
	String date = df.format(secs);
	Font font = new Font("SansSerif", Font.PLAIN, 8);
	g.setFont( font );
	Rectangle2D r2d = font.getStringBounds(date, g2.getFontRenderContext());
//	g2.translate( r.getWidth()-20.-r2d.getWidth(), r.getHeight()+18. );
	g2.setColor( Color.black);

//	g.setClip( new Rectangle( 0, 0, r.width, r.height) );
	double w = fmt.getImageableWidth();
	double h = fmt.getImageableHeight();
	double x = fmt.getImageableX();
	double y = fmt.getImageableY();
	g2.translate(x, y);
	double scale = Math.min( w / r.getWidth(), h / r.getHeight());
	int xd = (int)(scale*r.getWidth()-10.-r2d.getWidth());
	int yd = (int)(scale*r.getHeight()+18.);
	g2.drawString( date, xd, yd);
	g2.translate( -r.getX()*scale, -r.getY()*scale );
	g2.scale( scale, scale);

	wwd.getContext().makeCurrent();
	BufferedImage image = Screenshot.readToBufferedImage(r.width, r.height);
	g2.drawImage(image, 0, 0, this);
	return PAGE_EXISTS;
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:37,代码来源:WWMap.java

示例2: getImage

import com.jogamp.opengl.util.awt.Screenshot; //导入方法依赖的package包/类
public BufferedImage getImage() {
    // Needs the "current context"!
    this.drawable.getContext().makeCurrent();
    int width = component.getWidth();
    int height = component.getHeight();
    return Screenshot.readToBufferedImage(width, height);
}
 
开发者ID:OSUCartography,项目名称:TerrainViewer,代码行数:8,代码来源:Map3DViewer.java


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