Class DrawObjectsGenerator

All Implemented Interfaces:
Generator<ObjectCollectionWithProperties>, TransformingGenerator<ObjectCollectionWithProperties,Stack>, ElementWriter<ObjectCollectionWithProperties>

public class DrawObjectsGenerator extends ObjectsAsRGBGenerator
Generates stacks of RGB images using a DrawObject to draw objects on a background.
Author:
Owen Feehan
  • Method Details

    • withBackgroundAndColors

      public static DrawObjectsGenerator withBackgroundAndColors(DrawObject drawObject, DisplayStack background, ColorIndex colorIndex)
      Creates a generator that draws an object in a particular way with particular colors and background.
      Parameters:
      drawObject - how to draw the object.
      background - the background.
      colorIndex - the colors.
      Returns:
      the generator.
    • outlineVariedColors

      public static DrawObjectsGenerator outlineVariedColors(int numberColors, int outlineWidth, DisplayStack background)
      Creates a generator that draws an outline around objects on a background using varied colors for the objects.
      Parameters:
      numberColors - the number of unique colors to use.
      outlineWidth - the width of the outline.
      background - the background.
      Returns:
      the generator.
    • outlineWithColorIndex

      public static DrawObjectsGenerator outlineWithColorIndex(int outlineWidth, ColorIndex colorIndex)
      Creates a generator that draws an outline around objects using a particular ColorIndex.
      Parameters:
      outlineWidth - the width of the outline.
      colorIndex - the color-index.
      Returns:
      the generator.
    • outlineVariedColors

      public static DrawObjectsGenerator outlineVariedColors(int numberColors, int outlineWidth, io.vavr.control.Either<Dimensions,DisplayStack> background)
      Creates a generator that draws an outline around objects on a background using varied colors for the objects.
      Parameters:
      numberColors - the number of unique colors to use.
      outlineWidth - the width of the outline.
      background - the background or dimensions for a background (drawn as all black).
      Returns:
      the generator.
    • outlineSingleColor

      public static DrawObjectsGenerator outlineSingleColor(int outlineWidth, DisplayStack background, RGBColor color)
      Creates a generator that draws an outline around objects on a background using a single color for all objects.
      Parameters:
      outlineWidth - the width of the outline.
      background - the background or dimensions for a background (drawn as all black).
      color - the single color to use for all objects.
      Returns:
      the generator.
    • generateBackgroundRegion

      protected RGBStack generateBackgroundRegion(ObjectCollectionWithProperties objects, io.vavr.control.Either<Dimensions,DisplayStack> background)
      Description copied from class: ObjectsAsRGBGenerator
      Creates a RGBStack containing the background, without objects being drawn upon it.

      This background may be all or only a region of the entire background-stack.

      Specified by:
      generateBackgroundRegion in class ObjectsAsRGBGenerator
      Parameters:
      objects - the current objects to be drawn.
      background - the entire background.
      Returns:
      a newly created RGBStack, as above.
    • generateMasks

      Description copied from class: ObjectsAsRGBGenerator
      Creates a ObjectCollectionWithProperties indicative of the masks that will be imposed on top of the background-region.
      Specified by:
      generateMasks in class ObjectsAsRGBGenerator
      Parameters:
      objects - the objects to draw.
      Returns:
      either objects or a derived-representation of objects, as will be drawn on the background-region.