Class ThincClientCanvas

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by ThincClientCanvas
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible

public class ThincClientCanvas
extends javax.swing.JPanel

Canvas concept to draw incoming messages from network. extended from JPanel class from java.

Since:
2006
Version:
0.3
Author:
Young Jin Yoon
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
private  java.awt.image.ColorModel alphaColorModel
           
private  byte[] bgbCursor
           
private  int bgCursor
           
static int BIT_CACHE
           
private  int bpp
           
private  java.util.Hashtable[] cache
           
private  int[] cacheMask
           
private  ThincClient client
           
private  boolean clientResize
           
private  java.awt.Point currentCursor
           
private  java.awt.image.MemoryImageSource cursor
           
static java.lang.String CURSOR_NAME
           
private  java.awt.Point cursorHot
           
private  java.awt.Image cursorImage
           
private  int[] cursorIntArray
           
private  boolean cursorVisible
           
private  int depth
           
private  short fbHeight
           
private  short fbWidth
           
private  byte[] fgbCursor
           
private  int fgCursor
           
private  ThincFrame frame
           
private  ThincMsgHandler handler
           
private  int heightCursor
           
static int IMG_CACHE
           
private  java.awt.Image invCursor
           
private  boolean isARGB
           
private static int NUM_CACHE
           
static int PIX_CACHE
           
private  int[] pixels
           
private  java.awt.image.ColorModel rawColorModel
           
private  java.awt.image.MemoryImageSource rawPixel
           
private  java.awt.Image rawPixelImage
           
private  int[] rawPixelIntArray
           
private  java.nio.IntBuffer rawPixelIntBuffer
           
private  java.awt.geom.AffineTransform resized
           
private  java.awt.Graphics2D resizedGraphics
           
private  java.awt.image.BufferedImage resizedImage
           
private  java.awt.Graphics2D screenGraphics
           
private  java.awt.image.BufferedImage screenImage
           
private static long serialVersionUID
          serialVersionUID generated from compiler
private  java.awt.image.BufferedImage tile
           
private  java.awt.Rectangle tileRect
           
static int TYPE_BITMAP
           
static int TYPE_PNG
           
static int TYPE_RAW
           
static int TYPE_SCALED_BITMAP
           
static int TYPE_SCALED_RAW
           
static int TYPE_SCALED_TRANSPARENT
           
static int TYPE_TRANSPARENT
           
static int TYPE_VIDEO
           
private  java.awt.geom.AffineTransform uniform
           
private  int widthCursor
           
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
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
ThincClientCanvas(ThincClient tc)
          ThincClientCanvas creating ThincClientCanvas object. it disables focus traversal and simply put the pointer of ThincClient object into client variable.
 
Method Summary
 int argbToAbgr(int src)
          argbToAbgr() converts ARGB image to ABGR images.
 void colorChangeCursor(int fg, int bg)
          colorChangeCursor() modifies the cursor image color.
 void copyRegion(int sx, int sy, int dx, int dy, int width, int height)
          copyRegion() copies the region from the frame buffer
 void createBitMapImage(int[] imageArray, byte[] fgb, byte[] bgb, int fg, int bg, int width)
          createBitmapImage() creates the image as an int array from bitmap image information.
 void createCache(int img, int bit, int pix)
          createCache() creates the cache.
private  void createColorModel(int bpp, int depth)
          createColorModel() creates the ColorModel objects to draw frame buffer later
 void createCursor(int[] imageArray, byte[] fgb, byte[] bgb)
          createCursor() creates the cursor image as an int array if it comes as a bitmap image.
 void createCursor(int[] imageArray, byte[] fgb, byte[] bgb, int fg, int bg, int width)
          createCursor() creates the cursor image as an int array if it comes as a bitmap image
 void createCursor(int[] imageArray, java.nio.ByteBuffer bb)
          createCursor() creates a cursor image if it comes as a RGB image
 void createFrameBuffer(short w, short h, int bpp, int depth)
          createFrameBuffer() creates frame buffer from the network message from the server.
 void drawFillRect(int x, int y, int w, int h, int color)
          drawFillRect() draws a rectangle onto canvas.
 void drawFrameBuffer()
          drawFrameBuffer() draws frame buffer onto canvas. when it used, the frame buffer should be filled with setFrameBuffer methods
 void drawImage(java.nio.IntBuffer bb, int x, int y, int w, int h, int type)
          drawImage() draws the image represented as IntBuffer object.
 void drawImageScaled(java.nio.IntBuffer bb, int x, int y, int w, int h, int dst_w, int dst_h, int type)
          drawImageScaled() draws the scaled image onto canvas. it is as same as drawImage methods except scaling
 void drawThincCursor()
           
 void drawThincCursor(int x, int y)
          drawThincCursor() Actually draws imitate ThincCursor.
 void drawTile(int x, int y, int width, int height)
          drawTile() fills the region using tile defined by setTile() method.
 int getBpp()
           
 java.lang.Object getCache(int id, int type)
          getCache() gets the object from the cache.
 boolean getClientResize()
           
 int getCursorHeight()
           
 int getCursorWidth()
           
 short getFBHeight()
           
 short getFBWidth()
           
 boolean isFocusable()
          Always returns true in order to properly handle key events.
 boolean isOpaque()
          Always returns true because it should always be opaque.
 void moveThincCursor(int x, int y)
          moveThincCursor() moves the cursor to the specific location
 void paint(java.awt.Graphics g)
          paint() simply draws frame buffer onto canvas.
 void setCache(java.lang.Object contents, int id, int type)
          setCache() sets the object into cache.
 void setFrame(ThincFrame f)
          setFrame() sets the ThincFrame into frame variable.
 void setFrameBuffer(int[] bb)
          setFrameBuffer() sets the frame buffer from the latest position.
 void setListener()
          setListener() set the listener to listen any changes or interactions from user.
 void setMsgHandler(ThincMsgHandler h)
          setMsgHandler() set the ThincMsgHandler into handler variable.
 void setResized(int newWidth, int newHeight)
           
 void setThincCursor(int[] imageArray)
          setThincCursor() sets the cursor to the canvas which is generated from createThincCursor().
 void setThincCursor(int[] imageArray, int hotx, int hoty)
          setThincCursor() sets the cursor to the canvas which is generated from createThincCursor().
 void setThincCursor(int[] imageArray, int hotx, int hoty, int w, int h)
          setThincCursor() sets the cursor to the canvas which is generated from createThincCursor().
 void setTile(int x, int y, int width, int height, int[] pixels)
          setTile() sets the tile to be filled later by using drawTile() method
 void showThincCursor(boolean value)
          showThincCursor() shows or hides the cursor from the user
 void update(java.awt.Graphics g)
          update() simply invokes paint method
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
serialVersionUID generated from compiler

See Also:
Constant Field Values

CURSOR_NAME

public static final java.lang.String CURSOR_NAME
See Also:
Constant Field Values

IMG_CACHE

public static final int IMG_CACHE
See Also:
Constant Field Values

PIX_CACHE

public static final int PIX_CACHE
See Also:
Constant Field Values

BIT_CACHE

public static final int BIT_CACHE
See Also:
Constant Field Values

NUM_CACHE

private static final int NUM_CACHE
See Also:
Constant Field Values

TYPE_RAW

public static final int TYPE_RAW
See Also:
Constant Field Values

TYPE_PNG

public static final int TYPE_PNG
See Also:
Constant Field Values

TYPE_BITMAP

public static final int TYPE_BITMAP
See Also:
Constant Field Values

TYPE_TRANSPARENT

public static final int TYPE_TRANSPARENT
See Also:
Constant Field Values

TYPE_VIDEO

public static final int TYPE_VIDEO
See Also:
Constant Field Values

TYPE_SCALED_BITMAP

public static final int TYPE_SCALED_BITMAP
See Also:
Constant Field Values

