Package rendering

Class ImageWriter

java.lang.Object
rendering.ImageWriter

public class ImageWriter
extends java.lang.Object
This class is responsible for writing pixels to an image file.
  • Constructor Summary

    Constructors
    Constructor Description
    ImageWriter​(java.lang.String filename, Resolution resolution)
    Construct an image writer which will write to the given file.
  • Method Summary

    Modifier and Type Method Description
    void setPixel​(int row, int col, Colour colour)
    Set the pixel at coordinates (row, col) to the given colour.
    void writeToFile()
    Write the image to disk.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ImageWriter

      public ImageWriter​(java.lang.String filename, Resolution resolution)
      Construct an image writer which will write to the given file.
      Parameters:
      filename - The name of the file to write to.
      resolution - The resolution of the image.
  • Method Details

    • setPixel

      public void setPixel​(int row, int col, Colour colour)
      Set the pixel at coordinates (row, col) to the given colour.
      Parameters:
      row - The row index of the pixel to be written.
      col - The column index of the pixel to be written.
      colour - The colour to be written to the pixel.
    • writeToFile

      public void writeToFile()
      Write the image to disk.