Last updated

Attributes

# Introduction

A node can have different graphics attributes to represent text, line, and fill properties. The properties are called styles.

# Architecture

It is better to group these styles in three general groups: a line style, a fill style, and a text style. Each node implementation can have from zero to N styles and they can be shared between different nodes. The diagram below shows a schematic class diagram of the styles.

Style is a base class of all styles. It has a time stamp. A time stamp is a way to check if a style has changed. Each time a style is changed, it gets a new time stamp. The graphics system and nodes can check if it is necessary to apply these changes to the underlying graphics system. For example, if a line color is changed, then the HTML5 canvas context must be updated with the changed color. FillStyle has sub classes to represent a gradient fill, solid color fill and fill with patterns.