TYPE_SCALED_RAW

public static final int TYPE_SCALED_RAW
See Also:
Constant Field Values

TYPE_SCALED_TRANSPARENT

public static final int TYPE_SCALED_TRANSPARENT
See Also:
Constant Field Values

client

private ThincClient client

handler

private ThincMsgHandler handler

frame

private ThincFrame frame

cache

private java.util.Hashtable[] cache

cacheMask

private int[] cacheMask

rawPixelIntArray

private int[] rawPixelIntArray

rawPixelIntBuffer

private java.nio.IntBuffer rawPixelIntBuffer

rawPixel

private java.awt.image.MemoryImageSource rawPixel

rawPixelImage

private java.awt.Image rawPixelImage

cursorIntArray

private int[] cursorIntArray

cursor

private java.awt.image.MemoryImageSource cursor

cursorImage

private java.awt.Image cursorImage

cursorHot

private java.awt.Point cursorHot

currentCursor

private java.awt.Point currentCursor

fgCursor

private int fgCursor

bgCursor

private int bgCursor

widthCursor

private int widthCursor

heightCursor

private int heightCursor

bgbCursor

private byte[] bgbCursor

fgbCursor

private byte[] fgbCursor

isARGB

private boolean isARGB

pixels

private int[] pixels

invCursor

private java.awt.Image invCursor

cursorVisible

private boolean cursorVisible

screenImage

private java.awt.image.BufferedImage screenImage

screenGraphics

private java.awt.Graphics2D screenGraphics

fbWidth

private short fbWidth

fbHeight

private short fbHeight

bpp

private int bpp

depth

private int depth

rawColorModel

private java.awt.image.ColorModel rawColorModel

alphaColorModel

private java.awt.image.ColorModel alphaColorModel

tile

private java.awt.image.BufferedImage tile

tileRect

private java.awt.Rectangle tileRect

clientResize

private boolean clientResize

resized

private java.awt.geom.AffineTransform resized

uniform

private java.awt.geom.AffineTransform uniform

resizedImage

private java.awt.image.BufferedImage resizedImage

resizedGraphics

private java.awt.Graphics2D resizedGraphics
Constructor Detail

ThincClientCanvas

public ThincClientCanvas(ThincClient tc)
ThincClientCanvas creating ThincClientCanvas object. it disables focus traversal and simply put the pointer of ThincClient object into client variable.

Parameters:
tc - ThincClient class which constructs this object
Method Detail

setMsgHandler

public void setMsgHandler(ThincMsgHandler h)
setMsgHandler() set the ThincMsgHandler into handler variable.

Parameters:
h - ThincMsgHandler object to set

setFrame

public void setFrame(ThincFrame f)
setFrame() sets the ThincFrame into frame variable.

Parameters:
f - ThincFrame object to set

setListener

public void setListener()
setListener() set the listener to listen any changes or interactions from user.


createFrameBuffer

public void createFrameBuffer(short w,
                              short h,
                              int bpp,
                              int depth)
createFrameBuffer() creates frame buffer from the network message from the server. It also creates ColorModel objects to draw frame buffer later.

Parameters:
w - width for frame buffer
h - height for frame buffer
bpp - bit per pixel for frame buffer
depth - depth for each pixel

createColorModel

private void createColorModel(int bpp,
                              int depth)
createColorModel() creates the ColorModel objects to draw frame buffer later

Parameters:
bpp - Bit per pixel of frame buffer
depth - Depth for each pixel

createCursor

public void createCursor(int[] imageArray,
                         java.nio.ByteBuffer bb)
createCursor() creates a cursor image if it comes as a RGB image

Parameters:
imageArray - target int array for cursor
bb - ByteBuffer object which contains RGB image for cursor

createCursor

public void createCursor(int[] imageArray,
                         byte[] fgb,
                         byte[] bgb,
                         int fg,
                         int bg,
                         int width)
createCursor() creates the cursor image as an int array if it comes as a bitmap image

Parameters:
imageArray - target int array for cursor
fgb - byte array which contains bitmap image for foreground
bgb - byte array which contains bitmap image for background
fg - color information for foreground
bg - color information for background
width - width for cursor

createCursor

public void createCursor(int[] imageArray,
                         byte[] fgb,
                         byte[] bgb)
createCursor() creates the cursor image as an int array if it comes as a bitmap image. this method is used when modifying the cursor into different images.

Parameters:
imageArray - target int array for cursor
fgb - byte array which contains bitmap image for foreground
bgb - byte array which contains bitmap image for background

colorChangeCursor

public void colorChangeCursor(int fg,
                              int bg)
colorChangeCursor() modifies the cursor image color.

Parameters:
fg - color information for foreground
bg - color information for background

createBitMapImage

public void createBitMapImage(int[] imageArray,
                              byte[] fgb,
                              byte[] bgb,
                              int fg,
                              int bg,
                              int width)
createBitmapImage() creates the image as an int array from bitmap image information.

Parameters:
imageArray - target int array for cursor
fgb - byte array which contains bitmap image for foreground
bgb - byte array which contains bitmap image for background
fg - color information for foreground
bg - color information for background
width - width for cursor

setThincCursor

public void setThincCursor(int[] imageArray,
                           int hotx,
                           int hoty)
setThincCursor() sets the cursor to the canvas which is generated from createThincCursor(). used when cursor is changed after initialization.

Parameters:
imageArray - image array generated from createThincCursor()
hotx - hot x coordinate in cursor(ex> 0 for normal arrow cursor)
hoty - hot y coordinate in cursor(ex> 0 for normal arrow cursor)

setThincCursor

public void setThincCursor(int[] imageArray)
setThincCursor() sets the cursor to the canvas which is generated from createThincCursor(). used when cursor is changed after initialization.

Parameters:
imageArray - image array generated from createThincCursor()

setThincCursor

public void setThincCursor(int[] imageArray,
                           int hotx,
                           int hoty,
                           int w,
                           int h)
setThincCursor() sets the cursor to the canvas which is generated from createThincCursor(). used when it wants to initialize the cursor.

Parameters:
imageArray - image array generated from createThincCursor()
hotx - hot x coordinate in cursor(ex> 0 for normal arrow cursor)
hoty - hot y coordinate in cursor(ex> 0 for normal arrow cursor)
w - width for cursor
h - height for cursor

showThincCursor

public void showThincCursor(boolean value)
showThincCursor() shows or hides the cursor from the user

Parameters:
value - true for show, false for hide

moveThincCursor

public void moveThincCursor(int x,
                            int y)
                     throws ThincException
moveThincCursor() moves the cursor to the specific location

Parameters:
x - x coordinate to move
y - y coordinate to move
Throws:
ThincException

drawThincCursor

public void drawThincCursor(int x,
                            int y)
drawThincCursor() Actually draws imitate ThincCursor.

Parameters:
x - x coordinate to draw
y - y coordinate to draw

drawThincCursor

public void drawThincCursor()

setFrameBuffer

public void setFrameBuffer(int[] bb)
setFrameBuffer() sets the frame buffer from the latest position.

Parameters:
bb - images to fill in

drawFrameBuffer

public void drawFrameBuffer()
drawFrameBuffer() draws frame buffer onto canvas. when it used, the frame buffer should be filled with setFrameBuffer methods


drawFillRect

public void drawFillRect(int x,
                         int y,
                         int w,
                         int h,
                         int color)
drawFillRect() draws a rectangle onto canvas.

Parameters:
x - x coordinate for rectangle
y - y coordinate for rectangle
w - width for rectangle
h - height for rectangle
color - color for rectangle

drawImage

public void drawImage(java.nio.IntBuffer bb,
                      int x,
                      int y,
                      int w,
                      int h,
                      int type)
               throws ThincException
drawImage() draws the image represented as IntBuffer object.

