Compare commits
No commits in common. "10dc0d2204efe2f5c40265b000c3e7cbaf1595f3" and "81611a34918a1c154ddc6955f9b78f4df62f0cc0" have entirely different histories.
10dc0d2204
...
81611a3491
2
.gitignore
vendored
2
.gitignore
vendored
@ -5,13 +5,11 @@ libtthimage.a
|
||||
|
||||
Lib/foo
|
||||
Lib/testtga
|
||||
Lib/t_png
|
||||
Lib/t_t16x24
|
||||
Lib/testbmp
|
||||
|
||||
Tools/genplot2
|
||||
|
||||
Tools/tga_alpha
|
||||
Tools/tga_cadre
|
||||
Tools/tga_combine
|
||||
Tools/tga_dither
|
||||
|
10
Lib/Makefile
10
Lib/Makefile
@ -14,9 +14,6 @@ all: foo testtga
|
||||
|
||||
7seg.o: 7seg.c $(DEPS)
|
||||
|
||||
alpha.o: alpha.c $(DEPS)
|
||||
alpha2.o: alpha2.c $(DEPS)
|
||||
|
||||
basic_io.o: basic_io.c $(DEPS)
|
||||
bitblt.o: bitblt.c $(DEPS)
|
||||
bmp.o: bmp.c $(DEPS) bmp.h
|
||||
@ -93,7 +90,6 @@ pht.o: pht.c $(DEPS)
|
||||
pixeliz.o: pixeliz.c $(DEPS)
|
||||
pixels.o: pixels.c $(DEPS)
|
||||
plotteur.o: plotteur.c $(DEPS)
|
||||
png.o: png.c $(DEPS)
|
||||
pnm.o: pnm.c $(DEPS)
|
||||
pov_hf15a.o: pov_hf15a.c $(DEPS)
|
||||
pov_hf15b.o: pov_hf15b.c $(DEPS)
|
||||
@ -132,7 +128,6 @@ zoom.o: zoom.c $(DEPS)
|
||||
#-----------------------------------------------------------------
|
||||
|
||||
OBJECTS = 7seg.o \
|
||||
alpha.o alpha2.o \
|
||||
basic_io.o bitblt.o bmp.o \
|
||||
cadres2.o cadres3.o cadres4.o cadres84.o cadresbox.o \
|
||||
cadres.o \
|
||||
@ -156,7 +151,7 @@ OBJECTS = 7seg.o \
|
||||
palettes.o \
|
||||
patterns.o patterns2.o patterns3.o patterns4.o \
|
||||
photomaton.o pht.o pixeliz.o pixels.o plotteur.o \
|
||||
pnm.o png.o \
|
||||
pnm.o \
|
||||
pov_hf15a.o pov_hf15b.o pov_hf15c.o pov_hf15d.o \
|
||||
pov_hf15e.o pov_hf15e.o pov_hf15f.o pov_synth.o \
|
||||
ptlist.o \
|
||||
@ -181,9 +176,6 @@ foo: foo.c $(DEPS) ../libtthimage.a
|
||||
t_t16x24: t_t16x24.c $(DEPS) ../libtthimage.a
|
||||
gcc $(CFLAGS) $< ../libtthimage.a -o $@
|
||||
|
||||
t_png: t_png.c $(DEPS) ../libtthimage.a
|
||||
gcc $(CFLAGS) $< ../libtthimage.a -lpng -lz -o $@
|
||||
|
||||
testbmp: testbmp.c $(DEPS) ../libtthimage.a
|
||||
gcc $(CFLAGS) $< ../libtthimage.a -lm -o $@
|
||||
|
||||
|
296
Lib/alpha.c
296
Lib/alpha.c
@ -1,296 +0,0 @@
|
||||
/*
|
||||
alpha.c
|
||||
-------
|
||||
Various transparency operations, aka "alpha channel ops"
|
||||
|
||||
--------------------------------------
|
||||
Et c,a va me forcer a installer libpng
|
||||
--------------------------------------
|
||||
15May01: on attend toujours libPNG
|
||||
07Dec01: pfeue, libPNG toujours pas là...
|
||||
03Fev14: ... please wait more ...
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include "../tthimage.h"
|
||||
|
||||
/*::------------------------------------------------------------------::*/
|
||||
int
|
||||
Image_RGBA_over_RGB(Image_Desc *rgba, Image_Desc *src, Image_Desc *dst)
|
||||
{
|
||||
int x, y;
|
||||
int rs, gs, bs, rm, gm, bm, am, r, g, b;
|
||||
int foo;
|
||||
|
||||
if (rgba->type != IMAGE_RGBA)
|
||||
{
|
||||
fprintf(stderr, "RGBA over RGB: image is not RGBA (%d)\n", rgba->type);
|
||||
return IMAGE_BAD_TYPE;
|
||||
}
|
||||
if ( (foo=Image_compare_desc(rgba, src)) )
|
||||
{
|
||||
fprintf(stderr, "RGBA over RGB: err on sources: %s\n",
|
||||
Image_err2str(foo));
|
||||
return foo;
|
||||
}
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, "RGBA/RGB types: %d %d %d\n", rgba->type, src->type, dst->type);
|
||||
#endif
|
||||
|
||||
for (y=0; y<src->height; y++)
|
||||
{
|
||||
for (x=0; x<src->width; x++)
|
||||
{
|
||||
rs = (src->Rpix[y])[x];
|
||||
gs = (src->Gpix[y])[x];
|
||||
bs = (src->Bpix[y])[x];
|
||||
Image_getRGBA(rgba, x, y, &rm, &gm, &bm, &am);
|
||||
|
||||
r = ((rs*(255-am)) + (rm*am)) / 256;
|
||||
g = ((gs*(255-am)) + (gm*am)) / 256;
|
||||
b = ((bs*(255-am)) + (bm*am)) / 256;
|
||||
|
||||
Image_plotRGB(dst, x, y, r, g, b);
|
||||
}
|
||||
}
|
||||
|
||||
return FUNC_IS_BETA;
|
||||
}
|
||||
/*::------------------------------------------------------------------::*/
|
||||
/*
|
||||
* this function do some dirty things with the internals
|
||||
* of the library. And you got here a 'secret' prototype.
|
||||
*/
|
||||
int Image_alloc_pixels(unsigned char ***pix, int w, int h);
|
||||
/*
|
||||
* Ahem. You, if you use this prototype, you are going
|
||||
* to be a big laM3r. Don't do it. You have be warned.
|
||||
*/
|
||||
int
|
||||
Image_add_alpha_channel(Image_Desc *img, int value)
|
||||
{
|
||||
uint8_t **tmp_ptr;
|
||||
int foo;
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, "Add Alpha Channel v=%d to Img %p\n", value, img);
|
||||
#endif
|
||||
|
||||
if (img == NULL)
|
||||
{
|
||||
fprintf(stderr, "Add Alpha Channel: ZarWa, 'img' is NULL\n");
|
||||
return NULL_DESCRIPTOR;
|
||||
}
|
||||
|
||||
if (img->Apix != NULL)
|
||||
{
|
||||
fprintf(stderr, "Image %p already has an alpha channel\n", img);
|
||||
return VERY_STRANGE;
|
||||
}
|
||||
|
||||
if (img->type != IMAGE_RGB)
|
||||
{
|
||||
fprintf(stderr, "Image %p is not RGB.\n", img);
|
||||
return VERY_STRANGE;
|
||||
}
|
||||
|
||||
foo = Image_alloc_pixels(&tmp_ptr, img->width, img->height);
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, "creation channel alpha foo=%d ptr=%p\n", foo, tmp_ptr);
|
||||
#endif
|
||||
|
||||
/* Yo, le plan memoire est disponible, on y poke la 'value' */
|
||||
for (foo=0; foo<img->height; foo++) {
|
||||
memset(tmp_ptr[foo], value, img->width);
|
||||
}
|
||||
|
||||
/* and now, we update the image descriptor */
|
||||
img->type = IMAGE_RGBA;
|
||||
img->nb_planes = 4;
|
||||
img->Apix = tmp_ptr;
|
||||
img->modified = 1;
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
Image_dump_descriptor(img, "apres creation canal Alpha");
|
||||
#endif
|
||||
|
||||
return OLL_KORRECT;
|
||||
}
|
||||
/*::------------------------------------------------------------------::*/
|
||||
int
|
||||
Image_kill_alpha_channel(Image_Desc *img)
|
||||
{
|
||||
int line;
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
Image_dump_descriptor(img, "Killing Alpha Channel");
|
||||
#endif
|
||||
|
||||
if (img->type != IMAGE_RGBA) {
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, "Kill Alpha Channel: bad type %d\n", img->type);
|
||||
#endif
|
||||
return VERY_STRANGE;
|
||||
}
|
||||
|
||||
if (img->nb_planes != 4) {
|
||||
fprintf(stderr, "Kill Alpha Channel: bad planes number %d\n",
|
||||
img->nb_planes);
|
||||
return VERY_STRANGE;
|
||||
}
|
||||
|
||||
if (img->Apix == NULL) {
|
||||
fprintf(stderr, "Kill Alpha Channel: _no_ alpha channel in %p\n", img);
|
||||
return NO_ALPHA_CHANNEL;
|
||||
}
|
||||
|
||||
for (line=0; line<img->height; line++)
|
||||
if (img->Apix[line] != NULL) free(img->Apix[line]);
|
||||
|
||||
free(img->Apix); img->Apix = NULL;
|
||||
img->nb_planes = 3;
|
||||
img->type = IMAGE_RGB;
|
||||
img->modified = 1;
|
||||
|
||||
return OLL_KORRECT;
|
||||
}
|
||||
/*::------------------------------------------------------------------::*/
|
||||
int
|
||||
Image_map_alpha_on_img(Image_Desc *img)
|
||||
{
|
||||
register int pix;
|
||||
int x, y;
|
||||
|
||||
if (img->Apix == NULL)
|
||||
{
|
||||
fprintf(stderr, "%s : %p have no alpha channel.\n", __func__, img);
|
||||
return FULL_NUCKED;
|
||||
}
|
||||
|
||||
if (img->type != IMAGE_RGBA)
|
||||
{
|
||||
fprintf(stderr, "%s : %p is not an RGBA image.\n", __func__, img);
|
||||
return FULL_NUCKED;
|
||||
}
|
||||
|
||||
for (y=0; y<img->height; y++)
|
||||
{
|
||||
for (x=0; x<img->width; x++)
|
||||
{
|
||||
pix = (img->Rpix[y])[x] * (img->Apix[y])[x];
|
||||
(img->Rpix[y])[x] = pix / 256;
|
||||
|
||||
pix = (img->Gpix[y])[x] * (img->Apix[y])[x];
|
||||
(img->Gpix[y])[x] = pix / 256;
|
||||
|
||||
pix = (img->Bpix[y])[x] * (img->Apix[y])[x];
|
||||
(img->Bpix[y])[x] = pix / 256;
|
||||
}
|
||||
}
|
||||
|
||||
return OLL_KORRECT;
|
||||
}
|
||||
/*::------------------------------------------------------------------::*/
|
||||
/*
|
||||
* given two levels by RGB component, this func build an alpha
|
||||
* binary mask where pixels in the 3 RGB intervals have the v1
|
||||
* alpha value, and all others have the v2 alpha value.
|
||||
*/
|
||||
int
|
||||
Image_alpha_op_0(Image_Desc *src, Image_Desc *dst, int v1, int v2,
|
||||
int rb, int rt, int gb, int gt, int bb, int bt,
|
||||
int param)
|
||||
{
|
||||
int x, y, foo, r, g, b;
|
||||
int c1, c2;
|
||||
|
||||
/*
|
||||
XXX NO SAFETY CONTROLS ?
|
||||
*/
|
||||
if (dst->Apix == NULL)
|
||||
{
|
||||
fprintf(stderr, "Alpha op 0: dst %p have no alpha channel.\n", dst);
|
||||
return FULL_NUCKED;
|
||||
}
|
||||
if (0 != param)
|
||||
{
|
||||
fprintf(stderr, "%s: parameter must be 0\n", __func__);
|
||||
}
|
||||
|
||||
c1 = c2 = 0;
|
||||
for (y=0; y<src->height; y++)
|
||||
{
|
||||
for (x=0; x<src->width; x++)
|
||||
{
|
||||
foo = Image_getRGB(src, x, y, &r, &g, &b);
|
||||
|
||||
if ( (r > rb && r < rt) ||
|
||||
(g > gb && g < gt) ||
|
||||
(b > bb && b < bt) )
|
||||
{
|
||||
dst->Apix[y][x] = v1;
|
||||
c1++;
|
||||
}
|
||||
else
|
||||
{
|
||||
dst->Apix[y][x] = v2;
|
||||
c2++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, "Alpha op 0: c1=%d c2=%d\n", c1, c2);
|
||||
#endif
|
||||
|
||||
return FUNC_IS_BETA;
|
||||
}
|
||||
/*::------------------------------------------------------------------::*/
|
||||
/*
|
||||
* New: 16 Oct 2001.
|
||||
*/
|
||||
int Image_copy_component_to_alpha(Image_Desc *img, char component)
|
||||
{
|
||||
int x, y;
|
||||
|
||||
if (img->type != IMAGE_RGBA)
|
||||
{
|
||||
fprintf(stderr, "Alpha copy comp: %p is not an RGBA image.\n", img);
|
||||
return NO_ALPHA_CHANNEL;
|
||||
}
|
||||
|
||||
if (img->Apix == NULL)
|
||||
{
|
||||
fprintf(stderr, "Alpha copy comp: %p have no alpha channel.\n", img);
|
||||
return NO_ALPHA_CHANNEL;
|
||||
}
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, "moving component '%c' to alpha channel of %p\n",
|
||||
component, img);
|
||||
#endif
|
||||
|
||||
for (y=0; y<img->height; y++) {
|
||||
for (x=0; x<img->width; x++) {
|
||||
switch (component)
|
||||
{
|
||||
case 'r': case 'R':
|
||||
img->Apix[y][x] = img->Rpix[y][x]; break;
|
||||
case 'g': case 'G':
|
||||
img->Apix[y][x] = img->Gpix[y][x]; break;
|
||||
case 'b': case 'B':
|
||||
img->Apix[y][x] = img->Bpix[y][x]; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return FUNC_IS_ALPHA;
|
||||
}
|
||||
/*::------------------------------------------------------------------::*/
|
||||
/*
|
||||
* bon, et maintenant, qu'est-ce qu'on invente ?
|
||||
* ben 'alpha2.c' !
|
||||
*/
|
||||
/*::------------------------------------------------------------------::*/
|
129
Lib/alpha2.c
129
Lib/alpha2.c
@ -1,129 +0,0 @@
|
||||
/*
|
||||
alpha2.c
|
||||
--------
|
||||
Various transparency operations, aka "alpha channel ops"
|
||||
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "tthimage.h"
|
||||
|
||||
/*::------------------------------------------------------------------::*/
|
||||
int Image_alpha_setvalue(Image_Desc *dst, int v_alpha)
|
||||
{
|
||||
int y;
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, "%s : %d -> %p\n", __func__, v_alpha, dst);
|
||||
#endif
|
||||
|
||||
if (dst->type != IMAGE_RGBA)
|
||||
{
|
||||
fprintf(stderr, "%s : picz %p haz no alpha\n", __func__, dst);
|
||||
#if MUST_ABORT
|
||||
abort();
|
||||
#endif
|
||||
return NO_ALPHA_CHANNEL;
|
||||
}
|
||||
|
||||
for (y=0; y<dst->height; y++)
|
||||
{
|
||||
memset(dst->Apix[y], v_alpha, dst->width);
|
||||
}
|
||||
dst->modified = 1;
|
||||
return OLL_KORRECT;
|
||||
}
|
||||
/*::------------------------------------------------------------------::*/
|
||||
/*
|
||||
* values of r,g,b pixels are scaled by alpha value.
|
||||
*/
|
||||
int
|
||||
Image_alpha_reduce(Image_Desc *src, Image_Desc *dst, int yo)
|
||||
{
|
||||
int foo, x, y;
|
||||
int r, g, b, a;
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, "Image: alpha reduce: %p -> %p (yo=%d)\n", src, dst, yo);
|
||||
#endif
|
||||
|
||||
if (src->type != IMAGE_RGBA)
|
||||
{
|
||||
fprintf(stderr, "Image: alpha reduce: %p is not RGBA", src);
|
||||
return NO_ALPHA_CHANNEL;
|
||||
}
|
||||
|
||||
if ( (foo=Image_compare_desc(src, dst)) )
|
||||
{
|
||||
fprintf(stderr, "Image: alpha reduce: images are differents %d\n", foo);
|
||||
return foo;
|
||||
}
|
||||
|
||||
for (y=0; y<src->height; y++)
|
||||
{
|
||||
for (x=0; x<src->width; x++)
|
||||
{
|
||||
Image_getRGBA(src, x, y, &r, &g, &b, &a);
|
||||
r = (r * a) / 256;
|
||||
g = (g * a) / 256;
|
||||
b = (b * a) / 256;
|
||||
Image_plotRGB(dst, x, y, r, g, b);
|
||||
}
|
||||
}
|
||||
|
||||
dst->modified = 1;
|
||||
|
||||
return FUNC_IS_BETA;
|
||||
}
|
||||
/*::------------------------------------------------------------------::*/
|
||||
/*
|
||||
* this fonction need more explanations :(
|
||||
*/
|
||||
int
|
||||
Image_poke_alpha_from_rgb(Image_Desc *src, Image_Desc *dst,
|
||||
int fr, int fg, int fb, int flag)
|
||||
{
|
||||
int foo, x, y, r, g, b, a0, a1, a;
|
||||
|
||||
a = 0; /* warning shutdown */
|
||||
|
||||
if ( (foo=Image_compare_desc(src, dst)) )
|
||||
{
|
||||
fprintf(stderr, "Poke alpha from rgb: images are differents %d\n", foo);
|
||||
return foo;
|
||||
}
|
||||
|
||||
if ( dst->Apix == NULL )
|
||||
{
|
||||
fprintf(stderr, "poke alpha from rgb: dest image have NO alpha channel\n");
|
||||
return NO_ALPHA_CHANNEL;
|
||||
}
|
||||
|
||||
a0 = flag ? 0 : 255;
|
||||
a1 = flag ? 255 : 0;
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, "For rgb = %d,%d,%d alpha wil be %d\n", fr, fg, fb, a);
|
||||
#endif
|
||||
|
||||
for (y=0; y<src->height; y++)
|
||||
{
|
||||
for (x=0; x<src->width; x++)
|
||||
{
|
||||
Image_getRGB(src, x, y, &r, &g, &b);
|
||||
|
||||
if (r==fr && g==fg && b==fb) a = a0;
|
||||
else a = a1;
|
||||
|
||||
Image_plotRGBA(dst, x, y, r, g, b, a);
|
||||
}
|
||||
}
|
||||
|
||||
dst->modified = 1;
|
||||
|
||||
return FUNC_NOT_FINISH;
|
||||
}
|
||||
/*::------------------------------------------------------------------::*/
|
||||
|
@ -120,8 +120,6 @@ int x, y;
|
||||
fprintf(stderr, "%s ( %p %p %d )\n", __func__, src, dst, factor);
|
||||
#endif
|
||||
|
||||
fprintf(stderr, "luminance factor: %d %f\n", factor, (float)factor / 256.0);
|
||||
|
||||
if ( (foo=Image_compare_desc(src, dst)) ) {
|
||||
fprintf(stderr, "Image Luminance: images are differents %d\n", foo);
|
||||
return foo;
|
||||
|
36
Lib/png.c
36
Lib/png.c
@ -2,45 +2,23 @@
|
||||
|
||||
PNG aka "portable network graphics"s.
|
||||
|
||||
|
||||
Un vrai merdier, en fait :(
|
||||
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <png.h>
|
||||
#include <zlib.h>
|
||||
|
||||
#undef DEBUG_LEVEL
|
||||
#define DEBUG_LEVEL 1
|
||||
#include "tthimage.h"
|
||||
|
||||
#include "../tthimage.h"
|
||||
|
||||
/*
|
||||
* les infos et le code ici viennent de
|
||||
* http://www.libpng.org/pub/png/pngbook.html
|
||||
*/
|
||||
|
||||
|
||||
/* static mainprog_info wpng_info; */
|
||||
|
||||
|
||||
|
||||
/*::------------------------------------------------------------------::*/
|
||||
static void writepng_version_info(void)
|
||||
{
|
||||
fprintf(stderr, " Compiled with libpng %s; using libpng %s.\n",
|
||||
PNG_LIBPNG_VER_STRING, png_libpng_ver);
|
||||
fprintf(stderr, " Compiled with zlib %s; using zlib %s.\n",
|
||||
ZLIB_VERSION, zlib_version);
|
||||
}
|
||||
/*::------------------------------------------------------------------::*/
|
||||
Image_Desc * Image_PNG_alloc_load(char *fname, int k)
|
||||
{
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, "%s ( '%s' %d )\n", __func__, fname, k);
|
||||
writepng_version_info();
|
||||
#endif
|
||||
|
||||
return 666;
|
||||
}
|
||||
@ -48,12 +26,12 @@ return 666;
|
||||
int Image_save_as_PNG(Image_Desc *img, char *fname, int p1, int p2)
|
||||
{
|
||||
FILE *fp;
|
||||
int x, y, foo;
|
||||
int x, y;
|
||||
png_uint_32 pngv;
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, "%s ( %p '%s' %d %d )\n", __func__, img, fname, p1, p2);
|
||||
writepng_version_info();
|
||||
fprintf(stderr, " png version -> %d\n", png_access_version_number());
|
||||
#endif
|
||||
|
||||
return FULL_NUCKED;
|
||||
|
39
Lib/t_png.c
39
Lib/t_png.c
@ -1,39 +0,0 @@
|
||||
/*
|
||||
* test des fonctionsPNG
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "../tthimage.h"
|
||||
|
||||
|
||||
/*::------------------------------------------------------------------::*/
|
||||
/*::------------------------------------------------------------------::*/
|
||||
/*::------------------------------------------------------------------::*/
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
Image_Desc *img;
|
||||
int foo;
|
||||
char *fname = "foo.png";
|
||||
|
||||
Image_print_version(0);
|
||||
|
||||
writepng_version_info();
|
||||
|
||||
if (2==argc) {
|
||||
fname = argv[1];
|
||||
}
|
||||
|
||||
img = Image_alloc(640, 480, IMAGE_RGB);
|
||||
|
||||
foo = Image_save_as_PNG(img, fname, 0, 0);
|
||||
if (foo) {
|
||||
fprintf(stderr, "save as '%s' -> %d\n", fname, foo);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
/*::------------------------------------------------------------------::*/
|
||||
|
@ -10,7 +10,7 @@ DEPS = ../tthimage.h Makefile tga_outils.h ../libtthimage.a
|
||||
|
||||
all: genplot2 \
|
||||
tga_cadre tga_effects tga_filtres tga_remap tga_tools \
|
||||
tga_combine tga_export tga_alpha \
|
||||
tga_combine tga_export \
|
||||
tga_television tga_dither tga_applymap tga_makehf15 \
|
||||
tga_mires tga_incrust tga_pattern tga_equalize
|
||||
|
||||
@ -28,9 +28,6 @@ genplot2: genplot2.c $(DEPS) fonctions.o
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
|
||||
tga_alpha: tga_alpha.c $(DEPS) fonctions.o
|
||||
gcc $(CFLAGS) $< ../libtthimage.a fonctions.o -lm -o $@
|
||||
|
||||
tga_applymap: tga_applymap.c $(DEPS) fonctions.o
|
||||
gcc $(CFLAGS) $< ../libtthimage.a fonctions.o -lm -o $@
|
||||
|
||||
|
@ -26,10 +26,7 @@ La colonne du milieu undique le type des paramètres :
|
||||
- `s` pour une chaine, ex: un nom de fichier
|
||||
- `f` pour un flag : 0, F, 1, T
|
||||
|
||||
## tga_alpha
|
||||
|
||||
Manipulation du canal alpha (la transparence), lequel canal
|
||||
est globalement mal géré par l'ensemble de libtthimage.
|
||||
|
||||
## tga_applymap
|
||||
|
||||
@ -58,8 +55,6 @@ Attendu avec impatience, il aura le support complet des PNG.
|
||||
|
||||
## tga_mires
|
||||
|
||||
La génération de diverses image de test ou de calibration.
|
||||
|
||||
## tga_pattern
|
||||
|
||||
## tga_remap
|
||||
|
@ -1,133 +0,0 @@
|
||||
/*
|
||||
=I =I
|
||||
=I=I=I =I =I=I=I =I=I=I =I=I=I =I=I =I=I=I =I=I=I
|
||||
=I =I =I =I =I =I =I =I =I =I =I =I =I =I=I
|
||||
=I =I =I =I =I =I =I =I =I =I =I =I =I =I=I
|
||||
=I=I=I =I =I=I=I =I =I =I=I=I =I=I =I=I=I =I=I=I
|
||||
=I =I
|
||||
=I =I
|
||||
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "tga_outils.h"
|
||||
|
||||
/*::------------------------------------------------------------------::*/
|
||||
|
||||
#define ALPHA_ADD 1
|
||||
#define ALPHA_REDUCE 2
|
||||
#define ALPHA_KILL 3
|
||||
#define ALPHA_SETV 4
|
||||
|
||||
mot_clef mots_clef[] =
|
||||
{
|
||||
{ "add", ALPHA_ADD, "i", "value of alpha channel" },
|
||||
{ "reduce", ALPHA_REDUCE, "i", "param = ?, put zero..." },
|
||||
{ "kill", ALPHA_KILL, "", "kill the alpha channel" },
|
||||
{ "setv", ALPHA_SETV, "i", "set alpha channel to param" },
|
||||
{ NULL, 0, NULL, NULL }
|
||||
};
|
||||
|
||||
/*::------------------------------------------------------------------::*/
|
||||
void usage(int flag)
|
||||
{
|
||||
fprintf(stderr, "* tga_alpha v 0.0.10 [%s] %s\n",
|
||||
TGA_OUTILS_VERSION, TGA_OUTILS_COPYLEFT);
|
||||
Image_print_version(0);
|
||||
|
||||
fprintf(stderr, "Usage:\n tga_alpha src op dst\n");
|
||||
|
||||
if (flag)
|
||||
{
|
||||
liste_mots_clefs(mots_clef, 0);
|
||||
}
|
||||
|
||||
exit(5);
|
||||
}
|
||||
/*::------------------------------------------------------------------::*/
|
||||
/*
|
||||
* argv[1] = source image
|
||||
* argv[2] = operation
|
||||
* argv[3] = destination image
|
||||
*/
|
||||
#define FIRST_PARAM 4
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
Image_Desc *src, *dst;
|
||||
int foo;
|
||||
RGB_map map;
|
||||
int idx, commande, nbargs;
|
||||
|
||||
dump_command_line(argc, argv, 0);
|
||||
|
||||
if (argc<3) usage(1);
|
||||
|
||||
/* search operation keyword in table */
|
||||
idx = cherche_mot_clef(argv[2], mots_clef, &commande, &nbargs);
|
||||
if (idx < 0)
|
||||
{
|
||||
fprintf(stderr, "tga_filtres: mot-clef %s inconnu...\n", argv[2]);
|
||||
exit (5);
|
||||
}
|
||||
|
||||
foo = parse_parametres(argc, argv, mots_clef[idx].ptypes, FIRST_PARAM);
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, "tga_alpha: parse params : %d\n", foo);
|
||||
#endif
|
||||
|
||||
if ( (src=Image_TGA_alloc_load(argv[1])) == NULL )
|
||||
{
|
||||
fprintf(stderr, "tga_alpha: can't load '%s'\n", argv[1]);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if ( (dst=Image_clone(src, 0)) == NULL )
|
||||
{
|
||||
fprintf(stderr, "tga_alpha: can't clone %p\n", src);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
switch (commande)
|
||||
{
|
||||
case ALPHA_ADD:
|
||||
Image_copy(src, dst);
|
||||
foo = GIP(0);
|
||||
fprintf(stderr, "valeur canal alpha %d\n", foo);
|
||||
Image_add_alpha_channel(dst, foo);
|
||||
break;
|
||||
|
||||
case ALPHA_REDUCE:
|
||||
fprintf(stderr, "'%s' not implemented.\n", argv[2]);
|
||||
exit(1);
|
||||
break;
|
||||
|
||||
case ALPHA_KILL:
|
||||
Image_copy(src, dst);
|
||||
fprintf(stderr, "jette le canal alpha\n");
|
||||
Image_kill_alpha_channel(dst);
|
||||
break;
|
||||
|
||||
case ALPHA_SETV:
|
||||
Image_copy(src, dst);
|
||||
foo = Image_alpha_setvalue(dst, GIP(0));
|
||||
break;
|
||||
|
||||
default:
|
||||
fprintf(stderr, "FUNCTION NOT IMPLEMENTED\n");
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
if (foo)
|
||||
{
|
||||
fprintf(stderr, "alpha op -> %d\n", foo);
|
||||
}
|
||||
|
||||
foo = Image_TGA_save(argv[3], dst, 0);
|
||||
|
||||
return 1;
|
||||
}
|
||||
/*::------------------------------------------------------------------::*/
|
@ -331,9 +331,7 @@ switch (commande)
|
||||
fprintf(stderr, " -> %d\n", foo);
|
||||
break;
|
||||
case EFF_RECURSE:
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, "RECURSE EXPERIMENTAL !\n");
|
||||
#endif
|
||||
foo = Image_call_recursion_0(src, dst, GIP(0));
|
||||
break;
|
||||
case EFF_RGBMSKH:
|
||||
|
@ -19,26 +19,23 @@
|
||||
#define EQ_SQUARE 16
|
||||
#define EQ_SQROOT 17
|
||||
#define EQ_GAMMA 20
|
||||
#define EQ_MULT 21
|
||||
|
||||
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" },*/
|
||||
{ "lumin", EQ_LUMIN, "i", "param : ident is 256" },
|
||||
{ "gamma", EQ_GAMMA, "d", "not implemented" },
|
||||
{ "square", EQ_SQUARE, "", "pix**2" },
|
||||
{ "sqroot", EQ_SQROOT, "", "sqr(pix)" },
|
||||
{ "mult", EQ_MULT, "d", "multiply by const" },
|
||||
{ NULL, 0, NULL, NULL }
|
||||
};
|
||||
|
||||
/*::------------------------------------------------------------------::*/
|
||||
void usage()
|
||||
{
|
||||
fprintf(stderr, "* tga_equalize v 0.0.21 [%s] (dwtfywl) tonton Th\n",
|
||||
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");
|
||||
@ -111,11 +108,6 @@ switch (commande)
|
||||
foo = FULL_NUCKED;
|
||||
break;
|
||||
|
||||
case EQ_MULT:
|
||||
foo = PASTIS;
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
foo=-1;
|
||||
break;
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
#include "../tthimage.h"
|
||||
|
||||
#define TGA_OUTILS_VERSION "0.60"
|
||||
#define TGA_OUTILS_VERSION "0.59"
|
||||
/*
|
||||
* 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)
|
||||
|
@ -48,7 +48,7 @@ fprintf(stderr, "* tga_television v 0.0.24 [%s] %s\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);
|
||||
if (flag) { liste_mots_clefs(mots_clef, 42); }
|
||||
liste_mots_clefs(mots_clef, 42);
|
||||
|
||||
exit(5);
|
||||
}
|
||||
@ -70,7 +70,7 @@ srand(getpid());
|
||||
|
||||
if ( (src=Image_TGA_alloc_load(argv[1])) == NULL )
|
||||
{
|
||||
fprintf(stderr, "can't load image file '%s'\n", argv[1]);
|
||||
fprintf(stderr, "can't load '%s'\n", argv[1]);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,7 @@ install -m 0644 tthimage.h $DESTDIR/include/tthimage.h
|
||||
|
||||
liste="genplot2 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_alpha"
|
||||
tga_mires tga_incrust tga_pattern tga_equalize"
|
||||
|
||||
for binaire in $liste
|
||||
do
|
||||
|
@ -4,7 +4,7 @@
|
||||
http:///la.buvette.org/devel/libimage/
|
||||
*/
|
||||
#ifndef IMAGE_VERSION_STRING
|
||||
#define IMAGE_VERSION_STRING "0.4.51 pl 8"
|
||||
#define IMAGE_VERSION_STRING "0.4.50"
|
||||
|
||||
/*::------------------------------------------------------------------::*/
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user