Class Pixers
- java.lang.Object
-
- uk.ac.starlink.ttools.plot2.layer.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.
-
-
-
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 valuesys
- array of Y valuesnp
- 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 iteratortx
- offset in X directionty
- 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 iteratorclip
- 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 iteratorclip
- clipping rectanglexminBase
- lower limit of X values dispensed by base pixerxmaxBase
- upper limit of X values dispensed by base pixeryminBase
- lower limit of Y values dispensed by base pixerymaxBase
- upper limit of Y values dispensed by base pixer- Returns:
- clipped pixel iterator, or null if no pixels
-
-