Compare commits
	
		
			5 Commits
		
	
	
		
			99b580a1d7
			...
			60409a050c
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					60409a050c | ||
| 
						 | 
					6ce9f49c55 | ||
| 
						 | 
					2c8798e96e | ||
| 
						 | 
					99c3ee1166 | ||
| 
						 | 
					4ce5241411 | 
							
								
								
									
										12
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										12
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@ -9,9 +9,19 @@ Lib/foo
 | 
				
			|||||||
Lib/testtga
 | 
					Lib/testtga
 | 
				
			||||||
Lib/t_t16x24
 | 
					Lib/t_t16x24
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Tools/genplot2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Tools/tga_cadre
 | 
					Tools/tga_cadre
 | 
				
			||||||
 | 
					Tools/tga_combine
 | 
				
			||||||
 | 
					Tools/tga_dither
 | 
				
			||||||
Tools/tga_tools
 | 
					Tools/tga_tools
 | 
				
			||||||
Tools/tga_effects
 | 
					Tools/tga_effects
 | 
				
			||||||
 | 
					Tools/tga_equalize
 | 
				
			||||||
Tools/tga_filtres
 | 
					Tools/tga_filtres
 | 
				
			||||||
 | 
					Tools/tga_remap
 | 
				
			||||||
Tools/tga_television
 | 
					Tools/tga_television
 | 
				
			||||||
 | 
					Tools/tga_applymap
 | 
				
			||||||
 | 
					Tools/tga_makehf15
 | 
				
			||||||
 | 
					Tools/tga_mires
 | 
				
			||||||
 | 
					Tools/tga_incrust
 | 
				
			||||||
 | 
					Tools/tga_pattern
 | 
				
			||||||
 | 
				
			|||||||
@ -38,6 +38,7 @@ combine3.o:	combine3.c	$(DEPS)
 | 
				
			|||||||
combine4.o:	combine4.c	$(DEPS)
 | 
					combine4.o:	combine4.c	$(DEPS)
 | 
				
			||||||
combine5.o:	combine5.c	$(DEPS)
 | 
					combine5.o:	combine5.c	$(DEPS)
 | 
				
			||||||
combine6.o:	combine6.c	$(DEPS)
 | 
					combine6.o:	combine6.c	$(DEPS)
 | 
				
			||||||
 | 
					contrast.o:	contrast.c	$(DEPS)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
detect.o:	detect.c	$(DEPS)
 | 
					detect.o:	detect.c	$(DEPS)
 | 
				
			||||||
distances.o:	distances.c	$(DEPS)
 | 
					distances.o:	distances.c	$(DEPS)
 | 
				
			||||||
@ -102,6 +103,7 @@ rgbmask.o:	rgbmask.c	$(DEPS)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
scale.o:	scale.c		$(DEPS)
 | 
					scale.o:	scale.c		$(DEPS)
 | 
				
			||||||
sobel4.o:	sobel4.c	$(DEPS)
 | 
					sobel4.o:	sobel4.c	$(DEPS)
 | 
				
			||||||
 | 
					stereo.o:	stereo.c	$(DEPS)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
tamppool.o:	tamppool.c	$(DEPS)
 | 
					tamppool.o:	tamppool.c	$(DEPS)
 | 
				
			||||||
tele_2.o:	tele_2.c	$(DEPS)
 | 
					tele_2.o:	tele_2.c	$(DEPS)
 | 
				
			||||||
@ -130,6 +132,8 @@ OBJECTS =	7seg.o							\
 | 
				
			|||||||
		calculs.o classif.o 					\
 | 
							calculs.o classif.o 					\
 | 
				
			||||||
		col4bits.o colors.o colors2.o col_reduc.o col_xyz.o	\
 | 
							col4bits.o colors.o colors2.o col_reduc.o col_xyz.o	\
 | 
				
			||||||
		combine.o combine2.o combine3.o combine4.o combine5.o 	\
 | 
							combine.o combine2.o combine3.o combine4.o combine5.o 	\
 | 
				
			||||||
 | 
							combine6.o combine_rnd.o				\
 | 
				
			||||||
 | 
							contrast.o						\
 | 
				
			||||||
		detect.o distances.o					\
 | 
							detect.o distances.o					\
 | 
				
			||||||
		dither.o dither2.o dither3.o dither4.o			\
 | 
							dither.o dither2.o dither3.o dither4.o			\
 | 
				
			||||||
		doublesz.o drawalpha.o drawing.o drawpatt.o		\
 | 
							doublesz.o drawalpha.o drawing.o drawpatt.o		\
 | 
				
			||||||
@ -149,7 +153,7 @@ OBJECTS =	7seg.o							\
 | 
				
			|||||||
		pov_hf15e.o pov_hf15e.o pov_hf15f.o pov_synth.o		\
 | 
							pov_hf15e.o pov_hf15e.o pov_hf15f.o pov_synth.o		\
 | 
				
			||||||
		ptlist.o						\
 | 
							ptlist.o						\
 | 
				
			||||||
		recurse.o rgbmask.o					\
 | 
							recurse.o rgbmask.o					\
 | 
				
			||||||
		scale.o	sobel4.o					\
 | 
							scale.o	sobel4.o stereo.o				\
 | 
				
			||||||
		tamppool.o tele_2.o television.o			\
 | 
							tamppool.o tele_2.o television.o			\
 | 
				
			||||||
		text0.o text1.o text16x24.o				\
 | 
							text0.o text1.o text16x24.o				\
 | 
				
			||||||
		tga.o tools.o						\
 | 
							tga.o tools.o						\
 | 
				
			||||||
 | 
				
			|||||||
@ -9,7 +9,7 @@
 | 
				
			|||||||
#include  <stdio.h>
 | 
					#include  <stdio.h>
 | 
				
			||||||
#include  <stdlib.h>
 | 
					#include  <stdlib.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include  "tthimage.h"
 | 
					#include  "../tthimage.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*::------------------------------------------------------------------::*/
 | 
					/*::------------------------------------------------------------------::*/
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 | 
				
			|||||||
@ -4,7 +4,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include  <stdio.h>
 | 
					#include  <stdio.h>
 | 
				
			||||||
#include  <math.h>
 | 
					#include  <math.h>
 | 
				
			||||||
#include  "tthimage.h"
 | 
					#include  "../tthimage.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*::------------------------------------------------------------------::*/
 | 
					/*::------------------------------------------------------------------::*/
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 | 
				
			|||||||
@ -1314,7 +1314,7 @@ if (NULL == dst)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
foo = Image_lissage_3x3(src, dst);
 | 
					foo = Image_lissage_3x3(src, dst);
 | 
				
			||||||
Image_TGA_save("Pictures/filtre-liss3x3.tga", dst, 0);
 | 
					Image_TGA_save("Pictures/filtre-liss3x3.tga", dst, 0);
 | 
				
			||||||
if (foo) { fprintf(stderr, "%s: liss3x3   -> %d\n", foo); }
 | 
					if (foo) { fprintf(stderr, "%s: liss3x3   -> %d\n", __func__, foo); }
 | 
				
			||||||
foo = Image_filtre_Prewitt(src, dst, 5);
 | 
					foo = Image_filtre_Prewitt(src, dst, 5);
 | 
				
			||||||
Image_TGA_save("Pictures/filtre-prewitt-5.tga", dst, 0);
 | 
					Image_TGA_save("Pictures/filtre-prewitt-5.tga", dst, 0);
 | 
				
			||||||
foo = Image_filtre_passe_haut(src, dst);
 | 
					foo = Image_filtre_passe_haut(src, dst);
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										126
									
								
								Lib/stereo.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										126
									
								
								Lib/stereo.c
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,126 @@
 | 
				
			|||||||
 | 
					/*
 | 
				
			||||||
 | 
							+[
 | 
				
			||||||
 | 
								S=T=R=E=R=E=O
 | 
				
			||||||
 | 
							]+
 | 
				
			||||||
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include  <stdio.h>
 | 
				
			||||||
 | 
					#include  <stdlib.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include  "../tthimage.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*::------------------------------------------------------------------::*/
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 *	première fonction, assez primitive, mais qui marche.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					int
 | 
				
			||||||
 | 
					Image_combine_stereo_0(Image_Desc *gauche, Image_Desc *droite,
 | 
				
			||||||
 | 
										Image_Desc *stereo)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					int		x, y, foo;
 | 
				
			||||||
 | 
					int		rouge, vert;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if ( (foo=Image_compare_desc(gauche, droite)) )
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						fprintf(stderr, "Combine Stereo 0: sources are differents (%d)\n", foo);
 | 
				
			||||||
 | 
						return foo;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if ( (foo=Image_compare_desc(gauche, stereo)) )
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						fprintf(stderr, "Combine Stereo 0: dest have a bad dim  (%d)\n", foo);
 | 
				
			||||||
 | 
						return foo;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					for (y=0; y<gauche->height; y++)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						for (x=0; x<droite->width; x++)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							rouge = ( Image_R_pixel(droite, x, y)+
 | 
				
			||||||
 | 
								  Image_G_pixel(droite, x, y)+
 | 
				
			||||||
 | 
								  Image_B_pixel(droite, x, y) ) / 3;
 | 
				
			||||||
 | 
							vert =  ( Image_R_pixel(gauche, x, y)+
 | 
				
			||||||
 | 
								  Image_G_pixel(gauche, x, y)+
 | 
				
			||||||
 | 
								  Image_B_pixel(gauche, x, y) ) / 3;
 | 
				
			||||||
 | 
							Image_plotRGB(stereo, x, y, rouge, vert, 0);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					stereo->modified = 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					return OLL_KORRECT;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*::------------------------------------------------------------------::*/
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 *	celui-ci semble le meme que le '_0', mais il va probablement
 | 
				
			||||||
 | 
					 *	evoluer... Et il serait vraiment bien que je trouve de la doc
 | 
				
			||||||
 | 
					 *	sur les differents parametres chromatiques.
 | 
				
			||||||
 | 
					 *	=============================================================
 | 
				
			||||||
 | 
					 *	En fait (30 janv 2008, ave StEx) au lieu de faire du Rouge/Vert
 | 
				
			||||||
 | 
					 *	il va faire du Rouge/Bleu. A la demande de Ker2x.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					int
 | 
				
			||||||
 | 
					Image_combine_stereo_1(Image_Desc *s1, Image_Desc *s2, Image_Desc *d,
 | 
				
			||||||
 | 
										int kr, int kg, int kb)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					int		x, y, foo, cumul;
 | 
				
			||||||
 | 
					int		rouge, bleu;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if ( (foo=Image_compare_desc(s1, s2)) )
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						fprintf(stderr, "Combine Stereo 1: sources are differents (%d)\n", foo);
 | 
				
			||||||
 | 
						return foo;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					if ( (foo=Image_compare_desc(s1, d)) )
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						fprintf(stderr, "Combine Stereo 1: dest have a bad dim  (%d)\n", foo);
 | 
				
			||||||
 | 
						return foo;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					cumul = kr + kg + kb;
 | 
				
			||||||
 | 
					#if DEBUG_LEVEL
 | 
				
			||||||
 | 
					fprintf(stderr, "Combine Stereo 1: coefs are %d %d %d\n", kr, kg, kb);
 | 
				
			||||||
 | 
					fprintf(stderr, "Combine Stereo 1: cumul is %d\n", cumul);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					for (y=0; y<s1->height; y++)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						for (x=0; x<s1->width; x++)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							rouge =   Image_R_pixel(s2, x, y) * kr	+
 | 
				
			||||||
 | 
								  Image_G_pixel(s2, x, y) * kg	+
 | 
				
			||||||
 | 
								  Image_B_pixel(s2, x, y) * kb;
 | 
				
			||||||
 | 
							rouge /= cumul;
 | 
				
			||||||
 | 
							bleu =    Image_R_pixel(s1, x, y) * kr	+
 | 
				
			||||||
 | 
								  Image_G_pixel(s1, x, y) * kg	+
 | 
				
			||||||
 | 
								  Image_B_pixel(s1, x, y) * kb;
 | 
				
			||||||
 | 
							bleu /= cumul;
 | 
				
			||||||
 | 
							Image_plotRGB(d, x, y, rouge, 0, bleu);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					d->modified = 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					return FUNC_IS_BETA;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					/*::------------------------------------------------------------------::*/
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 *	Et pour celui-ci, il faudrait trouver une façon de définir
 | 
				
			||||||
 | 
					 *	les composantes pour l'image destination, afin de tenir
 | 
				
			||||||
 | 
					 *	compte des filtres qui seront dans les lunettes...
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					int
 | 
				
			||||||
 | 
					Image_combine_stereo_2(Image_Desc *s1, Image_Desc *s2, Image_Desc *d,
 | 
				
			||||||
 | 
										char cr, char cl)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					/* XXX
 | 
				
			||||||
 | 
					int		x, y, foo;
 | 
				
			||||||
 | 
					int		rouge, vert, bleu;
 | 
				
			||||||
 | 
					XXX */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					fprintf(stderr, "%s: %s missing, sorry.\n", __FILE__, __func__);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					return FULL_NUCKED;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					/*::------------------------------------------------------------------::*/
 | 
				
			||||||
							
								
								
									
										352
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										352
									
								
								Makefile
									
									
									
									
									
								
							@ -1,352 +0,0 @@
 | 
				
			|||||||
#-----------------------------------------------------------------
 | 
					 | 
				
			||||||
#	1er Fevrier 2000: Je met une cible pour installer
 | 
					 | 
				
			||||||
#		les fichiers dans le systeme. C'est assez
 | 
					 | 
				
			||||||
#		rudimentaire/arbitraire, mais c,a marche
 | 
					 | 
				
			||||||
#		a peu pres, mieux que le Momo...
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
#-----------------------------------------------------------------
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
DESTDIR=/usr/local
 | 
					 | 
				
			||||||
SHARED_FILES=$(DESTDIR)/share/libimage
 | 
					 | 
				
			||||||
HTML_DIR=$(DESTDIR)/html
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#-----------------------------------------------------------------
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
#	pour le debuging: option -g
 | 
					 | 
				
			||||||
#	pour le profiling: option -pg
 | 
					 | 
				
			||||||
#	pour tracer plein de trucs: -DDEBUG_LEVEL=1
 | 
					 | 
				
			||||||
#	if IMGCOMMENT, the image comment is written to the TGA file,
 | 
					 | 
				
			||||||
#		but this files can't be loaded by Xv...
 | 
					 | 
				
			||||||
#	pour coredumper dans les situations graves: -DABORT=1
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
#	--> see file 'PORTING.txt' for porting tips on misc
 | 
					 | 
				
			||||||
#	    architextures (just sparc64 for now)
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
LIBIMG_OPT=-DFORCE_ABORT=1 -DDEBUG_LEVEL=0 -DIMGCOMMENT=0
 | 
					 | 
				
			||||||
CC_OPTS=-Wall -W -g -ansi  -Wmissing-prototypes -fPIC -no-pie
 | 
					 | 
				
			||||||
CC_HACKS=-DNEED_ALLOCA_H 
 | 
					 | 
				
			||||||
CFLAGS= $(CC_OPTS)			\
 | 
					 | 
				
			||||||
	$(LIBIMG_OPT)			\
 | 
					 | 
				
			||||||
	$(CC_HACKS) 			\
 | 
					 | 
				
			||||||
	-DDESTDIR=\"$(DESTDIR)\"	\
 | 
					 | 
				
			||||||
	-DSHAREDIR=\"$(SHARED_FILES)\"	\
 | 
					 | 
				
			||||||
	-DCC_OPTS=\"'$(CC_OPTS)'\"
 | 
					 | 
				
			||||||
LINKOPT=-lm
 | 
					 | 
				
			||||||
RANLIB=wc -c
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# modify it 'as you like'
 | 
					 | 
				
			||||||
AR=ar 
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#-------- essentials targets
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
all:		testtga libs
 | 
					 | 
				
			||||||
libs:		libimage.a libimageSO.so
 | 
					 | 
				
			||||||
trucs:		t_t16x24  fnt8to16 t_png
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#-----------------------------------------------------------------
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
image.o:    	image.c     tthimage.h	Makefile
 | 
					 | 
				
			||||||
filtres.o:  	filtres.c   tthimage.h
 | 
					 | 
				
			||||||
filtadapt.o:	filtadapt.c tthimage.h
 | 
					 | 
				
			||||||
sobel4.o:	sobel4.c	tthimage.h
 | 
					 | 
				
			||||||
showdiff.o:  	showdiff.c  tthimage.h
 | 
					 | 
				
			||||||
effects.o:  	effects.c   tthimage.h Makefile
 | 
					 | 
				
			||||||
effects2.o:  	effects2.c  tthimage.h
 | 
					 | 
				
			||||||
effects3.o:  	effects3.c  tthimage.h
 | 
					 | 
				
			||||||
television.o:  	television.c  tthimage.h	Makefile
 | 
					 | 
				
			||||||
tele_2.o:	tele_2.c    tthimage.h Makefile
 | 
					 | 
				
			||||||
classif.o:	classif.c   tthimage.h
 | 
					 | 
				
			||||||
combine.o:  	combine.c   tthimage.h
 | 
					 | 
				
			||||||
combine2.o:  	combine2.c  tthimage.h
 | 
					 | 
				
			||||||
combine3.o:  	combine3.c  tthimage.h
 | 
					 | 
				
			||||||
combine4.o:  	combine4.c  tthimage.h
 | 
					 | 
				
			||||||
combine5.o:  	combine5.c  tthimage.h
 | 
					 | 
				
			||||||
combine6.o:  	combine6.c  tthimage.h Makefile
 | 
					 | 
				
			||||||
combine_rnd.o: 	combine_rnd.c  tthimage.h
 | 
					 | 
				
			||||||
basic_io.o:  	basic_io.c  tthimage.h
 | 
					 | 
				
			||||||
pcx.o:      	pcx.c       tthimage.h 
 | 
					 | 
				
			||||||
png.o:      	png.c       tthimage.h 
 | 
					 | 
				
			||||||
bmp.o:		bmp.c       tthimage.h bmp.h
 | 
					 | 
				
			||||||
tga.o:      	tga.c       tthimage.h Makefile
 | 
					 | 
				
			||||||
eps.o:      	eps.c       tthimage.h
 | 
					 | 
				
			||||||
pht.o:      	pht.c       tthimage.h 
 | 
					 | 
				
			||||||
pnm.o:      	pnm.c       tthimage.h
 | 
					 | 
				
			||||||
fits.o:		fits.c	    tthimage.h
 | 
					 | 
				
			||||||
zoom.o:		zoom.c	    tthimage.h
 | 
					 | 
				
			||||||
gadgrect.o:	gadgrect.c	tthimage.h
 | 
					 | 
				
			||||||
ascii.o:      	ascii.c     tthimage.h
 | 
					 | 
				
			||||||
asciiart.o:    	asciiart.c  tthimage.h
 | 
					 | 
				
			||||||
glitch.o:	glitch.c    tthimage.h Makefile
 | 
					 | 
				
			||||||
contours.o:	contours.c    tthimage.h Makefile
 | 
					 | 
				
			||||||
calculs.o:  	calculs.c   tthimage.h Makefile
 | 
					 | 
				
			||||||
contrast.o:  	contrast.c   tthimage.h Makefile
 | 
					 | 
				
			||||||
calcluts.o:  	calcluts.c  tthimage.h
 | 
					 | 
				
			||||||
luts15bits.o:	luts15bits.c tthimage.h
 | 
					 | 
				
			||||||
gamma.o:  	gamma.c   tthimage.h
 | 
					 | 
				
			||||||
quadpics.o:	quadpics.c tthimage.h Makefile
 | 
					 | 
				
			||||||
colors.o:   	colors.c    tthimage.h Makefile
 | 
					 | 
				
			||||||
colors2.o:   	colors2.c    tthimage.h
 | 
					 | 
				
			||||||
col_xyz.o:   	col_xyz.c   tthimage.h
 | 
					 | 
				
			||||||
palettes.o:	palettes.c	tthimage.h
 | 
					 | 
				
			||||||
indexcol.o:	indexcol.c	tthimage.h
 | 
					 | 
				
			||||||
col_reduc.o:	col_reduc.c	tthimage.h	Makefile
 | 
					 | 
				
			||||||
drawpatt.o:	drawpatt.c	tthimage.h
 | 
					 | 
				
			||||||
operat.o:   	operat.c    tthimage.h		Makefile
 | 
					 | 
				
			||||||
stereo.o:	stereo.c	tthimage.h
 | 
					 | 
				
			||||||
tools.o:    	tools.c     tthimage.h
 | 
					 | 
				
			||||||
mircol.o:    	mircol.c    tthimage.h
 | 
					 | 
				
			||||||
mustopen.o:    	mustopen.c     tthimage.h	Makefile
 | 
					 | 
				
			||||||
msglib.o:    	msglib.c    tthimage.h 		Makefile
 | 
					 | 
				
			||||||
ptlist.o:	ptlist.c	tthimage.h	Makefile
 | 
					 | 
				
			||||||
dither.o:   	dither.c	tthimage.h 	Makefile
 | 
					 | 
				
			||||||
dither2.o:   	dither2.c	tthimage.h 	Makefile
 | 
					 | 
				
			||||||
dither3.o:   	dither3.c	tthimage.h 	Makefile
 | 
					 | 
				
			||||||
dither4.o:   	dither4.c	tthimage.h 	Makefile
 | 
					 | 
				
			||||||
bitblt.o:	bitblt.c	tthimage.h	Makefile
 | 
					 | 
				
			||||||
detect.o:	detect.c	tthimage.h	Makefile
 | 
					 | 
				
			||||||
detect2.o:	detect2.c	tthimage.h	Makefile
 | 
					 | 
				
			||||||
op2x2.o:	op2x2.c		tthimage.h
 | 
					 | 
				
			||||||
morpho.o:	morpho.c	tthimage.h
 | 
					 | 
				
			||||||
recurse.o:	recurse.c	tthimage.h
 | 
					 | 
				
			||||||
drawing.o:	drawing.c	tthimage.h	Makefile
 | 
					 | 
				
			||||||
draw_alpha.o:	draw_alpha.c	tthimage.h
 | 
					 | 
				
			||||||
marques.o:	marques.c	tthimage.h	Makefile
 | 
					 | 
				
			||||||
pov_hf15.o:	pov_hf15.c	tthimage.h
 | 
					 | 
				
			||||||
pov_hf15b.o:	pov_hf15b.c	tthimage.h
 | 
					 | 
				
			||||||
pov_hf15c.o:	pov_hf15c.c	tthimage.h
 | 
					 | 
				
			||||||
pov_hf15d.o:	pov_hf15d.c	tthimage.h
 | 
					 | 
				
			||||||
pov_hf15e.o:	pov_hf15e.c	tthimage.h
 | 
					 | 
				
			||||||
pov_hf15f.o:	pov_hf15f.c	tthimage.h
 | 
					 | 
				
			||||||
pov_hf_synth.o:	pov_hf_synth.c	tthimage.h
 | 
					 | 
				
			||||||
df3.o:		df3.c		tthimage.h
 | 
					 | 
				
			||||||
df3b.o:		df3b.c		tthimage.h
 | 
					 | 
				
			||||||
cadres.o:	cadres.c	tthimage.h	Makefile
 | 
					 | 
				
			||||||
cadres2.o:	cadres2.c	tthimage.h
 | 
					 | 
				
			||||||
cadres3.o:	cadres3.c	tthimage.h
 | 
					 | 
				
			||||||
cadres4.o:	cadres4.c	tthimage.h
 | 
					 | 
				
			||||||
cadres84.o:	cadres84.c	tthimage.h
 | 
					 | 
				
			||||||
cadresbox.o:	cadresbox.c	tthimage.h	Makefile
 | 
					 | 
				
			||||||
alpha.o:	alpha.c		tthimage.h	Makefile
 | 
					 | 
				
			||||||
alpha2.o:	alpha2.c	tthimage.h
 | 
					 | 
				
			||||||
alpha3.o:	alpha3.c	tthimage.h
 | 
					 | 
				
			||||||
mosaic.o:	mosaic.c	tthimage.h	Makefile
 | 
					 | 
				
			||||||
text0.o:	text0.c		tthimage.h	Makefile
 | 
					 | 
				
			||||||
text1.o:	text1.c		tthimage.h	Makefile
 | 
					 | 
				
			||||||
text2.o:	text2.c		tthimage.h	Makefile
 | 
					 | 
				
			||||||
text16x24.o:	text16x24.c	tthimage.h Makefile
 | 
					 | 
				
			||||||
freetype.o:	freetype.c	tthimage.h
 | 
					 | 
				
			||||||
vectfont.o:	vectfont.c	tthimage.h
 | 
					 | 
				
			||||||
scale.o:	scale.c		tthimage.h
 | 
					 | 
				
			||||||
halfsize.o:	halfsize.c	tthimage.h	Makefile
 | 
					 | 
				
			||||||
doublesz.o:	doublesz.c	tthimage.h
 | 
					 | 
				
			||||||
levels.o:	levels.c	tthimage.h
 | 
					 | 
				
			||||||
patterns2.o:	patterns2.c	tthimage.h	Makefile
 | 
					 | 
				
			||||||
patterns.o:	patterns.c	tthimage.h
 | 
					 | 
				
			||||||
patterns3.o:	patterns3.c	tthimage.h
 | 
					 | 
				
			||||||
patterns4.o:	patterns4.c	tthimage.h
 | 
					 | 
				
			||||||
insert.o:	insert.c	tthimage.h	Makefile
 | 
					 | 
				
			||||||
plotteur.o:	plotteur.c	tthimage.h	Makefile
 | 
					 | 
				
			||||||
imprime.o:	imprime.c	tthimage.h	Makefile
 | 
					 | 
				
			||||||
col4bits.o:	col4bits.c	tthimage.h	Makefile
 | 
					 | 
				
			||||||
dumppix.o:	dumppix.c	tthimage.h
 | 
					 | 
				
			||||||
warp0.o:	warp0.c		tthimage.h
 | 
					 | 
				
			||||||
warp1.o:	warp1.c		tthimage.h
 | 
					 | 
				
			||||||
warp2.o:	warp2.c		tthimage.h
 | 
					 | 
				
			||||||
warp3.o:	warp3.c		tthimage.h
 | 
					 | 
				
			||||||
xper.o:		xper.c		tthimage.h	Makefile
 | 
					 | 
				
			||||||
dissolve.o:	dissolve.c	tthimage.h
 | 
					 | 
				
			||||||
troisD.o:	troisD.c	tthimage.h
 | 
					 | 
				
			||||||
turtle.o:	turtle.c	tthimage.h
 | 
					 | 
				
			||||||
cjpeg.o:	cjpeg.c 	tthimage.h
 | 
					 | 
				
			||||||
rgbmask.o:	rgbmask.c	tthimage.h
 | 
					 | 
				
			||||||
octree.o:	octree.c	tthimage.h
 | 
					 | 
				
			||||||
addborder.o:	addborder.c	tthimage.h
 | 
					 | 
				
			||||||
fill_pat.o:	fill_pat.c	tthimage.h
 | 
					 | 
				
			||||||
vectfont.o:	vectfont.c	tthimage.h
 | 
					 | 
				
			||||||
photomaton.o:	photomaton.c	tthimage.h	Makefile
 | 
					 | 
				
			||||||
pixeliz.o:	pixeliz.c	tthimage.h Makefile
 | 
					 | 
				
			||||||
pixels.o:	pixels.c	tthimage.h Makefile
 | 
					 | 
				
			||||||
anamorphose.o:	anamorphose.c	tthimage.h	Makefile
 | 
					 | 
				
			||||||
life.o:		life.c		tthimage.h
 | 
					 | 
				
			||||||
tamppool.o:	tamppool.c	tthimage.h
 | 
					 | 
				
			||||||
vignetize.o:	vignetize.c	tthimage.h
 | 
					 | 
				
			||||||
7seg.o:		7seg.c		tthimage.h Makefile
 | 
					 | 
				
			||||||
bitplanes.o:	bitplanes.c	tthimage.h Makefile
 | 
					 | 
				
			||||||
distances.o:	distances.c	tthimage.h Makefile
 | 
					 | 
				
			||||||
gray_ops.o:	gray_ops.c	tthimage.h Makefile
 | 
					 | 
				
			||||||
extractbits.o:	extractbits.c	tthimage.h Makefile
 | 
					 | 
				
			||||||
jauges.o:	jauges.c	tthimage.h Makefile
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#-----------------------------------------------------------------
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
OBJECTS=  image.o filtres.o effects.o operat.o			\
 | 
					 | 
				
			||||||
	  tamppool.o gray_ops.o					\
 | 
					 | 
				
			||||||
          calculs.o calcluts.o luts15bits.o			\
 | 
					 | 
				
			||||||
	  octree.o filtadapt.o sobel4.o				\
 | 
					 | 
				
			||||||
	  classif.o vignetize.o					\
 | 
					 | 
				
			||||||
	  gamma.o zoom.o gadgrect.o				\
 | 
					 | 
				
			||||||
	  pht.o eps.o pnm.o png.o				\
 | 
					 | 
				
			||||||
	  bmp.o pcx.o tga.o 					\
 | 
					 | 
				
			||||||
	  colors.o colors2.o col_reduc.o col_xyz.o		\
 | 
					 | 
				
			||||||
	  tools.o mircol.o imprime.o				\
 | 
					 | 
				
			||||||
	  combine.o combine2.o combine3.o combine4.o combine5.o	\
 | 
					 | 
				
			||||||
	  combine6.o combine_rnd.o				\
 | 
					 | 
				
			||||||
	  turtle.o marques.o rgbmask.o				\
 | 
					 | 
				
			||||||
	  television.o tele_2.o					\
 | 
					 | 
				
			||||||
	  effects2.o effects3.o					\
 | 
					 | 
				
			||||||
	  contrast.o glitch.o					\
 | 
					 | 
				
			||||||
	  basic_io.o mustopen.o ptlist.o			\
 | 
					 | 
				
			||||||
	  anamorphose.o quadpics.o 				\
 | 
					 | 
				
			||||||
	  dither.o dither2.o dither3.o dither4.o		\
 | 
					 | 
				
			||||||
	  bitblt.o detect.o op2x2.o detect2.o			\
 | 
					 | 
				
			||||||
	  drawing.o draw_alpha.o drawpatt.o			\
 | 
					 | 
				
			||||||
	  pov_hf15.o pov_hf15b.o pov_hf15c.o pov_hf15d.o	\
 | 
					 | 
				
			||||||
	  pov_hf15e.o pov_hf15f.o				\
 | 
					 | 
				
			||||||
	  pov_hf_synth.o df3.o df3b.o				\
 | 
					 | 
				
			||||||
	  alpha.o alpha2.o alpha3.o				\
 | 
					 | 
				
			||||||
	  text0.o text1.o text2.o text16x24.o			\
 | 
					 | 
				
			||||||
	  freetype.o vectfont.o					\
 | 
					 | 
				
			||||||
	  cadres.o cadres2.o cadres3.o cadres4.o		\
 | 
					 | 
				
			||||||
	  cadres84.o cadresbox.o 7seg.o				\
 | 
					 | 
				
			||||||
	  dissolve.o photomaton.o				\
 | 
					 | 
				
			||||||
	  mosaic.o life.o extractbits.o				\
 | 
					 | 
				
			||||||
	  palettes.o col4bits.o indexcol.o			\
 | 
					 | 
				
			||||||
	  xper.o showdiff.o					\
 | 
					 | 
				
			||||||
	  scale.o halfsize.o doublesz.o				\
 | 
					 | 
				
			||||||
	  levels.o stereo.o jauges.o				\
 | 
					 | 
				
			||||||
	  patterns4.o patterns3.o patterns2.o patterns.o	\
 | 
					 | 
				
			||||||
	  fill_pat.o pixeliz.o pixels.o				\
 | 
					 | 
				
			||||||
	  insert.o addborder.o					\
 | 
					 | 
				
			||||||
	  morpho.o ascii.o plotteur.o dumppix.o asciiart.o	\
 | 
					 | 
				
			||||||
	  warp0.o warp1.o warp2.o warp3.o			\
 | 
					 | 
				
			||||||
	  fits.o recurse.o msglib.o troisD.o			\
 | 
					 | 
				
			||||||
	  cjpeg.o bitplanes.o distances.o
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
libimage.a: 	$(OBJECTS)
 | 
					 | 
				
			||||||
	$(AR) r libimage.a $?
 | 
					 | 
				
			||||||
	$(RANLIB) libimage.a
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#-----------------------------------------------------------------
 | 
					 | 
				
			||||||
#	WARNING !!!
 | 
					 | 
				
			||||||
#		this is my first trial on shared library, so
 | 
					 | 
				
			||||||
#		use with care... and what is the "-PIC" option ?
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
libimageSO.so: $(OBJECTS)
 | 
					 | 
				
			||||||
	gcc -o libimageSO.so -shared $(OBJECTS)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#-----------------------------------------------------------------
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
#	fabrication du (des) programme(s) de test.
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
essais.o:	essais.c tthimage.h  Makefile essais.h
 | 
					 | 
				
			||||||
essais2.o:	essais2.c tthimage.h  Makefile essais.h
 | 
					 | 
				
			||||||
all_tests.o:	all_tests.c tthimage.h  Makefile essais.h
 | 
					 | 
				
			||||||
essai3d.o:	essai3d.c tthimage.h Makefile
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
testtga.o:	testtga.c tthimage.h essais.h Makefile
 | 
					 | 
				
			||||||
	gcc $(CFLAGS) -c testtga.c
 | 
					 | 
				
			||||||
