# Class GlyphPaper

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

All Implemented Interfaces:
  `Paper`

public abstract class GlyphPaper extends Object implements Paper
Translates Glyph paint operations into pixel iterators. This class provides an implementation of the `Paper` interface which means it can be painted on by a `ShapePainter`. Concrete subclasses are handed a Pixer giving the pixels actually painted by each received glyph.

Since:
  1 Oct 2015
Author:
  Mark Taylor

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static interface`
`GlyphPaper.GlyphPaperType`
Type of paper used by this object.

## Constructor Summary

Constructors
Constructor
Description
`GlyphPaper(Rectangle plotBounds)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`boolean`
`canMerge()`
Returns false.
`Paper`
`createSheet()`
Returns a blank Paper instance that is compatible with this one.
`GlyphPaper.GlyphPaperType`
`getPaperType()`
Returns a partial PaperType implementation to use with this object.
`abstract void`
`glyphPixels(Pixer pixer)`
For each glyph painted on this paper, a pixer will be passed to this method that iterates over all the pixels within this paper's bounds.
`void`
`mergeSheet(Paper other)`
Merges the contents of a compatible paper instance with this one.

### Methods inherited from class Object

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

## Constructor Details

### GlyphPaper

public GlyphPaper(Rectangle plotBounds)
Constructor.

Parameters:
  `plotBounds` - bounds within which all pixels must be contained

## Method Details

### glyphPixels

public abstract void glyphPixels(Pixer pixer)
For each glyph painted on this paper, a pixer will be passed to this method that iterates over all the pixels within this paper's bounds. The supplied pixer will not contain any pixels outside the plot bounds.

Parameters:
  `pixer` - pixel iterator

### getPaperType

public GlyphPaper.GlyphPaperType getPaperType()
Returns a partial PaperType implementation to use with this object. The returned value is private to this paper instance.

Specified by:
  `getPaperType` in interface `Paper`
Returns:
  paper type

### canMerge

public boolean canMerge()
Returns false. Use of this paper type is expected to be parallel already, so parallelising paint operations is not necessary.

Specified by:
  `canMerge` in interface `Paper`
Returns:
  true iff sheet split/merge is supported

### createSheet

public Paper createSheet()
Description copied from interface: `Paper`
Returns a blank Paper instance that is compatible with this one. That essentially means an instance like this but with nothing yet painted on it.

May only be invoked if `Paper.canMerge()` returns true.

Specified by:
  `createSheet` in interface `Paper`
Returns:
  new compatible paper instance

### mergeSheet

public void mergeSheet(Paper other)
Description copied from interface: `Paper`
Merges the contents of a compatible paper instance with this one. The supplied sheet is assumed to have been created by an earlier invocation of `Paper.createSheet()` on this instance or on a compatible instance.

The effect is as if everything that has been painted to the supplied sheet will now be painted on this one.

This is intended for use in parallelising painting of a large number of 2D or 3D `Glyph`s. Merging papers on which `Decal`s have been placed may or may not work.

May only be invoked if `Paper.canMerge()` returns true.

Specified by:
  `mergeSheet` in interface `Paper`
Parameters:
  `other` - compatible paper instance