org.jzy3d.plot3d.rendering.view
Class AWTImageViewport

java.lang.Object
  extended by org.jzy3d.plot3d.rendering.view.AWTImageViewport
All Implemented Interfaces:
IImageViewport
Direct Known Subclasses:
AWTLegend

public class AWTImageViewport
extends Object
implements IImageViewport

A AWTImageViewport allows displaying a 2d Image within an OpenGL2 viewport.

Author:
Martin Pernollet

Field Summary
protected  int imageHeight
           
protected  Image imageObj
           
protected  int imageWidth
           
protected  ViewportConfiguration lastViewPort
           
protected  ViewportMode mode
           
protected  float ratioHeight
           
protected  float ratioWidth
           
protected  int screenBottom
           
protected  boolean screenGridDisplayed
           
protected  int screenHeight
           
protected  int screenLeft
           
protected  int screenSquaredDim
           
protected  int screenWidth
           
protected  int screenXOffset
           
protected  int screenYOffset
           
 
Constructor Summary
AWTImageViewport()
           
 
Method Summary
protected  ViewportConfiguration applyViewport(javax.media.opengl.GL gl, javax.media.opengl.glu.GLU glu)
          Build and return a ViewportConfiguration.
 Image getImage()
          Return the image rendered by the AWTImageViewport
 ViewportConfiguration getLastViewPort()
           
 Dimension getMinimumSize()
          Return the minimum size for this graphic.
 ViewportMode getMode()
           
 Dimension getPreferedSize()
          Return the prefered size for this graphic.
 Rectangle getRectangle()
          Returns the (x,y) offset that was applied to make this AbstractViewportManager stand in the appropriate canvas part. and the actual width and height of the viewport.
 void render(javax.media.opengl.GL gl, javax.media.opengl.glu.GLU glu)
          Renders the picture into the window, according to the viewport settings.
 void setImage(Image image)
           
 void setImage(Image image, int width, int height)
          Set the Image that will be displayed by the layer.
 void setImage(Image image, int width, int height, ByteBuffer buffer)
           
 void setScreenGridDisplayed(boolean status)
          Set the status of the screen grid.
 void setViewPort(int width, int height)
          Set the view port (size of the renderer).
 void setViewPort(int width, int height, float left, float right)
          Set the view port (size of the renderer).
 void setViewPort(ViewportConfiguration viewport)
           
 void setViewportMode(ViewportMode mode)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jzy3d.plot3d.rendering.view.IImageViewport
getLastViewPort, getMode, setViewPort, setViewPort, setViewPort, setViewportMode
 

Field Detail

imageObj

protected Image imageObj

imageHeight

protected int imageHeight

imageWidth

protected int imageWidth

lastViewPort

protected ViewportConfiguration lastViewPort

screenLeft

protected int screenLeft

screenBottom

protected int screenBottom

screenXOffset

protected int screenXOffset

screenYOffset

protected int screenYOffset

screenWidth

protected int screenWidth

screenHeight

protected int screenHeight

screenSquaredDim

protected int screenSquaredDim

screenGridDisplayed

protected boolean screenGridDisplayed

mode

protected ViewportMode mode

ratioWidth

protected float ratioWidth

ratioHeight

protected float ratioHeight
Constructor Detail

AWTImageViewport

public AWTImageViewport()
Method Detail

render

public void render(javax.media.opengl.GL gl,
                   javax.media.opengl.glu.GLU glu)
Description copied from interface: IImageViewport
Renders the picture into the window, according to the viewport settings. If the picture is bigger than the viewport, it is simply centered in it, otherwise, it is scaled in order to fit into the viewport.

Specified by:
render in interface IImageViewport

setImage

public void setImage(Image image,
                     int width,
                     int height)
Set the Image that will be displayed by the layer.

Parameters:
image -

setImage

public void setImage(Image image,
                     int width,
                     int height,
                     ByteBuffer buffer)

setImage

public void setImage(Image image)

getImage

public Image getImage()
Return the image rendered by the AWTImageViewport


getMinimumSize

public Dimension getMinimumSize()
Return the minimum size for this graphic.

Specified by:
getMinimumSize in interface IImageViewport

getPreferedSize

public Dimension getPreferedSize()
Return the prefered size for this graphic.

Specified by:
getPreferedSize in interface IImageViewport

setViewPort

public void setViewPort(int width,
                        int height)
Set the view port (size of the renderer).

Parameters:
width - the width of the target window.
height - the height of the target window.

getMode

public ViewportMode getMode()

setViewportMode

public void setViewportMode(ViewportMode mode)

setViewPort

public void setViewPort(int width,
                        int height,
                        float left,
                        float right)
Set the view port (size of the renderer).

Parameters:
width - the width of the target window.
height - the height of the target window.
left - the width's ratio where this subscreen starts in the target window.
right - the width's ratio where this subscreen stops in the target window.
Throws:
an - IllegalArgumentException if right is not greater than left.

setViewPort

public void setViewPort(ViewportConfiguration viewport)

getLastViewPort

public ViewportConfiguration getLastViewPort()

applyViewport

protected ViewportConfiguration applyViewport(javax.media.opengl.GL gl,
                                              javax.media.opengl.glu.GLU glu)
Build and return a ViewportConfiguration. Uses gl to

Parameters:
gl -
glu -

getRectangle

public Rectangle getRectangle()
Returns the (x,y) offset that was applied to make this AbstractViewportManager stand in the appropriate canvas part. and the actual width and height of the viewport. Only relevant after a call to applyViewPort.


setScreenGridDisplayed

public void setScreenGridDisplayed(boolean status)
Set the status of the screen grid.

Parameters:
status - the grid is displayed if status is set to true


Copyright © 2013. All rights reserved.