Canvas

Description

Name

abstract class Tinman.Canvas

Extended by

HeightmapSource / PyramidSource

Used by

CanvasView.canvas

Maps a rectangular map or a cubemap onto a contiguous pixel layer.

Putting a rectangular map or a cubemap onto a pixel layer involves these steps:

  • Unfolding of the cubemap faces faces (see below).

  • Mapping to coverage of pixel layer:
    Coordinates on the rectangular map resp. cubemap always refer to infinitesimal points (see Coverage.Type.PixelIsPoint semantic). Same holds for unfolded canvas raster coordinates. The pixels in a canvas block (and thus the pixel layer) can have either Coverage.Type.PixelIsPoint or Coverage.Type.PixelIsArea semantic (see below).

Cubemaps are unfolded onto the canvas as follows:

         +--------+
         |        |
         |        |
         |        |
+--------+--------+--------+--------+
|        |        |        |        |
|        | Center |        |        |
|        |        |        |        |
+--------+--------+--------+--------+
         |        |
         |        |
         |        |
         +--------+

The Face of Center depicts which cubemap face will be the Center one (see figure). By default, the canvas X- and Y-axis correspond to the cubemap face axes. The other faces will be unfolded and displayed accordingly. When the map rectangular, only the Center face (always Face.NegZ) will be displayed.

When the pixel layer has a Coverage.Type.PixelIsPoint coverage, blocks are mapped onto the canvas as follows:

0   4   8   12  16  20  24  28  32     .-->
+---+---+---+---+---+---+---+---+      | Canvas X- and Y-axis
|   |   |   |   |   |   |   |   |      V
+---+---oooo#oooo---ooooo---+---+ 4
|   |   o   #   o   o   o   |   |      o := Block edge samples
+---+---oooo#oooo---#####---+---+ 8    # := Shared edge samples
|   |   |   |   |   o   o   |   |
+---+---+---+---+---ooooo---+---+ ...

The block size is always a power of two plus one. Adjacent blocks have overlapping edges (one raster sample). Pixel coordinates are mapped directly to canvas raster coordinates.

When the pixel layer has a Coverage.Type.PixelIsArea coverage, blocks are mapped onto the canvas as follows:

0   4   8   12  16  20  24  28  32     .-->
+---+---+---+---+---+---+---+---+      | Canvas X- and Y-axis
|   |   |   |   |   |   |   |   |      V
+---+---+---+---+---+---+---+---+ 4
|   |   |###|###|   |###|   |   |      # := Block samples
+---+---+---+---+---+---+---+---+ 8
|   |   |   |   |   |###|   |   |
+---+---+---+---+---+---+---+---+ ...

The block size is always a power of two. Adjacent blocks are disjoint. Pixel coordinates are mapped to the top-left corner of the corresponding pixel on the canvas raster.