org.razvan.jzx
Class ScreenJava1

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Canvas
          extended by org.razvan.jzx.BaseScreen
              extended by org.razvan.jzx.ScreenJava1
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible

public class ScreenJava1
extends BaseScreen

Screen implementation that is optimized for running in a JDK1.1 VM.

This implementation makes use of a cache of pre-rendered Image objects for a given byte/attribute nibble. Its performance hinges on the fact that the call to Graphics.drawImage() is very fast in JDK1.1.

Author:
Razvan Surdulescu (c) 2001 - 2006, Erik Kunze (c) 1995, 1996, 1997, Des Herriott (c) 1993, 1994
You may use and distribute this software for free provided you include this copyright notice. You may not sell this software, use my name for publicity reasons or modify the code without permission from me.
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.Canvas
java.awt.Canvas.AccessibleAWTCanvas
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class org.razvan.jzx.BaseScreen
ATTR_LENGTH, ATTR_START, BLACK, BLUE, BORDER_PIXELS, BRIGHT, BRIGHT_BLACK, BRIGHT_BLUE, BRIGHT_CYAN, BRIGHT_GREEN, BRIGHT_MAGENTA, BRIGHT_RED, BRIGHT_WHITE, BRIGHT_YELLOW, COLS, CYAN, FLASH, GREEN, INK, m_borderColor, m_borderDirty, m_flashPhase, m_inkTable, m_logger, m_offscreenBorder, m_offscreenBorderGraphics, m_offscreenImage, m_offscreenImageGraphics, m_paperTable, m_scale, m_screenChanged, m_screenDirty, m_screenHeight, m_screenWidth, m_spectrum, MAGENTA, PAPER, PIXEL_LENGTH, PIXEL_START, RED, ROWS, s_colorPalette, s_rgbPalette, WHITE, X_PIXELS, Y_PIXELS, YELLOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
ScreenJava1()
           
 
Method Summary
protected  void draw8(int x, int y, int pix8, int attr8)
          Draw a given byte onto the screen using the given attribute, at the given location.
protected  java.awt.Image getImage(int pix4, int attr8)
          Retrieve an Image object from the cache.
 void init(BaseSpectrum spectrum, ILogger logger)
          Allocate the image cache.
 void terminate()
          Clear and release the image map.
 
Methods inherited from class org.razvan.jzx.BaseScreen
attrTouch, clear, clear, createCompatibleImage, dumpScreenshot, endRender, flash, getCursorX, getCursorY, getInstance, getMinimumSize, getPage, getPreferredSize, load, paint, print, print, println, println, reset, screenTouch, setBorderColor, setCursor, setPage, setScale, startRender, update
 
Methods inherited from class java.awt.Canvas
addNotify, createBufferStrategy, createBufferStrategy, getAccessibleContext, getBufferStrategy
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ScreenJava1

public ScreenJava1()
Method Detail

init

public void init(BaseSpectrum spectrum,
                 ILogger logger)
Allocate the image cache.

Overrides:
init in class BaseScreen

getImage

protected java.awt.Image getImage(int pix4,
                                  int attr8)
Retrieve an Image object from the cache.

If the cache is not yet full, a new image is created, initialized and placed into the cache. Otherwise, a random image is taken out of the cache, reinitialized and replaced into the cache in a different position.


draw8

protected void draw8(int x,
                     int y,
                     int pix8,
                     int attr8)
Draw a given byte onto the screen using the given attribute, at the given location.

Specified by:
draw8 in class BaseScreen
Parameters:
x - The X coordinate where the pixels should be drawn onto the Canvas object.
y - The Y coordinat where the pixels should be drawn onto the Canvas object.
pix8 - The 8 bits to draw starting at (X,Y) ending at (X+8,Y).
attr8 - The attributes used to draw the 8 bits.

terminate

public void terminate()
Clear and release the image map.

Overrides:
terminate in class BaseScreen