core.io
Class OutputWindow

java.lang.Object
  extended bycore.io.OutputWindow

public class OutputWindow
extends java.lang.Object

An RGB frame-buffer accessible window = < title, width, height, byte-buffer >. On construction, a window with the specified width, height, and title appears. This window can be drawn to via Raster or Graphics operations, or its contents can be accessed directly via an RGB byte-buffer. Since the window contents are effectively double-buffered, an explicit call to Refresh() is required to update the window.

Version:
1.0
Author:
Andreas Sundquist

Nested Class Summary
private  class OutputWindow.OutputComponent
           
private  class OutputWindow.OutputFrame
           
 
Field Summary
private  OutputWindow.OutputFrame f
           
private  OutputWindow.OutputComponent o
           
 
Constructor Summary
OutputWindow(java.lang.String Title, int Width, int Height)
          Consturcts a new OutputWindow = < Title, Width, Height, zero-buffer >.
 
Method Summary
 void dispose()
           
 java.awt.Graphics getBufferedGraphics()
          Returns: a Graphics object that can be used to draw on the back-buffer
 byte[] getByteBuffer()
          Returns: a byte array that contains the contents of the back-buffer.
 java.awt.image.WritableRaster getRaster()
          Returns: a WritableRaster that cna be used to draw to the back-buffer
 void Refresh()
          Draws the back-buffer contents to the screen
 void SetSize(int Width, int Height)
          Sets the size of the window to (Width, Height)
 void SetTitle(java.lang.String Title)
          Changes the title of the window to 'Title'
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

f

private OutputWindow.OutputFrame f

o

private OutputWindow.OutputComponent o
Constructor Detail

OutputWindow

public OutputWindow(java.lang.String Title,
                    int Width,
                    int Height)
Consturcts a new OutputWindow = < Title, Width, Height, zero-buffer >. Because of AWT inconsistencies, it uses an ugly hack... appears to work well on Windows, but not so well on UNIX.

Method Detail

SetSize

public void SetSize(int Width,
                    int Height)
Sets the size of the window to (Width, Height)


SetTitle

public void SetTitle(java.lang.String Title)
Changes the title of the window to 'Title'


dispose

public void dispose()

Refresh

public void Refresh()
Draws the back-buffer contents to the screen


getBufferedGraphics

public java.awt.Graphics getBufferedGraphics()
Returns: a Graphics object that can be used to draw on the back-buffer


getRaster

public java.awt.image.WritableRaster getRaster()
Returns: a WritableRaster that cna be used to draw to the back-buffer


getByteBuffer

public byte[] getByteBuffer()
Returns: a byte array that contains the contents of the back-buffer. The pixels are stored in scanline order in packed RGB byte-components.