• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Screenshot类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



Screenshot类属于com.jogamp.opengl.util.awt包,在下文中一共展示了Screenshot类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例3: saveJPEGImage

import com.jogamp.opengl.util.awt.Screenshot; //导入依赖的package包/类
public void saveJPEGImage(File file) throws IOException {
	Rectangle r = wwd.getBounds();
	wwd.getContext().makeCurrent();
	Screenshot.writeToFile(file, r.width, r.height);
	wwd.getContext().release();
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:7,代码来源:WWMap.java


示例4: savePMGImage

import com.jogamp.opengl.util.awt.Screenshot; //导入依赖的package包/类
public void savePMGImage(File file) throws IOException {
	Rectangle r = wwd.getBounds();
	wwd.getContext().makeCurrent();
	Screenshot.writeToFile(file, r.width, r.height);
	wwd.getContext().release();
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:7,代码来源:WWMap.java


示例5: captureCamera

import com.jogamp.opengl.util.awt.Screenshot; //导入依赖的package包/类
protected void captureCamera(Graphics3D drawable, StandardCamera camera) {

		GL2 gl = drawable.getGL2();

		int w = camera.getWidth();

		int h = camera.getHeight();

		gl.glViewport(0, 0, w, h);

		// Update Camera View
		drawable.aimCamera(camera);

		drawScene(gl);

		// Draw Drone Camera
		camera.setBufferedImage(Screenshot.readToBufferedImage(0, 0, w, h, false));

		gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
		gl.glClearColor(1f, 1f, 1f, 1);

		gl.glLoadIdentity();

	}
 
开发者ID:yuripourre,项目名称:drone4,代码行数:25,代码来源:MultiPilotEnvironment.java


示例6: captureCamera

import com.jogamp.opengl.util.awt.Screenshot; //导入依赖的package包/类
protected void captureCamera(Graphics3D drawable, Gimbal gimbal, StandardCamera camera) {

		GL2 gl = drawable.getGL2();

		int w = camera.getWidth();

		int h = camera.getHeight();

		gl.glViewport(0, 0, w, h);

		// Update Camera View
		drawable.aimCamera(camera, gimbal.getAngleX(), gimbal.getAngleY(), gimbal.getAngleZ());

		drawScene(gl);

		// Draw Drone Camera
		camera.setBufferedImage(Screenshot.readToBufferedImage(0, 0, w, h, false));

		gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
		gl.glClearColor(1f, 1f, 1f, 1);

		gl.glLoadIdentity();

	}
 
开发者ID:yuripourre,项目名称:drone4,代码行数:25,代码来源:CleanEnvironment.java


示例7: captureCamera

import com.jogamp.opengl.util.awt.Screenshot; //导入依赖的package包/类
protected void captureCamera(Graphics3D drawable, Gimbal gimbal, StandardCamera camera) {

		GL2 gl = drawable.getGL2();

		int w = camera.getWidth();

		int h = camera.getHeight();

		gl.glViewport(0, 0, w, h);

		// Update Camera View
		drawable.aimCamera(camera, gimbal.getAngleX(), gimbal.getAngleY(), gimbal.getAngleZ());

		drawScene(drawable);

		// Draw Drone Camera
		camera.setBufferedImage(Screenshot.readToBufferedImage(0, 0, w, h, false));

		gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
		gl.glClearColor(1f, 1f, 1f, 1);

		gl.glLoadIdentity();

	}
 
开发者ID:yuripourre,项目名称:drone4,代码行数:25,代码来源:AutonomousCleanEnvironment.java


示例8: saveImageItemActionPerformed

import com.jogamp.opengl.util.awt.Screenshot; //导入依赖的package包/类
private void saveImageItemActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_saveImageItemActionPerformed
{//GEN-HEADEREND:event_saveImageItemActionPerformed

    final int choice = this.pngChooser.showSaveDialog(this);

    if (choice == JFileChooser.APPROVE_OPTION)
    {
        if (
            !this.pngChooser.getSelectedFile()
                .isFile() ||
                (JOptionPane.showConfirmDialog(
                    this,
                    "This file already exists. Do you want to\n" +
                    "overwrite it?", "Replace File?",
                    JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION))
        {
            try
            {
                display.getCanvas()
                    .getContext()
                    .makeCurrent();

                try
                {
                    final File target =
                        FileUtils.addExtension(
                            this.pngChooser.getSelectedFile(), ".png");

                    Screenshot.writeToFile(
                        target, display.getCanvas().getWidth(),
                        display.getCanvas().getHeight());
                }
                finally
                {
                    display.getCanvas()
                        .getContext()
                        .release();
                }
            }
            catch (IOException ioe)
            {
                log.error("Error writing image file", ioe);

                JOptionPane.showMessageDialog(
                    this,
                    "Error: " + ioe.getMessage() +
                    "\nCheck log file for full details", "Error Saving",
                    JOptionPane.ERROR_MESSAGE);
            }
        }
    }
}
 
开发者ID:madebyjeffrey,项目名称:TerraJ,代码行数:53,代码来源:AbstractTerrainViewerFrame.java


示例9: captureCamera

import com.jogamp.opengl.util.awt.Screenshot; //导入依赖的package包/类
protected void captureCamera(Graphics3D drawable, StandardCamera camera) {

		GL2 gl = drawable.getGL2();

		int w = camera.getWidth();

		int h = camera.getHeight();

		gl.glViewport(0, 0, w, h);

		// Update Camera View
		drawable.aimCamera(camera);

		// gl.glRotated(angleX, 1, 0, 0);

		// gl.glRotated(camera.getAngleY(), 0, 1, 0);
		// gl.glTranslated(camera.getX(), camera.getY(), camera.getZ());

		// gl.glRotated(angleZ, 0, 0, 1);

		drawScene(gl);

		// Draw Drone Camera
		camera.setBufferedImage(Screenshot.readToBufferedImage(0, 0, w, h, false));

		gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
		gl.glClearColor(1f, 1f, 1f, 1);

		gl.glLoadIdentity();

	}
 
开发者ID:yuripourre,项目名称:drone4,代码行数:32,代码来源:RemoteEnvironment.java


示例10: captureCamera

import com.jogamp.opengl.util.awt.Screenshot; //导入依赖的package包/类
protected void captureCamera(Graphics3D drawable, StandardCamera camera) {

		GL2 gl = drawable.getGL2();

		int w = camera.getWidth();

		int h = camera.getHeight();

		gl.glViewport(0, 0, w, h);

		// Update Camera View
		drawable.aimCamera(camera);
		
		//drawable.drawCamera(personView);
		
		// gl.glRotated(angleX, 1, 0, 0);

		// gl.glRotated(camera.getAngleY(), 0, 1, 0);
		// gl.glTranslated(camera.getX(), camera.getY(), camera.getZ());

		// gl.glRotated(angleZ, 0, 0, 1);

		drawScene(gl);
		
		// Draw Drone Camera
		camera.setBufferedImage(Screenshot.readToBufferedImage(0, 0, w, h, false));

		gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
		gl.glClearColor(1f, 1f, 1f, 1);

		gl.glLoadIdentity();

	}
 
开发者ID:yuripourre,项目名称:drone4,代码行数:34,代码来源:BeachEnvironment.java


示例11: captureCamera

import com.jogamp.opengl.util.awt.Screenshot; //导入依赖的package包/类
private void captureCamera(Graphics3D g, StandardCamera camera) {

		GL2 gl = g.getGL2();

		int w = camera.getWidth();

		int h = camera.getHeight();

		gl.glViewport(0, 0, w, h);

		//Update Camera View
		g.aimCamera(camera);

		gl.glRotated(angleX, 1, 0, 0);
		gl.glRotated(angleY, 0, 1, 0);
		gl.glRotated(angleZ, 0, 0, 1);

		drawScene(gl);

		//Draw Drone Camera
		camera.setBufferedImage(Screenshot.readToBufferedImage(0, 0, w, h, false));

		gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
		gl.glClearColor(1f, 1f, 1f, 1);

		gl.glLoadIdentity();
	}
 
开发者ID:yuripourre,项目名称:drone4,代码行数:28,代码来源:IndoorEnvironment.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ClassDefinition类代码示例发布时间:2022-05-22
下一篇:
Java ContextConfigurationAttributes类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap