ach
Interface ImgComponentIntf

All Known Implementing Classes:
ImgCanvas, ImgComponent

public interface ImgComponentIntf

ImgComponentIntf.java
Copyright (C) 2001 Helge Hackbarth, All Rights Reserved
Interface for a comfortable image display component. Current implementations: ImgCanvas (heavyweight) and ImgComponent (lightweight)
THE AUTHOR MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. THE AUTHOR SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.


Field Summary
static boolean clearBackground
          Flag if background is simply cleared or drawn with a black-and-white pattern
static boolean clearBeforePaint
          Flag if component needs to be cleared before paint.
static boolean needsFocus
          Flag if component needs to request focus (e.g. for JDK 1.0 compatibility).
 
Method Summary
 void checkFocus()
          request focus if boolean var needsFocus is set true
 void drawError(java.lang.String errorMsg)
          schedule a repaint that will draw an error messages (may contain \r\n)
 void drawImage(java.awt.Image img, int x, int y)
          schedule a repaint with drawing the given image (not scaled)
 void drawImage(java.awt.Image img, int x, int y, int width, int height, int hints)
          schedule a repaint with drawing the given image (scaled)
 void drawShapes(ShapeList sl)
          draw vector graphics objects
 void fitInImage(java.awt.Image img, java.awt.Dimension imgDim, int hints)
          schedule a repaint with an image proportionally scaled to fit in component
 boolean getDoubleBuffering()
          Retrieve current setting of double buffering mode
 java.awt.Image getOffscreen()
          Get offscreen image
 boolean imageUpdate(java.awt.Image img, int flags, int x, int y, int w, int h)
          Image component is a modified ImageObserver to retry after ABORT and to be able to chain in another ImageObserver
 void paint(java.awt.Graphics g)
          the paint method of the image component
 void resize(java.awt.Dimension d)
           
 void resize(int width, int height)
           
 void setBackground(java.awt.Color c)
           
 void setBackgroundExclusion(int x, int y, int width, int height)
          Specify the area that has to be excluded from drawing the background
 void setDoubleBuffering(boolean dblBufMode)
          Enable or disable double buffering when component is painted
 void setSize(java.awt.Dimension d)
           
 void setSize(int width, int height)
           
 void update(java.awt.Graphics g)
          the update method of the image component (calling paint()); drawing of the background is controlled by clearBeforePaint-flag
 

Field Detail

needsFocus

public static final boolean needsFocus
Flag if component needs to request focus (e.g. for JDK 1.0 compatibility).

See Also:
Constant Field Values

clearBeforePaint

public static final boolean clearBeforePaint
Flag if component needs to be cleared before paint. This class automatically draws a background pattern around the image, so usually clearing the background before painting is not necessary

See Also:
Constant Field Values

clearBackground

public static final boolean clearBackground
Flag if background is simply cleared or drawn with a black-and-white pattern

See Also:
Constant Field Values
Method Detail

setDoubleBuffering

public void setDoubleBuffering(boolean dblBufMode)
Enable or disable double buffering when component is painted

Parameters:
dblBufMode - true to enable double buffering, false otherwise

getDoubleBuffering

public boolean getDoubleBuffering()
Retrieve current setting of double buffering mode

Returns:
true if double buffering is enabled, false otherwise

getOffscreen

public java.awt.Image getOffscreen()
Get offscreen image

Returns:
image representing the current double buffer screen or null

resize

public void resize(java.awt.Dimension d)

resize

public void resize(int width,
                   int height)

setSize

public void setSize(java.awt.Dimension d)

setSize

public void setSize(int width,
                    int height)

setBackground

public void setBackground(java.awt.Color c)

setBackgroundExclusion

public void setBackgroundExclusion(int x,
                                   int y,
                                   int width,
                                   int height)
Specify the area that has to be excluded from drawing the background

Parameters:
x - the X-coordinate of the excluded area
y - the Y-coordinate of the excluded area
width - the width of the excluded area
height - the height of the excluded area

checkFocus

public void checkFocus()
request focus if boolean var needsFocus is set true


drawImage

public void drawImage(java.awt.Image img,
                      int x,
                      int y,
                      int width,
                      int height,
                      int hints)
schedule a repaint with drawing the given image (scaled)

Parameters:
img - the image to be drawn
x - the X-coordinate of the image relative to component
y - the Y-coordinate of the image relative to component
width - the scaled width of the image
height - the scaled height of the image
hints - options for scaling method, see getScaledInstance (e.g. SCALE_SMOOTH)
See Also:
Image.getScaledInstance(int width, int height, int hints)

drawImage

public void drawImage(java.awt.Image img,
                      int x,
                      int y)
schedule a repaint with drawing the given image (not scaled)

Parameters:
img - the image to be drawn
x - the X-coordinate of the image relative to component
y - the Y-coordinate of the image relative to component

fitInImage

public void fitInImage(java.awt.Image img,
                       java.awt.Dimension imgDim,
                       int hints)
schedule a repaint with an image proportionally scaled to fit in component

Parameters:
img - the image to be drawn
imgDim - the size of the image
hints - options for scaling method, see getScaledInstance (e.g. SCALE_SMOOTH)
See Also:
Image.getScaledInstance(int width, int height, int hints)

drawError

public void drawError(java.lang.String errorMsg)
schedule a repaint that will draw an error messages (may contain \r\n)

Parameters:
errorMsg - the error message

drawShapes

public void drawShapes(ShapeList sl)
draw vector graphics objects


paint

public void paint(java.awt.Graphics g)
the paint method of the image component


update

public void update(java.awt.Graphics g)
the update method of the image component (calling paint()); drawing of the background is controlled by clearBeforePaint-flag


imageUpdate

public boolean imageUpdate(java.awt.Image img,
                           int flags,
                           int x,
                           int y,
                           int w,
                           int h)
Image component is a modified ImageObserver to retry after ABORT and to be able to chain in another ImageObserver