|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
ThincClientCanvas
public class ThincClientCanvas
Canvas concept to draw incoming messages from network. extended from JPanel class from java.
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 |
---|
private static final long serialVersionUID
public static final java.lang.String CURSOR_NAME
public static final int IMG_CACHE
public static final int PIX_CACHE
public static final int BIT_CACHE
private static final int NUM_CACHE
public static final int TYPE_RAW
public static final int TYPE_PNG
public static final int TYPE_BITMAP
public static final int TYPE_TRANSPARENT
public static final int TYPE_VIDEO
public static final int TYPE_SCALED_BITMAP
public static final int TYPE_SCALED_RAW
public static final int TYPE_SCALED_TRANSPARENT
private ThincClient client
private ThincMsgHandler handler
private ThincFrame frame
private java.util.Hashtable[] cache
private int[] cacheMask
private int[] rawPixelIntArray
private java.nio.IntBuffer rawPixelIntBuffer
private java.awt.image.MemoryImageSource rawPixel
private java.awt.Image rawPixelImage
private int[] cursorIntArray
private java.awt.image.MemoryImageSource cursor
private java.awt.Image cursorImage
private java.awt.Point cursorHot
private java.awt.Point currentCursor
private int fgCursor
private int bgCursor
private int widthCursor
private int heightCursor
private byte[] bgbCursor
private byte[] fgbCursor
private boolean isARGB
private int[] pixels
private java.awt.Image invCursor
private boolean cursorVisible
private java.awt.image.BufferedImage screenImage
private java.awt.Graphics2D screenGraphics
private short fbWidth
private short fbHeight
private int bpp
private int depth
private java.awt.image.ColorModel rawColorModel
private java.awt.image.ColorModel alphaColorModel
private java.awt.image.BufferedImage tile
private java.awt.Rectangle tileRect
private boolean clientResize
private java.awt.geom.AffineTransform resized
private java.awt.geom.AffineTransform uniform
private java.awt.image.BufferedImage resizedImage
private java.awt.Graphics2D resizedGraphics
Constructor Detail |
---|
public ThincClientCanvas(ThincClient tc)
tc
- ThincClient class which constructs this objectMethod Detail |
---|
public void setMsgHandler(ThincMsgHandler h)
h
- ThincMsgHandler object to setpublic void setFrame(ThincFrame f)
f
- ThincFrame object to setpublic void setListener()
public void createFrameBuffer(short w, short h, int bpp, int depth)
w
- width for frame bufferh
- height for frame bufferbpp
- bit per pixel for frame bufferdepth
- depth for each pixelprivate void createColorModel(int bpp, int depth)
bpp
- Bit per pixel of frame bufferdepth
- Depth for each pixelpublic void createCursor(int[] imageArray, java.nio.ByteBuffer bb)
imageArray
- target int array for cursorbb
- ByteBuffer object which contains RGB image for cursorpublic void createCursor(int[] imageArray, byte[] fgb, byte[] bgb, int fg, int bg, int width)
imageArray
- target int array for cursorfgb
- byte array which contains bitmap image for foregroundbgb
- byte array which contains bitmap image for backgroundfg
- color information for foregroundbg
- color information for backgroundwidth
- width for cursorpublic void createCursor(int[] imageArray, byte[] fgb, byte[] bgb)
imageArray
- target int array for cursorfgb
- byte array which contains bitmap image for foregroundbgb
- byte array which contains bitmap image for backgroundpublic void colorChangeCursor(int fg, int bg)
fg
- color information for foregroundbg
- color information for backgroundpublic void createBitMapImage(int[] imageArray, byte[] fgb, byte[] bgb, int fg, int bg, int width)
imageArray
- target int array for cursorfgb
- byte array which contains bitmap image for foregroundbgb
- byte array which contains bitmap image for backgroundfg
- color information for foregroundbg
- color information for backgroundwidth
- width for cursorpublic void setThincCursor(int[] imageArray, int hotx, int hoty)
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)public void setThincCursor(int[] imageArray)
imageArray
- image array generated from createThincCursor()public void setThincCursor(int[] imageArray, int hotx, int hoty, int w, int h)
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 cursorh
- height for cursorpublic void showThincCursor(boolean value)
value
- true for show, false for hidepublic void moveThincCursor(int x, int y) throws ThincException
x
- x coordinate to movey
- y coordinate to move
ThincException
public void drawThincCursor(int x, int y)
x
- x coordinate to drawy
- y coordinate to drawpublic void drawThincCursor()
public void setFrameBuffer(int[] bb)
bb
- images to fill inpublic void drawFrameBuffer()
public void drawFillRect(int x, int y, int w, int h, int color)
x
- x coordinate for rectangley
- y coordinate for rectanglew
- width for rectangleh
- height for rectanglecolor
- color for rectanglepublic void drawImage(java.nio.IntBuffer bb, int x, int y, int w, int h, int type) throws ThincException
bb
- IntBuffer object which contains the imagex
- x coordinates to drawy
- y coordinates to draww
- width to drawh
- height to drawtype
- type to draw - TYPE_RAW, TYPE_PNG, TYPE_BITMAP, and TYPE_TRANSPARENT
ThincException
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
bb
- IntBuffer object which contains the imagex
- x coordinates to drawy
- y coordinates to draww
- original width to drawh
- original height to drawdst_w
- resized width to drawdst_h
- resized height to drawtype
- type to draw - TYPE_CIDEO, TYPE_SCALED_RAW, TYPE_SCALED_BITMAP, and TYPE_SCALED_TRANSPARENT
ThincException
public void copyRegion(int sx, int sy, int dx, int dy, int width, int height)
sx
- source x coordinatessy
- source y coordinatesdx
- destination x coordinatesdy
- destination y coordinateswidth
- width for regionheight
- height for regionpublic void setTile(int x, int y, int width, int height, int[] pixels)
x
- x coordinates for tiley
- y coordinates for tilewidth
- width for tileheight
- height for tilepixels
- int array to create the tilepublic void drawTile(int x, int y, int width, int height)
x
- x coordinates to be filled withy
- y coordinates to be filled withwidth
- width to be filled withheight
- height to be filled withpublic void createCache(int img, int bit, int pix)
img
- number of image cache. total number of slot in cache should be the power of 2bit
- number of bitmap cache. total number of slot in cache should be the power of 2pix
- number of pixmap cache. total number of slot in cache should be the power of 2public java.lang.Object getCache(int id, int type) throws ThincException
id
- identifier to get an objecttype
- cache type - IMG_CACHE, BIT_CACHE, and PIX_CACHE
java.lang.Exception
ThincException
public void setCache(java.lang.Object contents, int id, int type) throws ThincException
contents
- actual object to be containedid
- id to be referedtype
- cache type - IMG_CACHE, BIT_CACHE, and PIX_CACHE
java.lang.Exception
ThincException
public int argbToAbgr(int src)
src
- source ARGB pixel
public void setResized(int newWidth, int newHeight)
public int getBpp()
public short getFBHeight()
public short getFBWidth()
public boolean getClientResize()
public int getCursorHeight()
public int getCursorWidth()
public void paint(java.awt.Graphics g)
paint
in class javax.swing.JComponent
public void update(java.awt.Graphics g)
update
in class javax.swing.JComponent
public boolean isOpaque()
isOpaque
in class javax.swing.JComponent
public boolean isFocusable()
isFocusable
in class java.awt.Component
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |