Ejemplo n.º 1
0
unsigned long long dof(unsigned long long y, unsigned long long *a)
{
    unsigned long long x = 0;
    unsigned long long g[3];

    g[0] = a[0] * 3;
    g[1] = a[1] * 2;
    g[2] = a[2] * 1;

    int dg = g[1] * g[1] - 4 * g[0] * g[2];

    if (dg <= 0) {
        fprintf(stdout, "%s", "jest");
    } else {
        fprintf(stdout, "%s", "BRAK");
    }


    fprintf(stdout, "=%lld=", funf(x, a));
    fprintf(stdout, "=%lld=", fung(x, g));

    long xne = rek(x, a, g);
    fprintf(stdout, "===%ld===", xne);

    return xne;
}
Ejemplo n.º 2
0
static void labtoxyz(fz_colorspace *fzcs, float *lab, float *xyz)
{
	struct cielab *cs = (struct cielab *) fzcs;
	float lstar, astar, bstar, l, m, n;
	float tmp[3];
	tmp[0] = lab[0] * 100;
	tmp[1] = lab[1] * 200 - 100;
	tmp[2] = lab[2] * 200 - 100;
	lstar = tmp[0];
	astar = MAX(MIN(tmp[1], cs->range[1]), cs->range[0]);
	bstar = MAX(MIN(tmp[2], cs->range[3]), cs->range[2]);
	l = (lstar + 16.0) / 116.0 + astar / 500.0;
	m = (lstar + 16.0) / 116.0;
	n = (lstar + 16.0) / 116.0 - bstar / 200.0;
	xyz[0] = fung(l) * cs->white[0];
	xyz[1] = fung(m) * cs->white[1];
	xyz[2] = fung(n) * cs->white[2];
}
Ejemplo n.º 3
0
static void
lab_to_rgb(fz_context *ctx, fz_colorspace *cs, float *lab, float *rgb)
{
	/* input is in range (0..100, -128..127, -128..127) not (0..1, 0..1, 0..1) */
	float lstar, astar, bstar, l, m, n, x, y, z, r, g, b;
	lstar = lab[0];
	astar = lab[1];
	bstar = lab[2];
	m = (lstar + 16) / 116;
	l = m + astar / 500;
	n = m - bstar / 200;
	x = fung(l);
	y = fung(m);
	z = fung(n);
	r = (3.240449f * x + -1.537136f * y + -0.498531f * z) * 0.830026f;
	g = (-0.969265f * x + 1.876011f * y + 0.041556f * z) * 1.05452f;
	b = (0.055643f * x + -0.204026f * y + 1.057229f * z) * 1.1003f;
	rgb[0] = sqrtf(CLAMP(r, 0, 1));
	rgb[1] = sqrtf(CLAMP(g, 0, 1));
	rgb[2] = sqrtf(CLAMP(b, 0, 1));
}
Ejemplo n.º 4
0
unsigned long long rek(unsigned long long x, unsigned long long *a, unsigned long long *g)
{
    double xne = ((double) x) - (funf(x, a) / fung(x, g));

    double xnemx = xne - (double) x;
    if (xnemx < 0)
        xnemx *= -1;

fprintf(stdout, "xnemx: %d", &xnemx);

    if (xnemx < 0.001) {
        return xne;
    } else {
        return rek(xne, a, g);
    }
}