testtga:    testtga.o libimage.a essais.o essais2.o all_tests.o Makefile
 | 
					 | 
				
			||||||
	gcc $(CFLAGS) testtga.o essais.o essais2.o all_tests.o libimage.a -lm -o testtga
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
testrect.o:	testrect.c tthimage.h essais.h Makefile
 | 
					 | 
				
			||||||
	gcc $(CFLAGS) -c testrect.c
 | 
					 | 
				
			||||||
testrect:    testrect.o libimage.a Makefile
 | 
					 | 
				
			||||||
	gcc $(CFLAGS) testrect.o libimage.a -lm -o testrect
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
testSO:		testtga.o libimageSO.so
 | 
					 | 
				
			||||||
	gcc testtga.o -o testSO libimageSO.so -lm
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
essai3d:	essai3d.o libimage.a Makefile
 | 
					 | 
				
			||||||
	gcc $(CFLAGS) essai3d.o -o essai3d libimage.a -lm
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
t_ascii:	t_ascii.c libimage.a tthimage.h Makefile
 | 
					 | 
				
			||||||
	gcc $(CFLAGS) t_ascii.c -o t_ascii libimage.a -lm -g
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
t_png:	t_png.c libimage.a tthimage.h Makefile
 | 
					 | 
				
			||||||
	gcc $(CFLAGS) t_png.c -o t_png libimage.a -lm -lpng -g
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
t_t16x24.o:	t_t16x24.c tthimage.h Makefile
 | 
					 | 
				
			||||||
	gcc -c $(CFLAGS) t_t16x24.c 
 | 
					 | 
				
			||||||
t_t16x24:	t_t16x24.o libimage.a Makefile
 | 
					 | 
				
			||||||
	gcc $(CFLAGS) t_t16x24.o -o t_t16x24 libimage.a -lm -g
 | 
					 | 
				
			||||||
all16x24chars.tga:	bigfont.txt t_t16x24 Makefile
 | 
					 | 
				
			||||||
	./t_t16x24
 | 
					 | 
				
			||||||
all16x24chars.png:	all16x24chars.tga	
 | 
					 | 
				
			||||||
	convert all16x24chars.tga all16x24chars.png
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
testpcx:	testpcx.c libimage.a Makefile
 | 
					 | 
				
			||||||
	gcc $(CFLAGS) -g testpcx.c -o testpcx libimage.a -lm 
 | 
					 | 
				
			||||||
testbmp:	testbmp.c libimage.a Makefile
 | 
					 | 
				
			||||||
	gcc $(CFLAGS) -g testbmp.c -o testbmp libimage.a -lm 
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
foo:		foo.c Makefile libimage.a
 | 
					 | 
				
			||||||
	gcc $(CFLAGS) foo.c libimage.a -o foo -lm 
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
fnt8to16:	fnt8to16.c Makefile
 | 
					 | 
				
			||||||
	gcc -Wall fnt8to16.c -o fnt8to16
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#-----------------------------------------------------------------
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
#	procedure d'installation en chantier...
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
install_lib:
 | 
					 | 
				
			||||||
	install -d         $(DESTDIR)/lib/
 | 
					 | 
				
			||||||
	install libimage.a $(DESTDIR)/lib/libimage.a
 | 
					 | 
				
			||||||
	install libimageSO.so $(DESTDIR)/lib/
 | 
					 | 
				
			||||||
	install -d         $(DESTDIR)/include/
 | 
					 | 
				
			||||||
	install -m 0644 tthimage.h    $(DESTDIR)/include/tthimage.h
 | 
					 | 
				
			||||||
