legacy
Class VideoAdapter

java.lang.Object
  extended by legacy.VideoAdapter
All Implemented Interfaces:
VideoCodecToolkit

public abstract class VideoAdapter
extends java.lang.Object
implements VideoCodecToolkit

VideoAdapter.class VideoAdapter handles graphics and graphics device functions and prepiration. Hêbê is deigned to allow operation comparible to classical games and operates on a maximin bit resolution of 8Bits or 256 Colors. This mode operates on initial tests at over 40% faster than a 32bit resolution. in fact initial tests clocked a simple test at opertating at a peak of 1288fps (frames per second). Considering this one should have ample power to rebith classic titles on the java platform. Note. refresh rates are set to operate at 60Htz by new standard models this would be considerd 60p(Progresive) not 60i(interlaced) or 30P(Progresive) and equates to 60fps so reaching this rate would be running in excess of the actual hardwares capabilites and not recomended. In addition Verticle Syncronization (VSync) is not adheard to so operating at this limit will produce Atrifacts.

Author:
Benjamin Tarrant
See Also:
RGB

Field Summary
protected  int[] activeBufferPagePixels
          active buffer to be pushed ont to the source
protected  int bufferPageSize
          size of page buffer
protected static RGB[] lookupPallet
          Internal pallet structure holds pallet data before Initialization.
static java.lang.Object MemoryModelPalletized1Bit
          Reference Object for monochrome color pallet, required by Configuration to determin correct graphics enviroment
example
static java.lang.Object MemoryModelPalletized4Bit
          Reference Object for 16 color pallet, required by Configuration to determin correct graphics enviroment
example
static java.lang.Object MemoryModelPalletized6Bit
          Reference Object for 64 color pallet, required by Configuration to determin correct graphics enviroment
example
static java.lang.Object MemoryModelPalletized8Bit
          Reference Object for 256 color pallet, required by Configuration to determin correct graphics enviroment
example
 
Constructor Summary
protected VideoAdapter()
          VideoAdapter() is the default constructor and calls register wich must be called before any other class or method invocation.
protected VideoAdapter(int width, int height, java.lang.String standard)
          VideoAdapter(int width, int height, String standard) constucts a video standard with supplied paramiters for later use.
 
Method Summary
abstract  void clearScreen(int color)
          clearScreen(int color) clears the active video buffer to a color index
protected  void close()
          close() should be called by legacy to ensure graphics are correctly disposed of
protected static RGB[] createMemoryModel(java.lang.Object memoryModel)
          createMemoryModel prepairs the pallet for use.
protected static VideoAdapter getAdapter(int width, int height)
          getAdapter(int width, int height) caution when using this method.
 int getClosetColor(int r, int g, int b)
          Returns the closest color in the existing pallet
 int getClosetColor(RGB rgb)
          Returns the closest color in the existing pallet
abstract  int getHeight()
          getHeight() returns the height of the active VideoAdapter
 RGB getPalletIndex(int index)
          getPalletIndex(int) returns the color currently set for the pallet at index of
 int getPalletSize()
          getPalletSize() simply returns the size of the Pallet
 float getRatio()
          getRatio() returns the ratio of the resolution eg VGA has an aspect ratio or [4:3] so 480x [4:3] would equate to 480*(4/3=1.333)=640
static float getRatioFloat(java.lang.String s)
          getRatioFloat(String s) parses a ratio ie [16:9] to it ratio where [16:9] = 16/9=1.77777...8
static java.lang.String getRatioString(float r)
          getRatioString(float r) coverts a decimal fraction to a ration string where applicable
protected  VideoAdapter getRenderer()
          getRenderer() called exclusivly from within the legacy kernal to flip the page and return this Video Interface
 java.lang.String getStandard()
          getStandard() returns a
static VideoAdapter getStandardFor(int width, int height)
          getStandardFor() returns a DisplayAdapters or video mode compatible with this machine provided it matched width and height parameters
static VideoAdapter[] getStandards()
          getStandards() returns a list of DisplayAdapters or video modes compatible with this machine
abstract  int getWidth()
          getWidth() returns the width of the active VideoAdapter
 boolean isActive()
          isActive() returns weather this VideoAdaptor is active and therfore sucessfully prepaired
abstract  void putPixel(int x, int y, int color)
          putPixel(int x, int y, int color) places a pixel on the active video buffer
protected  void render()
          render() pushes the current video buffer or page into the video device
 void setPalletIndex(int index, RGB color)
          setPalletIndex(int, RGB) sets a color in this pallet at index to a specific color
 java.lang.String toString()
          Generic fucntion.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MemoryModelPalletized8Bit

public static final java.lang.Object MemoryModelPalletized8Bit
Reference Object for 256 color pallet, required by Configuration to determin correct graphics enviroment
example
                   
 public Object getVideoMemoryModel(){
      return adaptor.MemoryModelPalletized8Bit;
 }
 

See Also:
Configuration

MemoryModelPalletized6Bit

public static final java.lang.Object MemoryModelPalletized6Bit
Reference Object for 64 color pallet, required by Configuration to determin correct graphics enviroment
example
                   
 public Object getVideoMemoryModel(){
      return adaptor.MemoryModelPalletized6Bit;
 }
 

See Also:
Configuration

MemoryModelPalletized4Bit

public static final java.lang.Object MemoryModelPalletized4Bit
Reference Object for 16 color pallet, required by Configuration to determin correct graphics enviroment
example
                   
 public Object getVideoMemoryModel(){
      return adaptor.MemoryModelPalletized4Bit;
 }
 

See Also:
Configuration

MemoryModelPalletized1Bit

