Skip to content
Hapaxia edited this page Aug 13, 2023 · 10 revisions

Grambol

Grambol

Introduction

Grambol is a system for Programmable Symbols for use with SFML. That is, they become "vector" graphics similar to "clip-art".

The base class/classes gives similar features and interface to SFML's own Shape class. However, it expands the idea to allow derived classes to have more flexibility and control. For example, they can specify which primitive type is used as well as allowing multiple colours within one symbol.

Each symbol is set up in a similar way to a rectangle; it has a width and height. All point calculations in Grambol are ratios - in the range of 0 to 1. That is the x co-ordinate 0-1 expands to 0-width and the y co-ordinate 0-1 expands to 0-height. This "rectangle" is the foundational two-dimensional space in which the symbol is contained. The points can use this information however they choose - including expanding outside of this rectangle.

Derived classes can easily optionally expose extra controls that make controlling the symbol's shape and parameters more intuitive. For example, a simple "thick line" symbol would be a basic rectangle but could include the ability to set its position and rotation based of start and end control points. Another example would be allowing a circle or ellipse symbol to be sized by its radius/radii.

The main base class, Symbol, is all that is required. It provides all the of the base code to use. However, two other "base" classes are provided: PlainSymbol and FullSymbol. These are derived from Symbol but include some specific features. PlainSymbol simply adds setting and getting of the symbol's (single) colour. This is perfect for single colour symbols. FullSymbol adds ability to set a palette of multiple colours, allowing each point to use any one of these colours. This allows a single symbol to be multi-coloured.

The logo was entirely created using Grambol symbols except the curve of the G and the lines in the M (those were Selba Ward's Spline) with only some minimal image post processing. All of the symbols are a part of Provided Symbol Groups that are still to come; they will all be available.

IMPORTANT

Before using, make sure you first read: Setup

Base Classes

Provided Symbol Groups

Note

Grambol is published under the zlib licence.
C++11 (or later) and SFML version 2 are required.

Clone this wiki locally