Class Pixers


  • public class Pixers
    extends java.lang.Object
    Utility class for use with Pixers.
    Since:
    27 Nov 2013
    Author:
    Mark Taylor
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static Pixer clip​(Pixer base, java.awt.Rectangle clip)
      Returns a clipped version of a given pixel iterator whose extent is not known.
      static Pixer clip​(Pixer base, java.awt.Rectangle clip, int xminBase, int xmaxBase, int yminBase, int ymaxBase)
      Returns a clipped version of a given pixel iterator whose extent is known.
      static Pixer createArrayPixer​(int[] xs, int[] ys, int np)
      Returns a new pixer that iterates over a given list of X,Y coordinates.
      static PixerFactory createPixerCopier​(Pixer pixer)
      Takes a given pixer and copies its data, returning an object that can issue pixers that behave the same as the original.
      static Pixer translate​(Pixer base, int tx, int ty)
      Returns a translated version of a pixel iterator.
      • Methods inherited from class java.lang.Object

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

      • createArrayPixer

        public static Pixer createArrayPixer​(int[] xs,
                                             int[] ys,
                                             int np)
        Returns a new pixer that iterates over a given list of X,Y coordinates.
        Parameters:
        xs - array of X values
        ys - array of Y values
        np - number of points (xs and ys must be at least this length)
        Returns:
        new pixel iterator
      • createPixerCopier

        public static PixerFactory createPixerCopier​(Pixer pixer)
        Takes a given pixer and copies its data, returning an object that can issue pixers that behave the same as the original. Since pixers are one-use iterators, this may be a useful caching operation for pixer generation methods that are potentially expensive to create and may be consumed multiple times.
        Parameters:
        pixer - input pixer
        Returns:
        factory to create copies of pixer
      • translate

        public static Pixer translate​(Pixer base,
                                      int tx,
                                      int ty)
        Returns a translated version of a pixel iterator.
        Parameters:
        base - base pixel iterator
        tx - offset in X direction
        ty - offset in Y direction
        Returns:
        translated pixel iterator
      • clip

        public static Pixer clip​(Pixer base,
                                 java.awt.Rectangle clip)
        Returns a clipped version of a given pixel iterator whose extent is not known.
        Parameters:
        base - base pixel iterator
        clip - clipping rectangle
        Returns:
        clipped pixel iterator
      • clip

        public static Pixer clip​(Pixer base,
                                 java.awt.Rectangle clip,
                                 int xminBase,
                                 int xmaxBase,
                                 int yminBase,
                                 int ymaxBase)
        Returns a clipped version of a given pixel iterator whose extent is known. May return null if the clipped pixer would dispense no pixels. {x,y}{min,max}Base are the extreme values of the base pixer; they do not account for the extent of a single pixel (so a single pixel at the origin would have all values set to zero).
        Parameters:
        base - base pixel iterator
        clip - clipping rectangle
        xminBase - lower limit of X values dispensed by base pixer
        xmaxBase - upper limit of X values dispensed by base pixer
        yminBase - lower limit of Y values dispensed by base pixer
        ymaxBase - upper limit of Y values dispensed by base pixer
        Returns:
        clipped pixel iterator, or null if no pixels