Bibliothèque de traitements d'images en virgule flottante.
http://la.buvette.org/photos/cumul/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
840 B
44 lines
840 B
|
|
|
|
#include <stdio.h> |
|
|
|
|
|
#include "../floatimg.h" |
|
|
|
extern int verbosity; /* must be declared around main() */ |
|
|
|
/* --------------------------------------------------------------------- */ |
|
int parse_WxH(char *str, int *pw, int *ph) |
|
{ |
|
// char *ptr; |
|
int foo, w, h; |
|
|
|
#if DEBUG_LEVEL |
|
fprintf(stderr, ">>> %s ( '%s' %p %p )\n", __func__, |
|
str, pw, ph); |
|
#endif |
|
|
|
foo = sscanf(str, "%dx%d", &w, &h); |
|
if (2 != foo) { |
|
fprintf(stderr, "%s : arg '%s' is invalid\n", __func__, str); |
|
return foo; |
|
} |
|
|
|
*pw = w; *ph = h; |
|
|
|
return 2; |
|
} |
|
/* --------------------------------------------------------------------- */ |
|
int parse_double(char *str, double *dptr) |
|
{ |
|
double value; |
|
int foo; |
|
|
|
foo = sscanf(str, "%lf", &value); |
|
if (1 == foo) { |
|
*dptr = value; |
|
return 1; |
|
} |
|
return -1; |
|
} |
|
/* --------------------------------------------------------------------- */
|
|
|