#include <math.h>
#include <stdio.h>
Go to the source code of this file.
static int blueloop |
( |
int |
restart | ) |
|
|
static |
Definition at line 480 of file inv_cmap.c.
484 register unsigned long *dp;
485 register unsigned char *rgbp;
486 register long bdist, bxx;
490 static int here,
min, max;
492 static int prevmin, prevmax;
493 int thismin, thismax;
494 #ifdef DMIN_DMAX_TRACK
495 static int dmin, dmax;
512 #ifdef DMIN_DMAX_TRACK
525 tdist = cred -
red *
x -
x/2;
527 tdist = cgreen -
green *
x -
x/2;
529 tdist = cblue - here *
x -
x/2;
532 fprintf( stderr,
"*** At %d,%d,%d; dist = %ld != gdist = %ld\n",
535 fprintf( stderr,
"*** At %d,%d,%d: buffer pointer is at %d,%d,%d\n",
544 for ( b = here, bdist =
gdist, bxx = binc, dp =
gdp, rgbp =
grgbp, lim = max;
547 bdist += bxx, bxx += txsqr )
566 fprintf( stderr,
"===Adjusting blue here up at %d,%d,%d\n",
569 tdist = cred -
red *
x -
x/2;
571 tdist = cgreen -
green *
x -
x/2;
573 tdist = cblue - here *
x -
x/2;
577 "*** Adjusting here up at %d,%d,%d; dist = %ld != gdist = %ld\n",
592 bdist += bxx, bxx += txsqr )
614 tdist = cred -
red *
x -
x/2;
616 tdist = cgreen -
green *
x -
x/2;
618 tdist = cblue - b *
x -
x/2;
622 "*** After up loop at %d,%d,%d; dist = %ld != bdist = %ld\n",
643 bxx -= txsqr, bdist -= bxx )
664 fprintf( stderr,
"===Adjusting blue here down at %d,%d,%d\n",
666 tdist = cred -
red *
x -
x/2;
668 tdist = cgreen -
green *
x -
x/2;
670 tdist = cblue - here *
x -
x/2;
674 "*** Adjusting here down at %d,%d,%d; dist = %ld != gdist = %ld\n",
687 bxx -= txsqr, bdist -= bxx )
710 tdist = cred -
red *
x -
x/2;
712 tdist = cgreen -
green *
x -
x/2;
714 tdist = cblue - b *
x -
x/2;
718 "*** After down loop at %d,%d,%d; dist = %ld != bdist = %ld\n",
726 #ifdef DMIN_DMAX_TRACK
729 if ( prevmax >= prevmin )
732 dmin = thismin - prevmin - 1;
736 dmax = thismax - prevmax + 1;
740 max = thismax + dmax;
743 min = thismin + dmin;
751 if ( thismax < prevmax )
754 if ( thismin > prevmin )
static unsigned long * gdp
static unsigned char green[256]
static unsigned char * grgbp
static unsigned char red[256]
static int greenloop |
( |
int |
restart | ) |
|
|
static |
Definition at line 339 of file inv_cmap.c.
Referenced by redloop().
346 static int here,
min, max;
348 static int prevmax, prevmin;
349 int thismax, thismin;
351 static long ginc, gxx, gcdist;
352 static unsigned long *gcdp;
353 static unsigned char *gcrgbp;
375 for ( g = here, gcdist =
gdist =
rdist, gxx = ginc,
379 gdist += gxx, gcdist += gxx, gxx += txsqr, first = 0 )
400 fprintf( stderr,
"===Adjusting green here up at %d,%d\n",
417 for ( g = here - 1, gxx = ginc - txsqr, gcdist = gdist =
rdist - gxx,
422 gxx -= txsqr, gdist -= gxx, gcdist -= gxx, first = 0 )
441 fprintf( stderr,
"===Adjusting green here down at %d,%d\n",
463 if ( thismax < prevmax )
468 if ( thismin > prevmin )
static unsigned char * rrgbp
static unsigned long * gdp
static unsigned char green[256]
static unsigned char * grgbp
static unsigned long * rdp
static unsigned char red[256]
void inv_cmap |
( |
int |
colors, |
|
|
colormap |
, |
|
|
int |
bits, |
|
|
unsigned long * |
dist_buf, |
|
|
* |
rgbmap |
|
) |
| |
Definition at line 214 of file inv_cmap.c.
219 int nbits = 8 - bits;
263 fprintf( stderr,
"---Starting %d: %d,%d,%d -> %d,%d,%d\n",
264 cindex, cred, cgreen, cblue,
285 fprintf( stderr,
"K = %d, N = %d, outer count = %ld, inner count = %ld\n",
286 colors, colormax, outercount, innercount );
static unsigned char nbits[256]
static unsigned long * cdp
static unsigned char * crgbp
static void maxfill |
( |
unsigned long * |
buffer, |
|
|
long |
side |
|
) |
| |
|
static |
Definition at line 768 of file inv_cmap.c.
772 register unsigned long maxv = ~0L;
774 register unsigned long *bp;
Definition at line 292 of file inv_cmap.c.
References cdist, cdp, colormax, crgbp, crinc, greenloop(), rcenter, rdist, rdp, rrgbp, rstride, and xsqr.
307 rdist += rxx, rxx += txsqr, first = 0 )
323 rxx -= txsqr, rdist -= rxx, first = 0 )
static unsigned char * rrgbp
static unsigned long * cdp
static unsigned long * rdp
static unsigned char red[256]
static unsigned char * crgbp