From 04bce0a7a2f463ff2a7a4a878500dd757e45f634 Mon Sep 17 00:00:00 2001 From: Brett Date: Sun, 7 Sep 2025 23:14:37 -0400 Subject: [PATCH] Add sample.c --- sample.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 sample.c diff --git a/sample.c b/sample.c new file mode 100644 index 0000000..ed846ac --- /dev/null +++ b/sample.c @@ -0,0 +1,24 @@ +// This program simply loads a QOI file into Allegro +// as a texture and then dumps the texture data as a PNG. +// Take notice of lines 12 and 13. You only need to initialize +// the QOI plugin (this registers the function hooks that Allegro +// will use whenever you want to I/O on a filename ending in .qoi) +// +// Compile the test program with: +// gcc -o test allegro_qoi.c test.c -lallegro -lallegro_image -I./ +// +// qoi.h should be inside of your include path. +// Either place it here, or in your system's global includes. + +#include +#include +#include "allegro_qoi.h" + +int main() { + al_init(); + al_init_image_addon(); + al_init_qoi(); + ALLEGRO_BITMAP* bmp = al_load_bitmap("sample.qoi"); + al_save_bitmap("out.png", bmp); + return 0; +}