jfig.objects
Class FigImage

java.lang.Object
  extended byjfig.objects.FigBaseobject
      extended byjfig.objects.FigRectangle
          extended byjfig.objects.FigImage
All Implemented Interfaces:
FigDrawable, FigObject, java.awt.image.ImageObserver
Direct Known Subclasses:
ImageObject

public class FigImage
extends FigRectangle
implements java.awt.image.ImageObserver

embedded (GIF/JPEG/XBM) image object.

This class represents embedded image objects, realized as a subclass of FigRectangle with a reference to a java.awt.Image object. As for all other objects, the reference point for a FigImage is the top left corner.

Due to the usage of java.awt.Image, not all image formats supported by xfig can be displayed in jfig. Currently, only XBM, GIF, and JPEG images are supported on all platforms, while TIFF, PNG, and EPS/Postscript are not.

FigImage objects will react to 'mirror x/y' command with corresponding coordinate changes. The image, however, will not be mirrored but only be moved.

See Also:
Image

Field Summary
protected  int aspectRatio
           
protected  java.lang.String filetype
           
static int FIT_TO_HEIGHT
           
static int FIT_TO_WIDTH
           
(package private)  boolean has_error
           
(package private)  boolean imageUpdateDebug
           
static int KEEP_SELECTED_SIZE
           
protected  java.lang.String name
           
protected  java.lang.String pathname
           
(package private)  int sx1
           
(package private)  int sx2
           
(package private)  int sy1
           
(package private)  int sy2
           
protected  FullRedraw theCanvas
           
protected  java.awt.Image theImage
           
protected  java.awt.image.ImageObserver theObserver
           
 
Fields inherited from class jfig.objects.FigRectangle
pixel_width, radius, renderer, use_rounded_corners
 
Fields inherited from class jfig.objects.FigBaseobject
attribs, bbox, comment, debug, painter, printer, sc_bbox, sc_bbox_timestamp, selected, showPoints, syncRedrawFlag, timestamp, trafo, visible, x, y
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
FigImage()
          construct a so-far empty image
FigImage(int x1, int y1, int x2, int y2, FigAttribs attribs, FigTrafo2D trafo, java.lang.String imageName)
          The FigImage constructor with full parameter set: (x1,y1) and (x2,y2) specify the image position (and size), attribs and trafo are the FigImage attributes and trafo is a reference to the current editor viewport transformation.
 
Method Summary
 FigObject copy()
          make a copy of this object and return the reference to the copy.
 void createRenderer()
           
 java.awt.Image getImage()
           
 void getImageFromResource(java.lang.String name)
           
 java.lang.String getImageName()
           
 boolean imageUpdate(java.awt.Image img, int flags, int x, int y, int width, int height)
           
 void paint(java.awt.Graphics g)
          the paint() method
 void paint(java.awt.Graphics g, FigTrafo2D trafo)
          paint this object using the specified transformation and Graphics g
 void rebuild()
          as we store our coordinates directly as the bounding box coords, we have nothing to do here except to tell our renderer.
 void setFilenameAndType(java.lang.String pathname, java.lang.String filetype)
           
 void setImage(java.awt.Image image)
           
 void setImage(java.lang.String name, boolean preserve_aspect)
           
 void setImageAndFilename(java.lang.String name, java.lang.String pathname, java.lang.String filetype, boolean preserve_aspect)
           
 void setImageName(java.lang.String name)
           
 void setObjectPainter(ObjectPainter canvas)
          set the ObjectPainter responsible for drawing this FigBaseobject
 void setRedraw(FullRedraw canvas)
           
 java.lang.String toString()
          toString() for debug purposes.
 void updateAspectRatio(int aspectRatio)
           
 
Methods inherited from class jfig.objects.FigRectangle
appendPoint, canRotate, deletePoint, getMovePointNeighbors, getNearestPoint, getNeighborPoints, getPoints, insertPoint, isClosed, isRounded, minDistance, minDistanceEuclid, mirrorX, mirrorY, move, movePoint, paintSave, setAttributes, setFillColor, setFillStyle, setLayer, setLineColor, setLineStyle, setLineWidth, setPoints, supportsPointOps, update
 
