|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--javax.swing.JComponent | +--com.vistech.imageviewer.ImageCanvas
A canvas class for displaying images. It can display the AWT Image as well as the BufferedImage objects.
Inner classes inherited from class javax.swing.JComponent |
javax.swing.JComponent.AccessibleJComponent |
Inner classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
Inner classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent |
Field Summary | |
java.awt.image.BufferedImage |
bufferedImage
|
protected java.awt.Shape |
clipShape
|
protected java.awt.Graphics2D |
dispGc
|
java.awt.image.BufferedImage |
displayImage
|
protected int |
displayMode
|
protected int |
flipMode
|
protected int |
height
|
protected int |
imageHeight
|
protected int |
imageType
|
protected int |
imageWidth
|
protected boolean |
invertOn
|
protected java.awt.Graphics2D |
offScrGc
|
java.awt.image.BufferedImage |
offScrImage
|
protected int |
originalImageType
|
protected boolean |
paintFlag
|
protected static int |
PRINT_SIZE_ACTUAL
|
protected static int |
PRINT_SIZE_PAGE
|
protected java.awt.Point |
printLoc
|
protected int |
printMode
|
protected java.awt.Dimension |
printSize
|
protected int |
width
|
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 com.vistech.imageviewer.ImageDisplay |
TYPE_AWT_IMAGE, TYPE_BUFFERED_IMAGE |
Fields inherited from interface java.awt.print.Printable |
NO_SUCH_PAGE, PAGE_EXISTS |
Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
ImageCanvas()
|
Method Summary | |
void |
addImageSentListener(ImageSentListener p)
|
void |
clearImageCanvas()
Clears the image canvas. |
static java.awt.Image |
convertToAWTImage(java.awt.image.BufferedImage bufImage)
|
static java.awt.image.BufferedImage |
convertToBufferedImage(java.awt.Image img,
int wid,
int ht,
int type)
|
protected void |
createDisplayImage()
Creates the offScreen image. |
protected boolean |
doDisplayModeAndFlip(int imWid,
int imHt)
Applies the current display mode and flip mode settings to the displayed image. |
static boolean |
doFlip(java.awt.image.BufferedImage img,
java.awt.Graphics gc,
int flipMode,
int dx1,
int dy1,
int dx2,
int dy2,
int sx1,
int sy1,
int sx2,
int sy2)
Flips a buffered image. |
static boolean |
doFlip(java.awt.Image img,
java.awt.Graphics gc,
int flipMode,
int dx1,
int dy1,
int dx2,
int dy2,
int sx1,
int sy1,
int sx2,
int sy2)
Flips an AWT image. |
void |
draw(java.awt.Shape shape)
Draws the specified shape on the destination image |
java.awt.Dimension |
drawingDim()
|
protected void |
fireImageSentEvents(java.awt.image.BufferedImage img)
|
java.awt.Image |
getAWTImage()
Returns the image property. |
java.awt.image.BufferedImage |
getBufferedImage()
Returns the BufferedImage property. |
java.awt.image.BufferedImage |
getDisplayedImage()
Returns the image displayed on the canvas. |
java.awt.Graphics2D |
getDisplayedImageGC()
|
int |
getDisplayMode()
Returns the display mode. |
int |
getFlipMode()
Returns the flip mode. |
java.awt.Dimension |
getImageSize()
Returns the image size. |
int |
getImageType()
Returns the image type property. |
boolean |
getInvert()
Returns the invert mode. |
java.awt.image.BufferedImage |
getOffScreenImage()
Returns the off screen image. |
java.awt.Dimension |
getPreferredSize()
|
java.awt.Point |
getPrintLocation()
Returns the ULHC of the print location. |
java.awt.Dimension |
getPrintSize()
Returns the print size. |
boolean |
imageUpdate(java.awt.Image img,
int infoflags,
int x,
int y,
int wid,
int ht)
|
protected void |
init()
|
void |
invert(boolean on)
Inverts and image. |
static void |
main(java.lang.String[] args)
|
void |
paintComponent(java.awt.Graphics gc)
|
boolean |
paintImage()
Paints the currently set image. |
int |
print(java.awt.Graphics g,
java.awt.print.PageFormat f,
int pageIndex)
|
void |
printImage(java.awt.Graphics2D g2d)
Prints the image(s)drawn on the input graphics context. |
protected void |
redraw()
creates a new off screen image and then redraws the current image over it. |
void |
removeImageSentListener(ImageSentListener p)
|
void |
reset()
Paints the currently displayed image again with currently set display and flip modes |
void |
setAWTImage(java.awt.Image image)
Sets the image property. |
void |
setBufferedImage(java.awt.image.BufferedImage bimage)
Sets the BufferedImage property. |
void |
setClip(java.awt.Shape clip)
Sets the clip shape on the destination image |
void |
setDisplayImage(java.awt.image.BufferedImage image)
Sets the image to be displayed on the canvas. |
void |
setDisplayMode(int mode)
Sets the display mode. |
void |
setFlipMode(int mode)
Sets the flip mode. |
void |
setImageType(int imageType)
Sets the image type property. |
void |
setInvert(boolean onOrOff)
Sets the invert mode property. |
void |
setOffScreenImage(java.awt.image.BufferedImage image)
Sets the off screen image. |
protected void |
setOffScrGc()
Sets off screen Graphics. |
void |
setPrintLocation(java.awt.Point d)
Sets the ULHC location at which the printing starts. |
void |
setPrintSize(java.awt.Dimension d)
Sets the size of the print. |
Methods inherited from class javax.swing.JComponent |
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getUIClassID, getVerifyInputWhenFocusTarget, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, hide, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processFocusEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI |
Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setLayout, validate, validateTree |
Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.vistech.imageviewer.ImageDisplay |
addMouseListener, addMouseMotionListener, addPropertyChangeListener, addVetoableChangeListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removeVetoableChangeListener, setCursor |
Field Detail |
protected static final int PRINT_SIZE_PAGE
protected static final int PRINT_SIZE_ACTUAL
protected int printMode
protected int originalImageType
public transient java.awt.image.BufferedImage bufferedImage
public transient java.awt.image.BufferedImage offScrImage
public transient java.awt.image.BufferedImage displayImage
protected transient java.awt.Graphics2D offScrGc
protected transient java.awt.Graphics2D dispGc
protected java.awt.Point printLoc
protected java.awt.Dimension printSize
protected int width
protected int height
protected int imageWidth
protected int imageHeight
protected int displayMode
protected int flipMode
protected int imageType
protected java.awt.Shape clipShape
protected boolean invertOn
protected boolean paintFlag
Constructor Detail |
public ImageCanvas()
Method Detail |
protected void init()
public java.awt.Dimension getPreferredSize()
getPreferredSize
in class javax.swing.JComponent
public void setAWTImage(java.awt.Image image)
ImageDisplay
setAWTImage
in interface ImageDisplay
com.vistech.imageviewer.ImageDisplay
image
- the image objectpublic java.awt.Image getAWTImage()
ImageDisplay
getAWTImage
in interface ImageDisplay
com.vistech.imageviewer.ImageDisplay
public void setBufferedImage(java.awt.image.BufferedImage bimage)
ImageDisplay
setBufferedImage
in interface ImageDisplay
com.vistech.imageviewer.ImageDisplay
BufferedImage
- the image objectpublic java.awt.image.BufferedImage getBufferedImage()
ImageDisplay
getBufferedImage
in interface ImageDisplay
com.vistech.imageviewer.ImageDisplay
public java.awt.Dimension getImageSize()
ImageDisplay
getImageSize
in interface ImageDisplay
com.vistech.imageviewer.ImageDisplay
public static java.awt.image.BufferedImage convertToBufferedImage(java.awt.Image img, int wid, int ht, int type)
public static java.awt.Image convertToAWTImage(java.awt.image.BufferedImage bufImage)
public void setOffScreenImage(java.awt.image.BufferedImage image)
ImageDisplay
setOffScreenImage
in interface ImageDisplay
com.vistech.imageviewer.ImageDisplay
image
- the off screen image.public java.awt.image.BufferedImage getOffScreenImage()
ImageDisplay
getOffScreenImage
in interface ImageDisplay
com.vistech.imageviewer.ImageDisplay
public void setDisplayImage(java.awt.image.BufferedImage image)
ImageDisplay
setDisplayImage
in interface ImageDisplay
com.vistech.imageviewer.ImageDisplay
image
- the image to be displayed.public java.awt.image.BufferedImage getDisplayedImage()
ImageDisplay
getDisplayedImage
in interface ImageDisplay
com.vistech.imageviewer.ImageDisplay
public java.awt.Graphics2D getDisplayedImageGC()
public void setImageType(int imageType)
ImageDisplay
setImageType
in interface ImageDisplay
com.vistech.imageviewer.ImageDisplay
imageType
- the image type.public int getImageType()
ImageDisplay
getImageType
in interface ImageDisplay
com.vistech.imageviewer.ImageDisplay
public void setDisplayMode(int mode)
ImageDisplay
setDisplayMode
in interface ImageDisplay
com.vistech.imageviewer.ImageDisplay
dispMode
- the display modepublic int getDisplayMode()
ImageDisplay
getDisplayMode
in interface ImageDisplay
com.vistech.imageviewer.ImageDisplay
public void setFlipMode(int mode)
ImageDisplay
setFlipMode
in interface ImageDisplay
com.vistech.imageviewer.ImageDisplay
flipMode
- the flip modepublic int getFlipMode()
ImageDisplay
getFlipMode
in interface ImageDisplay
com.vistech.imageviewer.ImageDisplay
public void setInvert(boolean onOrOff)
ImageDisplay
setInvert
in interface ImageDisplay
com.vistech.imageviewer.ImageDisplay
onOrOff
- the invert mode.public boolean getInvert()
ImageDisplay
getInvert
in interface ImageDisplay
com.vistech.imageviewer.ImageDisplay
protected void createDisplayImage()
protected void setOffScrGc()
public java.awt.Dimension drawingDim()
public boolean paintImage()
paintImage
in interface ImageDisplay
protected boolean doDisplayModeAndFlip(int imWid, int imHt)
imWid
- the image width.imHt
- the image height.public static boolean doFlip(java.awt.Image img, java.awt.Graphics gc, int flipMode, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2)
img
- the image to be flipped.@see FlipModegc
- the graphics context.flipMode
- the orientation of the flip.dx1
- the x coordinate of the first corner of the destination image.dy1
- the y coordinate of the first corner of the destination image.dx2
- the x coordinate of the second corner of the destination image.dy2
- the y coordinate of the second corner of the destination image.dx1
- the x coordinate of the first corner of the source image.dy1
- the y coordinate of the first corner of the source image.dx2
- the x coordinate of the second corner of the source image.dy2
- the y coordinate of the second corner of the source image.public static boolean doFlip(java.awt.image.BufferedImage img, java.awt.Graphics gc, int flipMode, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2)
img
- the image to be flipped.@see FlipModegc
- the graphics context.flipMode
- the orientation of the flip.dx1
- the x coordinate of the first corner of the destination image.dy1
- the y coordinate of the first corner of the destination image.dx2
- the x coordinate of the second corner of the destination image.dy2
- the y coordinate of the second corner of the destination image.dx1
- the x coordinate of the first corner of the source image.dy1
- the y coordinate of the first corner of the source image.dx2
- the x coordinate of the second corner of the source image.dy2
- the y coordinate of the second corner of the source image.public void invert(boolean on)
on
- If true, inverts the currently displayed image, else redraws
the current image. Set the input to true to invert the image. Set the input
to false to revert to the normal display mode.public void setClip(java.awt.Shape clip)
ImageDisplay
setClip
in interface ImageDisplay
com.vistech.imageviewer.ImageDisplay
clipshape
- the shape of the clipping areapublic void draw(java.awt.Shape shape)
ImageDisplay
draw
in interface ImageDisplay
com.vistech.imageviewer.ImageDisplay
shape
- the shape to be drawnpublic boolean imageUpdate(java.awt.Image img, int infoflags, int x, int y, int wid, int ht)
imageUpdate
in class java.awt.Component
public void setPrintLocation(java.awt.Point d)
ImagePrint
setPrintLocation
in interface ImagePrint
com.vistech.imageviewer.ImagePrint
d
- the ULHC location.public java.awt.Point getPrintLocation()
ImagePrint
getPrintLocation
in interface ImagePrint
com.vistech.imageviewer.ImagePrint
public void setPrintSize(java.awt.Dimension d)
ImagePrint
setPrintSize
in interface ImagePrint
com.vistech.imageviewer.ImagePrint
d
- the print size.public java.awt.Dimension getPrintSize()
ImagePrint
getPrintSize
in interface ImagePrint
com.vistech.imageviewer.ImagePrint
public int print(java.awt.Graphics g, java.awt.print.PageFormat f, int pageIndex)
print
in interface java.awt.print.Printable
public void printImage(java.awt.Graphics2D g2d)
ImagePrint
printImage
in interface ImagePrint
com.vistech.imageviewer.ImagePrint
g
- the graphics context over which images are drawn.public void paintComponent(java.awt.Graphics gc)
paintComponent
in class javax.swing.JComponent
protected void redraw()
public void reset()
public void clearImageCanvas()
public void addImageSentListener(ImageSentListener p)
public void removeImageSentListener(ImageSentListener p)
protected void fireImageSentEvents(java.awt.image.BufferedImage img)
public static void main(java.lang.String[] args)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |