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.

How to use the API_DisplayStaticImage on DLP Lightcrafter ?

Dear Engineers:

    I have a problem about how to use the API_DisplayStaticImage on the DLP Lightcrafter (DM365) Platform. 

    The function prototype is as follows:

                             typedef ErrorCode_t (API_DataFunc_t)(void *Param, uint8 *Data, uint32 Size);

                            ErrorCode_t API_DisplayStaticImage(API_DataFunc_t *GetData, void *DataParam);

    Could you tell me the relationship among the parameters. And how to use the API_DisplayStaticImage function .

    Thank you for your time!

Haitao Deng

  • Hi Haitao,

    Thanks for posting. We will research this issue further. Can you provide some more insight into how you are trying to use this function in your current system?

    Thanks,

    Clinton

  • Hello Haitao,

    I am Clinton's colleague.

    How to use API_DisplayStaticImage  function -

    typedef ErrorCode_t (API_DataFunc_t)(void *Param, uint8 *Data, uint32 Size);

    //You should write a function that will take the

    Param - buffer_address

    Data - Destination address where the requested number of bytes from buffer_address to be copied

    Size - Number of bytes to be copied from Param address into the location given in Data location

    For example:

    You can write function like the following -

    ErrorCode_t RetrieveData(void *Param, uint8* Destination, uint32 Size)

    {

         //Copy the contents simple copy

        memcpy(Data,Param,Size);

        return SUCCESS;

    }

    ErrorCode_t API_DisplayStaticImage(API_DataFunc_t *GetData, void *DataParam);


    Now, you can refer to any bmp file and pass the address, like open the BMP file in binary operation, note, if it is a FILE pointer you must pass the pointer to buffer inside the FILE structure NOT the file pointer.

    //Lets assume ptrFileBMP - buffer pointer. 

    API_DisplayStaticImage(&RetrieveData, (void*) ptrFileBMP);

    Let us know if it helps.

    Regards,

    Sanjeev

     

  • Hello, Clinton. Thank you very much for your answer. I'd like to use the function to display a static image , e.g. raw format, bmp format, and so forth.

    I printed the addresses of all the parameters with a bmp image. There are two "size = 0", could you tell me how to explain it.

    Additionally, if I want to display a raw format image,  could you give me some suggestions.

    Thank you and good luck!

    Haitao Deng

  • Hello, Sanjeev. Your answers are very helpful ans important and thank you very much for your answer and time.
  • Hello, Sanjeev. Thank you for your answer again. There are two "size = 0" appeared when I try to display a bmp file. Could you tell me what should to be done when the size equals to "0".
  • I have not tested the below code, something like below should work for you.

    FILE *fp;

    ErrorCode_t RetrieveData(void *Param, uint8* Destination, uint32 Size)
    {

    if((fp == NULL) || foef(fp))
    return FAIL;

    fread(Destination,1,Size,(FILE*) Param);

    return SUCCESS;

    }

    main()
    {
    fp = fopen("name_of_bmp_file.bmp", "rb");
    if(fp == NULL)
    return -1;

    API_DisplayStaticImage(&RetrieveData, (void*) fp);

    }

    Regards,
    Sanjeev