doodle.java2d.algebra.reified

Members list

Type members

Classlikes

Render in screen space

Render in screen space

Attributes

Source
GraphicsContext.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
sealed abstract class Reified extends Product, Serializable

Each element of Reified is an instruction to draw something on the screen or to otherwise alter the state the graphics context.

Each element of Reified is an instruction to draw something on the screen or to otherwise alter the state the graphics context.

Each instruction should be atomic: there should be no nesting of instructions inside instructions. In compiler terms, this is a "linear IR", not a "tree IR".

When defining a Picture, there are many operations that apply to some group of elements. For example, rotating a Picture or setting a stroke color applies to all the elements within the Picture on which the method is called. This has a natural representation as a tree, but we need to use a different strategy to represent it as a linear list of instructions. There are two implementation approaches:

  • Push all these operations into the atomic instructions. This is the approach currently taken, with each element containing the transform, and fill or stroke as appropriate. The advantage of this approach is that each reified instruction is independent of any other. The disadvantage is that this doesn't scale as the amount of context grows, as each instruction needs to have additional fields added.

  • Have stateful operations to add and remove some context. For example, push and pop a transform or stroke color. This is the approach taken in the Graphics2D Java API. For example, calling the transform method on Graphics2D adds the transform to the already existing transforms. (However, the API lacks methods to undo these operations, which makes it a bit limited.)

Attributes

Companion
object
Source
Reified.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
Known subtypes
class Bitmap
class FillCircle
class FillOpenPath
class FillPolygon
class FillRect
class StrokeCircle
class StrokeRect
class Text
Show all
object Reified

Attributes

Companion
class
Source
Reified.scala
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
Reified.type
trait ReifiedBitmap extends Bitmap

Attributes

Source
ReifiedBitmap.scala
Supertypes
trait Bitmap
trait Algebra
class Object
trait Matchable
class Any
Known subtypes
class Algebra
Self type
Algebra { type Drawing <: (Drawing); }

Attributes

Source
ReifiedPath.scala
Supertypes
trait Path
trait Algebra
class Object
trait Matchable
class Any
Show all
Known subtypes
class Algebra
Self type
Algebra { type Drawing <: (Drawing); }

Attributes

Source
ReifiedShape.scala
Supertypes
trait Shape
trait Algebra
class Object
trait Matchable
class Any
Show all
Known subtypes
class Algebra
Self type
Algebra { type Drawing <: (Drawing); }

Attributes

Source
ReifiedText.scala
Supertypes
trait Text
trait Algebra
class Object
trait Matchable
class Any
Show all
Known subtypes
class Algebra
Self type
Algebra { type Drawing <: (Drawing); def gc: Graphics2D; }

Types

Attributes

Source
package.scala