Compare commits

..

No commits in common. "35e5947fdba889d2b6dcb0634c80967d8ddb0eb8" and "d5d9aa8c433c99feb0080f05df109e19d4d72fe3" have entirely different histories.

10 changed files with 25 additions and 217 deletions

View File

@ -198,31 +198,6 @@
..************..
..************..
................
55
................
..************..
..************..
................
.............**.
.............**.
.............**.
.............**.
.............**.
.............**.
................
................
................
................
.............**.
.............**.
.............**.
.............**.
.............**.
.............**.
................
................
................
................
56
................
..************..
@ -248,31 +223,6 @@
..************..
..************..
................
57
................
..************..
..************..
................
.**..........**.
.**..........**.
.**..........**.
.**..........**.
.**..........**.
.**..........**.
................
..************..
..************..
................
.............**.
.............**.
.............**.
.............**.
.............**.
.............**.
................
..************..
..************..
................
60
................
................

View File

@ -34,7 +34,3 @@ RANLIB=wc -c
# modify it 'as you like'
AR=ar
#
# and valgrind is your friend
#

5
Tests/.gitignore vendored
View File

@ -1,5 +0,0 @@
a.scratch
*.tga

View File

@ -1,15 +0,0 @@
#!/bin/bash
echo "------------------------------------------"
echo "GO" | ./mk_dessin.awk > a.scratch
wc a.scratch
echo "------------------------------------------"
../Tools/genplot2 -s 640x480
errcode=$?
echo "code retour genplot2 = " $errcode
echo "------------------------------------------"
echo "------------------------------------------"

View File

@ -1,27 +0,0 @@
#!/usr/bin/awk -f
# ce joli programme fabrique un fichier de donnees qui sera
# utile au bon deroulement de 'essai_genplot2.sh'
BEGIN { nbretraits = 20000 }
END {
for (trait=0; trait<nbretraits; trait++)
{
if (0.498 > rand())
{
posx += rand()
posy += rand()
print posx, posy, 1
}
else
{
posx -= rand()
posy -= rand()
print posx, posy, 2
}
}
}
# job done

4
Tools/.gitignore vendored
View File

@ -1,4 +0,0 @@
*.tga
*.scratch

View File