Methods inherited from class jfig.objects.FigBaseobject
build_sc_bbox, clonePoints, deselect, get_sc_bbox, getAttributes, getBbox, getComment, getLayer, getPosition, getSyncRedrawFlag, getText, getTimestamp, getTrafo, initialize, isSelected, isShowPoints, isVisible, isVisible, keyPressed, manhattan, message, numPoints, reset_debug, rotate, scale, select, set_debug, setComment, setConsole, setSyncRedrawFlag, setText, setTrafo, setVisible, showPoints, updateAttributes, writeAsResource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

name

protected java.lang.String name

theImage

protected java.awt.Image theImage

aspectRatio

protected int aspectRatio

theCanvas

protected FullRedraw theCanvas

theObserver

protected java.awt.image.ImageObserver theObserver

sx1

int sx1

sy1

int sy1

sx2

int sx2

sy2

int sy2

has_error

boolean has_error

imageUpdateDebug

boolean imageUpdateDebug

pathname

protected java.lang.String pathname

filetype

protected java.lang.String filetype

FIT_TO_WIDTH

public static final int FIT_TO_WIDTH
See Also:
Constant Field Values

FIT_TO_HEIGHT

public static final int FIT_TO_HEIGHT
See Also:
Constant Field Values

KEEP_SELECTED_SIZE

public static final int KEEP_SELECTED_SIZE
See Also:
Constant Field Values
Constructor Detail

FigImage

public FigImage(int x1,
                int y1,
                int x2,
                int y2,
                FigAttribs attribs,
                FigTrafo2D trafo,
                java.lang.String imageName)
The FigImage constructor with full parameter set: (x1,y1) and (x2,y2) specify the image position (and size), attribs and trafo are the FigImage attributes and trafo is a reference to the current editor viewport transformation.

The paint() method for the FigImage relies on the Java AWT. Therefore, only GIF and JPEG images are supported by now. Other images won't be loaded and displayed, but still we create the object and display the bounding box.

Note that the java.AWT functions load Images asynchronously!

Parameters:
imageName - The URL-name (or pathname) for the Image to load.

FigImage

public FigImage()
construct a so-far empty image

Method Detail

rebuild

public void rebuild()
Description copied from class: FigRectangle
as we store our coordinates directly as the bounding box coords, we have nothing to do here except to tell our renderer.

Specified by:
rebuild in interface FigObject
Overrides:
rebuild in class FigRectangle

createRenderer

public void createRenderer()
Overrides:
createRenderer in class FigRectangle

getImageName

public java.lang.String getImageName()

setFilenameAndType

public void setFilenameAndType(java.lang.String pathname,
                               java.lang.String filetype)

getImageFromResource

public void getImageFromResource(java.lang.String name)

setImage

public void setImage(java.lang.String name,
                     boolean preserve_aspect)

setImageName

public void setImageName(java.lang.String name)

setImageAndFilename

public void setImageAndFilename(java.lang.String name,
                                java.lang.String pathname,
                                java.lang.String filetype,
                                boolean preserve_aspect)

setImage

public void setImage(java.awt.Image image)

getImage

public java.awt.Image getImage()

setObjectPainter

public void setObjectPainter(ObjectPainter canvas)
Description copied from class: FigBaseobject
set the ObjectPainter responsible for drawing this FigBaseobject

Specified by:
setObjectPainter in interface FigObject
Overrides:
setObjectPainter in class FigBaseobject

updateAspectRatio

public void updateAspectRatio(int aspectRatio)

copy

public FigObject copy()
Description copied from class: FigRectangle
make a copy of this object and return the reference to the copy.

Specified by:
copy in interface FigObject
Overrides:
copy in class FigRectangle

paint

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

Specified by:
paint in interface FigObject
Overrides:
paint in class FigRectangle

paint

public void paint(java.awt.Graphics g,
                  FigTrafo2D trafo)
Description copied from interface: FigDrawable
paint this object using the specified transformation and Graphics g

Specified by:
paint in interface FigObject
Overrides:
paint in class FigRectangle

imageUpdate

public boolean imageUpdate(java.awt.Image img,
                           int flags,
                           int x,
                           int y,
                           int width,
                           int height)
Specified by:
imageUpdate in interface java.awt.image.ImageObserver

setRedraw

public void setRedraw(FullRedraw canvas)

toString

public java.lang.String toString()
toString() for debug purposes.

Specified by:
toString in interface FigObject
Overrides:
toString in class FigRectangle