## Class Picture

- java.lang.Object
- - Picture

-     public class Picture
      extends java.lang.Object

  A picture from an image file.

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `Picture()` | Constructs an empty picture.
    `Picture​(java.lang.String source)` | Constructs a picture from a given file name or URL.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `border​(int width)` | Adds a black border to the image.
    `java.awt.Color` | `getColorAt​(int x, int y)` | Gets the color of a pixel.
    `int` | `getHeight()` | Gets the height of this picture.
    `int` | `getWidth()` | Gets the width of this picture.
    `void` | `load​(java.lang.String source)` | Loads a picture from a given file or URL.
    `void` | `move​(int dx, int dy)` | Moves this picture by a given amount.
    `void` | `pick()` | Displays a file chooser for picking a file, loads the picture from the file that the user selected, and pauses so that the user can see the loaded picture.
    `void` | `scale​(int newWidth, int newHeight)` | Scales this picture to a new size.
    `void` | `setColorAt​(int x, int y, java.awt.Color c)` | Sets the color of a pixel.
    `java.lang.String` | `toString()` |

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### Picture

          public Picture()

      Constructs an empty picture.

    - #### Picture

          public Picture​(java.lang.String source)

      Constructs a picture from a given file name or URL.
      Parameters:
        `source` - the filename or URL

  - ### Method Detail

    - #### load

          public void load​(java.lang.String source)

      Loads a picture from a given file or URL.
      Parameters:
        `source` - the filename or URL

    - #### pick

          public void pick()

      Displays a file chooser for picking a file, loads the picture from the file that the user selected, and pauses so that the user can see the loaded picture.

    - #### getWidth

          public int getWidth()

      Gets the width of this picture.
      Returns:
        the width

    - #### getHeight

          public int getHeight()

      Gets the height of this picture.
      Returns:
        the height

    - #### move

          public void move​(int dx,
                           int dy)

      Moves this picture by a given amount.
      Parameters:
        `dx` - the amount by which to move in x-direction
        `dy` - the amount by which to move in y-direction

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

    - #### getColorAt

          public java.awt.Color getColorAt​(int x,
                                           int y)

      Gets the color of a pixel.
      Parameters:
        `x` - the column index (between 0 and getWidth() - 1)
        `y` - the row index (between 0 and getHeight() - 1)
      Returns:
        the color of the pixel at position (x, y)

    - #### setColorAt

          public void setColorAt​(int x,
                                 int y,
                                 java.awt.Color c)

      Sets the color of a pixel.
      Parameters:
        `x` - the column index (between 0 and getWidth() - 1)
        `y` - the row index (between 0 and getHeight() - 1)
        `c` - the color for the pixel at position (x, y)

    - #### scale

          public void scale​(int newWidth,
                            int newHeight)

      Scales this picture to a new size.
      Parameters:
        `newWidth` - the new width of the picture
        `newHeight` - the new height of the picture

    - #### border

          public void border​(int width)

      Adds a black border to the image.
      Parameters:
        `width` - the border width