back to FEHImage
Description
The function is used to open an image file for drawing on the LCD screen. Once this is called, Draw
can be used. When you open the image you provide it with the path to the Proteus formatted image file. The format of the filename is *FEH.pic
where *
represents any string. This is a specific format that the object expects in order to open and draw the image to the screen. If Open is called, Close must also be called.
Prerequisite
Before you can open an image with the FEHImage
object, you need to convert your image to the *FEH.pic
format. This can be done with the pic2proteus.m MATLAB script. The script contains one function called pic2proteus
. To use this function, you need to be in the same directory as the MATLAB script file.
Syntax
pic2proteus(filename, width, height)
Parameters
filename: path to an image file to convert to the Proteus format
width: width in pixels (number of cols) to resize the image to. Note the Proteus supports widths up to 320 pixels
height: height in pixels (number of rows) to resize the image to. Note the Proteus supports heights up to 240 pixels
Returns
none
Supported Image Types
- JPEG
- GIF
- TIFF
- PNG
Support for transparent backgrounds is also available for most file types.
Examples
For the example below, save this jpeg to the same folder as pic2proteus, and run the following in the command window:
pic2proteus('Unicorn.jpeg',320,240)
Syntax
.Open(const char* filename);
Parameters
filename: path to an image file of the form *FEH.pic
Returns
None.
Examples
#include <FEHImages.h> int main(void) { // Declares an image for a unicorn FEHImage unicorn; // Open the image unicorn.Open("UnicornFEH.pic"); // Draw a unicorn in the top left corner unicorn.Draw(0, 0); // Close the image unicorn.Close(); while(1) LCD.Update(); //Never quit return 0;
}