Everything You Should Know About HyperDisplay
What is HyperDisplay?
HyperDisplay was created with the following goals in mind:
- Standardize a graphics library so that the same code will work for any display
- Reduce the duplicated work of adding support for new display technologies
- Use a general interface that can be simplified when not needed
- Make it easier to create graphical user interfaces
Those goals are met by modularity, default parameters in drawing functions, the windows feature, and buffered drawing mode.
Standardization and easy extensibility is achieved by making HyperDisplay modular. There are up to three levels of code that all work together.
- Top Level: HyperDisplay
- HyperDisplay itself is the top level and it contains the standardized drawing interface. This includes all of the drawing, window, and buffering options.
- A few functions, like that to draw a single pixel, are left as pure virtual to indicate that they must be implemented by a lower level
- The remainder of functions are all defined in terms of these pure virtual functions so that as long as they are implemented the whole HyperDisplay suite will be available
- There are some optional functions that can be re-written to provide extra speed or additional capabilities for a particular display
- Mid Level: Drivers, ICs
- It is possible to make a fully functional HyperDisplay driver at this level just by implementing the required functions
- Often at this level we will represent the internal workings of the integrated circuit that is used to run a whole genre of display, such as the ILI9163C used to control TFT LCD screens
- Bottom Level: Specific Products
- Drivers based on mid-level layers
- Represent a particular interface type (e.g. SPI vs I2C vs parallel)
- Represent the physical dimensions of the display
That is as much as you need to know about the modularity for now. At the end of the tutorial we will cover how to create a driver of your own.
A simple interface helps avoid confusion. It would be unfortunate to need a whole slew of possible functions like
drawThickFilledInRectangle() -- how would you ever know where to start? In HyperDisplay we make use of the default parameters in C++ which allows you to use each drawing function with only the information that you need. As the core of a graphics library we will present the drawing functions in two parts:
- Simply, with just enough information to use the color of your choice
- E.g. line( x0, y0, x1, y1, width, color );
- In full complexity, with the option to use repeating patterns of color and additional arguments
- E.g. line( x0, y0, x1, y1, width, color, colorCycleLength, startColorOffset, reverseGradient);
Windows Feature and Buffered Drawing
With the creation of HyperDisplay was the opportunity to add something that was missing from other microcontroller graphics libraries; namely being able to draw in 'windows' like on a computer. Buffered drawing is available as an option when memory constraints are not a concern. Now it is easier to create GUIs, animations, and, with some creativity, even translucent layered images.
Now read on to learn how to install HyperDisplay and get started!