Class JDImage


public class JDImage extends JDRectangular
JDraw Image graphic object. JDraw supports GIF, JPG and PNG format. Alpha mask is supported for PNG image.
  • Constructor Details

    • JDImage

      public JDImage(String objectName, String fileName, int x, int y)
      Contruct an image.
      Parameters:
      objectName - Image name
      fileName - Image file name.
      x - Up left corner x coordinate
      y - Up left corner y coordinate
  • Method Details

    • copy

      public JDObject copy(int x, int y)
      Description copied from class: JDObject
      Returns a copy of this object at the specified location.
      Specified by:
      copy in class JDObject
      Parameters:
      x - Horizontal position of the copied object (pixel)
      y - Vertical Position of the copied object (pixel)
      Returns:
      The copy of this object.
    • paint

      public void paint(JDrawEditor parent, Graphics g)
      Description copied from class: JDObject
      Paints this object.
      Overrides:
      paint in class JDRectangular
      Parameters:
      parent - JdrawEditor parent (Can be null except for JDSwingObject)
      g - the specified Graphics window
    • hasShadow

      public boolean hasShadow()
      Overrides:
      hasShadow in class JDObject
      Returns:
      false, Image cannot be shadowed.
    • setFileName

      public void setFileName(String fileName)
      Loads a new image into this object.
      Parameters:
      fileName - Image file name.
    • getFileName

      public String getFileName()
      Returns:
      current image filename.
    • resetToOriginalSize

      public void resetToOriginalSize()
      Reset the size to its original size.
    • getImageWidth

      public int getImageWidth()
      Returns:
      original image width.
    • getImageHeight

      public int getImageHeight()
      Returns:
      original image height.