Package bagel

Class Image

java.lang.Object
bagel.Image

public class Image extends Object
Class to load and draw an image.
  • Constructor Details

    • Image

      public Image(String filename)
      Load an image from a file.
      Parameters:
      filename - the filename to load
  • Method Details

    • drawFromTopLeft

      public void drawFromTopLeft(double x, double y)
      Draw the image with its top-left at (x, y).
    • drawFromTopLeft

      public void drawFromTopLeft(double x, double y, DrawOptions options)
      Draw the image with its top-left at (x, y) with extra options.
    • draw

      public void draw(double x, double y)
      Draw the image with its centre at (x, y).
    • draw

      public void draw(double x, double y, DrawOptions options)
      Draw the image with advanced options as described by an DrawOptions object.
    • getWidth

      public double getWidth()
      Returns the width of the image in pixels.
    • getHeight

      public double getHeight()
      Returns the height of the image in pixels.
    • getBoundingBox

      public Rectangle getBoundingBox()
      Creates a Rectangle as defined by this image, located with its top-left at (0, 0).
    • getBoundingBoxAt

      public Rectangle getBoundingBoxAt(Point point)
      Helper method to create a Rectangle around this image, centred at a Point.