Class JavaApplication2D
- java.lang.Object
-
- WildMagic.LibApplications.OpenGLApplication.Application
-
- WildMagic.LibApplications.OpenGLApplication.JavaApplication
-
- WildMagic.LibApplications.OpenGLApplication.JavaApplication2D
-
- All Implemented Interfaces:
java.awt.event.KeyListener,java.io.Serializable,java.util.EventListener
public abstract class JavaApplication2D extends JavaApplication implements java.io.Serializable
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected byte[]m_akFlipScreenFor right-handed drawing.protected byte[]m_akScreenScreen polygonprotected booleanm_bClampToWindowScreen wraps or is clampedprotected booleanm_bFlipScreenSet to true to flip the screen:protected intm_iScrHeightScreen width, heightprotected intm_iScrWidthScreen width, heightprivate static longserialVersionUID-
Fields inherited from class WildMagic.LibApplications.OpenGLApplication.JavaApplication
m_acWindowTitle, m_eBuffering, m_eDepth, m_eFormat, m_eMultisampling, m_eStencil, m_iHeight, m_iWidth, m_iXPosition, m_iYPosition, m_kBackgroundColor, m_pkRenderer
-
-
Constructor Summary
Constructors Constructor Description JavaApplication2D(java.lang.String acWindowTitle, int iXPosition, int iYPosition, int iWidth, int iHeight, ColorRGBA rkBackgroundColor)Constructs a 2D application.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanClampToWindow()Returns if the Screen wraps or is clampedvoidClearScreen()Clears the screen polygon.voiddispose()Delete memory.voidDoFlip(boolean bDoFlip)For right-handed drawing.voidDrawCircle(int iXCenter, int iYCenter, int iRadius, ColorRGB kColor, boolean bSolid)Draw a circle centered at iXCenter, iYCentervoidDrawLine(int iX0, int iY0, int iX1, int iY1, ColorRGB kColor)Draw a line from (iX0,iY0) to (iX1,iY1).voidDrawRectangle(int iXMin, int iYMin, int iXMax, int iYMax, ColorRGB kColor, boolean bSolid)Draw a rectangle with lower-left corner (iXMin,iYMin) and upper-right corner (iXMax,iYMax).voidFill(int iX, int iY, ColorRGB kFColor, ColorRGB kBColor)Flood fill operation.ColorRGBGetPixel(int iX, int iY)Returns the pixel color at the specified location.protected intIndex(int iX, int iY)left-handed screen coordinatesprotected intIndexFlip(int iX, int iY)right-handed screen coordinatesvoidOnDisplay()Display event callback.booleanOnInitialize()Initialize event callback.voidOnResize(int iWidth, int iHeight)Resize event callback.voidOnTerminate()Terminate event callback.voidScreenOverlay()Allows you to do additional drawing after the screen polygon is drawn.voidSetPixel(int iX, int iY, ColorRGB kColor)Sets the pixel color.voidSetThickPixel(int iX, int iY, int iThick, ColorRGB kColor)Sets a thick pixel color.-
Methods inherited from class WildMagic.LibApplications.OpenGLApplication.JavaApplication
GetAspectRatio, GetHeight, GetRenderer, GetWidth, GetWindowTitle, GetXPosition, GetYPosition, keyPressed, keyReleased, keyTyped, OnIdle, OnMove, OnPrecreate, SetRenderer
-
Methods inherited from class WildMagic.LibApplications.OpenGLApplication.Application
reloadShaders, TestStreaming
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
m_iScrWidth
protected int m_iScrWidth
Screen width, height
-
m_iScrHeight
protected int m_iScrHeight
Screen width, height
-
m_akScreen
protected byte[] m_akScreen
Screen polygon
-
m_bClampToWindow
protected boolean m_bClampToWindow
Screen wraps or is clamped
-
m_bFlipScreen
protected boolean m_bFlipScreen
Set to true to flip the screen:
-
m_akFlipScreen
protected byte[] m_akFlipScreen
For right-handed drawing. The array m_akScreen is copied to m_akFlipScreen so that the rows are reversed.
-
-
Constructor Detail
-
JavaApplication2D
public JavaApplication2D(java.lang.String acWindowTitle, int iXPosition, int iYPosition, int iWidth, int iHeight, ColorRGBA rkBackgroundColor)Constructs a 2D application.- Parameters:
acWindowTitle- the window titleiXPosition- window screen x-positioniYPosition- window screen y-positioniWidth- window widthiHeight- window heightrkBackgroundColor- background color
-
-
Method Detail
-
ClampToWindow
public boolean ClampToWindow()
Returns if the Screen wraps or is clamped- Returns:
- true if the Screen is clamped, false if it wraps.
-
ClearScreen
public void ClearScreen()
Clears the screen polygon.
-
dispose
public void dispose()
Delete memory.- Overrides:
disposein classJavaApplication
-
DoFlip
public void DoFlip(boolean bDoFlip)
For right-handed drawing. You need only call DoFlip(true) once for an application. The default is 'false'.- Parameters:
bDoFlip- sets the flip screen flag.
-
DrawCircle
public void DrawCircle(int iXCenter, int iYCenter, int iRadius, ColorRGB kColor, boolean bSolid)Draw a circle centered at iXCenter, iYCenter- Parameters:
iXCenter- center x-positioniYCenter- center y-positioniRadius- circle radiuskColor- color.bSolid- when true the circle is solid, when false it is an outline.
-
DrawLine
public void DrawLine(int iX0, int iY0, int iX1, int iY1, ColorRGB kColor)Draw a line from (iX0,iY0) to (iX1,iY1).- Parameters:
iX0- start x-location.iY0- start y-location.iX1- end x-location.iY1- end y-location.kColor- line color.
-
DrawRectangle
public void DrawRectangle(int iXMin, int iYMin, int iXMax, int iYMax, ColorRGB kColor, boolean bSolid)Draw a rectangle with lower-left corner (iXMin,iYMin) and upper-right corner (iXMax,iYMax).- Parameters:
iXMin- lower-left corner x-positioniYMin- lower-left corner y-positioniXMax- upper-right corner x-positioniYMax- upper-right corner y-positionkColor- color.bSolid- when true the rectangle is solid, when false it is an outline.
-
Fill
public void Fill(int iX, int iY, ColorRGB kFColor, ColorRGB kBColor)Flood fill operation.- Parameters:
iX- start x-coordinate in pixelsiY- start y-coordinate in pixelskFColor- the fill color.kBColor- the back-ground color.
-
GetPixel
public ColorRGB GetPixel(int iX, int iY)
Returns the pixel color at the specified location.- Parameters:
iX- pixel x-location.iY- pixel y-location.- Returns:
- the new pixel color.
-
OnDisplay
public void OnDisplay()
Display event callback.- Overrides:
OnDisplayin classJavaApplication
-
OnInitialize
public boolean OnInitialize()
Initialize event callback.- Overrides:
OnInitializein classJavaApplication- Returns:
- true if successful initialization, false otherwise.
-
OnResize
public void OnResize(int iWidth, int iHeight)Resize event callback.- Overrides:
OnResizein classJavaApplication- Parameters:
iWidth- new window widthiHeight- new window height
-
OnTerminate
public void OnTerminate()
Terminate event callback.- Overrides:
OnTerminatein classJavaApplication
-
ScreenOverlay
public void ScreenOverlay()
Allows you to do additional drawing after the screen polygon is drawn.
-
SetPixel
public void SetPixel(int iX, int iY, ColorRGB kColor)Sets the pixel color.- Parameters:
iX- pixel x-location.iY- pixel y-location.kColor- new pixel color.
-
SetThickPixel
public void SetThickPixel(int iX, int iY, int iThick, ColorRGB kColor)Sets a thick pixel color.- Parameters:
iX- pixel x-location.iY- pixel y-location.iThick- pixel thickness.kColor- new pixel color.
-
Index
protected int Index(int iX, int iY)left-handed screen coordinates- Parameters:
iX- screen coordinateiY- screen coordinate- Returns:
- left-handed screen coordinates.
-
IndexFlip
protected int IndexFlip(int iX, int iY)right-handed screen coordinates- Parameters:
iX- screen coordinateiY- screen coordinate- Returns:
- right-handed screen coordinates.
-
-