N64 QOI Demo
A N64 homebrew app that opens QOI images from ROM
Loading...
Searching...
No Matches
qoi_viewer.h File Reference

This header contains declaration of functions related to QOI viewer. More...

#include "sQOI.h"
#include <stdint.h>
#include <stdbool.h>
#include <libdragon.h>

Go to the source code of this file.

Data Structures

struct  qoi_img_info
 Metadata about the QOI image and the QOI image viewer. More...

Macros

#define IMG_BUFFER_SIZE   307200
 Image buffer size: 320 pixels in width * 240 pixels in height * 4 channels.

Typedefs

typedef enum qoi_error_code qoi_error_code
 Error codes for different situations when handling a QOI file.
typedef struct qoi_img_info qoi_img_info_t
 Metadata about the QOI image and the QOI image viewer.

Enumerations

enum  qoi_error_code {
  QOI_NOT_INITIALIZED = -1 , QOI_OK , QOI_NULL_BUFFER , QOI_INVAILD_FILE ,
  QOI_NO_FILE , QOI_NO_FILENAME
}
 Error codes for different situations when handling a QOI file. More...

Functions

void draw_image (surface_t *disp, qoi_img_info_t info)
 This function draws image decoded from QOI.
void openQOIFile (const char *filename, uint8_t *bytes, qoi_img_info_t *info)
 This function decodes QOI file from from into the framebuffer.
void toggleDebugText (qoi_img_info_t *info)
 Toggles printing debugging text.

Variables

uint8_t buffer0 [IMG_BUFFER_SIZE]
 Raw image buffer that decoded from qoi image file.
uint8_t buffer1 [IMG_BUFFER_SIZE]
 second raw image buffer that decoded from qoi image file

Detailed Description

This header contains declaration of functions related to QOI viewer.

Definition in file qoi_viewer.h.

Macro Definition Documentation

◆ IMG_BUFFER_SIZE

#define IMG_BUFFER_SIZE   307200

Image buffer size: 320 pixels in width * 240 pixels in height * 4 channels.

Definition at line 46 of file qoi_viewer.h.

Enumeration Type Documentation

◆ qoi_error_code

Error codes for different situations when handling a QOI file.

Enumerator
QOI_NOT_INITIALIZED 

QOI Image not yet decoded.

QOI_OK 

QOI Image decoded successfully.

QOI_NULL_BUFFER 

No buffer for image found.

QOI_INVAILD_FILE 

Invaild QOI image file found.

QOI_NO_FILE 

No file found given a filename to the supposed QOI image.

QOI_NO_FILENAME 

Filename to the QOI image not passed to decoder.

Definition at line 53 of file qoi_viewer.h.

Function Documentation

◆ draw_image()

void draw_image ( surface_t * disp,
qoi_img_info_t info )

This function draws image decoded from QOI.

Parameters
dispSurface image
infoQOI info for drawing image properly

Definition at line 51 of file qoi_viewer.c.

◆ openQOIFile()

void openQOIFile ( const char * filename,
uint8_t * bytes,
qoi_img_info_t * info )

This function decodes QOI file from from into the framebuffer.

Parameters
filenameName of the QOI file
bytesPointer to a raw image buffer
infoQOI decoding info as a result of decoding qoi file

Definition at line 116 of file qoi_viewer.c.

◆ toggleDebugText()

void toggleDebugText ( qoi_img_info_t * info)
inline

Toggles printing debugging text.

Parameters
infoQOI decoding info

Definition at line 105 of file qoi_viewer.h.

Variable Documentation

◆ buffer0

uint8_t buffer0[IMG_BUFFER_SIZE]
extern

Raw image buffer that decoded from qoi image file.

Definition at line 54 of file main.c.

◆ buffer1

uint8_t buffer1[IMG_BUFFER_SIZE]
extern

second raw image buffer that decoded from qoi image file

Definition at line 57 of file main.c.