# Class FillPixer

java.lang.Object
uk.ac.starlink.ttools.plot2.layer.FillPixer

All Implemented Interfaces:
  `Pixer`

public class FillPixer extends Object implements Pixer
Pixer that iterates over all points inside a polygon. Should handle all polygons (convex, concave, re-entrant). I think(?) the algorithm is about as efficient as it's going to get for a single-threaded implementation. Memory consumption is low.

Since:
  6 Oct 2021
Author:
  Mark Taylor
See Also:
  - https://alienryderflex.com/polygon_fill/

## Constructor Summary

Constructors
Constructor
Description
`FillPixer(int[] xs, int[] ys, int np, Rectangle bounds)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`int`
`getX()`
Returns the X coordinate of the current point.
`int`
`getY()`
Returns the Y coordinate of the current point.
`boolean`
`next()`
Advances to the next point to be dispensed by this iterator.

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### FillPixer

public FillPixer(int[] xs, int[] ys, int np, Rectangle bounds)
Constructor.

Parameters:
  `xs` - np-element array giving graphics X vertex coordinates
  `ys` - np-element array giving graphics Y vertex coordinates
  `np` - number of vertices
  `bounds` - actual bounds within which pixels are required, or null for all pixels

## Method Details

### next

public boolean next()
Description copied from interface: `Pixer`
Advances to the next point to be dispensed by this iterator. Must be called before any calls to getX/getY.

Specified by:
  `next` in interface `Pixer`
Returns:
  true iff there is another point

### getX

public int getX()
Description copied from interface: `Pixer`
Returns the X coordinate of the current point.

Specified by:
  `getX` in interface `Pixer`
Returns:
  X coordinate

### getY

public int getY()
Description copied from interface: `Pixer`
Returns the Y coordinate of the current point.

Specified by:
  `getY` in interface `Pixer`
Returns:
  Y coordinate