Compare commits
7 Commits
f4c3825186
...
97ad716bd2
Author | SHA1 | Date | |
---|---|---|---|
|
97ad716bd2 | ||
|
ae54fb932a | ||
|
5418e01820 | ||
|
24b3d4de11 | ||
|
5ffc94c17d | ||
|
6fddb97ee4 | ||
|
725ccf3c87 |
@ -1,4 +1,4 @@
|
||||
# libtthimage
|
||||
# libtthimage, la doc
|
||||
|
||||
Les fichiers [HTML](html/) que vous avez ici sont des versions historiques,
|
||||
qui seront peut-être mise à jour au prochain grand refactoring.
|
||||
@ -13,11 +13,11 @@ Certaines options de compilation sont dans le fichier de
|
||||
[paramètres](../Paramakes.mk) pour les différents fichiers make.
|
||||
Je vous conseille de vérifier leurs pertinences, et en particulier
|
||||
les options `-p` et `-pg` que j'oublie parfois d'enlever avant
|
||||
le _/push_.
|
||||
le _push_.
|
||||
|
||||
Le script [build.sh](../build.sh) tente d'automatiser les
|
||||
compilations de la bibilothèque, des tests et des outils
|
||||
en ligne de commande.
|
||||
en ligne de commande. Il est encore loin d'être parfait.
|
||||
|
||||
## Installation
|
||||
|
||||
@ -28,4 +28,4 @@ dans le fichier Paramakes.mk !
|
||||
|
||||
## Utilisation
|
||||
|
||||
???
|
||||
??? *Insérez ici quelques exemples d'utilisation des tools.*
|
||||
|
2
Lib/.gitignore
vendored
2
Lib/.gitignore
vendored
@ -1,4 +1,6 @@
|
||||
|
||||
*.png
|
||||
*.gif
|
||||
|
||||
cflow.txt
|
||||
|
||||
|
@ -1,8 +1,9 @@
|
||||
# The tTh image processing library
|
||||
|
||||
Ugly software born around 1995 on a MS-Dos 286 computer.
|
||||
|
||||
Look at the `Makefile` for no more explanations.
|
||||
Look at the [`Makefile`](Makefile) for no more explanations.
|
||||
More pertinent informations can be found in
|
||||
[`tthimage.h`](../tthimage.h).
|
||||
|
||||
|
||||
## Text primitives
|
||||
|
56
Lib/essais.c
56
Lib/essais.c
@ -216,18 +216,17 @@ if (NULL==(src=Image_TGA_alloc_load(srcname))) {
|
||||
}
|
||||
/* on va creer le receptacle des horreurs */
|
||||
if (NULL==(dst=Image_clone(src, 0))) {
|
||||
fprintf(stderr, "%s: err clone\n", __func__);
|
||||
exit(5);
|
||||
}
|
||||
|
||||
/* ah bravo ! enfin un test unitaire appelable
|
||||
* depuis le test unitaire */
|
||||
for (idx=0; idx<20; idx++)
|
||||
{
|
||||
for (idx=0; idx<20; idx++) {
|
||||
foo = Image_essai_col_reduce(src, dst, 133, idx);
|
||||
printf("le retour de l'essai_col_reduce %d est %d\n", idx, foo);
|
||||
if (OLL_KORRECT==foo)
|
||||
{
|
||||
sprintf(fname, "Pictures/aaaa-colredux-%02d.tga", idx);
|
||||
if (OLL_KORRECT==foo) {
|
||||
sprintf(fname, "aaaa-colredux-%02d.tga", idx);
|
||||
Image_TGA_save(fname, dst, 0);
|
||||
}
|
||||
}
|
||||
@ -582,32 +581,30 @@ int foo, ax, ay;
|
||||
|
||||
printf("====== essais Warping sur %s (k=%d) ====\n", srcname, k);
|
||||
|
||||
if (NULL == (src = Image_TGA_alloc_load(srcname)) )
|
||||
{
|
||||
if (NULL == (src = Image_TGA_alloc_load(srcname)) ) {
|
||||
fprintf(stderr, "Err loading '%s'\n", srcname);
|
||||
exit(5);
|
||||
}
|
||||
dst = Image_clone(src, 0);
|
||||
|
||||
foo = Image_warp_essai_0(src, dst, 33.5, 100, 100);
|
||||
Image_TGA_save("Pictures/warp-essai-0.tga", dst, 0);
|
||||
Image_TGA_save("warp-essai-0.tga", dst, 0);
|
||||
|
||||
foo = Image_center_rotate(src, dst, 21.5);
|
||||
Image_TGA_save("Pictures/warp-center-rotate.tga", dst, 0);
|
||||
Image_TGA_save("warp-center-rotate.tga", dst, 0);
|
||||
|
||||
ax = (src->width * 2) / 3;
|
||||
ay = (src->height * 2) / 3;
|
||||
foo = Image_shift_xy(src, dst, ax, ay);
|
||||
Image_TGA_save("Pictures/warp-shift-xy.tga", dst, 0);
|
||||
Image_TGA_save("warp-shift-xy.tga", dst, 0);
|
||||
foo = Image_shift_x(src, dst, ax);
|
||||
Image_TGA_save("Pictures/warp-shift-x.tga", dst, 0);
|
||||
Image_TGA_save("warp-shift-x.tga", dst, 0);
|
||||
foo = Image_shift_y(src, dst, ay);
|
||||
Image_TGA_save("Pictures/warp-shift-y.tga", dst, 0);
|
||||
Image_TGA_save("warp-shift-y.tga", dst, 0);
|
||||
|
||||
Image_DeAllocate(src); free(src);
|
||||
Image_DeAllocate(dst); free(dst);
|
||||
|
||||
|
||||
return 42;
|
||||
}
|
||||
/*::------------------------------------------------------------------::*/
|
||||
@ -795,7 +792,7 @@ Image_DeAllocate(dst); free(dst);
|
||||
return 42;
|
||||
}
|
||||
/*::------------------------------------------------------------------::*/
|
||||
int Test_classif(char *srcname, int k)
|
||||
int Test_Classif(char *srcname, int k)
|
||||
{
|
||||
Image_Desc *src, *dst;
|
||||
int foo;
|
||||
@ -812,8 +809,7 @@ static Une_Classe_Sph classs[] =
|
||||
{ 0, 255, 0, DC, 0, 255, 0 }
|
||||
};
|
||||
|
||||
if (NULL == (src = Image_TGA_alloc_load(srcname)) )
|
||||
{
|
||||
if (NULL == (src = Image_TGA_alloc_load(srcname)) ) {
|
||||
fprintf(stderr, "Err loading '%s'\n", srcname);
|
||||
exit(5);
|
||||
}
|
||||
@ -821,11 +817,11 @@ dst = Image_clone(src, 0);
|
||||
|
||||
foo = Image_classif_0(src, dst);
|
||||
Image_print_error("essai classif 0", foo);
|
||||
Image_TGA_save("Pictures/aaaa-classif0.tga", dst, 0);
|
||||
Image_TGA_save("aaaa-classif0.tga", dst, 0);
|
||||
|
||||
foo = Image_classif_1(src, dst, classs, 5, 0);
|
||||
Image_print_error("essai classif 1", foo);
|
||||
Image_TGA_save("Pictures/aaaa-classif1.tga", dst, 0);
|
||||
Image_TGA_save("aaaa-classif1.tga", dst, 0);
|
||||
|
||||
Image_DeAllocate(src); free(src);
|
||||
Image_DeAllocate(dst); free(dst);
|
||||
@ -1159,7 +1155,7 @@ Image_dump_descriptor(source, "just after load");
|
||||
* est-ce bien necessaire ?
|
||||
*/
|
||||
/* Image_egalise_RGB(source, source, 0); */
|
||||
wf = source->width; hf = (source->height) * 4;
|
||||
wf = source->width; hf = (source->height) * 3;
|
||||
x2 = source->width / 2; y2 = source->height / 2;
|
||||
rect.w = x2; rect.h = y2;
|
||||
rect.x = 0; rect.y = 0;
|
||||
@ -1353,8 +1349,7 @@ Image_DeAllocate(finale); free(finale);
|
||||
return 42;
|
||||
}
|
||||
/*::------------------------------------------------------------------::*/
|
||||
int
|
||||
Test_des_tamppools(char *imgname, int param)
|
||||
int Test_des_tamppools(char *imgname, int param)
|
||||
{
|
||||
void *ptr;
|
||||
int foo;
|
||||
@ -1377,7 +1372,7 @@ int Test_des_filtres(char *srcname, int k)
|
||||
Image_Desc *src, *dst;
|
||||
int foo;
|
||||
|
||||
printf("=============== LES FILTRES =====[ %s ]====[ %d ]====\n", srcname, k);
|
||||
printf("=============== Filtres =====[ %s ]====[ %d ]====\n", srcname, k);
|
||||
|
||||
src = Image_TGA_alloc_load(srcname);
|
||||
if (NULL == src) {
|
||||
@ -1397,8 +1392,11 @@ foo = Image_filtre_Prewitt(src, dst, 5);
|
||||
Image_TGA_save("filtre-prewitt-5.tga", dst, 0);
|
||||
foo = Image_filtre_passe_haut(src, dst);
|
||||
Image_TGA_save("filtre-passe-haut.tga", dst, 0);
|
||||
|
||||
/*
|
||||
foo = Image_filtre_Sobel_4(src, dst, 0);
|
||||
Image_TGA_save("filtre-sobel-4.tga", dst, 0);
|
||||
*/
|
||||
|
||||
Image_DeAllocate(src); free(src);
|
||||
Image_DeAllocate(dst); free(dst);
|
||||
@ -1494,3 +1492,17 @@ Image_DeAllocate(dst); free(dst);
|
||||
return -1;
|
||||
}
|
||||
/*::------------------------------------------------------------------::*/
|
||||
/* ============================== */
|
||||
|
||||
void essai_gradients(void)
|
||||
{
|
||||
int foo;
|
||||
|
||||
foo = Image_plot_H_gradient("foo.tga", 640, 200);
|
||||
fprintf(stderr, "plot h gradient -> %d\n", foo);
|
||||
foo = Image_plot_V_gradient("foo.tga", 900, 200);
|
||||
fprintf(stderr, "plot v gradient -> %d\n", foo);
|
||||
}
|
||||
/* ============================== */
|
||||
/*::------------------------------------------------------------------::*/
|
||||
|
||||
|
@ -27,6 +27,8 @@ int Essai_des_lut15bits(char *srcname, int k);
|
||||
int Essai_des_mires(char *, int, int);
|
||||
int Essai_des_zooms(char *srcname, int k);
|
||||
|
||||
int Test_Classif(char *srcname, int k);
|
||||
|
||||
int Essai_des_7_segments(char *srcname, int flag);
|
||||
int Essai_des_distances(char *srcname, int nbre, int flag);
|
||||
int Essai_des_cadres(char *srcname, int flags);
|
||||
|
24
Lib/foo.c
24
Lib/foo.c
@ -17,14 +17,12 @@
|
||||
*/
|
||||
#define PIXEL_COPY(ip, ix, iy, op, ox, oy) \
|
||||
do { \
|
||||
op->Rpix[oy][x] = ip->Rpix[y][x]; \
|
||||
op->Gpix[oy][x] = ip->Gpix[y][x]; \
|
||||
op->Bpix[oy][x] = ip->Bpix[y][x]; \
|
||||
(op->Rpix[oy])[ox] = (ip->Rpix[iy])[ix]; \
|
||||
(op->Gpix[oy])[ox] = (ip->Gpix[iy])[ix]; \
|
||||
(op->Bpix[oy])[ox] = (ip->Bpix[iy])[ix]; \
|
||||
} while (0)
|
||||
|
||||
#define SZPIC 5777
|
||||
|
||||
double tthi_dtime(void);
|
||||
#define SZPIC 4096
|
||||
|
||||
void essai_pixcopy(int usemacro)
|
||||
{
|
||||
@ -32,11 +30,13 @@ Image_Desc *alice, *bob;
|
||||
int x, y, foo;
|
||||
double T0, T1, perpix;
|
||||
long count;
|
||||
char *fname;
|
||||
|
||||
alice = Image_alloc(SZPIC, SZPIC, IMAGE_RGB);
|
||||
bob = Image_alloc(SZPIC, SZPIC, IMAGE_RGB);
|
||||
|
||||
Image_pattern_000(alice, rand());
|
||||
Image_pattern_000(alice, 0);
|
||||
Image_TGA_save("alice.tga", alice, 0);
|
||||
|
||||
T0 = tthi_dtime();
|
||||
count = 0L;
|
||||
@ -48,6 +48,7 @@ if (usemacro) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
fname = "bob1.tga";
|
||||
}
|
||||
else {
|
||||
for (y=0; y<SZPIC; y++) {
|
||||
@ -56,17 +57,18 @@ else {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
fname = "bob0.tga";
|
||||
}
|
||||
|
||||
T1 = tthi_dtime();
|
||||
|
||||
foo = Image_TGA_save("bob.tga", bob, 0);
|
||||
foo = Image_TGA_save(fname, bob, 0);
|
||||
if (foo) {
|
||||
fprintf(stderr, "%s: save -> %d\n", __func__, foo);
|
||||
}
|
||||
|
||||
perpix = (T1-T0) / (double)count;
|
||||
fprintf(stderr, "%s : %10ld pixels, elapsed %9.6f seconds ==> %5.3g µs/ppix\n",
|
||||
perpix = ((T1-T0) / (double)count) * 1e6;
|
||||
fprintf(stderr, "%s : %10ld pixels, elapsed %9.6f seconds ==> %9.6f µs/pix\n",
|
||||
usemacro ? "macro" : "func ",
|
||||
count, T1-T0, perpix);
|
||||
|
||||
@ -79,7 +81,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
int i;
|
||||
|
||||
fprintf(stderr, "******** %s is running *********\n", argv[0]);
|
||||
fprintf(stderr, "*********** %s ************\n", argv[0]);
|
||||
|
||||
if (argc > 1) {
|
||||
fprintf(stderr, "argument: %s\n", argv[1]);
|
||||
|
110
Lib/image.c
110
Lib/image.c
@ -93,8 +93,7 @@ return 0;
|
||||
* on the structure who describe the image.
|
||||
* - - - > don't "free" this pointer, please.
|
||||
*/
|
||||
Image_Desc *
|
||||
Image_alloc(int width, int height, int type)
|
||||
Image_Desc * Image_alloc(int width, int height, int type)
|
||||
{
|
||||
Image_Desc *header;
|
||||
int foo;
|
||||
@ -192,19 +191,18 @@ return header;
|
||||
/*
|
||||
This fonction build another image from a model.
|
||||
*/
|
||||
Image_Desc *
|
||||
Image_clone (Image_Desc *src, int copy)
|
||||
Image_Desc * Image_clone (Image_Desc *src, int copy)
|
||||
{
|
||||
Image_Desc *image;
|
||||
|
||||
if ( src==NULL )
|
||||
if ( NULL == src )
|
||||
{
|
||||
fprintf(stderr, "Image_clone: source descriptor is NULL\n");
|
||||
exit(5);
|
||||
}
|
||||
|
||||
image = Image_alloc(src->width, src->height, src->type);
|
||||
if ( image==NULL )
|
||||
if ( NULL == image )
|
||||
{
|
||||
fprintf(stderr, "Image_clone: cloned descriptor is NULL\n");
|
||||
exit(5);
|
||||
@ -246,20 +244,16 @@ return FUNC_IS_ALPHA;
|
||||
* Helas, cette fonction ne marche que sur les images RGB
|
||||
* et comment la rendre compatible tout-types sans tout casser ?
|
||||
*/
|
||||
int
|
||||
Image_clear( Image_Desc *image, int r, int g, int b )
|
||||
int Image_clear( Image_Desc *image, int r, int g, int b )
|
||||
{
|
||||
int x, y;
|
||||
|
||||
if (image->type == IMAGE_RGB)
|
||||
{
|
||||
for (y=0; y<image->height; y++)
|
||||
{
|
||||
if (image->type == IMAGE_RGB) {
|
||||
for (y=0; y<image->height; y++) {
|
||||
/*
|
||||
* XXX here we can go faster with a few memset
|
||||
*/
|
||||
for (x=0; x<image->width; x++)
|
||||
{
|
||||
for (x=0; x<image->width; x++) {
|
||||
(image->Rpix[y])[x] = r;
|
||||
(image->Gpix[y])[x] = g;
|
||||
(image->Bpix[y])[x] = b;
|
||||
@ -269,12 +263,9 @@ if (image->type == IMAGE_RGB)
|
||||
return 0; /* ok, this 'return' here is a "spleyterie" :) */
|
||||
}
|
||||
|
||||
if (image->type == IMAGE_RGBA)
|
||||
{
|
||||
for (y=0; y<image->height; y++)
|
||||
{
|
||||
for (x=0; x<image->width; x++)
|
||||
{
|
||||
if (image->type == IMAGE_RGBA) {
|
||||
for (y=0; y<image->height; y++) {
|
||||
for (x=0; x<image->width; x++) {
|
||||
(image->Rpix[y])[x] = r;
|
||||
(image->Gpix[y])[x] = g;
|
||||
(image->Bpix[y])[x] = b;
|
||||
@ -309,6 +300,7 @@ if (IMAGE_RGB != img->type) {
|
||||
|
||||
for (y=0; y<img->height; y++) {
|
||||
for (x=0; x<img->width; x++) {
|
||||
/* please, use memset here */
|
||||
(img->Rpix[y])[x] = rgba->r;
|
||||
(img->Gpix[y])[x] = rgba->g;
|
||||
(img->Bpix[y])[x] = rgba->b;
|
||||
@ -321,8 +313,7 @@ return FUNC_IS_BETA;
|
||||
* every image in memory have a comment field, who is writen
|
||||
* in TGA and PNM file when image is saved.
|
||||
*/
|
||||
int
|
||||
Image_set_comment(Image_Desc *image, char *text)
|
||||
int Image_set_comment(Image_Desc *image, char *text)
|
||||
{
|
||||
if (strlen(text) > IMG_OBJCOMMENT_LEN)
|
||||
return STRING_TOO_LONG;
|
||||
@ -331,8 +322,7 @@ return OLL_KORRECT;
|
||||
}
|
||||
/* 10 nov 2001: no #define for this not-so-magic 254 value ? */
|
||||
/*::------------------------------------------------------------------::*/
|
||||
int
|
||||
Image_plot_gray(Image_Desc *img, int x, int y, int v)
|
||||
int Image_plot_gray(Image_Desc *img, int x, int y, int v)
|
||||
{
|
||||
if ( x<0 || y<0 || x>=img->width || y>=img->height )
|
||||
{
|
||||
@ -352,8 +342,7 @@ int Image_plotRGB(Image_Desc *img, int x, int y, int r, int g, int b)
|
||||
fprintf(stderr, "PLOTRGB %d %d\n", x, y);
|
||||
#endif
|
||||
|
||||
if ( x<0 || y<0 || x>=img->width || y>=img->height )
|
||||
{
|
||||
if ( x<0 || y<0 || x>=img->width || y>=img->height ) {
|
||||
fprintf(stderr, "Errplot RGB X=%d, Y=%d %d, %d, %d\n", x, y, r, g, b);
|
||||
#if FORCE_ABORT
|
||||
abort();
|
||||
@ -368,8 +357,7 @@ return OLL_KORRECT;
|
||||
|
||||
int Image_plotRGBA(Image_Desc *img, int x, int y, int r, int g, int b, int a)
|
||||
{
|
||||
if ( x<0 || y<0 || x>=img->width || y>=img->height )
|
||||
{
|
||||
if ( x<0 || y<0 || x>=img->width || y>=img->height ) {
|
||||
/* may be an #if DEBUG_LEVEL here ? */
|
||||
fprintf(stderr, "Errplot RGBA X %4d Y %4d %d, %d, %d, %d\n",
|
||||
x, y, r, g, b, a);
|
||||
@ -387,11 +375,9 @@ if ( x<0 || y<0 || x>=img->width || y>=img->height )
|
||||
return OLL_KORRECT;
|
||||
}
|
||||
/*::------------------------------------------------------------------::*/
|
||||
int
|
||||
Image_getRGB(Image_Desc *img, int x, int y, int *pr, int *pg, int *pb)
|
||||
{
|
||||
if ( x<0 || y<0 || x>=img->width || y>=img->height )
|
||||
int Image_getRGB(Image_Desc *img, int x, int y, int *pr, int *pg, int *pb)
|
||||
{
|
||||
if ( x<0 || y<0 || x>=img->width || y>=img->height ) {
|
||||
/* may be an #if DEBUG_LEVEL here ? */
|
||||
fprintf(stderr, "ERR GETRGB X %4d Y %4d\n", x, y);
|
||||
#if FORCE_ABORT
|
||||
@ -407,11 +393,9 @@ if ( x<0 || y<0 || x>=img->width || y>=img->height )
|
||||
return OLL_KORRECT;
|
||||
}
|
||||
/*::------------------------------------------------------------------::*/
|
||||
int
|
||||
Image_getRGBA(Image_Desc *img, int x, int y, int *pr, int *pg, int *pb, int *pa)
|
||||
{
|
||||
if ( x<0 || y<0 || x>=img->width || y>=img->height )
|
||||
int Image_getRGBA(Image_Desc *img, int x, int y, int *pr, int *pg, int *pb, int *pa)
|
||||
{
|
||||
if ( x<0 || y<0 || x>=img->width || y>=img->height ) {
|
||||
fprintf(stderr, "ERR GETRGBA X %4d Y %4d\n", x, y);
|
||||
#if FORCE_ABORT
|
||||
abort();
|
||||
@ -419,10 +403,9 @@ if ( x<0 || y<0 || x>=img->width || y>=img->height )
|
||||
return OUT_OF_IMAGE;
|
||||
}
|
||||
|
||||
if (img->type != IMAGE_RGBA)
|
||||
{
|
||||
fprintf(stderr, "Image get RGBA: bad image type: %d, %s\n",
|
||||
img->type, Image_type2str(img->type));
|
||||
if (img->type != IMAGE_RGBA) {
|
||||
fprintf(stderr, "%s: bad image type: %d, %s\n",
|
||||
__func__, img->type, Image_type2str(img->type));
|
||||
#if FORCE_ABORT
|
||||
abort();
|
||||
#endif
|
||||
@ -443,16 +426,14 @@ return OLL_KORRECT;
|
||||
*/
|
||||
int Image_plot_channel(Image_Desc *img, char channel, int x, int y, int value)
|
||||
{
|
||||
if ( x<0 || y<0 || x>=img->width || y>=img->height )
|
||||
{
|
||||
if ( x<0 || y<0 || x>=img->width || y>=img->height ) {
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, "ERR PLOTCHANNEL X %4d Y %4d\n", x, y);
|
||||
#endif
|
||||
return OUT_OF_IMAGE;
|
||||
}
|
||||
|
||||
switch (channel)
|
||||
{
|
||||
switch (channel) {
|
||||
case 'r': case 'R': (img->Rpix[y])[x] = (uint8_t)(value&0xff); break;
|
||||
case 'g': case 'G': (img->Gpix[y])[x] = (uint8_t)(value&0xff); break;
|
||||
case 'b': case 'B': (img->Bpix[y])[x] = (uint8_t)(value&0xff); break;
|
||||
@ -466,44 +447,36 @@ return OLL_KORRECT;
|
||||
/*
|
||||
lecture d'une des composantes de l'image.
|
||||
*/
|
||||
int
|
||||
Image_R_pixel(Image_Desc *img, int x, int y)
|
||||
{
|
||||
if ( x<0 || y<0 || x>=img->width || y>=img->height )
|
||||
int Image_R_pixel(Image_Desc *img, int x, int y)
|
||||
{
|
||||
if ( x<0 || y<0 || x>=img->width || y>=img->height ) {
|
||||
fprintf(stderr, "ERR READ R PIX X%d Y%d\n", x, y);
|
||||
return OUT_OF_IMAGE;
|
||||
}
|
||||
return (int)((img->Rpix[y])[x]);
|
||||
}
|
||||
|
||||
int
|
||||
Image_G_pixel(Image_Desc *img, int x, int y)
|
||||
{
|
||||
if ( x<0 || y<0 || x>=img->width || y>=img->height )
|
||||
int Image_G_pixel(Image_Desc *img, int x, int y)
|
||||
{
|
||||
if ( x<0 || y<0 || x>=img->width || y>=img->height ) {
|
||||
fprintf(stderr, "ERR READ G PIX X%d Y%d\n", x, y);
|
||||
return OUT_OF_IMAGE;
|
||||
}
|
||||
return (int)((img->Gpix[y])[x]);
|
||||
}
|
||||
|
||||
int
|
||||
Image_B_pixel(Image_Desc *img, int x, int y)
|
||||
{
|
||||
if ( x<0 || y<0 || x>=img->width || y>=img->height )
|
||||
int Image_B_pixel(Image_Desc *img, int x, int y)
|
||||
{
|
||||
if ( x<0 || y<0 || x>=img->width || y>=img->height ) {
|
||||
fprintf(stderr, "ERR READ B PIX X%d Y%d\n", x, y);
|
||||
return OUT_OF_IMAGE;
|
||||
}
|
||||
return (int)((img->Bpix[y])[x]);
|
||||
}
|
||||
|
||||
int
|
||||
Image_A_pixel(Image_Desc *img, int x, int y)
|
||||
{
|
||||
if ( x<0 || y<0 || x>=img->width || y>=img->height )
|
||||
int Image_A_pixel(Image_Desc *img, int x, int y)
|
||||
{
|
||||
if ( x<0 || y<0 || x>=img->width || y>=img->height ) {
|
||||
fprintf(stderr, "ERR A PIX X%d Y%d\n", x, y);
|
||||
return OUT_OF_IMAGE;
|
||||
}
|
||||
@ -545,7 +518,7 @@ return 0;
|
||||
}
|
||||
/*::------------------------------------------------------------------::*/
|
||||
/*
|
||||
* no boundary control ?
|
||||
* no boundary control ? XXX
|
||||
*/
|
||||
int Image_pixel_copy(Image_Desc *s, int x, int y, Image_Desc *d, int i, int j)
|
||||
{
|
||||
@ -563,18 +536,16 @@ return OLL_KORRECT;
|
||||
*/
|
||||
int Image_compare_desc(Image_Desc *a, Image_Desc *b)
|
||||
{
|
||||
char *fmt = "Image at %p have no 'Dead Beef' in it\n";
|
||||
char *fmt = "%s: Image at %p have no 'Dead Beef' in it\n";
|
||||
|
||||
if ( (a==NULL) || (b==NULL) ) return NULL_DESCRIPTOR;
|
||||
|
||||
if ( a->magic != MAGIC_OF_IMAGE )
|
||||
{
|
||||
fprintf(stderr, fmt, a);
|
||||
if ( a->magic != MAGIC_OF_IMAGE ) {
|
||||
fprintf(stderr, fmt, __func__, a);
|
||||
return NOT_AN_IMAGE_DESC;
|
||||
}
|
||||
if ( b->magic != MAGIC_OF_IMAGE )
|
||||
{
|
||||
fprintf(stderr, fmt, a);
|
||||
if ( b->magic != MAGIC_OF_IMAGE ) {
|
||||
fprintf(stderr, fmt, __func__, a);
|
||||
return NOT_AN_IMAGE_DESC;
|
||||
}
|
||||
|
||||
@ -592,8 +563,7 @@ return OLL_KORRECT;
|
||||
c'est qu'il reste un pointeur fou chez
|
||||
l'appelant ...
|
||||
*/
|
||||
int
|
||||
Image_DeAllocate(Image_Desc *im)
|
||||
int Image_DeAllocate(Image_Desc *im)
|
||||
{
|
||||
int line;
|
||||
|
||||
|
@ -53,7 +53,7 @@ else
|
||||
|
||||
Image_start_chrono("Essai", 0);
|
||||
|
||||
for (idx=0; idx<1; idx++) {
|
||||
for (idx=0; idx<3; idx++) {
|
||||
foo = Test_Egalisations(fichier, 0);
|
||||
fprintf(stderr, " essai egalisation -> %d\n", foo);
|
||||
foo = Essai_Televisions(fichier, 10);
|
||||
@ -64,17 +64,24 @@ for (idx=0; idx<1; idx++) {
|
||||
fprintf(stderr, " essai filtres -> %d\n", foo);
|
||||
foo = Test_RGBmask(fichier);
|
||||
fprintf(stderr, " essai rgb mask -> %d\n", foo);
|
||||
foo = Test_Classif(fichier, 0);
|
||||
fprintf(stderr, " essai classif -> %d\n", foo);
|
||||
foo = Test_des_warpings(fichier, 0);
|
||||
fprintf(stderr, " essai warping -> %d\n", foo);
|
||||
|
||||
fprintf(stderr, "********* %s: fin passe %d\n", argv[0], idx);
|
||||
|
||||
fprintf(stderr, "\n*************** %s: fin passe %d ******\n\n",
|
||||
argv[0], idx);
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
foo = Essai_color_2_map(fichier, idx);
|
||||
fprintf(stderr, " essai col2map -> %d\n", foo);
|
||||
|
||||
foo = test_du_jpeg_reader("in.jpeg");
|
||||
fprintf(stderr, " essai lecture jpeg -> %d\n", foo);
|
||||
|
||||
foo = Test_Dithering(fichier, 17);
|
||||
fprintf(stderr, "essai dithering -> %d\n", foo);
|
||||
|
||||
Test_des_patterns("/tmp/pattt", 0, 0);
|
||||
foo = Essai_des_jauges(fichier, 17);
|
||||
|
||||
|
@ -1,14 +1,20 @@
|
||||
# Some useless tests
|
||||
# Some useless tests ?
|
||||
|
||||
Tester, c'est douter.
|
||||
<u>Tester, c'est douter.</u>
|
||||
|
||||
## État des lieux
|
||||
|
||||
Pas grand chose.
|
||||
Pas grand chose pour le moment. Mais comme j'utilise régulièrement
|
||||
et depuis très longtemps cet amas de fonctions, on peut dire que
|
||||
les tests sont fait *in-vivo* sans formalisme formalisé.
|
||||
|
||||
Allez quand même voir `config.sh` et `functions.sh` pour avoir une idée
|
||||
du désastre actuel. Il reste beaucoup de choses à faire.
|
||||
|
||||
## Mais encore ?
|
||||
|
||||
Dans le répertoire `Lib/` il y a un `essais.c` assez prometteur.
|
||||
Dans le répertoire `Lib/` il y a un `essais.c` assez
|
||||
[prometteur](../Lib/essais.c) et en constante évolution.
|
||||
Il manque à son [driver](../Lib/testtga.c) une gestion plus
|
||||
fluide de la sélection
|
||||
des essais à faire tourner.
|
||||
|
@ -81,8 +81,8 @@ tga_extract: tga_extract.c $(DEPS) fonctions.o
|
||||
gcc $(CFLAGS) $< ../libtthimage.a fonctions.o -lm -o $@
|
||||
|
||||
|
||||
# tga_info: tga_info.c $(DEPS) fonctions.o
|
||||
# gcc $(CFLAGS) $< ../libimage.a fonctions.o -lm -o $@
|
||||
tga_info: tga_info.c $(DEPS) fonctions.o
|
||||
gcc $(CFLAGS) $< ../libimage.a fonctions.o -lm -o $@
|
||||
|
||||
tga_pattern: tga_pattern.c $(DEPS) fonctions.o
|
||||
gcc $(CFLAGS) $< ../libtthimage.a fonctions.o -lm -o $@
|
||||
|
@ -50,9 +50,9 @@ La gestion de la ligne de commande est désastreuse. **À REFAIRE**
|
||||
|
||||
## tga_cadre
|
||||
|
||||
Pas mal de façons de mettre un cadre sur l'image.
|
||||
Niveau de kitchitude assez élevé.
|
||||
Paramètres mal documentés.
|
||||
Il existe pas mal de façons de mettre un cadre sur l'image,
|
||||
avec un niveau de kitchitude assez élevé.
|
||||
Les paramètres sont mal documentés.
|
||||
|
||||
## tga_combine
|
||||
|
||||
@ -61,7 +61,8 @@ Usage:
|
||||
tga_combine s1.tga s2.tga MODE d.tga [PARAMS]
|
||||
```
|
||||
Il existe plein de façon de combiner deux images, la commande
|
||||
`testtga list` vous les fera découvrir, la cinquième va vous étonner.
|
||||
`tga_combine list` vous les fera découvrir, la cinquième va vous étonner.
|
||||
Les paramètres sont mal documentés.
|
||||
|
||||
## tga_dither
|
||||
|
||||
@ -77,11 +78,16 @@ Attendu avec impatience, il aura le support complet des PNG. Un jour...
|
||||
|
||||
## tga_filtres
|
||||
|
||||
UTSL : [tga_filtres.c](caractère \textbf{invisible})
|
||||
|
||||
## tga_incrust
|
||||
|
||||
## tga_makehf15
|
||||
|
||||
Pour les POViste acharnés.
|
||||
Pour les POViste acharnés. De façon étrange,
|
||||
[Povray](https://povray.org/) a choisi de stocker des
|
||||
champs d'altitude dans les images Targa, en n'utilisant que
|
||||
15 bits pour la valeur.
|
||||
|
||||
## tga_to_text
|
||||
|
||||
@ -102,6 +108,11 @@ vraiment trop nulle...
|
||||
|
||||
## tga_remap
|
||||
|
||||
Usage: `tga_remap M <src.tga> <color.map> <dst.tga>`
|
||||
|
||||
Le paramètre `M` peut prendre les valeurs 0, 1, 2, 11, 12 ou 13.
|
||||
Je ne sais plus à quoi ça correspond.
|
||||
|
||||
## tga_television
|
||||
|
||||
## tga_tools
|
||||
|
@ -4,7 +4,7 @@
|
||||
http://la.buvette.org/devel/libimage/
|
||||
*/
|
||||
#ifndef IMAGE_VERSION_STRING
|
||||
#define IMAGE_VERSION_STRING "0.4.51 pl 85"
|
||||
#define IMAGE_VERSION_STRING "0.4.51 pl 91"
|
||||
|
||||
/*::------------------------------------------------------------------::*/
|
||||
/*
|
||||
@ -315,10 +315,15 @@ int Image_G_pixel(Image_Desc *img, int x, int y);
|
||||
int Image_B_pixel(Image_Desc *img, int x, int y);
|
||||
int Image_A_pixel(Image_Desc *img, int x, int y);
|
||||
|
||||
/* Mon Aug 12 2024 : this function may be rewrited with a macro ? */
|
||||
int Image_pixel_copy(Image_Desc *s, int x, int y, Image_Desc *d, int i, int j);
|
||||
|
||||
int Image_compare_desc(Image_Desc *a, Image_Desc *b);
|
||||
|
||||
/*::------------------------------------------------------------------::*/
|
||||
/* module functions.c */
|
||||
|
||||
double tthi_dtime(void);
|
||||
|
||||
/*::------------------------------------------------------------------::*/
|
||||
/* module pixels.c */
|
||||
|
Loading…
Reference in New Issue
Block a user