This function draws a GIF image on the display.

Syntax

int ShowGIF(
  unsigned short x_offs, 
  unsigned short y_offs, 
  unsigned short mode, 
  unsigned char *picture
);

Parameters

x_offs
[in] The horizontal start position of the picture.
y_offs
[in] The vertical start position of the picture.
mode
[in] This can be:
WRITE_TO_SCREEN:
The pixels in the supplied buffer are simply drawn on the screen.
The buffer holds 3 bytes per pixel, the LSB is the value for red, the MSB for blue.
picture
[in] A pointer to the GIF image in memory.

Return value

Returns the success (OK) or failure (ERROR) of the function.
If it is not a GIF file, it returns ERROR.

Remarks

This function uses the dot coordinates of the screen for drawing.
The values that can be set are as follows.
X (Left and Right): 0 ~ (DISP_WIDTH -1)
Y (Up and Down): 0 ~ (DISP_HEIGHT --1)
When the status bar is displayed, the Y coordinate values that can be set are as follows.
Y (Up and Down)): 0 〜 (DISP_HEIGHT - 17)
ValueDescription
DISP_WIDTH 128 pixel
DISP_HEIGHT 160 pixel

Requirements

Header file:
lib.h
Library file:
libSTARTUPOPH5000.a

Sample

#include <stdio.h>
#include <stdlib.h>
#include "lib.h"

void main(void)
{
    struct ffblk ffblkSt;
    unsigned char *imageBuffer;
    FILE *fp;
    printf("[ShowGIF]\n");
    printf("Please any key\r");
    ResetKey();
    while(!kbhit())
        Idle();
    if (findfirst("image.gif", &ffblkSt) == OK)
    {
        if ((imageBuffer = malloc(ffblkSt.filesize)) == NULL)
            return;
        fp = fopen("image.gif","rb");
        if (fp != NULL)
        {
            fread(imageBuffer, ffblkSt.filesize, 1, fp);
            fclose(fp);
        }
        ShowGIF(0, 0, WRITE_TO_SCREEN, imageBuffer);
        printf("Please any key\r");
        ResetKey();
        while(!kbhit())
            Idle();
    }
}

Last updated: 2020/10/02