Importing Images Into an MLA Graphics Project

 Summary

This article shows how to use the Graphics Resource Converter (GRC) to import fonts into a Graphics project based on the MLA. This tutorial places the imported font into program memory.

Starting the GRC Utility

GRC_directory.png

The GRC is located in the MLA Installation directory:
…microchip/mla/vYYYY-MM-DD/framework/gfx/utilities/grc

Linux and Apple OS X® users launch the resource converter by executinggrc.jar, and Microsoft® Windows users invoke it by executinglaunch_grc.bat.

1

Configuring the GRC

  • From the GRC user interface, selectProject thenSettings.
  • For this example configure the GRC to place imported images into internal program memory (internal Flash).
  • Set the Graphics Module Bits per pixel to 16 (16 bpp).
  • When working with PIC® MCUs which have an internal graphics module, such as the PIC24FDA series, theGraphics Module option can be selected to set the image format.
  • After configuring the GRC selectOK
GRC_setup.png
GRC_settings.png

2

Starting the Import Process

To begin importing an image, selectFile thenAdd Images.

add_images.png
Click image to enlarge.

3

Selecting the Image to Import

After selectingAdd Image, you will be directed to browse and locate either a bitmap or a JPEG image to import into the project. Select the file, then pressOpen.

In this example, we will use the bitmap imageNewImage.bmp.

NewImage.png
new_image_bmp.png
Click image to enlarge.

4

Convert the Image

When you have finished selecting the images you wish to import, selectProject thenConvert.

convert_image.png
Click image to enlarge.

Before importing, the GRC will ask you to select a file name and location to store the imported image.

The conversion process will create an assembly file (.s), a c file (.c) and a header file (.h) using the name selected.

5

Include the C code and Header file in the MPLAB X Project

The conversion process creates an assembly file (.s), a C file (.c), and a header file (.h) for each imported image. These files need to be included in the MLA Graphics project just as all other source files and header files.

You will have to edit the appropriate files to add a#include for the newly created header file.

The image on the right shows the files for the imageNewImage.bmp included in a project which were saved in files with the name ofNewImage.*. The three files created are:

  • NewImage.s
  • NewImage.h
  • NewImage_reference.c


All three of these files are added to the project tree automatically by the GRC.

ImageFilesInclude.png
Click image to enlarge.

6

Build the Project

Re-building the project after the new image's header and source files have been added makes the image available for use.