libtthimage/Tests/t_t16x24.c

65 lines
1.6 KiB
C
Raw Normal View History

2022-06-26 22:55:56 +02:00
/*
Proggy de test pour les fontes 16x24 - new 4 mai 2007, a StEx.
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "../tthimage.h"
/*::------------------------------------------------------------------::*/
int essai_f1(char *tgasrc, char *tgadst, char *texte)
{
Image_Desc *img;
int foo;
RGBA encre, papier;
2022-09-20 13:47:11 +02:00
fprintf(stderr, ">>> %s ( %p %p '%s' )\n", __func__, tgasrc, tgadst, texte);
2022-06-26 22:55:56 +02:00
img = Image_TGA_alloc_load(tgasrc);
2022-09-20 13:47:11 +02:00
if (NULL==img) {
fprintf(stderr, "%s: can't read '%s'\n", __func__, tgasrc);
return FILE_NOT_FOUND;
}
2022-06-26 22:55:56 +02:00
foo = Image_t16x24_txtload("16x24thin", NULL, 0);
2022-07-07 12:52:00 +02:00
if (foo) {
fprintf(stderr, "%s err %d loading font '16x24thin'\n", __func__, foo);
return foo;
}
2022-06-26 22:55:56 +02:00
encre.r = 0; encre.g = 255; encre.b = 100; encre.a = 255;
papier.r = 255; papier.b = 0; papier.g = 0; papier.a = 200;
foo = Image_t16x24_pltstr_1(img, texte, 2, 42, &papier, &encre, 0);
foo = Image_TGA_save(tgadst, img, 0);
return -1;
}
/*::------------------------------------------------------------------::*/
int main(int argc, char *argv[])
{
2022-07-07 12:52:00 +02:00
int foo;
2022-06-26 22:55:56 +02:00
2022-09-20 19:16:42 +02:00
fprintf(stderr, "--------------[ %s ]------------\n", argv[0]);
2022-07-11 06:14:45 +02:00
foo = Image_t16x24_chars_map("16x24thin", "all16x24chars.tga", 0);
2022-09-20 19:16:42 +02:00
if (foo) { Image_print_error("load thin font", foo); }
foo = Image_t16x24_chars_map("16x24gruik", "all16X24chars.tga", 2);
if (foo) { Image_print_error("load gruik font", foo); }
2023-11-18 19:58:21 +01:00
fprintf(stderr, "--------------------------------------\n");
2022-06-26 22:55:56 +02:00
2022-09-20 19:16:42 +02:00
/*
2022-06-26 22:55:56 +02:00
foo = essai_f1("pov.tga", "/tmp/aaaa_plop.tga", "0123456789");
if (foo) {
2022-09-20 13:47:11 +02:00
fprintf(stderr, "essai f1 ---> %d\n", foo);
2022-06-26 22:55:56 +02:00
}
2022-09-20 19:16:42 +02:00
*/
2022-06-26 22:55:56 +02:00
return 0;
}
/*::------------------------------------------------------------------::*/