diff options
author | Kenneth Russel <[email protected]> | 2007-01-04 01:31:23 +0000 |
---|---|---|
committer | Kenneth Russel <[email protected]> | 2007-01-04 01:31:23 +0000 |
commit | 34f3b9eaf1e117c3a61fca577be58dc608b99dd9 (patch) | |
tree | 40759301aa7cc38c96293bcf11c856c20d3200e9 /src | |
parent | bdfe5c18903d8db0face92bf197d6fa146a494b8 (diff) |
Added getImage() and simpler drawOrthoRect() helper method on
suggestion of Chris Campbell
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@1065 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src')
-rwxr-xr-x | src/classes/com/sun/opengl/util/J2DTextureRenderer.java | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/classes/com/sun/opengl/util/J2DTextureRenderer.java b/src/classes/com/sun/opengl/util/J2DTextureRenderer.java index 940af43c9..de4aee9b8 100755 --- a/src/classes/com/sun/opengl/util/J2DTextureRenderer.java +++ b/src/classes/com/sun/opengl/util/J2DTextureRenderer.java @@ -41,6 +41,7 @@ package com.sun.opengl.util; import java.awt.Dimension; import java.awt.Graphics2D; +import java.awt.Image; import java.awt.image.*; import javax.media.opengl.*; @@ -163,6 +164,12 @@ public class J2DTextureRenderer { return image.createGraphics(); } + /** Returns the underlying Java 2D {@link java.awt.Image Image} + being rendered into. */ + public Image getImage() { + return image; + } + /** Synchronizes the specified region of the backing store down to the underlying OpenGL texture. @@ -247,6 +254,24 @@ public class J2DTextureRenderer { gl.glTexEnvi(GL.GL_TEXTURE_ENV, GL.GL_TEXTURE_ENV_MODE, GL.GL_REPLACE); } + /** Draws an orthographically projected rectangle containing all of + the underlying texture to the specified location on the + screen. All (x, y) coordinates are specified relative to the + lower left corner of either the texture image or the current + OpenGL drawable. This method is equivalent to + <code>drawOrthoRect(screenx, screeny, 0, 0, getWidth(), + getHeight());</code>. + + @param screenx the on-screen x coordinate at which to draw the rectangle + @param screeny the on-screen y coordinate (relative to lower left) at + which to draw the rectangle + + @throws GLException If an OpenGL context is not current when this method is called + */ + public void drawOrthoRect(int screenx, int screeny) throws GLException { + drawOrthoRect(screenx, screeny, 0, 0, getWidth(), getHeight()); + } + /** Draws an orthographically projected rectangle of the underlying texture to the specified location on the screen. All (x, y) coordinates are specified relative to the lower left corner of |