Parameters:
bb - IntBuffer object which contains the image
x - x coordinates to draw
y - y coordinates to draw
w - width to draw
h - height to draw
type - type to draw - TYPE_RAW, TYPE_PNG, TYPE_BITMAP, and TYPE_TRANSPARENT
Throws:
ThincException

drawImageScaled

public void drawImageScaled(java.nio.IntBuffer bb,
                            int x,
                            int y,
                            int w,
                            int h,
                            int dst_w,
                            int dst_h,
                            int type)
                     throws ThincException
drawImageScaled() draws the scaled image onto canvas. it is as same as drawImage methods except scaling

Parameters:
bb - IntBuffer object which contains the image
x - x coordinates to draw
y - y coordinates to draw
w - original width to draw
h - original height to draw
dst_w - resized width to draw
dst_h - resized height to draw
type - type to draw - TYPE_CIDEO, TYPE_SCALED_RAW, TYPE_SCALED_BITMAP, and TYPE_SCALED_TRANSPARENT
Throws:
ThincException

copyRegion

public void copyRegion(int sx,
                       int sy,
                       int dx,
                       int dy,
                       int width,
                       int height)
copyRegion() copies the region from the frame buffer

Parameters:
sx - source x coordinates
sy - source y coordinates
dx - destination x coordinates
dy - destination y coordinates
width - width for region
height - height for region

setTile

public void setTile(int x,
                    int y,
                    int width,
                    int height,
                    int[] pixels)
setTile() sets the tile to be filled later by using drawTile() method

Parameters:
x - x coordinates for tile
y - y coordinates for tile
width - width for tile
height - height for tile
pixels - int array to create the tile

drawTile

public void drawTile(int x,
                     int y,
                     int width,
                     int height)
drawTile() fills the region using tile defined by setTile() method.

Parameters:
x - x coordinates to be filled with
y - y coordinates to be filled with
width - width to be filled with
height - height to be filled with

createCache

public void createCache(int img,
                        int bit,
                        int pix)
createCache() creates the cache.

Parameters:
img - number of image cache. total number of slot in cache should be the power of 2
bit - number of bitmap cache. total number of slot in cache should be the power of 2
pix - number of pixmap cache. total number of slot in cache should be the power of 2

getCache

public java.lang.Object getCache(int id,
                                 int type)
                          throws ThincException
getCache() gets the object from the cache.

Parameters:
id - identifier to get an object
type - cache type - IMG_CACHE, BIT_CACHE, and PIX_CACHE
Returns:
object refered by id and type
Throws:
java.lang.Exception
ThincException

setCache

public void setCache(java.lang.Object contents,
                     int id,
                     int type)
              throws ThincException
setCache() sets the object into cache.

Parameters:
contents - actual object to be contained
id - id to be refered
type - cache type - IMG_CACHE, BIT_CACHE, and PIX_CACHE
Throws:
java.lang.Exception
ThincException

argbToAbgr

public int argbToAbgr(int src)
argbToAbgr() converts ARGB image to ABGR images.

Parameters:
src - source ARGB pixel
Returns:
ABGR image pixel

setResized

public void setResized(int newWidth,
                       int newHeight)

getBpp

public int getBpp()

getFBHeight

public short getFBHeight()

getFBWidth

public short getFBWidth()

getClientResize

public boolean getClientResize()

getCursorHeight

public int getCursorHeight()

getCursorWidth

public int getCursorWidth()

paint

public void paint(java.awt.Graphics g)
paint() simply draws frame buffer onto canvas.

Overrides:
paint in class javax.swing.JComponent

update

public void update(java.awt.Graphics g)
update() simply invokes paint method

Overrides:
update in class javax.swing.JComponent

isOpaque

public boolean isOpaque()
Always returns true because it should always be opaque.

Overrides:
isOpaque in class javax.swing.JComponent
Returns:
true

isFocusable

public boolean isFocusable()
Always returns true in order to properly handle key events.

Overrides:
isFocusable in class java.awt.Component
Returns:
true