Plan for Canvas slices

From OHRRPGCE-Wiki
Jump to navigation Jump to search

A Canvas slice would be a temporary video page (SU_RenderTarget surface) onto which all its child slices are drawn. The video page is then drawn to the screen (or the next ancestor Canvas slice) just like a Sprite slice, meaning it can be manipulated in various ways:

  • scaled
  • rotated
  • dissolved
  • blended (transparent)
  • paletted/tinted (in future)
  • stencil operations (in future)
  • selectively applied screen fades

For example, this would allow you to fade out a whole textbox without requiring us to implement opacity for Rect and Text slices.

Canvas slices would potentially be slow so you shouldn't use many at a time. If we switch to hardware-accelerated rendering, it's said that mobile GPUs are especially slow at switching render targets due to the tiled rendering method, so you shouldn't use more than ~4 (of course, this advice is for graphics intensive games running at 60fps).

Stencil slices[edit]

Canvas slices might also be a way to allow users to create multi-slice/compound stencils, that is, stencilling with a stencil mask that's the union of multiple sprites/slices instead of a single one. The current implementation of stencils creates a temporary video page like a Canvas slice anyway. However, it's not actually necessary to create a new video page/render target to support compound stencils, only to support nested stencils, so that may change for efficiency in a hardware-accelerated implementation. We could require the use of Canvas slices just to do nested stencilling.