fine tuning

This commit is contained in:
tth 2022-03-06 04:47:58 +01:00
parent b98c398c3c
commit 0cdb977a82
1 changed files with 23 additions and 2 deletions

View File

@ -227,17 +227,30 @@ switch (plane) {
abort(); break;
}
if (NULL == ptrplane) { /* mmmm... */
fprintf(stderr, "%s: mmmm...\n", __func__);
return -3;
}
if (NULL==(fp=fopen(fname, "w"))) {
perror(fname);
return -2;
}
/* WARNING !
* some software (yes, povray, I look at you) doesn't like
* width and height on two separate lines.
*/
fprintf(fp, "P2\n%d %d\n65535\n\n", psrc->width, psrc->height);
area = psrc->width * psrc->height;
maxval = fimg_get_plane_maxvalue(psrc, plane);
fk = maxval / 65535.0;
fprintf(stderr, "%s: maxval of %c = %f\n", __func__, plane, maxval);
if (verbosity) {
fprintf(stderr, "%s: maxval of plane '%c' = %f\n", __func__,
plane, maxval);
}
printed = 0;
for (idx=0; idx<area; idx++) {
@ -265,6 +278,10 @@ float accu;
fprintf(stderr, ">>> %s ( %p %s %d )\n", __func__, src, fname, flags);
#endif
if (flags) {
fprintf(stderr, "%s: flags must be 0\n", __func__);
}
if ( src->type != FIMG_TYPE_RGB ) {
#if DEBUG_LEVEL
fprintf(stderr, "%s : type %d is bad.\n", __func__, src->type);
@ -277,7 +294,11 @@ if (NULL==(fp=fopen(fname, "w"))) {
return -2;
}
fprintf(fp, "P2\n%d\n%d\n65532\n\n", src->width, src->height);
/* WARNING !
* some software (yes, povray, I look at you) doesn't like
* width and height on two separate lines.
*/
fprintf(fp, "P2\n%d %d\n65532\n\n", src->width, src->height);
area = src->width * src->height;
maximum = fimg_get_maxvalue(src);