public static final java.lang.Object MemoryModelPalletized1Bit
Reference Object for monochrome color pallet, required by Configuration to determin correct graphics enviroment
example
                   
 public Object getVideoMemoryModel(){
      return adaptor.MemoryModelPalletized1Bit;
 }
 

See Also:
Configuration

lookupPallet

protected static RGB[] lookupPallet
Internal pallet structure holds pallet data before Initialization.


bufferPageSize

protected int bufferPageSize
size of page buffer


activeBufferPagePixels

protected int[] activeBufferPagePixels
active buffer to be pushed ont to the source

Constructor Detail

VideoAdapter

protected VideoAdapter()
VideoAdapter() is the default constructor and calls register wich must be called before any other class or method invocation. Note this is called within the Hêbê kernel.


VideoAdapter

protected VideoAdapter(int width,
                       int height,
                       java.lang.String standard)
VideoAdapter(int width, int height, String standard) constucts a video standard with supplied paramiters for later use.

Parameters:
width - scanline lenght
height - width supplied to detrmin ratio
standard - known standard name
Method Detail

getAdapter

protected static VideoAdapter getAdapter(int width,
                                         int height)
getAdapter(int width, int height) caution when using this method. this will return a valid adapter only if the VideoAdapter is not active and the height and width are valid compatible formats.
Note called exlusivly from the Hêbê kernel to instanciate the VideoAdapter.

Parameters:
width - requested width
height - requested height
Returns:
applicible adapter
See Also:
getStandards()

createMemoryModel

protected static RGB[] createMemoryModel(java.lang.Object memoryModel)
createMemoryModel prepairs the pallet for use. Sebsequent Initialize() required. Note called exlusivly from the Hêbê kernel to instanciate the VideoAdapters color functions.

Parameters:
memoryModel - refererence to acceptable model

getRenderer

protected final VideoAdapter getRenderer()
getRenderer() called exclusivly from within the legacy kernal to flip the page and return this Video Interface

Returns:
the Video Interface associated with this VideoAdapter

render

protected final void render()
render() pushes the current video buffer or page into the video device


getRatioString

public static java.lang.String getRatioString(float r)
getRatioString(float r) coverts a decimal fraction to a ration string where applicable

Parameters:
r - the decimal; fractio o parse must not be NaN
Returns:
the resulting string standard ie [4:3]

getRatioFloat

public static float getRatioFloat(java.lang.String s)
getRatioFloat(String s) parses a ratio ie [16:9] to it ratio where [16:9] = 16/9=1.77777...8

Parameters:
s - ratio to parse
Returns:
the rusilting fraction or NaN if invalid format

getWidth

public abstract int getWidth()
getWidth() returns the width of the active VideoAdapter

Returns:
width of the adapter

getHeight

public abstract int getHeight()
getHeight() returns the height of the active VideoAdapter

Returns:
height of the adapter

putPixel

public abstract void putPixel(int x,
                              int y,
                              int color)
putPixel(int x, int y, int color) places a pixel on the active video buffer

Parameters:
x - coordinate
y - coordinate
color - as pallet index

clearScreen

public abstract void clearScreen(int color)
clearScreen(int color) clears the active video buffer to a color index

Parameters:
color - as pallet index

getPalletSize

public final int getPalletSize()
getPalletSize() simply returns the size of the Pallet

Returns:
the pallet size

setPalletIndex

public final void setPalletIndex(int index,
                                 RGB color)
setPalletIndex(int, RGB) sets a color in this pallet at index to a specific color

Specified by:
setPalletIndex in interface VideoCodecToolkit
Parameters:
index - index of coloe
color - color to set

getPalletIndex

public final RGB getPalletIndex(int index)
getPalletIndex(int) returns the color currently set for the pallet at index of

Specified by:
getPalletIndex in interface VideoCodecToolkit
Parameters:
index - of color
Returns:
the RGB for a pallet index

getClosetColor

public final int getClosetColor(RGB rgb)
Returns the closest color in the existing pallet

Specified by:
getClosetColor in interface VideoCodecToolkit
Parameters:
rgb - the RGB triplet to match
Returns:
the index in this pallet of the closest color

getClosetColor

public final int getClosetColor(int r,
                                int g,
                                int b)
Returns the closest color in the existing pallet

Specified by:
getClosetColor in interface VideoCodecToolkit
Parameters:
r - Red component to match
g - Green component to match
b - Blue component to match
Returns:
the index in this pallet of the closest color

getRatio

public float getRatio()
getRatio() returns the ratio of the resolution eg VGA has an aspect ratio or [4:3] so 480x [4:3] would equate to 480*(4/3=1.333)=640

Returns:
the ratio

getStandard

public java.lang.String getStandard()
getStandard() returns a

Returns:
a name representing this standard ie
CGA [8:5]
or /
x288 [11:9]
Note this would in reality be 352x288 or CIF [11:9] which is currently unsupported

getStandards

public static VideoAdapter[] getStandards()
getStandards() returns a list of DisplayAdapters or video modes compatible with this machine

Returns:
an array of compatible DispayAdapters

getStandardFor

public static VideoAdapter getStandardFor(int width,
                                          int height)
getStandardFor() returns a DisplayAdapters or video mode compatible with this machine provided it matched width and height parameters

Parameters:
width - parameter to match
height - parameter to match
Returns:
a compatible DispayAdapter or null otherwise

isActive

public boolean isActive()
isActive() returns weather this VideoAdaptor is active and therfore sucessfully prepaired

Returns:
state of this adaptor

toString

public java.lang.String toString()
Generic fucntion.

Overrides:
toString in class java.lang.Object
Returns:
as String representation of this version
See Also:
getStandard()

close

protected void close()
close() should be called by legacy to ensure graphics are correctly disposed of