Class ImageTransform

java.lang.Object
net.paulhertz.pixelaudio.ImageTransform

public class ImageTransform extends Object
Deprecated.
THIS CLASS IS PROBABLY NOT GOING TO BE INCLUDED IN THE PixelAudio LIBRARY. USE BitmapTransform INSTEAD.

Provides static methods for rotating and reflecting Processing images of type PImage using a PGraphics instance. The PGraphics width and height affect scaling of the PImage. No-args constructor defaults to a 1024 x 1024 image size.

Most or all of the functionality required for the PixelAudo library is now in BitmapTransform. BitmapTransform's methods are faster and more generalized than those in ImageTransform, but they do not provide scaling or rotation by angles other than 90 degrees, nor do they tap into Processing's off-screen graphics environment.

See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Deprecated.
    initializes a PGraphics with width = height = 1024.
    ImageTransform(int w, int h)
    Deprecated.
    initializes a PGraphics with width = w and height = h.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Deprecated.
     
    Deprecated.
    Reflects an image on the y-axis, flipping the x-coordinates, returns a transformed copy
    flipX(PImage img, int c)
    Deprecated.
    Reflects an image on the y-axis, flipping the x-coordinates, returns a transformed copy
    Deprecated.
    Reflects an image on the y-axis, flipping the x-coordinates, rotates it 90 degrees CW and returns a transformed copy: equivalent to reflecting the image on the secondary diagonal, upper right to lower left.
    flipX90(PImage img, int c)
    Deprecated.
    Reflects an image on the y-axis, flipping the x-coordinates, rotates it 90 degrees CW and returns a transformed copy: equivalent to reflecting the image on the secondary diagonal, upper right to lower left.
    Deprecated.
    Reflects an image on the y-axis, flipping the x-coordinates, rotates it 90 degrees CCW and returns a transformed copy: equivalent to reflecting the image on the primary diagonal, from upper left to lower right.
    flipX90CCW(PImage img, int c)
    Deprecated.
    Reflects an image on the y-axis, flipping the x-coordinates, rotates it 90 degrees CCW and returns a transformed copy: equivalent to reflecting the image on the primary diagonal, from upper left to lower right.
    Deprecated.
    Reflects an image on the x-axis, flipping the y-coordinates, returns a transformed copy.
    flipY(PImage img, int c)
    Deprecated.
    Reflects an image on the x-axis, flipping the y-coordinates, returns a transformed copy
    Deprecated.
     
    int
    Deprecated.
     
    int
    Deprecated.
     
    nada(PImage img, int c)
    Deprecated.
    Leaves image geometry untransformed but possibly with a different background color (for images with an alpha channel)
    void
    resizeGraphics(int w, int h)
    Deprecated.
     
    rotAndScale(PImage img, float rads, float sx, float sy)
    Deprecated.
    Rotates and scales a PImage around its center.
    rotAndScale(PImage img, float rads, float sx, float sy, int c)
    Deprecated.
    Rotates and scales a PImage around its center.
    Deprecated.
    Rotates an image 180 degrees, returns a transformed copy
    rotate180(PImage img, int c)
    Deprecated.
    Rotates an image 180 degrees, returns a transformed copy
    Deprecated.
    Rotates an image 90 degrees clockwise, returns a transformed copy
    rotate90(PImage img, int c)
    Deprecated.
    Rotates an image 90 degrees clockwise, returns a transformed copy
    Deprecated.
    Rotates an image 90 degrees counter-clockwise, returns a transformed copy
    rotate90CCW(PImage img, int c)
    Deprecated.
    Rotates an image 90 degrees counter-clockwise, returns a transformed copy
    Deprecated.
     
    transform(PImage img, AffineTransformType type, int c)
    Deprecated.
    Rotates or reflects a PImage, as specified by the type argument.

    Methods inherited from class java.lang.Object

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

    • ImageTransform

      public ImageTransform(int w, int h)
      Deprecated.
      initializes a PGraphics with width = w and height = h.
    • ImageTransform

      public ImageTransform()
      Deprecated.
      initializes a PGraphics with width = height = 1024.
  • Method Details

    • getGraphics

      public PGraphics getGraphics()
      Deprecated.
      Returns:
      itGraf, the PGraphics instance used for transforms
    • getWidth

      public int getWidth()
      Deprecated.
      Returns:
      the width of the PGraphics instance used for transforms
    • getHeight

      public int getHeight()
      Deprecated.
      Returns:
      the height of the PGraphics instance used for transforms
    • adjustToImage

      public void adjustToImage(PImage img)
      Deprecated.
      Parameters:
      img - a PImage whose width and height will be used to set the width and height of the PGraphics instance used for transforms
    • resizeGraphics

      public void resizeGraphics(int w, int h)
      Deprecated.
      Parameters:
      w - the new width of the PGraphics instance used for transforms
      h - the new height of the PGraphics instance used for transforms
    • transform

      public PImage transform(PImage img, AffineTransformType type)
      Deprecated.
      Parameters:
      img - a PImage to transform
      type - the ImageTransformType (ROT90CW, ROT90CCW, ROT180, FLIPX, FLIPY)
      Returns:
      a transformed PImage from the PGraphics instance used for transforms
    • transform

      public PImage transform(PImage img, AffineTransformType type, int c)
      Deprecated.
      Rotates or reflects a PImage, as specified by the type argument.
      Parameters:
      img - a PImage to transform
      type - the ImageTransformType (ROT90CW, ROT90CCW, ROT180, FLIPX, FLIPY)
      c - the background color for the image (affects the alpha channel of the output)
      Returns:
      a transformed PImage from the PGraphics instance used for transforms
    • rotAndScale

      public PImage rotAndScale(PImage img, float rads, float sx, float sy)
      Deprecated.
      Rotates and scales a PImage around its center. You may need to set width and height with resizeGraphics before calling this method, e.g., when rotating by and angle other than a multiple of pi/2 radians.
      Parameters:
      img - PImage to rotate and scale
      rads - angle of rotation in radians
      sx - x-axis scaling
      sy - y-axis scaling
      Returns:
      a PImage obtained from the PGraphics instance used for transforms
    • rotAndScale

      public PImage rotAndScale(PImage img, float rads, float sx, float sy, int c)
      Deprecated.
      Rotates and scales a PImage around its center. You may need to set width and height with resizeGraphics before calling this method, e.g., when rotating by and angle other than a multiple of pi/2 radians.
      Parameters:
      img - PImage to rotate and scale
      rads - angle of rotation in radians
      sx - x-axis scaling
      sy - y-axis scaling
      c - background color (may affect alpha channel of output)
      Returns:
      a PImage obtained from the PGraphics instance used for transforms
    • rotate90

      public PImage rotate90(PImage img)
      Deprecated.
      Rotates an image 90 degrees clockwise, returns a transformed copy
      Parameters:
      img - PImage to transform
      Returns:
      a PImage obtained from the PGraphics instance used for transforms
    • rotate90

      public PImage rotate90(PImage img, int c)
      Deprecated.
      Rotates an image 90 degrees clockwise, returns a transformed copy
      Parameters:
      img - PImage to transform
      c - background color (may affect alpha channel of output)
      Returns:
      a PImage obtained from the PGraphics instance used for transforms
    • rotate90CCW

      public PImage rotate90CCW(PImage img)
      Deprecated.
      Rotates an image 90 degrees counter-clockwise, returns a transformed copy
      Parameters:
      img - PImage to transform
      Returns:
      a PImage obtained from the PGraphics instance used for transforms
    • rotate90CCW

      public PImage rotate90CCW(PImage img, int c)
      Deprecated.
      Rotates an image 90 degrees counter-clockwise, returns a transformed copy
      Parameters:
      img - PImage to transform
      c - background color (may affect alpha channel of output)
      Returns:
      a PImage obtained from the PGraphics instance used for transforms
    • rotate180

      public PImage rotate180(PImage img)
      Deprecated.
      Rotates an image 180 degrees, returns a transformed copy
      Parameters:
      img - PImage to transform
      Returns:
      a PImage obtained from the PGraphics instance used for transforms
    • rotate180

      public PImage rotate180(PImage img, int c)
      Deprecated.
      Rotates an image 180 degrees, returns a transformed copy
      Parameters:
      img - PImage to transform
      c - background color (may affect alpha channel of output)
      Returns:
      a PImage obtained from the PGraphics instance used for transforms
    • flipX

      public PImage flipX(PImage img)
      Deprecated.
      Reflects an image on the y-axis, flipping the x-coordinates, returns a transformed copy
      Parameters:
      img - PImage to transform
      Returns:
      a PImage obtained from the PGraphics instance used for transforms
    • flipX

      public PImage flipX(PImage img, int c)
      Deprecated.
      Reflects an image on the y-axis, flipping the x-coordinates, returns a transformed copy
      Parameters:
      img - PImage to transform
      c - background color (may affect alpha channel of output)
      Returns:
      a PImage obtained from the PGraphics instance used for transforms
    • flipX90

      public PImage flipX90(PImage img)
      Deprecated.
      Reflects an image on the y-axis, flipping the x-coordinates, rotates it 90 degrees CW and returns a transformed copy: equivalent to reflecting the image on the secondary diagonal, upper right to lower left.
      Parameters:
      img - PImage to transform
      Returns:
      a PImage obtained from the PGraphics instance used for transforms
    • flipX90

      public PImage flipX90(PImage img, int c)
      Deprecated.
      Reflects an image on the y-axis, flipping the x-coordinates, rotates it 90 degrees CW and returns a transformed copy: equivalent to reflecting the image on the secondary diagonal, upper right to lower left.
      Parameters:
      img - PImage to transform
      c - background color (may affect alpha channel of output)
      Returns:
      a PImage obtained from the PGraphics instance used for transforms
    • flipX90CCW

      public PImage flipX90CCW(PImage img)
      Deprecated.
      Reflects an image on the y-axis, flipping the x-coordinates, rotates it 90 degrees CCW and returns a transformed copy: equivalent to reflecting the image on the primary diagonal, from upper left to lower right.
      Parameters:
      img - PImage to transform
      Returns:
      a PImage obtained from the PGraphics instance used for transforms
    • flipX90CCW

      public PImage flipX90CCW(PImage img, int c)
      Deprecated.
      Reflects an image on the y-axis, flipping the x-coordinates, rotates it 90 degrees CCW and returns a transformed copy: equivalent to reflecting the image on the primary diagonal, from upper left to lower right.
      Parameters:
      img - PImage to transform
      c - background color (may affect alpha channel of output)
      Returns:
      a PImage obtained from the PGraphics instance used for transforms
    • flipY

      public PImage flipY(PImage img)
      Deprecated.
      Reflects an image on the x-axis, flipping the y-coordinates, returns a transformed copy. Same as flipX() followed by rotate180().
      Parameters:
      img - PImage to transform
      Returns:
      a PImage obtained from the PGraphics instance used for transforms
    • flipY

      public PImage flipY(PImage img, int c)
      Deprecated.
      Reflects an image on the x-axis, flipping the y-coordinates, returns a transformed copy
      Parameters:
      img - PImage to transform
      c - background color (may affect alpha channel of output)
      Returns:
      a PImage obtained from the PGraphics instance used for transforms
    • nada

      public PImage nada(PImage img, int c)
      Deprecated.
      Leaves image geometry untransformed but possibly with a different background color (for images with an alpha channel)
      Parameters:
      img - PImage to transform
      c - background color (may affect alpha channel of output)
      Returns:
      a PImage obtained from the PGraphics instance used for transforms