#	install -m 0644 img77.fi   $(DESTDIR)/include/img77.fi
 | 
					 | 
				
			||||||
	install -d         $(SHARED_FILES)
 | 
					 | 
				
			||||||
	install -m 0644 libimage.fonte $(SHARED_FILES)/
 | 
					 | 
				
			||||||
	install -m 0644 8x8thin $(SHARED_FILES)/
 | 
					 | 
				
			||||||
	install -m 0644 16x24thin $(SHARED_FILES)/
 | 
					 | 
				
			||||||
	install -m 0644 bigfont.txt $(SHARED_FILES)/
 | 
					 | 
				
			||||||
	install -m 0644 neon.map $(SHARED_FILES)/neon.map
 | 
					 | 
				
			||||||
	install -m 0644 volcano.map $(SHARED_FILES)/volcano.map
 | 
					 | 
				
			||||||
	install -m 0644 primaires.map $(SHARED_FILES)/primaires.map
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
install_doc:
 | 
					 | 
				
			||||||
	install -m 0644 libimage.html $(HTML_DIR)/libimage.html
 | 
					 | 
				
			||||||
	install -m 0644 img-effets.html $(HTML_DIR)/img-effets.html
 | 
					 | 
				
			||||||
	install -m 0644 img-fichiers.html $(HTML_DIR)/img-fichiers.html
 | 
					 | 
				
			||||||
	install -m 0644 img-calculs.html $(HTML_DIR)/img-calculs.html
 | 
					 | 
				
			||||||
	install -m 0644 img-cadres.html $(HTML_DIR)/img-cadres.html
 | 
					 | 
				
			||||||
	install -m 0644 img-combine.html $(HTML_DIR)/img-combine.html
 | 
					 | 
				
			||||||
	install -m 0644 img-couleurs.html $(HTML_DIR)/img-couleurs.html
 | 
					 | 
				
			||||||
	install -m 0644 img-dither.html $(HTML_DIR)/img-dither.html
 | 
					 | 
				
			||||||
	install -m 0644 img-filtres.html $(HTML_DIR)/img-filtres.html
 | 
					 | 
				
			||||||
	install -m 0644 img-povhf15.html $(HTML_DIR)/img-povhf15.html
 | 
					 | 
				
			||||||
	install -m 0644 img-patterns.html $(HTML_DIR)/img-patterns.html
 | 
					 | 
				
			||||||
	install -m 0644 img-showdiff.html $(HTML_DIR)/img-showdiff.html
 | 
					 | 
				
			||||||
	install -m 0644 img-stereo.html $(HTML_DIR)/
 | 
					 | 
				
			||||||
	install -m 0644 image77.html $(HTML_DIR)/image77.html
 | 
					 | 
				
			||||||
	install -m 0644 img-devel.html $(HTML_DIR)/img-devel.html
 | 
					 | 
				
			||||||
	install -m 0644 img-texte.html $(HTML_DIR)/img-texte.html
 | 
					 | 
				
			||||||
	install -m 0644 img-alpha.html $(HTML_DIR)/img-alpha.html
 | 
					 | 
				
			||||||
	install -m 0644 img-operat.html $(HTML_DIR)/img-operat.html
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
install: install_lib 
 | 
					 | 
				
			||||||
	@echo
 | 
					 | 
				
			||||||
	@echo "Use 'make install_doc' for installing doc in " $(HTML_DIR)
 | 
					 | 
				
			||||||
	@echo
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#-----------------------------------------------------------------
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TXTFILES=*.c *.h Makefile Doc/*.html *.txt  \
 | 
					 | 
				
			||||||
	neon.map volcano.map primaires.map *.sh *.css *.fonte
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TOTAR=$(TXTFILES) pov.tga 8x8thin machin.bin 16x24thin
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
lines:          $(TXTFILES)
 | 
					 | 
				
			||||||
	@wc $^ | sort -g
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
tarball:	$(TOTAR)	
 | 
					 | 
				
			||||||
	date >> tarball
 | 
					 | 
				
			||||||
	ls $(TOTAR) | sed 's/^/LibImage\//'  > MANIFEST
 | 
					 | 
				
			||||||
	( cd .. ; tar zcvf libimage.tar.gz `cat LibImage/MANIFEST` )
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#----------- fini ------------------------------------------------
 | 
					 | 
				
			||||||
							
								
								
									
										17
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								README.md
									
									
									
									
									
								
							@ -1,10 +1,23 @@
 | 
				
			|||||||
# libtthimage
 | 
					# libtthimage
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Ce kluge a pour but de brotcher les images avec vigueur.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Du code né dans les années 1986 sur un Kenitec 286 sous msdos 4 ou 5,
 | 
					Du code né dans les années 1986 sur un Kenitec 286 sous msdos 4 ou 5,
 | 
				
			||||||
qui s'est un jour retrouvé dans un Linux (kernel 0.99) et qui végète
 | 
					puis s'est un jour retrouvé dans un Linux (kernel 0.99) et qui végète
 | 
				
			||||||
depuis ~2005. Il est venu le temps de le remettre en route.
 | 
					depuis ~2005. Il est venu le temps de le remettre en route.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Il a pour but de brotcher les images avec vigueur.
 | 
					## Construction
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Tout va bien se passer. 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## Utilisation
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					C'est là que ça se complique.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## Les outils
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Et ça sert à quoi ?
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## La suite ?
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Bah, c'est l'heure du _gloumiam_, alors on passe à table.
 | 
				
			||||||
 | 
				
			|||||||
@ -6,10 +6,15 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
include ../Paramakes.mk
 | 
					include ../Paramakes.mk
 | 
				
			||||||
 | 
					
 | 
				
			||||||
DEPS = ../tthimage.h Makefile 
 | 
					DEPS = ../tthimage.h Makefile tga_outils.h
 | 
				
			||||||
 | 
					
 | 
				
			||||||
all:	tga_cadre tga_effects tga_filtres tga_tools	\
 | 
					all:	genplot2						\
 | 
				
			||||||
	tga_television
 | 
						tga_cadre tga_effects tga_filtres tga_remap tga_tools	\
 | 
				
			||||||
 | 
						tga_combine						\
 | 
				
			||||||
 | 
						tga_television tga_dither tga_applymap tga_makehf15	\
 | 
				
			||||||
 | 
						tga_mires tga_incrust tga_pattern tga_equalize
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# 'tga_info.c' do not compile yet
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#-----------------------------------------------------------------
 | 
					#-----------------------------------------------------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -18,20 +23,55 @@ fonctions.o:	fonctions.c $(DEPS)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#-----------------------------------------------------------------
 | 
					#-----------------------------------------------------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					genplot2:	genplot2.c $(DEPS) fonctions.o
 | 
				
			||||||
 | 
						gcc $(CFLAGS) $< ../libimage.a fonctions.o -lm -o $@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#-----------------------------------------------------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					tga_applymap:	tga_applymap.c $(DEPS) fonctions.o
 | 
				
			||||||
 | 
						gcc $(CFLAGS) $< ../libimage.a fonctions.o -lm -o $@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
tga_cadre:	tga_cadre.c $(DEPS) fonctions.o
 | 
					tga_cadre:	tga_cadre.c $(DEPS) fonctions.o
 | 
				
			||||||
	gcc $(CFLAGS) $< ../libimage.a fonctions.o -lm -o $@
 | 
						gcc $(CFLAGS) $< ../libimage.a fonctions.o -lm -o $@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					tga_combine:	tga_combine.c $(DEPS) fonctions.o
 | 
				
			||||||
 | 
						gcc $(CFLAGS) $< ../libimage.a fonctions.o -lm -o $@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					tga_dither:	tga_dither.c $(DEPS) fonctions.o
 | 
				
			||||||
 | 
						gcc $(CFLAGS) $< ../libimage.a fonctions.o -lm -o $@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
tga_effects:	tga_effects.c $(DEPS) fonctions.o
 | 
					tga_effects:	tga_effects.c $(DEPS) fonctions.o
 | 
				
			||||||
	gcc $(CFLAGS) $< ../libimage.a fonctions.o -lm -o $@
 | 
						gcc $(CFLAGS) $< ../libimage.a fonctions.o -lm -o $@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					tga_equalize:	tga_equalize.c $(DEPS) fonctions.o
 | 
				
			||||||
 | 
						gcc $(CFLAGS) $< ../libimage.a fonctions.o -lm -o $@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
tga_filtres:	tga_filtres.c $(DEPS) fonctions.o
 | 
					tga_filtres:	tga_filtres.c $(DEPS) fonctions.o
 | 
				
			||||||
	gcc $(CFLAGS) $< ../libimage.a fonctions.o -lm -o $@
 | 
						gcc $(CFLAGS) $< ../libimage.a fonctions.o -lm -o $@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					tga_makehf15:	tga_makehf15.c $(DEPS) fonctions.o
 | 
				
			||||||
 | 
						gcc $(CFLAGS) $< ../libimage.a fonctions.o -lm -o $@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					tga_mires:	tga_mires.c $(DEPS) fonctions.o
 | 
				
			||||||
 | 
						gcc $(CFLAGS) $< ../libimage.a fonctions.o -lm -o $@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					tga_remap:	tga_remap.c $(DEPS) fonctions.o
 | 
				
			||||||
 | 
						gcc $(CFLAGS) $< ../libimage.a fonctions.o -lm -o $@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
tga_television:	tga_television.c $(DEPS) fonctions.o
 | 
					tga_television:	tga_television.c $(DEPS) fonctions.o
 | 
				
			||||||
	gcc $(CFLAGS) $< ../libimage.a fonctions.o -lm -o $@
 | 
						gcc $(CFLAGS) $< ../libimage.a fonctions.o -lm -o $@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
tga_tools:	tga_tools.c $(DEPS) fonctions.o
 | 
					tga_tools:	tga_tools.c $(DEPS) fonctions.o
 | 
				
			||||||
	gcc $(CFLAGS) $< ../libimage.a fonctions.o -lm -o $@
 | 
						gcc $(CFLAGS) $< ../libimage.a fonctions.o -lm -o $@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					tga_incrust:	tga_incrust.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) $< ../libimage.a fonctions.o -lm -o $@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#-----------------------------------------------------------------
 | 
					#-----------------------------------------------------------------
 | 
				
			||||||
 | 
				
			|||||||
@ -90,6 +90,8 @@ int	parse_int_param(char *str, int *pval, int k)
 | 
				
			|||||||
long	lfoo;
 | 
					long	lfoo;
 | 
				
			||||||
int	val;
 | 
					int	val;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if (k)	fprintf(stderr, "%s: k %d\n", __func__, k);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
val = (int)(lfoo = strtol(str, NULL, 0));
 | 
					val = (int)(lfoo = strtol(str, NULL, 0));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if DEBUG_LEVEL
 | 
					#if DEBUG_LEVEL
 | 
				
			||||||
@ -408,6 +410,8 @@ int	set_new_seed(int k)
 | 
				
			|||||||
char		*ptr;
 | 
					char		*ptr;
 | 
				
			||||||
long		seed;
 | 
					long		seed;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if (k)	fprintf(stderr, "%s: k %d\n", __func__, k);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if (NULL==(ptr=getenv("FIXED_SEED"))) {
 | 
					if (NULL==(ptr=getenv("FIXED_SEED"))) {
 | 
				
			||||||
	/* no fixed seed in context, doing semi-random */
 | 
						/* no fixed seed in context, doing semi-random */
 | 
				
			||||||
	srand(getpid());
 | 
						srand(getpid());
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										180
									
								
								Tools/genplot2.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										180
									
								
								Tools/genplot2.c
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,180 @@
 | 
				
			|||||||
 | 
					/*
 | 
				
			||||||
 | 
						Bon, c'est tres bien tout c,a mais il faudrait
 | 
				
			||||||
 | 
						faire une page de man pour expliquer comment 
 | 
				
			||||||
 | 
						ce machin fonctionne...
 | 
				
			||||||
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include  <stdio.h>
 | 
				
			||||||
 | 
					#include  <stdlib.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "tga_outils.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define XMIN 0
 | 
				
			||||||
 | 
					#define YMIN 0
 | 
				
			||||||
 | 
					#define XMAX 4096		/* constant from a 'dddd' */
 | 
				
			||||||
 | 
					#define YMAX 4096		/* constant from a 'dddd' */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*::------------------------------------------------------------------::*/
 | 
				
			||||||
 | 
					static 	Image_Desc	*image;
 | 
				
			||||||
 | 
					static	RGB_map		map;
 | 
				
			||||||
 | 
					static	int		curX, curY;
 | 
				
			||||||
 | 
					/*::------------------------------------------------------------------::*/
 | 
				
			||||||
 | 
					int initgr(int largeur, int hauteur)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					int foo, r, v, b, dummy;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if ((image=Image_alloc(largeur, hauteur, 3))==NULL)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						fprintf(stderr, "hu hu, 'man addswap' :)\n");
 | 
				
			||||||
 | 
						exit(3);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					printf("\n\tinitgr  %d  %d\n", largeur, hauteur);
 | 
				
			||||||
 | 
					for (foo=0; foo<8; foo++)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						printf("\tPal(%d) = ", foo);
 | 
				
			||||||
 | 
						r = foo & 1 ? 255 : 0;
 | 
				
			||||||
 | 
						v = foo & 2 ? 255 : 0;
 | 
				
			||||||
 | 
						b = foo & 4 ? 255 : 0;
 | 
				
			||||||
 | 
						printf("%02X %02X %02X\n", r, v, b);
 | 
				
			||||||
 | 
						map.red[foo] = r;
 | 
				
			||||||
 | 
						map.green[foo] = v;
 | 
				
			||||||
 | 
						map.blue[foo] = b;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					map.nbre = 8;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					return 0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					/*::------------------------------------------------------------------::*/
 | 
				
			||||||
 | 
					int move(int x, int y)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					#if DEBUG_LEVEL
 | 
				
			||||||
 | 
					printf("\tMOVE  %5d  %5d\n", x, y); 
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					curX = x;	curY = y;
 | 
				
			||||||
 | 
					return 0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int draw(int x, int y, int color)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					RGBA	rgba;
 | 
				
			||||||
 | 
					int	idx;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if DEBUG_LEVEL
 | 
				
			||||||
 | 
					printf("\tDRAW  %5d  %5d   to   %5d  %5d\n", curX, curY, x, y);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					idx = color % 8;
 | 
				
			||||||
 | 
					if (idx != color) {
 | 
				
			||||||
 | 
						fprintf(stderr, "%s %s : color %d out of range\n",
 | 
				
			||||||
 | 
										__FILE__, __func__, color);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					rgba.r = map.red[color];
 | 
				
			||||||
 | 
					rgba.g = map.green[color];
 | 
				
			||||||
 | 
					rgba.b = map.blue[color];
 | 
				
			||||||
 | 
					Image_draw_line(image, curX, curY, x, y, &rgba);
 | 
				
			||||||
 | 
					curX = x;	curY = y;
 | 
				
			||||||
 | 
					return 0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					/*::------------------------------------------------------------------::*/
 | 
				
			||||||
 | 
					int endgr(char *filename)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					fprintf(stderr, "saving '%s'\n", filename);
 | 
				
			||||||
 | 
					Image_TGA_save(filename, image, 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					return 0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					/*::------------------------------------------------------------------::*/
 | 
				
			||||||
 | 
					int main(int argc, char *argv[])
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					char		*filename, *image;
 | 
				
			||||||
 | 
					FILE		*fp;
 | 
				
			||||||
 | 
					double		x, y, xmin, ymin, xmax, ymax;
 | 
				
			||||||
 | 
					double		fx, fy, f, X, Y;
 | 
				
			||||||
 | 
					double		xC, yC, XC, YC, c1, c2;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int		v, nbp;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*---------- processing command line arguments */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if (argc<=1)	filename = "a.scratch";
 | 
				
			||||||
 | 
					else		filename = argv[1];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if (argc<=2)	image = "image.tga";
 | 
				
			||||||
 | 
					else		image = argv[2];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					fprintf(stderr, "*** Genplot2 v 1.0.4 [%s] (dwtfywl) 1995,2010 TontonTh \n",
 | 
				
			||||||
 | 
									TGA_OUTILS_VERSION);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*----------- giving to the yuser some useless informations --- */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					fprintf(stderr, "hardcoded picsize : %d %d\n", XMAX, YMAX);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*----------- opening input file and getting MIN and MAX values */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if ((fp = fopen(filename, "r"))==NULL)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						perror("fichier d'entree");
 | 
				
			||||||
 | 
						exit(1);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					nbp = 0;
 | 
				
			||||||
 | 
					xmin =  9999999;		xmax = -9999999;
 | 
				
			||||||
 | 
					ymin =  9999999;		ymax = -9999999;
 | 
				
			||||||
 | 
					while ( fscanf(fp, "%lf %lf %d", &x, &y, &v) == 3 )
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						nbp++;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (x > xmax)		xmax = x;
 | 
				
			||||||
 | 
						if (x < xmin)		xmin = x;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (y > ymax)		ymax = y;
 | 
				
			||||||
 | 
						if (y < ymin)		ymin = y;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					fclose(fp);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if (nbp == 0)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						fprintf(stderr, "omg, I'v found _ZERO_ points for plotting...\n");
 | 
				
			||||||
 | 
						exit(2);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					fprintf(stderr, "Genplot2: found %d points\n", nbp);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*---------- computing coefficients (temporary hack !-) */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					fx = (XMAX-XMIN-1)/(xmax-xmin);
 | 
				
			||||||
 | 
					fy = (YMAX-YMIN-1)/(ymax-ymin);
 | 
				
			||||||
 | 
					fprintf(stderr, "\nfc = %12f     fy = %12f\n", fx, fy);
 | 
				
			||||||
 | 
					f = (fx<fy?fx:fy);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					xC = 0.5*(xmin+xmax);		yC = 0.5*(ymin+ymax);
 | 
				
			||||||
 | 
					XC = 0.5*(XMIN+XMAX);		YC = 0.5*(YMIN+YMAX);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					c1 = XC-f*xC;			c2 = YC-f*yC;
 | 
				
			||||||
 | 
					fprintf(stderr, "c1 = %12f     c2 = %12f\n", c1, c2);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*------------- and now, plotting the image ! */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					initgr(XMAX, YMAX);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					fp = fopen(filename, "r");
 | 
				
			||||||
 | 
					puts("");
 | 
				
			||||||
 | 
					while ( fscanf(fp, "%lf %lf %d", &x, &y, &v) == 3 )
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
					#if DEBUG_LEVEL
 | 
				
			||||||
 | 
						fprintf(stderr, "%12f %12f %d\n", x, y, v);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
						X = f*x+c1;	Y = f*y+c2;
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if (v < 0)	move(X, Y);
 | 
				
			||||||
 | 
						else		draw(X, Y, v);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					endgr(image);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					return 0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							
								
								
									
										92
									
								
								Tools/tga_applymap.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										92
									
								
								Tools/tga_applymap.c
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,92 @@
 | 
				
			|||||||
 | 
					/*
 | 
				
			||||||
 | 
						WARNING!	this prog is bogus!
 | 
				
			||||||
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include  <stdio.h>
 | 
				
			||||||
 | 
					#include  <stdlib.h>
 | 
				
			||||||
 | 
					#include  <string.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include  "tga_outils.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*::------------------------------------------------------------------::*/
 | 
				
			||||||
 | 
					void usage(int flag)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					fprintf(stderr, "* tga_applymap v 0.0.14 [%s] (dwtfywl) Krabulator 1910\n",
 | 
				
			||||||
 | 
									TGA_OUTILS_VERSION);
 | 
				
			||||||
 | 
					fprintf(stderr, "Usage:    tga_applymap M src.tga color.map dst.tga\n");
 | 
				
			||||||
 | 
					fprintf(stderr, "       M is 1 or 2\n");
 | 
				
			||||||
 | 
					Image_print_version(0);
 | 
				
			||||||
 | 
					exit(5);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					/*::------------------------------------------------------------------::*/
 | 
				
			||||||
 | 
					int main(int argc, char *argv[])
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					Image_Desc	*src, *dst;
 | 
				
			||||||
 | 
					int		foo;
 | 
				
			||||||
 | 
					RGB_map		map;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					dump_command_line(argc, argv, 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if (argc==2 && !strcmp(argv[1], "-?"))	usage(1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if (argc != 5) usage(0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if ( (src=Image_TGA_alloc_load(argv[2])) == NULL )
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						fprintf(stderr, "can't load '%s'\n", argv[2]);
 | 
				
			||||||
 | 
						exit(1);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if ( (foo=Image_load_color_Map(argv[3], "map", &map)) )
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						fprintf(stderr, "%s: %s: err%d %s\n", argv[0], argv[3], 
 | 
				
			||||||
 | 
										foo, Image_err2str(foo));
 | 
				
			||||||
 | 
						exit(1);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if (must_be_verbose())
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						fprintf(stderr, "il y a %d couleurs dans la palette '%s'\n",
 | 
				
			||||||
 | 
								map.nbre, argv[3]);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if ( (dst=Image_clone(src, 0))==NULL )
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						fprintf(stderr, "can't clone %p, exiting...\n", src);
 | 
				
			||||||
 | 
						exit(2);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* ----------- */
 | 
				
			||||||
 | 
					switch (argv[1][0])
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						default:
 | 
				
			||||||
 | 
						case '1':
 | 
				
			||||||
 | 
							foo=Image_apply_Map(src, dst, &map);
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
						case '2':
 | 
				
			||||||
 | 
							foo=Image_gray_Map(src, dst, &map);
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
						case '3':
 | 
				
			||||||
 | 
							fprintf(stderr, "Not implemented\n");
 | 
				
			||||||
 | 
							exit(5);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					/* ----------- */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if (foo)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						fprintf(stderr, "%s: apply map: erreur %d: %s\n", 
 | 
				
			||||||
 | 
										argv[0], foo, Image_err2str(foo));
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					foo = Image_TGA_save(argv[4], dst, 0);
 | 
				
			||||||
 | 
					if (foo)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						fprintf(stderr, "%s: TGA_save: err #%d\n\t\t %s\n",
 | 
				
			||||||
 | 
								argv[0], foo, Image_err2str(foo));
 | 
				
			||||||
 | 
						exit(1);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					fprintf(stderr, "apply map ok\n");
 | 
				
			||||||
 | 
					exit (0);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					/*::------------------------------------------------------------------::*/
 | 
				
			||||||
@ -69,7 +69,7 @@ mot_clef mots_clef[] =
 | 
				
			|||||||
{ "burp0",	CDR_BURP0,	"iii",		"cadre burp 0"		},
 | 
					{ "burp0",	CDR_BURP0,	"iii",		"cadre burp 0"		},
 | 
				
			||||||
{ "burp1",	CDR_BURP1,	"ii",		"cadre burp 1"		},
 | 
					{ "burp1",	CDR_BURP1,	"ii",		"cadre burp 1"		},
 | 
				
			||||||
{ "burp2",	CDR_BURP2,	"iiii",		"inversion composantes"	},
 | 
					{ "burp2",	CDR_BURP2,	"iiii",		"inversion composantes"	},
 | 
				
			||||||
{ "burp3",	CDR_BURP3,	"",		"en chantier..."	},
 | 
					{ "burp3",	CDR_BURP3,	"iiii",		"en chantier..."	},
 | 
				
			||||||
{ "soft1",	CDR_SOFT_1,	"",		"en chantier aussi"	},
 | 
					{ "soft1",	CDR_SOFT_1,	"",		"en chantier aussi"	},
 | 
				
			||||||
{ "x",		CDR_PIXX,	"ii",		NULL			},
 | 
					{ "x",		CDR_PIXX,	"ii",		NULL			},
 | 
				
			||||||
{ "pixx",	CDR_PIXX,	"ii",		"pixx me !"		},
 | 
					{ "pixx",	CDR_PIXX,	"ii",		"pixx me !"		},
 | 
				
			||||||
@ -116,7 +116,7 @@ exit(5);
 | 
				
			|||||||
 *	argv[1] 	type cadre
 | 
					 *	argv[1] 	type cadre
 | 
				
			||||||
 *	argv[2] 	image source
 | 
					 *	argv[2] 	image source
 | 
				
			||||||
 *	argv[3] 	image destination 
 | 
					 *	argv[3] 	image destination 
 | 
				
			||||||
 *	argv[...] 	paramètres 
 | 
					 *	argv[...] 	parametres 
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
#define FIRST_PARAM 4
 | 
					#define FIRST_PARAM 4
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -143,7 +143,7 @@ if (strlen(argv[1])==1)
 | 
				
			|||||||
			   argv[0],                argv[1]);
 | 
								   argv[0],                argv[1]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* recherche du type de cadre demandé */
 | 
					/* recherche du type de cadre demande */
 | 
				
			||||||
idx = cherche_mot_clef(argv[2], mots_clef, &commande, &nbargs);
 | 
					idx = cherche_mot_clef(argv[2], mots_clef, &commande, &nbargs);
 | 
				
			||||||
if (idx < 0)
 | 
					if (idx < 0)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
@ -161,7 +161,7 @@ if ( (argc-nbargs) != FIRST_PARAM )
 | 
				
			|||||||
	exit(5);
 | 
						exit(5);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 *	décodage des paramètres
 | 
					 *	decodage des parametres
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
foo = parse_parametres(argc, argv, mots_clef[idx].ptypes, FIRST_PARAM);
 | 
					foo = parse_parametres(argc, argv, mots_clef[idx].ptypes, FIRST_PARAM);
 | 
				
			||||||
#if DEBUG_LEVEL
 | 
					#if DEBUG_LEVEL
 | 
				
			||||||
@ -178,7 +178,7 @@ if ( (src=Image_TGA_alloc_load(argv[1])) == NULL )
 | 
				
			|||||||
	exit(1);
 | 
						exit(1);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* 26 Jan 2002: en fait, est-il nécessaire de cloner l'image ? */
 | 
					/* 26 Jan 2002: en fait, est-il necessaire de cloner l'image ? */
 | 
				
			||||||
if ( (dst=Image_clone(src, 1)) == NULL )
 | 
					if ( (dst=Image_clone(src, 1)) == NULL )
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
	fprintf(stderr, "tga_cadre: can't clone %p\n", src);
 | 
						fprintf(stderr, "tga_cadre: can't clone %p\n", src);
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										306
									
								
								Tools/tga_combine.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										306
									
								
								Tools/tga_combine.c
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,306 @@
 | 
				
			|||||||
 | 
					/*
 | 
				
			||||||
 | 
						un outil pour combiner deux images TGA
 | 
				
			||||||
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include  <stdio.h>
 | 
				
			||||||
 | 
					#include  <string.h>
 | 
				
			||||||
 | 
					#include  <stdlib.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include  "tga_outils.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*::------------------------------------------------------------------::*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define MIX_SEUILS	10
 | 
				
			||||||
 | 
					#define MIX_GRAY	11
 | 
				
			||||||
 | 
					#define MIX_RGB		12
 | 
				
			||||||
 | 
					#define MIX_LINES	20
 | 
				
			||||||
 | 
					#define MIX_COLUMNS	21
 | 
				
			||||||
 | 
					#define MIX_CHECKER	22
 | 
				
			||||||
 | 
					#define MIX_RANDOM	23
 | 
				
			||||||
 | 
					#define MIX_RNDRGB	24
 | 
				
			||||||
 | 
					#define MIX_POWER	25
 | 
				
			||||||
 | 
					#define MIX_POWERM	26		/* new 14 mars 2014 */
 | 
				
			||||||
 | 
					#define MIX_XOR		27		/* new 25 sept 2018 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define MIX_DIAGO	40
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define MIX_HSPLIT0	50		/* new 29 nov 2013 */
 | 
				
			||||||
 | 
					#define MIX_VSPLIT0	51		/* new 29 nov 2013 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define MIX_MINMAX	60
 | 
				
			||||||
 | 
					#define MIX_STEREO	70
 | 
				
			||||||
 | 
					#define MIX_STEREOK	71
 | 
				
			||||||
 | 
					#define MIX_STEREO3	73
 | 
				
			||||||
 | 
					#define MIX_WAOU	80
 | 
				
			||||||
 | 
					#define MIX_WAUO	81
 | 
				
			||||||
 | 
					#define MIX_CIRCLE0	84
 | 
				
			||||||
 | 
					#define MIX_HDEG	100
 | 
				
			||||||
 | 
					#define MIX_VDEG	101
 | 
				
			||||||
 | 
					#define MIX_PROTO	110
 | 
				
			||||||
 | 
					#define MIX_IFNOTBLACK	200
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static char no_help[] = "no help";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static char h_mix_gray[] = "param: 1..10000";
 | 
				
			||||||
 | 
					static char h_mix_rgb[]	= "params: 3*1..10000";
 | 
				
			||||||
 | 
					static char h_lico[]	= "taille offset 0";
 | 
				
			||||||
 | 
					static char h_random[]	= "param: 1..10000";
 | 
				
			||||||
 | 
					static char h_minmax[]	= "0:min 1:max";
 | 
				
			||||||
 | 
					static char h_waou[]    = "ubyte ubyte ubyte bit";
 | 
				
			||||||
 | 
					static char h_wauo[]	= "must be 0";
 | 
				
			||||||
 | 
					static char h_circle0[]	= "must be 0";
 | 
				
			||||||
 | 
					static char h_deg[] 	= "0 or 1";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					mot_clef les_types[] = 
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						{ "mixer",	MIX_GRAY,	"i",	no_help		},
 | 
				
			||||||
 | 
						{ "mix_gray",	MIX_GRAY,	"i",	h_mix_gray	},
 | 
				
			||||||
 | 
						{ "mix_rgb",	MIX_RGB,	"iii",	h_mix_rgb	},
 | 
				
			||||||
 | 
						{ "seuils",	MIX_SEUILS,	"iii",  "P in [0..255]"	},
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						{ "lines",	MIX_LINES,	"iii",	h_lico		},
 | 
				
			||||||
 | 
						{ "columns",	MIX_COLUMNS,	"iii",	h_lico		},
 | 
				
			||||||
 | 
						{ "checker",	MIX_CHECKER,	"iiiii", no_help	},
 | 
				
			||||||
 | 
						{ "random",	MIX_RANDOM,	"i",	h_random	},
 | 
				
			||||||
 | 
						{ "rndrgb",	MIX_RNDRGB,	"i",	h_random	},
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						{ "diago",	MIX_DIAGO,	"fii",	no_help		},
 | 
				
			||||||
 | 
						{ "diagonale",	MIX_DIAGO,	"fii",	no_help		},
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						{ "hsplit",	MIX_HSPLIT0,	"ii",	"position 0"	},
 | 
				
			||||||
 | 
						{ "vsplit",	MIX_VSPLIT0,	"ii",	"P in pixels"	},
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						{ "minmax",	MIX_MINMAX,	"i",	h_minmax	},
 | 
				
			||||||
 | 
						{ "power",	MIX_POWER,	"",	""		},
 | 
				
			||||||
 | 
						{ "powerm",	MIX_POWERM,	"",	""		},
 | 
				
			||||||
 | 
						{ "xor",	MIX_XOR,	"",	""		},
 | 
				
			||||||
 | 
						{ "waou",	MIX_WAOU,	"iiii",	h_waou		},
 | 
				
			||||||
 | 
						{ "wauo",	MIX_WAUO,	"i",	h_wauo		},
 | 
				
			||||||
 | 
						{ "circle0",	MIX_CIRCLE0,	"i",	h_circle0	},
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						{ "hdeg",	MIX_HDEG,	"f",	h_deg		},
 | 
				
			||||||
 | 
						{ "vdeg",	MIX_VDEG,	"f",	h_deg		},
 | 
				
			||||||
 | 
						{ "ifnotblack",	MIX_IFNOTBLACK,	"",	"new mars 2007"	},
 | 
				
			||||||
 | 
						{ "stereo",	MIX_STEREO,	"",	"rouge/vert"	},
 | 
				
			||||||
 | 
						{ "stereok",	MIX_STEREOK,	"iii",	"rouge/bleu coefs"	},
 | 
				
			||||||
 | 
						{ "proto", 	MIX_PROTO,	"",	"prototype"	},
 | 
				
			||||||
 | 
						{ NULL,		0,		NULL,	NULL		}
 | 
				
			||||||
 | 
						};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*::------------------------------------------------------------------::*/
 | 
				
			||||||
 | 
					void usage(int flag)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					fprintf(stderr, "* Tga Combine v 0.1.43 [%s] %s\n",
 | 
				
			||||||
 | 
									TGA_OUTILS_VERSION, TGA_OUTILS_COPYLEFT);
 | 
				
			||||||
 | 
					if (flag)
 | 
				
			||||||
 | 
						fprintf(stderr, "* compiled : " __DATE__ " *\n");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Image_print_version(0);
 | 
				
			||||||
 | 
					fputs("Usage:\n", stderr);
 | 
				
			||||||
 | 
					fputs("\ttga_combine s1.tga s2.tga MODE d.tga [PARAMS]\n", stderr);
 | 
				
			||||||
 | 
					fputs("\n", stderr);
 | 
				
			||||||
 | 
					if (flag) liste_mots_clefs(les_types, 0);
 | 
				
			||||||
 | 
					exit(0);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					/*::------------------------------------------------------------------::*/
 | 
				
			||||||
 | 
					int combine_proto(Image_Desc *sa, Image_Desc *sb, Image_Desc *dest)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					fprintf(stderr, "%p + %p -> %p\n", sa, sb, dest);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					return 42;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					/*::------------------------------------------------------------------::*/
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 *	arg[1]		s1.tga
 | 
				
			||||||
 | 
					 *	arg[2]		s2.tga
 | 
				
			||||||
 | 
					 *	arg[3]		mode
 | 
				
			||||||
 | 
					 *	arg[4]		dst.tga
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					#define FIRST_PARAM 5
 | 
				
			||||||
 | 
					int main(int argc, char *argv[])
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					Image_Desc 	*s1, *s2, *d;
 | 
				
			||||||
 | 
					int		foo;
 | 
				
			||||||
 | 
					int		idx, mode, nbarg;
 | 
				
			||||||
 | 
					char		*dstname;
 | 
				
			||||||
 | 
					int		kr, kg, kb;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					dump_command_line(argc, argv, 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if (argc==2 && !strcmp(argv[1], "list"))	usage(1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if (argc < 5 ) usage(0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if ((idx=cherche_mot_clef(argv[3], les_types, &mode, &nbarg)) == -1)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						fprintf(stderr, "mode '%s' inconnu\n", argv[3]);
 | 
				
			||||||
 | 
						exit(1);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if DEBUG_LEVEL
 | 
				
			||||||
 | 
					fprintf(stderr, "%s --> idx=%d, mode=%d, %d args\n", argv[3], idx, mode, nbarg);
 | 
				
			||||||
 | 
					fprintf(stderr, "argc = %d\n", argc);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					if (mode == -1)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						fprintf(stderr, "mode '%s' inconnu\n", argv[3]);
 | 
				
			||||||
 | 
						exit(5);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					/* analyse des paramètres */
 | 
				
			||||||
 | 
					foo = parse_parametres(argc, argv, les_types[idx].ptypes, FIRST_PARAM);
 | 
				
			||||||
 | 
					#if DEBUG_LEVEL
 | 
				
			||||||
 | 
					fprintf(stderr, "parse params -> %d\n", foo);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if ((s1 = Image_TGA_alloc_load(argv[1]))==NULL)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						fprintf(stderr, "tga_combine: can't load image #1\n");
 | 
				
			||||||
 | 
						exit(5);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					if (must_be_verbose())
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						fprintf(stderr, "%s loaded at %p\n", argv[1], s1);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if ((s2 = Image_TGA_alloc_load(argv[2]))==NULL)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						fprintf(stderr, "tga_combine: can't load image #2\n");
 | 
				
			||||||
 | 
						exit(5);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					if (must_be_verbose())
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						fprintf(stderr, "%s loaded at %p\n", argv[2], s2);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if ((d = Image_clone(s2, 0))==NULL)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						fprintf(stderr, "tga_combine: erreur clonage destination\n");
 | 
				
			||||||
 | 
						exit(5);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					switch (mode)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						case MIX_SEUILS:
 | 
				
			||||||
 | 
							foo = Image_combine_seuils(s1, s2, d, GIP(0), GIP(1), GIP(2));
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						case MIX_GRAY:
 | 
				
			||||||
 | 
							foo = Image_mix(s1, s2, d, GIP(0));
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						case MIX_RGB:
 | 
				
			||||||
 | 
							foo = Image_mix_rgb(s1, s2, d, GIP(0), GIP(1), GIP(2));
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						case MIX_LINES:
 | 
				
			||||||
 | 
							foo = Image_combine_lines(s1, s2, d, GIP(0), GIP(1), GIP(2));
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						case MIX_COLUMNS:
 | 
				
			||||||
 | 
							foo = Image_combine_columns(s1, s2, d, GIP(0), GIP(1), GIP(2));
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						case MIX_CHECKER:
 | 
				
			||||||
 | 
							foo = Image_combine_checker(s1, s2, d, GIP(0), GIP(1), GIP(2),
 | 
				
			||||||
 | 
												GIP(3), GIP(4));	
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						case MIX_RANDOM:
 | 
				
			||||||
 | 
							foo = Image_combine_random_point(s1, s2, d, GIP(0));
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						case MIX_RNDRGB:
 | 
				
			||||||
 | 
							fprintf(stderr, "SEGFAULT, COREDUMP, what else ?\n");
 | 
				
			||||||
 | 
							foo = Image_combine_random_rgb(s1, s2, d, GIP(0));
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
						case MIX_DIAGO:
 | 
				
			||||||
 | 
							/* oui, bon, a quoi servent les parametres ? */
 | 
				
			||||||
 | 
							/* 17sept2009: le 0 est le sens de la coupure, 
 | 
				
			||||||
 | 
					                   et les 1 & 2 sont 'not used' */
 | 
				
			||||||
 | 
							foo = Image_combine_diagonale(s1, s2, d,
 | 
				
			||||||
 | 
										GFP(0), GIP(1), GIP(2));
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						case MIX_HSPLIT0:
 | 
				
			||||||
 | 
							foo = Image_combine_Hsplit(s1, s2, d, GIP(0), GIP(1));
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
						case MIX_VSPLIT0:
 | 
				
			||||||
 | 
							foo = Image_combine_Vsplit(s1, s2, d, GIP(0), GIP(1));
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						case MIX_MINMAX:
 | 
				
			||||||
 | 
							foo = Image_combine_minmax(s1, s2, d, GIP(0));
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						case MIX_POWER:
 | 
				
			||||||
 | 
							foo = Image_combine_power(s1, s2, d);
 | 
				
			||||||
 | 
							fprintf(stderr, "combine power -> %d\n", foo);
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
						case MIX_POWERM:
 | 
				
			||||||
 | 
							foo = Image_combine_power_m(s1, s2, d);
 | 
				
			||||||
 | 
							fprintf(stderr, "combine power_m -> %d\n", foo);
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						case MIX_WAOU:
 | 
				
			||||||
 | 
							foo = Image_combine_waou(s1,s2,d,GIP(0),GIP(1),GIP(2),GIP(3));
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						case MIX_WAUO:
 | 
				
			||||||
 | 
							foo = Image_combine_wauo(s1, s2, d, GIP(0));
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						case MIX_CIRCLE0:
 | 
				
			||||||
 | 
							foo = Image_combine_cercle_flou(s1, s2, d, 0);
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* FIXME 16 sept 2009 : je pense que hdeg et vdeg sont inverses */
 | 
				
			||||||
 | 
						case MIX_HDEG:
 | 
				
			||||||
 | 
							foo = Image_combine_Hdegrade(s1, s2, d, GFP(0));
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						case MIX_VDEG:
 | 
				
			||||||
 | 
							foo = Image_combine_Vdegrade(s1, s2, d, GFP(0));
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						case MIX_IFNOTBLACK:
 | 
				
			||||||
 | 
							foo = Image_combine_if_not_black(s1, s2, d);
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						case MIX_XOR:
 | 
				
			||||||
 | 
							foo = Image_XOR(s1, s2, d, 1);
 | 
				
			||||||
 | 
							if (666==foo) fputs("#####################", stderr);
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						case MIX_STEREO:
 | 
				
			||||||
 | 
							foo = Image_combine_stereo_0(s1, s2, d);
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						case MIX_STEREOK:
 | 
				
			||||||
 | 
							kr = GIP(0);
 | 
				
			||||||
 | 
							kg = GIP(1);
 | 
				
			||||||
 | 
							kb = GIP(2);
 | 
				
			||||||
 | 
							foo = Image_combine_stereo_1(s1, s2, d, kr, kg, kb);
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						default:
 | 
				
			||||||
 | 
							fprintf(stderr, "mode operation %d non implemente\n", mode);
 | 
				
			||||||
 | 
							exit(1);
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if (foo)
 | 
				
			||||||
 | 
						Image_print_error("Combination", foo);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					dstname = argv[4];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					foo = Image_TGA_save(dstname, d, 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if DEBUG_LEVEL
 | 
				
			||||||
 | 
					fprintf(stderr, "image '%s' ecrite (%d)\n", dstname, foo);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					return 0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					/*::------------------------------------------------------------------::*/
 | 
				
			||||||
							
								
								
									
										145
									
								
								Tools/tga_dither.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										145
									
								
								Tools/tga_dither.c
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,145 @@
 | 
				
			|||||||
 | 
					/*
 | 
				
			||||||
 | 
						----------------------------------------------
 | 
				
			||||||
 | 
						  utilitaire pour ditherizer (uh?) une image
 | 
				
			||||||
 | 
						----------------------------------------------
 | 
				
			||||||
 | 
						 http://krabulator.free.fr/devel/libimage.html
 | 
				
			||||||
 | 
						----------------------------------------------
 | 
				
			||||||
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include  <stdio.h>
 | 
				
			||||||
 | 
					#include  <stdlib.h>
 | 
				
			||||||
 | 
					#include  <string.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include  "tga_outils.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*::------------------------------------------------------------------::*/
 | 
				
			||||||
 | 
					#define		DI_2X2			2
 | 
				
			||||||
 | 
					#define		DI_3X3_0		11
 | 
				
			||||||
 | 
					#define		DI_3X3_1		12
 | 
				
			||||||
 | 
					#define		DI_BAYER0		16
 | 
				
			||||||
 | 
					#define		DI_ATKINSON		18
 | 
				
			||||||
 | 
					#define		DI_CRUDE		30
 | 
				
			||||||
 | 
					#define		DI_DBLTR		38
 | 
				
			||||||
 | 
					#define		DI_ERROR		45
 | 
				
			||||||
 | 
					#define		DI_RANDOM		60
 | 
				
			||||||
 | 
					#define		DI_BYR8RND		70
 | 
				
			||||||
 | 
					#define		DI_XPER			100
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					mot_clef mots_clef[] =
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					{ "2x2",	DI_2X2,		"",	"not working"		},
 | 
				
			||||||
 | 
					{ "3x3_0",	DI_3X3_0,	"",	""			},
 | 
				
			||||||
 | 
					{ "3x3_1",	DI_3X3_1,	"",	""			},
 | 
				
			||||||
 | 
					{ "bayer0",	DI_BAYER0,	"", 	""			},
 | 
				
			||||||
 | 
					{ "atkinson",	DI_ATKINSON,	"i",	"mmmm ?"		},
 | 
				
			||||||
 | 
					{ "crude",	DI_CRUDE,	"i",	""			},
 | 
				
			||||||
 | 
					{ "dbltresh",	DI_DBLTR,	"ii",	"hi & low tresholds"	},
 | 
				
			||||||
 | 
					{ "error",	DI_ERROR,	"",	"simple err diffusion"	},
 | 
				
			||||||
 | 
					{ "random",	DI_RANDOM,	"i",	"random treshold"	},
 | 
				
			||||||
 | 
					{ "byr8rnd",	DI_BYR8RND,	"ii",	"new 29 nov 2013"	},
 | 
				
			||||||
 | 
					{ "xper",	DI_XPER,	"i",	"param: 1..254"		},
 | 
				
			||||||
 | 
					{ NULL,		0,		NULL,	NULL			}
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*::------------------------------------------------------------------::*/
 | 
				
			||||||
 | 
					void usage(int flag)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					fprintf(stderr, "* tga_dither v 0.0.26 [%s] (dwtfywl 2022) tTh\n",
 | 
				
			||||||
 | 
										TGA_OUTILS_VERSION);
 | 
				
			||||||
 | 
					fprintf(stderr, "usage:\n\ttga_dither avant.tga mode avant.tga [params]\n");
 | 
				
			||||||
 | 
					if (flag)
 | 
				
			||||||
 | 
						liste_mots_clefs(mots_clef, 42);
 | 
				
			||||||
 | 
					else
 | 
				
			||||||
 | 
						Image_print_version(0);
 | 
				
			||||||
 | 
					exit(5);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					/*::------------------------------------------------------------------::*/
 | 
				
			||||||
 | 
					int main (int argc, char *argv[])
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					Image_Desc	*src, *dst;
 | 
				
			||||||
 | 
					int		foo;
 | 
				
			||||||
 | 
					int		commande, nbargs, idx;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					dump_command_line(argc, argv, 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if ( argc==2 && !strcmp(argv[1], "list") ) usage(1);
 | 
				
			||||||
 | 
					if ( argc < 4)	usage(0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					idx = cherche_mot_clef(argv[2], mots_clef, &commande, &nbargs);
 | 
				
			||||||
 | 
					if (idx < 0)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						fprintf(stderr, "tga_dither: keyword %s unknow.\n", argv[2]);
 | 
				
			||||||
 | 
						exit(5);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if DEBUG_LEVEL
 | 
				
			||||||
 | 
					fprintf(stderr, "idx %d commande %d nbargs %d argc %d\n",
 | 
				
			||||||
 | 
										idx, commande, nbargs, argc);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					foo = parse_parametres(argc, argv, mots_clef[idx].ptypes, 4);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if ( (src=Image_TGA_alloc_load(argv[1])) == NULL )
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						fprintf(stderr, "tga_dither: err load %s\n", argv[1]);
 | 
				
			||||||
 | 
						exit(5);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					if ( (dst=Image_clone(src, 1)) == NULL )
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						fprintf(stderr, "no mem for image cloning\n");
 | 
				
			||||||
 | 
						exit(5);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					switch (commande)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						case DI_2X2:
 | 
				
			||||||
 | 
							foo = Image_dither_2x2(src, dst, 255);
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
						case DI_3X3_0:
 | 
				
			||||||
 | 
							foo = Image_dither_3x3_0(src, dst, 127);
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
						case DI_3X3_1:
 | 
				
			||||||
 | 
							foo = Image_dither_3x3_1(src, dst, 255);
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
						case DI_BAYER0:
 | 
				
			||||||
 | 
							foo = Image_dither_Bayer_0(src, dst, 255);
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
						case DI_ATKINSON:
 | 
				
			||||||
 | 
							foo = Image_dither_atkinson(src, dst, 255);
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
						case DI_CRUDE:
 | 
				
			||||||
 | 
							foo = Image_dither_crude(src, dst, GIP(0));
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
						case DI_DBLTR:
 | 
				
			||||||
 | 
							foo = Image_dither_double_seuil(src, dst, GIP(0), GIP(1), 255);
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
						case DI_ERROR:
 | 
				
			||||||
 | 
							foo = Image_dither_simple_error(src, dst, 255);
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
						case DI_RANDOM:
 | 
				
			||||||
 | 
							foo = Image_dither_seuil_random(src, dst, 255);
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
						case DI_BYR8RND:
 | 
				
			||||||
 | 
							srand(getpid());
 | 
				
			||||||
 | 
							foo = Image_dither_bayer8x8rnd(src, dst, GIP(0), GIP(1));
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
						case DI_XPER:
 | 
				
			||||||
 | 
							foo = Image_dither_3x3_1(src, dst, GIP(0));
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
						default:
 | 
				
			||||||
 | 
							fprintf(stderr, "dithering method not implemented\n");
 | 
				
			||||||
 | 
							foo=-1;
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if DEBUG_LEVEL
 | 
				
			||||||
 | 
					if (foo)
 | 
				
			||||||
 | 
						fprintf(stderr, "dither %d retour = %d, %s\n", commande,
 | 
				
			||||||
 | 
										 foo, Image_err2str(foo));
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					foo = Image_TGA_save(argv[3], dst, 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					return 0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					/*::------------------------------------------------------------------::*/
 | 
				
			||||||
							
								
								
									
										124
									
								
								Tools/tga_equalize.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										124
									
								
								Tools/tga_equalize.c
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,124 @@
 | 
				
			|||||||
 | 
					/*
 | 
				
			||||||
 | 
						----------------------------------------------
 | 
				
			||||||
 | 
						    utilitaire pour egalizer (uh?) une image
 | 
				
			||||||
 | 
						----------------------------------------------
 | 
				
			||||||
 | 
						     http://la.buvette.org/devel/libimage/
 | 
				
			||||||
 | 
						----------------------------------------------
 | 
				
			||||||
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include  <stdio.h>
 | 
				
			||||||
 | 
					#include  <stdlib.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include  "tga_outils.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*::------------------------------------------------------------------::*/
 | 
				
			||||||
 | 
					#define		EQ_STD		4
 | 
				
			||||||
 | 
					#define		EQ_GRAY		8
 | 
				
			||||||
 | 
					#define		EQ_2X2		12
 | 
				
			||||||
 | 
					#define		EQ_LUMIN	14
 | 
				
			||||||
 | 
					#define		EQ_SQUARE	16
 | 
				
			||||||
 | 
					#define		EQ_SQROOT	17
 | 
				
			||||||
 | 
					#define		EQ_GAMMA	20
 | 
				
			||||||
 | 
					mot_clef mots_clef[] =
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					{ "std",	EQ_STD,		"", 	"standard method"	},
 | 
				
			||||||
 | 
					{ "rgb",	EQ_STD,		"", 	"same as 'std'"		},
 | 
				
			||||||
 | 
					{ "gray",	EQ_GRAY,	"",	"gray based"		},
 | 
				
			||||||
 | 
					{ "2x2",	EQ_2X2,		"",	"2x2 matrix"		},
 | 
				
			||||||
 | 
					{ "lumin",	EQ_LUMIN,	"i",	"param : ident is 256"	},
 | 
				
			||||||
 | 
					{ "gamma",	EQ_GAMMA,	"d",	"not implemented"	},
 | 
				
			||||||
 | 
					{ "square",	EQ_SQUARE,	"",	"pix**2"		},
 | 
				
			||||||
 | 
					{ "sqroot",	EQ_SQROOT,	"",	"sqr(pix)"		},
 | 
				
			||||||
 | 
					{ NULL,		0,		NULL,	NULL			}
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*::------------------------------------------------------------------::*/
 | 
				
			||||||
 | 
					void usage()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					fprintf(stderr, "* tga_equalize v 0.0.20 [%s]  (dwtfywl) tonton Th\n",
 | 
				
			||||||
 | 
										TGA_OUTILS_VERSION);
 | 
				
			||||||
 | 
					fprintf(stderr, "  compiled %s at %s\n", __DATE__, __TIME__);
 | 
				
			||||||
 | 
					fprintf(stderr, "usage:\n\ttga_equalize avant.tga mode apres.tga [params]\n");
 | 
				
			||||||
 | 
					liste_mots_clefs(mots_clef, 42);
 | 
				
			||||||
 | 
					exit(5);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					/*::------------------------------------------------------------------::*/
 | 
				
			||||||
 | 
					int main (int argc, char *argv[])
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					Image_Desc	*src, *dst;
 | 
				
			||||||
 | 
					int		foo;
 | 
				
			||||||
 | 
					int		commande, nbargs, idx;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					dump_command_line(argc, argv, 0);
 | 
				
			||||||
 | 
					if (argc < 4)		usage();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					idx = cherche_mot_clef(argv[2], mots_clef, &commande, &nbargs);
 | 
				
			||||||
 | 
					if (idx < 0)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						fprintf(stderr, "tga_equalize: mot-clef %s inconnu...\n", argv[2]);
 | 
				
			||||||
 | 
						exit(5);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					#if DEBUG_LEVEL
 | 
				
			||||||
 | 
					fprintf(stderr, "idx %d commande %d nbargs %d argc %d\n",
 | 
				
			||||||
 | 
										idx, commande, nbargs, argc);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					foo = parse_parametres(argc, argv, mots_clef[idx].ptypes, 4);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if ( (src=Image_TGA_alloc_load(argv[1])) == NULL )
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						fprintf(stderr, "tga_equalize: err load %s\n", argv[1]);
 | 
				
			||||||
 | 
						exit(5);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if ( (dst=Image_clone(src, 0)) == NULL )
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						fprintf(stderr, "no mem for image cloning\n");
 | 
				
			||||||
 | 
						exit(5);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					switch (commande)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						case EQ_STD:
 | 
				
			||||||
 | 
							foo = Image_egalise_RGB(src, dst, 0);
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						case EQ_GRAY:
 | 
				
			||||||
 | 
							foo = Image_egalise_mono_0(src, dst, 0);
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						case EQ_2X2:
 | 
				
			||||||
 | 
							foo = Image_2x2_contrast(src, dst);
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						case EQ_LUMIN:
 | 
				
			||||||
 | 
							foo = Image_luminance(src, dst, GIP(0));
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						case EQ_SQUARE:
 | 
				
			||||||
 | 
							foo = Image_pix_square(src, dst, 0);
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						case EQ_SQROOT:
 | 
				
			||||||
 | 
							foo = Image_pix_sqroot(src, dst, 0);
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						case EQ_GAMMA:
 | 
				
			||||||
 | 
							fprintf(stderr, "no gamma func in %d\n", getpid());
 | 
				
			||||||
 | 
							foo = FULL_NUCKED;
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						default:
 | 
				
			||||||
 | 
							foo=-1;
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if DEBUG_LEVEL
 | 
				
			||||||
 | 
					if (foo)
 | 
				
			||||||
 | 
						fprintf(stderr, "retour = %d, %s\n", foo, Image_err2str(foo));
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					foo = Image_TGA_save(argv[3], dst, 0);
 | 
				
			||||||
 | 
					return 0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					/*::------------------------------------------------------------------::*/
 | 
				
			||||||
							
								
								
									
										143
									
								
								Tools/tga_incrust.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										143
									
								
								Tools/tga_incrust.c
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,143 @@
 | 
				
			|||||||
 | 
					/*
 | 
				
			||||||
 | 
					 # #    #  ####  #####  #    #  ####  #####   ##   ##### #  ####  #    # 
 | 
				
			||||||
 | 
					 # ##   # #    # #    # #    # #        #    #  #    #   # #    # ##   # 
 | 
				
			||||||
 | 
					 # # #  # #      #    # #    #  ####    #   #    #   #   # #    # # #  # 
 | 
				
			||||||
 | 
					 # #  # # #      #####  #    #      #   #   ######   #   # #    # #  # # 
 | 
				
			||||||
 | 
					 # #   ## #    # #   #  #    # #    #   #   #    #   #   # #    # #   ## 
 | 
				
			||||||
 | 
					 # #    #  ####  #    #  ####   ####    #   #    #   #   #  ####  #    # 
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include  <stdio.h>
 | 
				
			||||||
 | 
					#include  <stdlib.h>
 | 
				
			||||||
 | 
					#include  <string.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include  "tga_outils.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*::------------------------------------------------------------------::*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define		ICRU_POKE	2
 | 
				
			||||||
 | 
					#define		ICRU_POKEMIX	3
 | 
				
			||||||
 | 
					#define		ICRU_POKEALPHA	4
 | 
				
			||||||
 | 
					#define		ICRU_POKESCALE	10
 | 
				
			||||||
 | 
					#define		ICRU_RGBXOR	20
 | 
				
			||||||
 | 
					#define		ICRU_RECT	30
 | 
				
			||||||
 | 
					#define		ICRU_RECT2	32
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					mot_clef mots_clef[] =
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					{ "poke",	ICRU_POKE,	"ii",	"poke it hardly"		},
 | 
				
			||||||
 | 
					{ "pokemix",	ICRU_POKEMIX,	"iii",	"ponderate it"			},
 | 
				
			||||||
 | 
					{ "pokealpha",	ICRU_POKEALPHA,	"ii",	"use the alpha channel"		},
 | 
				
			||||||
 | 
					{ "pokescale",	ICRU_POKESCALE,	"ii%",	"scale before poking"		},
 | 
				
			||||||
 | 
					{ "rgbxor",	ICRU_RGBXOR,	"ii",	"exclusive OR of poked pix"	},
 | 
				
			||||||
 | 
					{ "rect",	ICRU_RECT,	"iir",	"only a part of 'what'"		},
 | 
				
			||||||
 | 
					{ "rect2",	ICRU_RECT2,	"iir",	"only a part of 'what'"		},
 | 
				
			||||||
 | 
					{ NULL,		0,		"WTF",	NULL				},
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*::------------------------------------------------------------------::*/
 | 
				
			||||||
 | 
					int usage(int flag)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					fprintf(stderr, "* TGA incrustator  v 0.1.3 [%s] %s \n",
 | 
				
			||||||
 | 
									TGA_OUTILS_VERSION, TGA_OUTILS_COPYLEFT);
 | 
				
			||||||
 | 
					fprintf(stderr, "  compiled %s at %s\n", __DATE__, __TIME__);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					fprintf(stderr, "usage:\n\ttga_incrust orig insert mode out\n");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if (flag) {
 | 
				
			||||||
 | 
						Image_print_version(0);
 | 
				
			||||||
 | 
						liste_mots_clefs(mots_clef, 42);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					exit(0);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*::------------------------------------------------------------------::*/
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 *	argv[1] 	image originale
 | 
				
			||||||
 | 
					 *	argv[2] 	image a incruster
 | 
				
			||||||
 | 
					 *	argv[3] 	type d'incrustation
 | 
				
			||||||
 | 
					 *	argv[4] 	image destination
 | 
				
			||||||
 | 
					*/                                                                    
 | 
				
			||||||
 | 
					#define FIRST_PARAM	5
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int main(int argc, char *argv[])
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					Image_Desc	*where, *what;
 | 
				
			||||||
 | 
					int		foo, idx;
 | 
				
			||||||
 | 
					int		xpos, ypos;
 | 
				
			||||||
 | 
					int		par[NB_PARAMS], nb_int_par;
 | 
				
			||||||
 | 
					int		commande, nbargs;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					dump_command_line(argc, argv, 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if (argc==2 && !strcmp(argv[1], "-?"))		usage(0);
 | 
				
			||||||
 | 
					if (argc==2 && !strcmp(argv[1], "list"))	usage(1);
 | 
				
			||||||
 | 
					if (argc < 4) usage(1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if (must_be_verbose())
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						fprintf(stderr, "********************************\n");
 | 
				
			||||||
 | 
						fprintf(stderr, "*   EXPERIMENTAL CORE DUMPER   *\n");
 | 
				
			||||||
 | 
						fprintf(stderr, "********************************\n");
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					idx = cherche_mot_clef(argv[3], mots_clef, &commande, &nbargs);
 | 
				
			||||||
 | 
					if (idx < 0)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						fprintf(stderr, "tga_incrust: mot-clef '%s' inconnu...\n", argv[3]);
 | 
				
			||||||
 | 
						exit (5);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					if ( (argc-nbargs) != FIRST_PARAM )
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						fprintf(stderr, "%s: bad number of parameters\n", argv[0]);
 | 
				
			||||||
 | 
					#if DEBUG_LEVEL
 | 
				
			||||||
 | 
						fprintf(stderr, "argc=%d nbargs=%d FIRST_PARAM=%d\n",
 | 
				
			||||||
 | 
									argc, nbargs, FIRST_PARAM);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
						exit(5);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* analyse des parametres */
 | 
				
			||||||
 | 
					idx = 0;
 | 
				
			||||||
 | 
					foo = parse_parametres(argc, argv, mots_clef[idx].ptypes, FIRST_PARAM);
 | 
				
			||||||
 | 
					#if DEBUG_LEVEL
 | 
				
			||||||
 | 
					fprintf(stderr, "parse params -> %d\n", foo);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if (NULL==(where=Image_TGA_alloc_load(argv[1])))
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						fprintf(stderr, "can't load %s\n", argv[1]);
 | 
				
			||||||
 | 
						exit(2);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if (NULL==(what=Image_TGA_alloc_load(argv[2])))
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						fprintf(stderr, "can't load %s\n", argv[2]);
 | 
				
			||||||
 | 
						exit(2);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					switch (commande)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						case ICRU_POKE:
 | 
				
			||||||
 | 
							xpos = GIP(0);		ypos = GIP(1);
 | 
				
			||||||
 | 
							foo = Image_overlay(what, where, xpos, ypos);
 | 
				
			||||||
 | 
							if (foo) fprintf(stderr, "overlay -> %d\n", foo);
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						default:
 | 
				
			||||||
 | 
							fprintf(stderr, "%d command not implemented\n", commande);
 | 
				
			||||||
 | 
							exit(1);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Image_DeAllocate(what);			free(what);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					foo = Image_TGA_save(argv[4], where, 0);
 | 
				
			||||||
 | 
					if (foo)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						fprintf(stderr, "save -> %d\n", foo);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					Image_DeAllocate(where);		free(where);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					return 0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										80
									
								
								Tools/tga_info.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										80
									
								
								Tools/tga_info.c
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,80 @@
 | 
				
			|||||||
 | 
					/*
 | 
				
			||||||
 | 
						ce programme n'est pas pres pour le 'primtime'
 | 
				
			||||||
 | 
						il manque une gestion correcte des arguments.
 | 
				
			||||||
 | 
						voir aussi 'tga_tools.c'
 | 
				
			||||||
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <stdio.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "../tthimage.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int main(int argc, char *argv[])
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					Tga_file_header     head;
 | 
				
			||||||
 | 
					FILE                *fp;
 | 
				
			||||||
 | 
					char                *ptr;
 | 
				
			||||||
 | 
					char                comment[257];
 | 
				
			||||||
 | 
					int                 foo;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if (argc != 2)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					    fprintf(stderr, "il manque le nom du fichier TGA\n");
 | 
				
			||||||
 | 
					    exit(1);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if ((fp=fopen(argv[1], "rb")) == NULL)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					    fprintf(stderr, "erreur ouverture fichier %s\n", argv[1]);
 | 
				
			||||||
 | 
					    exit(1);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					fread(&head, 1, sizeof(head), fp);
 | 
				
			||||||
 | 
					if (head.text_size)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					    fread(comment, 1, head.text_size, fp);
 | 
				
			||||||
 | 
					    comment[head.text_size] = '\0';
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					fclose(fp);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					printf("file name           %s\n", argv[1]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if (head.text_size)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					    printf("comment size        %d\n", head.text_size);
 | 
				
			||||||
 | 
					    puts(comment);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					else puts("no comment.");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					printf("is color map ?      %d\n", head.is_color_map);
 | 
				
			||||||
 | 
					switch (head.type)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					    case  1:        ptr = "8-bit palette";  break;
 | 
				
			||||||
 | 
					    case  2:        ptr = "RGB";            break;
 | 
				
			||||||
 | 
					    case  3:        ptr = "Gray";	    break;
 | 
				
			||||||
 | 
					    case 10:        ptr = "rle/rvb";        break;
 | 
				
			||||||
 | 
					    case 11:	    ptr = "grey/rle";	    break; /* !!! a verifier !!! */
 | 
				
			||||||
 | 
					    default:        ptr = "???";            break;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					printf("type                %d     %s\n", head.type, ptr);
 | 
				
			||||||
 | 
					printf("map start           %d\n", head.map_start);
 | 
				
			||||||
 | 
					printf("map length          %d\n", head.map_length);
 | 
				
			||||||
 | 
					printf("map bits            %d\n", head.map_bits);
 | 
				
			||||||
 | 
					printf("x start             %d\n", head.x_start);
 | 
				
			||||||
 | 
					printf("y start             %d\n", head.y_start);
 | 
				
			||||||
 | 
					printf("width               %d\n", head.width);
 | 
				
			||||||
 | 
					printf("height              %d\n", head.height);
 | 
				
			||||||
 | 
					printf("nbr of bits         %d\n", head.bits);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					switch (head.flags>>4)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					    case 0:         ptr = "NON";            break;
 | 
				
			||||||
 | 
					    case 1:         ptr = "droite-gauche";  break;
 | 
				
			||||||
 | 
					    case 2:         ptr = "haut-bas";       break;
 | 
				
			||||||
 | 
					    case 3:         ptr = "les deux";       break;
 | 
				
			||||||
 | 
					    default:        ptr = "???";            break;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					printf("flags               %02x    flip: %s\n", head.flags, ptr);
 | 
				
			||||||
 | 
					return 0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										55
									
								
								Tools/tga_makehf15.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										55
									
								
								Tools/tga_makehf15.c
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,55 @@
 | 
				
			|||||||
 | 
					/*
 | 
				
			||||||
 | 
							convert a TGA image to a POVRAY height_field
 | 
				
			||||||
 | 
						    ----------------------------------------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    This operation is also implemented in 'povhf_tools' (dec 2009)
 | 
				
			||||||
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include  <stdio.h>
 | 
				
			||||||
 | 
					#include  <stdlib.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include  "tga_outils.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*::------------------------------------------------------------------::*/
 | 
				
			||||||
 | 
					void usage()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					fprintf(stderr, "* tga_makehf15 v 0.0.6 [%s] (dwtfywl) tontonTh\n",
 | 
				
			||||||
 | 
										TGA_OUTILS_VERSION);
 | 
				
			||||||
 | 
					fprintf(stderr, "Usage:\n\ttga_makehf15 source.tga hf.tga\n");
 | 
				
			||||||
 | 
					fprintf(stderr, "\tno parameters, no options... but stay tuned :)\n\n");
 | 
				
			||||||
 | 
					Image_print_version(0);
 | 
				
			||||||
 | 
					exit(5);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					/*::------------------------------------------------------------------::*/
 | 
				
			||||||
 | 
					int main (int argc, char *argv[])
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					Image_Desc 	*img, *hf15;
 | 
				
			||||||
 | 
					int		foo;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					dump_command_line(argc, argv, 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if (argc != 3)		usage();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if ( (img=Image_TGA_alloc_load(argv[1]))==NULL )
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						fprintf(stderr, "can't load '%s'\n", argv[1]);
 | 
				
			||||||
 | 
						exit(5);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if ( (hf15=Image_clone(img, 0))==NULL )
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						fprintf(stderr, "can't clone %p\n", img);
 | 
				
			||||||
 | 
						exit(5);	
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 *	et c'est quoi le paramètre qui est à 0 ?
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					foo = Image_hf15_rgb2hf(img, hf15, 0);
 | 
				
			||||||
 | 
					Image_print_error("hf15 rgb2hf", foo);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					foo = Image_TGA_save(argv[2], hf15, 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					return 0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					/*::------------------------------------------------------------------::*/
 | 
				
			||||||
							
								
								
									
										196
									
								
								Tools/tga_mires.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										196
									
								
								Tools/tga_mires.c
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,196 @@
 | 
				
			|||||||
 | 
					/*
 | 
				
			||||||
 | 
							FABRIQUEUR DE MIRES
 | 
				
			||||||
 | 
							===================
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						 http://krabulator.free.fr/devel/libimage.html
 | 
				
			||||||
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include  <stdio.h>
 | 
				
			||||||
 | 
					#include  <stdlib.h>
 | 
				
			||||||
 | 
					#include  <string.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include  "tga_outils.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*::------------------------------------------------------------------::*/
 | 
				
			||||||
 | 
					#define		MIRCOL0			2
 | 
				
			||||||
 | 
					#define		MIRCOL1			3
 | 
				
			||||||
 | 
					#define		MIRCOL2			4
 | 
				
			||||||
 | 
					#define		MIRCOL3			5
 | 
				
			||||||
 | 
					#define		MIRCOL4			6
 | 
				
			||||||
 | 
					#define		DECOMP			10
 | 
				
			||||||
 | 
					#define		RGB0			14
 | 
				
			||||||
 | 
					#define		RGBSTRIP		15	/* mmmm, c'est quoi ? */
 | 
				
			||||||
 | 
					#define		GRAY0			16
 | 
				
			||||||
 | 
					#define		FNT16X24		20
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					mot_clef mots_clef[] =
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					{ "mircol0",	MIRCOL0,	"s",	"free text"		},
 | 
				
			||||||
 | 
					{ "mircol1",	MIRCOL1,	"s",	"texte libre"		},
 | 
				
			||||||
 | 
					{ "mircol2",	MIRCOL2,	"iis",	"dims & free text"	},
 | 
				
			||||||
 | 
					{ "mircol3",	MIRCOL3,	"iiis",	"dims, flag & free text" },
 | 
				
			||||||
 | 
					{ "mircol4",	MIRCOL4,	"iiis",	"dims, flag & free text" },
 | 
				
			||||||
 | 
					{ "decomp",	DECOMP,		"",	"mysterious operation"	},
 | 
				
			||||||
 | 
					{ "rgb0",	RGB0,		"",	""			},
 | 
				
			||||||
 | 
					{ "gray0",	GRAY0,		"i",	"param: height"		},
 | 
				
			||||||
 | 
					{ "fnt16x24",	FNT16X24,	"s",	"param: font name"	},
 | 
				
			||||||
 | 
					{ NULL,		0,		NULL,	NULL			}
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*::------------------------------------------------------------------::*/
 | 
				
			||||||
 | 
					void usage(int flag)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					fprintf(stderr, "* tga_mires v 0.0.24 [%s]  (dwtfywl 2015) tonton Th\n",
 | 
				
			||||||
 | 
										TGA_OUTILS_VERSION);
 | 
				
			||||||
 | 
					fprintf(stderr, "usage:\n\ttga_mires type image.tga [params]\n");
 | 
				
			||||||
 | 
					if (flag)
 | 
				
			||||||
 | 
						liste_mots_clefs(mots_clef, 42);
 | 
				
			||||||
 | 
					else
 | 
				
			||||||
 | 
						Image_print_version(0);
 | 
				
			||||||
 | 
					exit(5);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					/*::------------------------------------------------------------------::*/
 | 
				
			||||||
 | 
					/* code selon ma methode de la rache le 25 avril 2007 */
 | 
				
			||||||
 | 
					int
 | 
				
			||||||
 | 
					mire_grise(Image_Desc *img)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					int	x, y;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if (256 != img->width)		abort();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					for (x=0; x<256; x++)
 | 
				
			||||||
 | 
						for (y=0; y<img->height; y++)
 | 
				
			||||||
 | 
							Image_plotRGB(img, x, y, x, x, x);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					return 0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					/*::------------------------------------------------------------------::*/
 | 
				
			||||||
 | 
					int do_mircol_2(Image_Desc *img, char *texte)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					int	foo;
 | 
				
			||||||
 | 
					foo = Image_mircol_2(img, texte, 0);
 | 
				
			||||||
 | 
					return foo;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					/*::------------------------------------------------------------------::*/
 | 
				
			||||||
 | 
					int do_mircol_3(Image_Desc *img, char *texte, int mode)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					int	foo;
 | 
				
			||||||
 | 
					fprintf(stderr, "%s : mode is %d\n", __func__, mode);
 | 
				
			||||||
 | 
					foo = Image_mircol_3(img, texte, mode);
 | 
				
			||||||
 | 
					return foo;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					/*::------------------------------------------------------------------::*/
 | 
				
			||||||
 | 
					int do_mircol_4(Image_Desc *img, char *texte, int mode)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					int	foo;
 | 
				
			||||||
 | 
					fprintf(stderr, "%s : mode is %d\n", __func__, mode);
 | 
				
			||||||
 | 
					foo = Image_mircol_4(img, texte, mode);
 | 
				
			||||||
 | 
					return foo;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					/*::------------------------------------------------------------------::*/
 | 
				
			||||||
 | 
					int main (int argc, char *argv[])
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					Image_Desc	*dst;
 | 
				
			||||||
 | 
					int		foo;
 | 
				
			||||||
 | 
					int		commande, nbargs, idx;
 | 
				
			||||||
 | 
					char		*cptr, *argument;
 | 
				
			||||||
 | 
					int		width, height;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					dump_command_line(argc, argv, 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if ( argc==2 && !strcmp(argv[1], "list") ) usage(1);
 | 
				
			||||||
 | 
					if ( argc < 3)	usage(0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					idx = cherche_mot_clef(argv[1], mots_clef, &commande, &nbargs);
 | 
				
			||||||
 | 
					if (idx < 0)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						fprintf(stderr, "tga_mires: mot-clef %s inconnu...\n", argv[1]);
 | 
				
			||||||
 | 
						exit(5);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					#if DEBUG_LEVEL
 | 
				
			||||||
 | 
					fprintf(stderr, "idx %d commande %d nbargs %d argc %d\n",
 | 
				
			||||||
 | 
										idx, commande, nbargs, argc);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					foo = parse_parametres(argc, argv, mots_clef[idx].ptypes, 3);
 | 
				
			||||||
 | 
					#if DEBUG_LEVEL
 | 
				
			||||||
 | 
					print_parametres();
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					dst = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					switch (commande)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						case MIRCOL0:
 | 
				
			||||||
 | 
							dst = Image_alloc(512, 512, 3);
 | 
				
			||||||
 | 
							foo = Image_mircol_0(dst, GSP(0), 0);
 | 
				
			||||||
 | 
							break;		
 | 
				
			||||||
 | 
						case MIRCOL1:
 | 
				
			||||||
 | 
							dst = Image_alloc(512, 512, 3);
 | 
				
			||||||
 | 
							foo = Image_mircol_1(dst, GSP(0), 0);
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
						case MIRCOL2:
 | 
				
			||||||
 | 
							width = GIP(0);
 | 
				
			||||||
 | 
							height = GIP(1);
 | 
				
			||||||
 | 
							fprintf(stderr, "mircol2 sur %dx%d\n", width, height);
 | 
				
			||||||
 | 
							dst = Image_alloc(width, height, 3);
 | 
				
			||||||
 | 
							foo = do_mircol_2(dst, GSP(2));
 | 
				
			||||||
 | 
							break;		
 | 
				
			||||||
 | 
						case MIRCOL3:
 | 
				
			||||||
 | 
							width = GIP(0);
 | 
				
			||||||
 | 
							height = GIP(1);
 | 
				
			||||||
 | 
					#if DEBUG_LEVEL
 | 
				
			||||||
 | 
							fprintf(stderr, "mircol3 sur %dx%d\n", width, height);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
							dst = Image_alloc(width, height, 3);
 | 
				
			||||||
 | 
							foo = do_mircol_3(dst, GSP(3), GIP(2));
 | 
				
			||||||
 | 
							break;		
 | 
				
			||||||
 | 
						case MIRCOL4:
 | 
				
			||||||
 | 
							width = GIP(0);
 | 
				
			||||||
 | 
							height = GIP(1);
 | 
				
			||||||
 | 
							fprintf(stderr, "mircol4 sur %dx%d\n", width, height);
 | 
				
			||||||
 | 
							dst = Image_alloc(width, height, 3);
 | 
				
			||||||
 | 
							foo = do_mircol_3(dst, GSP(3), GIP(2));
 | 
				
			||||||
 | 
							break;		
 | 
				
			||||||
 | 
						case RGB0:
 | 
				
			||||||
 | 
							dst = Image_alloc(256, 256, 3);
 | 
				
			||||||
 | 
							foo = Image_mirRGB_0(dst, 0);
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
						case GRAY0:
 | 
				
			||||||
 | 
							foo = GIP(0);
 | 
				
			||||||
 | 
							fprintf(stderr, "hauteur = %d\n", foo);
 | 
				
			||||||
 | 
							dst = Image_alloc(256, foo, 3);
 | 
				
			||||||
 | 
							foo = mire_grise(dst);
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
						case FNT16X24:
 | 
				
			||||||
 | 
					#if DEBUG_LEVEL
 | 
				
			||||||
 | 
							fprintf(stderr, "generation image fonte 16x24\n");
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
							cptr = argv[2];
 | 
				
			||||||
 | 
							argument = GSP(0);
 | 
				
			||||||
 | 
							fprintf(stderr, "image fonte 16x24 %s -> %s\n",
 | 
				
			||||||
 | 
											cptr, argument);
 | 
				
			||||||
 | 
							foo = Image_t16x24_chars_map(cptr, argument, 0);
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
						default:
 | 
				
			||||||
 | 
							fprintf(stderr, "method not implemented\n");
 | 
				
			||||||
 | 
							foo=-1;
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if (foo)
 | 
				
			||||||
 | 
						fprintf(stderr, "retour = %d, %s\n", foo, Image_err2str(foo));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if (dst != NULL)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						foo = Image_TGA_save(argv[2], dst, 0);
 | 
				
			||||||
 | 
						Image_DeAllocate(dst);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if DEBUG_LEVEL
 | 
				
			||||||
 | 
					puts("");
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					return 0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					/*::------------------------------------------------------------------::*/
 | 
				
			||||||
@ -7,7 +7,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include  "../tthimage.h"
 | 
					#include  "../tthimage.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define  TGA_OUTILS_VERSION   "0.58"
 | 
					#define  TGA_OUTILS_VERSION   "0.59"
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 *	13 Dec 2001: v0.11 a cause du 'mustopen' pour les palettes.
 | 
					 *	13 Dec 2001: v0.11 a cause du 'mustopen' pour les palettes.
 | 
				
			||||||
 *	11 Fev 2002: v0.12 a cause du '-ansi' (hein Kerdeuzz, on y vient)
 | 
					 *	11 Fev 2002: v0.12 a cause du '-ansi' (hein Kerdeuzz, on y vient)
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										204
									
								
								Tools/tga_pattern.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										204
									
								
								Tools/tga_pattern.c
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,204 @@
 | 
				
			|||||||
 | 
					/*
 | 
				
			||||||
 | 
						 , __                               
 | 
				
			||||||
 | 
						/|/  \                              
 | 
				
			||||||
 | 
						 |___/ __, _|__|_  _   ,_    _  _   
 | 
				
			||||||
 | 
						 |    /  |  |  |  |/  /  |  / |/ |  
 | 
				
			||||||
 | 
						 |    \_/|_/|_/|_/|__/   |_/  |  |_/
 | 
				
			||||||
 | 
					                                    
 | 
				
			||||||
 | 
					*/
 | 
				
			||||||
 | 
					                                    
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include  <stdio.h>
 | 
				
			||||||
 | 
					#include  <string.h>
 | 
				
			||||||
 | 
					#include  <stdlib.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include  "tga_outils.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*::------------------------------------------------------------------::*/
 | 
				
			||||||
 | 
					struct type
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						char	*nom;
 | 
				
			||||||
 | 
						int	code;
 | 
				
			||||||
 | 
						int nbparams;
 | 
				
			||||||
 | 
						};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define REPONSE		1
 | 
				
			||||||
 | 
					#define GRAYNOISE	2
 | 
				
			||||||
 | 
					#define RGBNOISE	3
 | 
				
			||||||
 | 
					#define TEXTURE_1	21
 | 
				
			||||||
 | 
					#define TEXTURE_2	22
 | 
				
			||||||
 | 
					#define TEXTURE_3	23
 | 
				
			||||||
 | 
					#define EXPOV_0		30
 | 
				
			||||||
 | 
					#define PATT_102	32	/* new June 2003 */
 | 
				
			||||||
 | 
					#define GRAYNOISE2	40
 | 
				
			||||||
 | 
					#define RGBNOISE1	50
 | 
				
			||||||
 | 
					#define RGBNOISE2	51
 | 
				
			||||||
 | 
					#define CHECK_BW	80
 | 
				
			||||||
 | 
					#define PATT_000	90
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static char no_help[] = "no help...";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					mot_clef mots_clef[] = 
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					{ "graynoise",	GRAYNOISE,	"ii",	"bruit gris" },
 | 
				
			||||||
 | 
					{ "rgbnoise",	RGBNOISE,	"ii",	"bruit RGB" },
 | 
				
			||||||
 | 
					{ "42",		REPONSE,	"ii",	no_help },
 | 
				
			||||||
 | 
					{ "reponse",	REPONSE,	"ii",	no_help },
 | 
				
			||||||
 | 
					{ "text1",	TEXTURE_1,	"ii",	no_help },
 | 
				
			||||||
 | 
					{ "text2",	TEXTURE_2,	"iii",	no_help },
 | 
				
			||||||
 | 
					{ "expov",	EXPOV_0,	"iii",	no_help },
 | 
				
			||||||
 | 
					{ "centdeux",	PATT_102,	"iiii", no_help },
 | 
				
			||||||
 | 
					{ "first",	PATT_000,	"i",	"byte mask" },
 | 
				
			||||||
 | 
					{ "graynoise2", GRAYNOISE2,	"ii",	no_help },
 | 
				
			||||||
 | 
					{ "rgbnoise1",  RGBNOISE1,	"iiiiii",	no_help },
 | 
				
			||||||
 | 
					{ "rgbnoise2",  RGBNOISE2,	"iiiiii",	no_help },
 | 
				
			||||||
 | 
					{ "check_bw",	CHECK_BW,	"iiii",		no_help },
 | 
				
			||||||
 | 
					{ NULL,		0,		NULL,	NULL		}
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*::------------------------------------------------------------------::*/
 | 
				
			||||||
 | 
					void usage(int flag)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					fprintf(stderr, "* Tga Pattern v 0.0.25 [%s] %s\n",
 | 
				
			||||||
 | 
									TGA_OUTILS_VERSION, TGA_OUTILS_COPYLEFT);
 | 
				
			||||||
 | 
					Image_print_version(flag);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					fprintf(stderr, "\nUsage:\n");
 | 
				
			||||||
 | 
					fprintf(stderr, "\ttga_pattern dest.tga width height type [params]\n");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if (flag)
 | 
				
			||||||
 | 
						liste_mots_clefs(mots_clef, 42);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					exit(5);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					/*::------------------------------------------------------------------::*/
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 *	argv[1]		nom du fichier resultat
 | 
				
			||||||
 | 
					 *	argv[2]		largeur
 | 
				
			||||||
 | 
					 *	argv[3]		hauteur
 | 
				
			||||||
 | 
					 *	argv[4]		type du pattern
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					#define FIRST_PARAM  5
 | 
				
			||||||
 | 
					int main(int argc, char *argv[])
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					Image_Desc	*dst;
 | 
				
			||||||
 | 
					int		foo, width, height;
 | 
				
			||||||
 | 
					RGBA		rgba1, rgba2;
 | 
				
			||||||
 | 
					int		commande, nbargs, idx;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					dump_command_line(argc, argv, 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					srand(getpid());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if (argc==1)	usage(0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if (argc==2 && !strcmp("list", argv[1]))
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						usage(1);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					if (argc < 5)	usage(0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					idx = cherche_mot_clef(argv[4], mots_clef, &commande, &nbargs);
 | 
				
			||||||
 | 
					if (idx < 0)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						fprintf(stderr, "mot-clef %s inconnu...\n", argv[4]);
 | 
				
			||||||
 | 
						exit(5);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					#if DEBUG_LEVEL
 | 
				
			||||||
 | 
					fprintf(stderr, "  idx=%d commande=%d nbargs=%d\n", idx, commande, nbargs);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					foo = parse_parametres(argc, argv, mots_clef[idx].ptypes, FIRST_PARAM);
 | 
				
			||||||
 | 
					#if DEBUG_LEVEL
 | 
				
			||||||
 | 
					fprintf(stderr, "  retour parse parameters = %d\n", foo);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* allocation et preparation de l'image */
 | 
				
			||||||
 | 
					width = atoi(argv[2]);
 | 
				
			||||||
 | 
					height = atoi(argv[3]);
 | 
				
			||||||
 | 
					if (width<1 || width>16000 || height<1 || height>16000)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						fprintf(stderr, "%s: hu ho ? invalid dimension\n", argv[0]);
 | 
				
			||||||
 | 
						exit(5);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					dst = Image_alloc(width, height, 3);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 *	calcul de l'image patternelle.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					switch(commande)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						case REPONSE:
 | 
				
			||||||
 | 
							foo = Image_pattern_042(dst, GIP(0));
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						case RGBNOISE:
 | 
				
			||||||
 | 
							foo = Image_rgb_noise_0(dst, GIP(0), GIP(1));
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						case GRAYNOISE:
 | 
				
			||||||
 | 
							foo = Image_gray_noise_0(dst, GIP(0), GIP(1));
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						case TEXTURE_1:
 | 
				
			||||||
 | 
							foo = Image_texture_1(dst, GIP(0), GIP(1));
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						case TEXTURE_2:
 | 
				
			||||||
 | 
							foo = Image_texture_2(dst, GIP(0), GIP(1), GIP(2));
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						case EXPOV_0:
 | 
				
			||||||
 | 
							foo = Image_pattern_100(dst, GIP(0), GIP(1), GIP(2));
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						case PATT_000:
 | 
				
			||||||
 | 
							foo = Image_pattern_000(dst, GIP(0));
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						case PATT_102:
 | 
				
			||||||
 | 
							foo = Image_pattern_102(dst, GIP(0), GIP(1), GIP(2), GIP(3));
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						case GRAYNOISE2:
 | 
				
			||||||
 | 
							foo = Image_gray_noise_2(dst, GIP(0), GIP(1));
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						case RGBNOISE1:
 | 
				
			||||||
 | 
							rgba1.r = GIP(0);	rgba2.r = GIP(1);
 | 
				
			||||||
 | 
							rgba1.g = GIP(2);	rgba2.g = GIP(3);
 | 
				
			||||||
 | 
							rgba1.b = GIP(4);	rgba2.b = GIP(5);
 | 
				
			||||||
 | 
							foo = Image_rgb_noise_1(dst, &rgba1, &rgba2);
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						case RGBNOISE2:
 | 
				
			||||||
 | 
							rgba1.r = GIP(0);	rgba2.r = GIP(1);
 | 
				
			||||||
 | 
							rgba1.g = GIP(2);	rgba2.g = GIP(3);
 | 
				
			||||||
 | 
							rgba1.b = GIP(4);	rgba2.b = GIP(5);
 | 
				
			||||||
 | 
							foo = Image_rgb_noise_2(dst, &rgba1, &rgba2);
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						case CHECK_BW:
 | 
				
			||||||
 | 
							rgba1.r = rgba1.g = rgba1.b = GIP(2);
 | 
				
			||||||
 | 
							rgba2.r = rgba2.g = rgba2.b = GIP(3);
 | 
				
			||||||
 | 
							fprintf(stderr, "CHECK_BW : encore en mise au point...\n");
 | 
				
			||||||
 | 
							foo = Image_pattern_104(dst, GIP(0), GIP(1), &rgba1, &rgba2);
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						default:
 | 
				
			||||||
 | 
							fprintf(stderr, "type #%d not implemented\n", commande);
 | 
				
			||||||
 | 
							exit(5);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if (foo)
 | 
				
			||||||
 | 
						Image_print_error("fabrication pattern", foo);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					foo = Image_TGA_save(argv[1], dst, 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if (foo)
 | 
				
			||||||
 | 
						Image_print_error("sauvegarde pattern", foo);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					return 0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					/*::------------------------------------------------------------------::*/
 | 
				
			||||||
							
								
								
									
										117
									
								
								Tools/tga_remap.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										117
									
								
								Tools/tga_remap.c
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,117 @@
 | 
				
			|||||||
 | 
					/*
 | 
				
			||||||
 | 
					            _                                                 
 | 
				
			||||||
 | 
					           | |_ __ _  __ _     _ __ ___ _ __ ___   __ _ _ __  
 | 
				
			||||||
 | 
					           | __/ _` |/ _` |   | '__/ _ \ '_ ` _ \ / _` | '_ \ 
 | 
				
			||||||
 | 
					           | || (_| | (_| |   | | |  __/ | | | | | (_| | |_) |
 | 
				
			||||||
 | 
					            \__\__, |\__,_|___|_|  \___|_| |_| |_|\__,_| .__/ 
 | 
				
			||||||
 | 
					               |___/     |_____|                       |_|    
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include  <stdio.h>
 | 
				
			||||||
 | 
					#include  <stdlib.h>
 | 
				
			||||||
 | 
					#include  <string.h>
 | 
				
			||||||
 | 
					#include  <time.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include  "tga_outils.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*::------------------------------------------------------------------::*/
 | 
				
			||||||
 | 
					void usage(int flag)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					fprintf(stderr, "* tga_remap v 0.1.21 [%s] %s\n",
 | 
				
			||||||
 | 
									TGA_OUTILS_VERSION, TGA_OUTILS_COPYLEFT);
 | 
				
			||||||
 | 
					fprintf(stderr, "Usage:    tga_remap M <src.tga> <color.map> <dst.tga>\n");
 | 
				
			||||||
 | 
					fprintf(stderr, "          tga_remap -? for more infos...\n");
 | 
				
			||||||
 | 
					if (flag)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						PERL;
 | 
				
			||||||
 | 
						PERR("valid values for 'M'");
 | 
				
			||||||
 | 
						PERR("   0   minimal distance");
 | 
				
			||||||
 | 
						PERR("   1   min of R or G or B dist");
 | 
				
			||||||
 | 
						PERR("   2   ???");
 | 
				
			||||||
 | 
						PERR("   11  minimal dist for R");
 | 
				
			||||||
 | 
						PERR("   12  minimal dist for G");
 | 
				
			||||||
 | 
						PERR("   13  minimal dist for B");
 | 
				
			||||||
 | 
						PERL;
 | 
				
			||||||
 | 
						Image_print_version(2);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					else
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						Image_print_version(0);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					exit(5);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					/*::------------------------------------------------------------------::*/
 | 
				
			||||||
 | 
					int main(int argc, char *argv[])
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					Image_Desc	*src, *dst;
 | 
				
			||||||
 | 
					int		foo, type;
 | 
				
			||||||
 | 
					RGB_map		map;
 | 
				
			||||||
 | 
					long		t_debut, t_fin;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					dump_command_line(argc, argv, 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if (argc==2 && !strcmp(argv[1], "-?"))	usage(1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if (argc != 5) usage(0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if ( (src=Image_TGA_alloc_load(argv[2])) == NULL )
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						fprintf(stderr, "can't load '%s'\n", argv[2]);
 | 
				
			||||||
 | 
						exit(1);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if ( (foo=Image_load_color_Map(argv[3], "map", &map)) )
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						fprintf(stderr, "%s: %s: err %d '%s'\n", argv[0], argv[3], 
 | 
				
			||||||
 | 
										foo, Image_err2str(foo));
 | 
				
			||||||
 | 
						exit(1);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if (must_be_verbose())
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						fprintf(stderr, "Il y a %d couleurs dans la palette '%s'\n",
 | 
				
			||||||
 | 
								map.nbre, argv[3]);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * que faire si le nombre de couleurs dans la palette est pas bon ??? 
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if ( (dst=Image_clone(src, 0))==NULL )
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						fprintf(stderr, "can't clone %p, exiting...\n", src);
 | 
				
			||||||
 | 
						exit(2);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* ---------- determiner le type de remap demande */
 | 
				
			||||||
 | 
					if ( (sscanf(argv[1], "%d", &type)) != 1 )	type = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if DEBUG_LEVEL
 | 
				
			||||||
 | 
					t_debut = time(NULL);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if ( (foo=Image_colors_2_Map(src, dst, &map, type)) )
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						fprintf(stderr, "%s: color->map: erreur %d: %s\n", argv[0],  
 | 
				
			||||||
 | 
										foo, Image_err2str(foo));
 | 
				
			||||||
 | 
						/* Oulala ! c'est pas un peu brutal ? */
 | 
				
			||||||
 | 
						exit(1);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if DEBUG_LEVEL
 | 
				
			||||||
 | 
					t_fin = time(NULL);
 | 
				
			||||||
 | 
					fprintf(stderr, "   remap : %ld secondes\n", t_fin-t_debut);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					foo = Image_TGA_save(argv[4], dst, 0);
 | 
				
			||||||
 | 
					if (foo)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						fprintf(stderr, "%s: TGA_save: err %d %s\n",
 | 
				
			||||||
 | 
								argv[0], foo, Image_err2str(foo));
 | 
				
			||||||
 | 
						exit(1);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					exit (0);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					/*::------------------------------------------------------------------::*/
 | 
				
			||||||
@ -37,14 +37,16 @@ mot_clef mots_clef[] =
 | 
				
			|||||||
{ "pix0",	TV_PIX0,	"iii",	"func not finished"		},
 | 
					{ "pix0",	TV_PIX0,	"iii",	"func not finished"		},
 | 
				
			||||||
{ "pix1",	TV_PIX1,	"iii",	"func not finished"		},
 | 
					{ "pix1",	TV_PIX1,	"iii",	"func not finished"		},
 | 
				
			||||||
{ "triligne",	TV_TRILIGNE,	"f",	"flag : rand or modulo"		},
 | 
					{ "triligne",	TV_TRILIGNE,	"f",	"flag : rand or modulo"		},
 | 
				
			||||||
 | 
					{ "cplus0",	TV_PROTO,	"i",    "premier cplus"			},
 | 
				
			||||||
{ "proto",	TV_PROTO,	"i",	"prototype canal+"		}
 | 
					{ "proto",	TV_PROTO,	"i",	"prototype canal+"		}
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
/*::------------------------------------------------------------------::*/
 | 
					/*::------------------------------------------------------------------::*/
 | 
				
			||||||
void usage(int flag)
 | 
					void usage(int flag)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
fprintf(stderr, "* tga_television v 0.0.23 [%s] %s\n",
 | 
					fprintf(stderr, "* tga_television v 0.0.24 [%s] %s\n",
 | 
				
			||||||
				TGA_OUTILS_VERSION, TGA_OUTILS_COPYLEFT);
 | 
									TGA_OUTILS_VERSION, TGA_OUTILS_COPYLEFT);
 | 
				
			||||||
fprintf(stderr, "Usage: tga_television <src.tga> method <dst.tga> [params]\n");
 | 
					fprintf(stderr, "  compiled %s at %s\n", __DATE__, __TIME__);
 | 
				
			||||||
 | 
					fprintf(stderr, "Usage:\n\ttga_television <src.tga> method <dst.tga> [params]\n");
 | 
				
			||||||
Image_print_version(0);
 | 
					Image_print_version(0);
 | 
				
			||||||
liste_mots_clefs(mots_clef, 42);
 | 
					liste_mots_clefs(mots_clef, 42);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										30
									
								
								bmp.h
									
									
									
									
									
								
							
							
						
						
									
										30
									
								
								bmp.h
									
									
									
									
									
								
							@ -1,30 +0,0 @@
 | 
				
			|||||||
/*
 | 
					 | 
				
			||||||
 *		header file for BMP functions
 | 
					 | 
				
			||||||
 *		-----------------------------
 | 
					 | 
				
			||||||
 *	'tthimage.h' must be included before this file.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#pragma pack(1)		/* est-ce encore utile ? */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
typedef struct
 | 
					 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
	char		id[2];
 | 
					 | 
				
			||||||
	long		filesize;
 | 
					 | 
				
			||||||
	uint16_t		reserved[2];
 | 
					 | 
				
			||||||
	long		headerSize;
 | 
					 | 
				
			||||||
	long		infoSize;
 | 
					 | 
				
			||||||
	long		width;
 | 
					 | 
				
			||||||
	long		height;
 | 
					 | 
				
			||||||
	short		planes;
 | 
					 | 
				
			||||||
	short		bits;
 | 
					 | 
				
			||||||
	long		compression;
 | 
					 | 
				
			||||||
	long		SizeImage;
 | 
					 | 
				
			||||||
	long		xpixpermeter;
 | 
					 | 
				
			||||||
	long		ypixpermeter;
 | 
					 | 
				
			||||||
	long		clrused;
 | 
					 | 
				
			||||||
	long		clrimportant;
 | 
					 | 
				
			||||||
	} BMPHEAD;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#pragma pack()
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
							
								
								
									
										8
									
								
								build.sh
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								build.sh
									
									
									
									
									
								
							@ -2,5 +2,11 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cd Lib
 | 
					cd Lib
 | 
				
			||||||
make foo
 | 
					echo "========== in $PWD"
 | 
				
			||||||
 | 
					make testtga
 | 
				
			||||||
 | 
					cd ..
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					cd Tools
 | 
				
			||||||
 | 
					echo "========== in $PWD"
 | 
				
			||||||
 | 
					make 
 | 
				
			||||||
cd ..
 | 
					cd ..
 | 
				
			||||||
 | 
				
			|||||||
@ -4,7 +4,7 @@
 | 
				
			|||||||
	http:///la.buvette.org/devel/libimage/
 | 
						http:///la.buvette.org/devel/libimage/
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
#ifndef IMAGE_VERSION_STRING
 | 
					#ifndef IMAGE_VERSION_STRING
 | 
				
			||||||
	#define IMAGE_VERSION_STRING "0.4.47"
 | 
						#define IMAGE_VERSION_STRING "0.4.49"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*::------------------------------------------------------------------::*/
 | 
					/*::------------------------------------------------------------------::*/
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user