[gegl] newsprint: implement 4 inks mode
- From: Øyvind Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] newsprint: implement 4 inks mode
- Date: Thu, 23 Mar 2017 20:21:04 +0000 (UTC)
commit 106efc3cd5975391100c145380efadb7afd43ac6
Author: Øyvind Kolås <pippin gimp org>
Date: Thu Mar 23 21:20:43 2017 +0100
newsprint: implement 4 inks mode
operations/common/newsprint.c | 77 +++++++++++++++++++++++++++++++++++++++++
1 files changed, 77 insertions(+), 0 deletions(-)
---
diff --git a/operations/common/newsprint.c b/operations/common/newsprint.c
index ae5a630..18aeaf2 100644
--- a/operations/common/newsprint.c
+++ b/operations/common/newsprint.c
@@ -247,6 +247,83 @@ process (GeglOperation *operation,
x++; if (x>=roi->x + roi->width) { x=roi->x; y++; }
}
break;
+ case 4:
+ while (n_pixels--)
+ {
+ float pinch = fabs(in_pixel[0]-in_pixel[1]);
+ float angle = fabs(in_pixel[2]-in_pixel[1]);
+ float c = 1.0 - in_pixel[0];
+ float m = 1.0 - in_pixel[1];
+ float iy = 1.0 - in_pixel[2];
+ float k = 1.0;
+ if (c < k) k = c;
+ if (m < k) k = m;
+ if (y < k) k = y;
+
+ k = k * 0.40;
+
+ if (k < 1.0)
+ {
+ c = (c - k) / (1.0 - k);
+ m = (m - k) / (1.0 - k);
+ iy = (iy - k) / (1.0 - k);
+ }
+ else /* wont happen with 0.40 pullout */
+ {
+ c = m = iy = 1.0;
+ }
+
+ c = spachrotyze(x, y,
+ c, pinch, angle,
+ o->pattern,
+ o->wavelength / (1.0*(1<<level)),
+ o->turbulence,
+ blocksize,
+ o->angleboost,
+ o->twist2);
+ m = spachrotyze(x, y,
+ m, pinch, angle,
+ o->pattern,
+ o->wavelength / (1.0*(1<<level)),
+ o->turbulence,
+ blocksize,
+ o->angleboost,
+ o->twist3);
+ iy = spachrotyze(x, y,
+ iy, pinch, angle,
+ o->pattern,
+ o->wavelength / (1.0*(1<<level)),
+ o->turbulence,
+ blocksize,
+ o->angleboost,
+ o->twist4);
+ k = spachrotyze(x, y,
+ k, pinch, angle,
+ o->pattern,
+ o->wavelength / (1.0*(1<<level)),
+ o->turbulence,
+ blocksize,
+ o->angleboost,
+ o->twist4);
+
+ if (k < 1.0) {
+ c = c * (1.0 - k) + k;
+ m = m * (1.0 - k) + k;
+ iy= iy* (1.0 - k) + k;
+ } else {
+ c = 1.0; iy = 1.0; m = 1.0;
+ }
+ out_pixel[0] = 1.0 - c;
+ out_pixel[1] = 1.0 - m;
+ out_pixel[2] = 1.0 - iy;
+ out_pixel[3] = in_pixel[3];
+ out_pixel += 4;
+ in_pixel += 4;
+
+ /* update x and y coordinates */
+ x++; if (x>=roi->x + roi->width) { x=roi->x; y++; }
+ }
+ break;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]