Course Programming the ezLCD+ with Lua

Sommaire: Course Programming the ezLCD+ with Lua

Introduction
Product Features
Quick Start
Quick Start: Lua
ezLCD+ Customization
Drawing on the ezLCD+
Print
Screen Coordinates
Vector Graphics
Raster Graphics (Bitmaps)
Drawing Parameters
General
Transparency
Pen
Fonts
Bitmap Fonts
True Type Fonts
Programming the ezLCD+ with Lua
Constants
Position Functions

Extrait du course Programming the ezLCD+ with Lua

Introduction
Welcome to the ezLCD+ API (Application Programming Interface) Manual for Lua. This manual details how to programmatically manipulate the EarthLCD ezLCD+ series of programmable color LCD’s using the Lua programming language. ezLCD+ displays are color touch screen displays that can be easily and quickly integrated into a wide variety of applications. The ezLCD+ with the Lua interpeter can operate as a stand-alone embedded system.
ezLCD+ displays are very similar to our original ezLCD Classic line of displays. ezLCD+ devices are programmable color LCD’s and support the ezLCD+ command set as documented in the ezLCD+ External Commands Manual. ezLCD+ devices can be programmed using the Lua programming language.
Product Features
The ezLCD+ series of programmable color LCD’s consist of a color display, touch screen, USB Interface, RS-232 Interface, I2C Interface and is programmable using the Lua programming language.
Other interfaces such as Ethernet and Audio will be available in future releases.
Quick Start
Quick Start Requirements:
· PC Computer with at least 1 USB 2.0 port
· Windows XP SP2, or Windows Server 2003, or any Windows Vista or Windows Server 2008
Note: The ezLCD+ products do not need a PC computer to work. The above requirements are for the « Quick Start » only.
1 Quick Start: Lua
1. Make sure, that USB FAVR-32 driver is installed on your PC
2. Download the setup of « ezLuaIDE » from http://www.ezlcd.com/support/
3. Install « ezLuaIDE » by running the downloaded setup
4. Turn-on ezLCD+ and make sure that it is connected to your computer through USB.
5. Run « ezLuaIDE ». From the Menu, select « File » – « Open »
6. Select HelloWorld.lua file from the folder « Program Files\ezLuaIDE\Examples ».
ezLCD+ Customization
To make the ezLCD+ easy to use we created a set of tools and features to configure, upgrade and enhance the functionality. The ezLCD+ customization features are documented in your « ezLCD+10x Manual » and updates are available at http://www.ezLCD.com/support .
Drawing on the ezLCD+
1 Print
The Lua native print function is used to write strings to the ezLCD+ display.
As the print function is part of the standard Lua language, make sure to *not* prepend « ez. »
Example
Use
print (« Hello World! »)
not
ez.print (« Hello World! »)
2 Screen Coordinates
For displaying both raster and vector graphics, the ezLCD+ uses the X-Y Cartesian coordinate system.
The origin is located in the upper-left corner of the display. The X values increase to the right, while Y increase to the bottom of the display.
The ezLCD+ uses 16-bit numbers to specify X and Y coordinates. Negative numbers are represented using two’s complement system. For example:
2 dec = 0000 0000 0000 0010 bin
1 dec = 0000 0000 0000 0001 bin
0 dec = 0000 0000 0000 0000 bin
-1 dec = 1111 1111 1111 1111 bin
-2 dec = 1111 1111 1111 1110 bin
etc.
This means that the numbers range
From: -32768 dec = 1000 0000 0000 0000 bin
To: 32767 dec = 0111 1111 1111 1111 bin
The above system is used to represent 16-bit signed integers by most of the CPUs and programming languages.
3 Vector Graphics
Vector Graphics is the use of geometrical primitives such as points, lines, curves, and polygons, which are all based upon mathematical equations to represent images in computer graphics. It is used in contrast to the term Raster Graphics, which is the representation of images as a collection of pixels.
The ezLCD supports drawing of various geometrical shapes, like lines, polygons, ellipses, arcs, etc.
The rendering of Vector Graphics is affected by the following Drawing Parameters:
· Current Position
· Current Color
· Transparency
· Pen
· Current Drawing Frame
Note: Since the ezLCD is physically a raster display, all Vector Graphics is converted to the Raster Graphics during rendering.
4 Raster Graphics (Bitmaps)
A Raster Graphics image, digital image, or bitmap, is the representation of images as a collection of pixels, or points of color. It is used in contrast to the term Vector Graphics which is the use of geometrical primitives such as points, lines, curves, and polygons, all based upon mathematical equations to represent images.
Raster images are commonly stored in image files with varying formats.The ezLCD can display the following formats of raster images:
· 24-bit .bmp
· .jpg
· .ezp (16-bit color format used in other ezLCD products, added here for compatibility).
A bitmap corresponds bit-for-bit with an image displayed on a screen, in the same format used for storage in the display’s video memory. Bitmap is technically characterized by the width and height of the image in pixels and by the number of bits per pixel (a color depth, which determines the number of colors it can represent).
5 Drawing Parameters
5.1 General
Graphics are drawn according to the following parameters:
Current Drawing Frame
· Set by Frame Management Functions
Current Position.
· Set by the SET Position Functions
· Updated by drawing commands
Current Color.
· Set by SetColor
· Bitmaps are not affected
Background Color.
· Set by SetBgColor
· Only Bitmap Fonts are affected
Transparent Color.
· Set by SetTrColor and TrColorNone
· Specifies the color, which is ignored during Bitmap drawing
· Only Bitmaps are affected (direct pixel drawing is not affected).
5.2 Transparency
The ezLCD+ supports transparency by alpha-blending of the pixel being drawn with the background pixel at the particular position. Alpha blending is a technique for combinating of two colors allowing for transparency effects in computer graphics. The alpha is a level of opaqueness of the pixel. The value of alpha ranges from 0 to 255, where 0 represents a fully transparent color, and 255 represents a fully opaque color. The drawing below shows a picture of electronic circuit drawn over another image using different values of alpha.

LIRE AUSSI :  Lua Upvalues and Globals

…….

Si le lien ne fonctionne pas correctement, veuillez nous contacter (mentionner le lien dans votre message)
Course Programming the ezLCD+ with Lua (3,30 Mo) (Cours PDF)
Programming the ezLCD+ with Lua

Télécharger aussi :

Laisser un commentaire

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *