Class PixelCanvas

  • All Implemented Interfaces:
    RenderTarget
    Direct Known Subclasses:
    CanvasACearth

    public class PixelCanvas
    extends java.lang.Object
    implements RenderTarget

    Swing compatible drawing surface for images and graphics.

    © 2002 Christian Treber, ct@ctreber.com

    • Constructor Summary

      Constructors 
      Constructor Description
      PixelCanvas​(int pWidth, int pHeight)
      Construct a canvas of the specified size.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.awt.Graphics2D getGraphics2D()  
      int getImageHeight()  
      int getImageWidth()  
      void saveToImage​(java.io.OutputStream os)  
      void setPixel​(int pX, int pY, int pA, int pR, int pG, int pB)  
      void setPixel​(int pX, int pY, java.awt.Color pColor)  
      • Methods inherited from class java.lang.Object

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

      • PixelCanvas

        public PixelCanvas​(int pWidth,
                           int pHeight)

        Construct a canvas of the specified size.

        Parameters:
        pWidth - Width
        pHeight - Height
    • Method Detail

      • getGraphics2D

        public java.awt.Graphics2D getGraphics2D()
      • setPixel

        public void setPixel​(int pX,
                             int pY,
                             int pA,
                             int pR,
                             int pG,
                             int pB)
        Specified by:
        setPixel in interface RenderTarget
      • setPixel

        public void setPixel​(int pX,
                             int pY,
                             java.awt.Color pColor)
        Specified by:
        setPixel in interface RenderTarget
      • saveToImage

        public void saveToImage​(java.io.OutputStream os)
                         throws java.io.IOException
        Throws:
        java.io.IOException