@ -13,14 +13,12 @@
/* non portable but useful function */
char *strdup(const char *s);
#define DEBUG_LEVEL 1
#define IN_FONCTION
#include "tga_outils.h"
/*::------------------------------------------------------------------::*/
int cherche_mot_clef(char *mot, mot_clef *liste, int *pmode, int *pnbarg)
int
cherche_mot_clef(char *mot, mot_clef *liste, int *pmode, int *pnbarg)
{
int idx = 0;
@ -50,7 +48,8 @@ fprintf(stderr, "%s : %s not found\n", __func__, mot);
return -1;
}
/*::------------------------------------------------------------------::*/
int liste_mots_clefs(mot_clef *liste, int flag)
int
liste_mots_clefs(mot_clef *liste, int flag)
{
mot_clef *pmc;
@ -80,7 +79,7 @@ return 0;
/*::------------------------------------------------------------------::*/
/*
* INPUT str string to scan for an integer
* pval pointer to the return value
* pval pointer to the retrun value
* k * not used *
*
* OUTPUT 1 successfuly make a conversion
@ -105,31 +104,6 @@ fprintf(stderr, "%s: %s: '%s' -> %ld -> %d\n",
return 1;
}
/*::------------------------------------------------------------------::*/
/* Thu 17 Nov 2022
* input str a string like '640x480'
* pw, ph pointers to result
*
* output 0 on ok, INVALID_PARAM on error
*/
int parse_size_param(char *str, int *pw, int *ph)
{
int tw, th, foo;
#if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( '%s' %p %p )\n", __func__,
str, pw, ph);
#endif
foo = sscanf(str, "%dx%d", &tw, &th);
if (2 != foo) {
fprintf(stderr, "%s: fail %d on '%s'\n", __func__, foo, str);
return INVALID_PARAM;
}
/* fprintf(stderr, " %d %d\n", tw, th); */
*pw = tw; *ph = th;
return 0;
}
/*::------------------------------------------------------------------::*/
/* input: str string to scan for four csv int
prect rectangle struct who need datas
@ -175,15 +149,14 @@ while (NULL != cptr) {
idx++;
}
free(cptr);
return 0;
}
/*::------------------------------------------------------------------::*/
static Param params[NB_PARAMS];
int parse_parametres(int argc, char *argv[], char *types, int prem)
int
parse_parametres(int argc, char *argv[], char *types, int prem)
{
int foo, idxt;
int entier;
@ -390,11 +363,11 @@ return params[rang].p.i;
}
/*::------------------------------------------------------------------::*/
static int verboselevel;
int must_be_verbose(void)
int
must_be_verbose(void)
{
char *envvar;
envvar = getenv(NOM_VAR_ENV_VERBOSE);
if ((envvar!=NULL) && !strcmp(envvar, "yes"))
{
@ -405,24 +378,9 @@ if ((envvar!=NULL) && !strcmp(envvar, "yes"))
}
return 0;
}
/* new Fri 18 Nov 2022 11:48:06 PM CET */
int set_verbosity(int level)
{
int tmplevel;
tmplevel = verboselevel;
verboselevel = level;
return tmplevel;
}
int get_verbosity(void)
{
return verboselevel;
}
/*::------------------------------------------------------------------::*/
int dump_command_line(int argc, char *argv[], int force)
int
dump_command_line(int argc, char *argv[], int force)
{
char *envvar;
int flag=0, foo;

View File

@ -6,8 +6,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <getopt.h>
#include "tga_outils.h"
@ -65,7 +63,7 @@ RGBA rgba;
int idx;
#if DEBUG_LEVEL
fprintf(stderr, "\tdraw %5d %5d to %5d %5d\n", curX, curY, x, y);
fprintf(stderr, "\tDRAW %5d %5d to %5d %5d\n", curX, curY, x, y);
#endif
idx = color % 8;
@ -90,60 +88,28 @@ Image_TGA_save(filename, image, 0);
return 0;
}
/*::------------------------------------------------------------------::*/
void help_me(char *proggy)
{
fprintf(stderr, "%s build %s %s\n", proggy, __DATE__, __TIME__);
puts("options:");
puts("\t-v\t\tdo some blablage");
puts("\t-s WxH\t\tset image size");
}
/*::------------------------------------------------------------------::*/
int main(int argc, char *argv[])
{
char *filename, *image;
FILE *fp;
int outw, outh; /* size of output pic */
double x, y, xmin, ymin, xmax, ymax;
double fx, fy, f, X, Y;
double xC, yC, XC, YC, c1, c2;
int v, nbp, opt, foo;
/* setting some default values */
outw = XMAX; outh = YMAX;
filename = "a.scratch"; image = "image.tga";
int v, nbp;
/*---------- processing command line arguments */
while ((opt = getopt(argc, argv, "hs:v")) != -1) {
switch (opt) {
case 'h':
help_me(argv[0]);
exit(0);
case 's': /* size of output pic */
foo = parse_size_param(optarg, &outw, &outh);
break;
case 'v':
break;
default:
fprintf(stderr, "invalid opt %d\n", opt);
exit(1);
break;
}
}
if (argc<=optind) filename = "a.scratch";
else filename = argv[optind];
if (argc<=1) filename = "a.scratch";
else filename = argv[1];
if (argc<=optind+1) image = "image.tga";
else image = argv[optind+1];
if (argc<=2) image = "image.tga";
else image = argv[2];
fprintf(stderr, "argc %d optind %d file '%s' image '%s'\n",
argc, optind, filename, image);
/*----------- giving to the yuser some useless informations --- */
#if DEBUG_LEVEL
fprintf(stderr, "*** Genplot2 v 1.0.9 (dwtfywl) 1995,2010,2022 TontonTh \n");
fprintf(stderr, " picsize : %d %d\n", outw, outh);
fprintf(stderr, "*** Genplot2 v 1.0.8 (dwtfywl) 1995,2010,2022 TontonTh \n");
fprintf(stderr, "hardcoded picsize : %d %d\n", XMAX, YMAX);
#endif
/*----------- opening input file and getting MIN and MAX values */
@ -171,26 +137,20 @@ if (nbp == 0)
fprintf(stderr, "omg, I'v found _ZERO_ points for plotting...\n");
exit(2);
}
if (nbp == 1)
{
fprintf(stderr, "omg, I can't do any job with only one point.\n");
exit(2);
}
fprintf(stderr, "Genplot2: found %d points\n", nbp);
/*---------- computing coefficients (temporary hack !-) */
fx = (outw-XMIN-1)/(xmax-xmin);
fy = (outh-YMIN-1)/(ymax-ymin);
fx = (XMAX-XMIN-1)/(xmax-xmin);
fy = (YMAX-YMIN-1)/(ymax-ymin);
#if DEBUG_LEVEL
fprintf(stderr, "fc = %12f fy = %12f\n", fx, fy);
#endif
f = (fx<fy?fx:fy);
xC = 0.5*(xmin+xmax); yC = 0.5*(ymin+ymax);
XC = 0.5*(XMIN+outw); YC = 0.5*(YMIN+outh);
XC = 0.5*(XMIN+XMAX); YC = 0.5*(YMIN+YMAX);
c1 = XC-f*xC; c2 = YC-f*yC;
@ -199,7 +159,7 @@ fprintf(stderr, "c1 = %12f c2 = %12f\n", c1, c2);
#endif
/*------------- and now, plotting the image ! */
initgr(outw, outh);
initgr(XMAX, YMAX);
fp = fopen(filename, "r");
puts("");

View File

@ -19,7 +19,6 @@
* 27 Dec 2009: v0.42 prise en compte des champs d'altitude.
* 06 Mar 2010: v0.43 introduction du 'df3 tool'.
* 27 Jan 2014: V0.52 added : 'parse_rect_param'.
* 18 Nov 2022: Vx.xx added parse_size_param
*/
#define TGA_OUTILS_COPYLEFT "(dwtfywl) TontonTh 2022"
@ -75,12 +74,8 @@ int cherche_mot_clef(char *mot, mot_clef *liste, int *pmode, int *pnbarg);
/* le flag ne sert a rien, mais il faut le mettre a 42 */
int liste_mots_clefs(mot_clef *liste, int flag);
int get_verbosity(void);
int set_verbosity(int level);
int parse_int_param(char *str, int *pval, int k);
int parse_rect_param(char *str, Image_Rect *prect, int k);
int parse_size_param(char *str, int *pw, int *ph);
int parse_parametres(int ac, char *av[], char *types, int prem);
void print_parametres(void);

View File

@ -4,7 +4,7 @@
http:///la.buvette.org/devel/libimage/
*/
#ifndef IMAGE_VERSION_STRING
#define IMAGE_VERSION_STRING "0.4.51 pl 41"
#define IMAGE_VERSION_STRING "0.4.51 pl 39"
/*::------------------------------------------------------------------::*/
/*