The display extensions contains a graphics library designed for platforms for with very limited memory resources. The drawing routines in the library operate on rectangular images (arrays) of pixels , called an image buffer.
The values stored in image buffers represents colors via an encoding determined by the image buffer pixel format. A pixel buffer has one of the following formats:
Note that the RAM requirement of a 100x100 image is;
So on an embedded platform you most likely not be able to be working with rgb565, rgb888 other than in very limited areas.
At the low-level end of things you will want to display graphics onto an display. The interface towards the low-level end needs to be implemented for the particular hardware platform and display. For examples of this see vesc_express. The LBM linux REPL has SDL and png backends for the display library.
the display library is specifically designed to allow for using many
colors simultaneously on screen, without needing to use full screen
high-color buffers. This is done by delaying the choice of color mapping
in the indexed2, indexed4 and
indexed16 images until they are presented on screen.
images are rendered onto a display using the function
disp-render. disp-render takes an image, a
position (x,y) where to draw the image, and a colormapping that can be
expressed as a list of colors. for example:
| Example | Image | Result |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| Example | Image | Result |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Allocate an image buffer from lbm memory or from a compactable
region. The form of an img-buffer expression is
(img-buffer opt-dm format width height).
| Example | Result |
|
|
| Example | Result |
|
|
Checks if the argument is likely to be an image buffer.
| Example | Result |
|
|
|
|
(img-blit dest src x y transparent ..option)Copy pixels from src to dest.
x and y are coordinates in dest.
Pixels colored transparent in src will be
skipped transparent can be set to -1 to
indicate no transparency
| Options | |
|---|---|
'(rotate x y deg) |
Rotate deg degrees around x
y |
'(scale s) |
Scale by s |
'(tile) |
Tile to fill dest |
'(clip x y w h) |
Clip output in destination coords |
| Example | Image | Result |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| Example | Image | Result |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| Example | Image | Result |
|
|
|
|
|
|
| Example | Image | Result |
|
|
|
|
|
|
|
|
|
|
|
|
| Example | Image | Result |
|
|
|
| Example | Image | Result |
|
|
|
|
|
|
| Example | Image | Result |
|
|
|
|
|
|
| Example | Image | Result |
|
|
|
|
|
|
|
|
|
| Example | Image | Result |
|
|
|
|
|
|
|
|
|
| Example | Image | Result |
|
|
|
| Example | Image | Result |
|
|
|
|
|
|
|
|
|
| Example | Image | Result |
|
|
|
|
|
|
|
|
|
These examples are leaving out the details on how to setup and initialize any particular display you may have connected to your embedded system. For information on how to initialize a display on a VESC EXPRESS platform see vesc_express display documentation.
| Example | Image | Result |
|
|
|
| Example | Image | Result |
|
|
|
Note that import is a feature of the VESC integration of
LispBM and not really a part of core LispBM. The LispBM REPL does not
have an import feature currently.
In the "Desktop" LispBM REPL the rotated llama examples looks as follows.
| Example | Image | Result |
|
|
|
|
|
|
| Example | Animation |
|
|
This document was generated by LispBM version 0.34.2