This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

grlib_demo

Other Parts Discussed in Thread: OMAPL138

Hi TI experts:

I use LCDK C6748 board interface with ULCD7 Lite.   I tried to run grlib_demo from starterware_1_20_04_01.  In the file " images.c", there are several image files.

(1)  what is the meaning for the first three lines in the image file?

IMAGE_FMT_16BPP_UNCOMP,
    35, 0,
    35, 0,

const unsigned char g_pucLogo[] =
{
    IMAGE_FMT_16BPP_UNCOMP,
    35, 0,
    35, 0,
    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, ....

(2)  how to use it ?

(3) could you please tell me how to form an Icon (like Audio icon)?   a code example will be helpful for understanding.

  • Hi,

    We will work on this and will let you know the update shortly.

    Thanks & regards,
    Sivaraj K
  • In my understanding, the first line is 16 bits per pixel with compressed or uncompressed image format, 2nd and 3rd line would be size of the image.

    I think, you have to provide the audio icon image as input to "bmpToRaster" tool to generate *.h file to get the array of data.

    C:\ti\OMAPL138_StarterWare_1_10_04_01\tools\bmpToRaster
  • Hi Mike,

    Titus has already answered your questions.

    However thought of giving some additional inputs.

    1. There is no real necessity to understand the image formats and its representation in the *.c or *.h as the bmpToraster tool will frame the needed array of data by taking the image file as input. But however the description is given in the grlib.h file. Please refer to it.

    command to use the tool in Windows:

    >bmp2c.exe -16 E2E.bmp image.h

     command to use the tool in Linux:

    mono bmp2c.exe -16 E2E.bmp image.h    ( here, E2E.bmp is the input image file. image.h is the out file which will get generated and " 16" is the 16 bit mode ) 

    Mike says said:
    could you please tell me how to form an Icon (like Audio icon)?   a code example will be helpful for understanding.

    All you have to have is just an image file and use the above mentioned tool. If you are really interested in understanding how the tool converts the data ( i.e, the source code of the tool ), then you revert to us.

    For more info please visit :

  • Thanks all of you!
    (1) I used bmp2c before in raster example, here is a part of it:
    const unsigned short image2[] =
    {
    /* palette data */
    0x4000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
    /* image data */
    0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,
    0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,....

    it does not have three lines shown in data file--- const unsigned char g_pucLogo[]
    IMAGE_FMT_16BPP_UNCOMP,
    35, 0,
    35, 0,
    these two data files are different in first lines, I guess how to use will be different.
    (2) what is the drawing context in \param pContext is a pointer to the drawing context?
    (3) I would like you help me draw a circle using API on 800x480 screen, that will be great help for me to understanding.

    Thanks,
    Mike
  • Hi Mike,
    Mike said:
    (3) I would like you help me draw a circle using API on 800x480 screen, that will be great help for me to understanding.


    What ever the APIs enclosed in the starterware is what we have.
    But however,
    I would suggest you a method to understand the difference.

    1. Open up MSpaint and draw a circle, save it as a bmp file. Convert it into a .h file1.
    2. Open up MSpaint and draw a line, save it as bmp file. convert it into a .h file2.

    Look at the difference between the two files, 1 and 2.
  • Hi Shankari:
    Thanks for replying my question. I mean that using APIs to draw a circle on 800x480 LCD7 screen will be great help.
    Best Regards,
    Mike
  • Hi Mike,
    Can you please use the "GrCircleDraw" API to draw the circle ?

    C:\ti\OMAPL138_StarterWare_1_10_04_01\grlib\circle.c
  • Hi Mike,

    Here is the list of other APIs available at grlib.h

    //*****************************************************************************
    //
    // Prototypes for the graphics library functions.
    //
    //*****************************************************************************
    extern void GrCircleDraw(const tContext *pContext, int lX, int lY,
                             int lRadius);
    extern void GrCircleFill(const tContext *pContext, int lX, int lY,
                             int lRadius);
    extern void GrContextClipRegionSet(tContext *pContext, tRectangle *pRect);
    extern void GrContextInit(tContext *pContext, const tDisplay *pDisplay);
    extern void GrImageDraw(const tContext *pContext,
                            const unsigned char *pucImage, int lX, int lY);
    extern void GrLineDraw(const tContext *pContext, int lX1, int lY1, int lX2,
                           int lY2);
    extern void GrLineDrawH(const tContext *pContext, int lX1, int lX2, int lY);
    extern void GrLineDrawV(const tContext *pContext, int lX, int lY1, int lY2);
    extern void GrOffScreen1BPPInit(tDisplay *pDisplay, unsigned char *pucImage,
                                    int lWidth, int lHeight);
    extern void GrOffScreen4BPPInit(tDisplay *pDisplay, unsigned char *pucImage,
                                    int lWidth, int lHeight);
    extern void GrOffScreen4BPPPaletteSet(tDisplay *pDisplay,
                                          unsigned int *pulPalette,
                                          unsigned int ulOffset,
                                          unsigned int ulCount);
    extern void GrOffScreen8BPPInit(tDisplay *pDisplay, unsigned char *pucImage,
                                    int lWidth, int lHeight);
    extern void GrOffScreen8BPPPaletteSet(tDisplay *pDisplay,
                                          unsigned int *pulPalette,
                                          unsigned int ulOffset,
                                          unsigned int ulCount);
    extern void GrOffScreen16BPPInit(tDisplay *pDisplay, unsigned char *pucImage,
                                    int lWidth, int lHeight);
    extern void GrOffScreen24BPPInit(tDisplay *pDisplay, unsigned char *pucImage,
                                    int lWidth, int lHeight);								
    extern void GrRectDraw(const tContext *pContext, const tRectangle *pRect);
    extern void GrRectFill(const tContext *pContext, const tRectangle *pRect);
    extern void GrStringDraw(const tContext *pContext, const char *pcString,
                             int lLength, int lX, int lY,
                             unsigned int bOpaque);
    extern int GrStringWidthGet(const tContext *pContext, const char *pcString,
                                 int lLength);
    extern void GrStringTableSet(const void *pvTable);
    unsigned int GrStringLanguageSet(unsigned short usLangID);
    unsigned int GrStringGet(int iIndex, char *pcData, unsigned int ulSize);
    extern int GrRectOverlapCheck(tRectangle *psRect1, tRectangle *psRect2);
    extern int GrRectIntersectGet(tRectangle *psRect1, tRectangle *psRect2,
  • Thanks Shankari for the response!
    Best Regards,
    Mike
  • Mike,

    You are welcome!.