summaryrefslogtreecommitdiff
path: root/graphics/epix/samples/color_sep.xp
blob: 5ba4df4fc948d9e0b288e6f0c2419bfb0193923a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/* -*-ePiX-*- */
#include "epix.h"
using namespace ePiX;

// re cos(u+iv)
P f(double u, double v)
{
  return P(u, v, 2*cosh(u)*Cos(v));
}

domain R(P(-1,-1), P(1,1), mesh(16,16));

// RGB densities
P color(double x, double y, double z)
{
  return P(Sin(x), -Sin(y), -Sin(x));
}

int main()
{
  picture(P(0,0), P(5,1), "5x1in");

  begin();

  camera.filter(CMYK_Neutral()); // convert colors to CMYK in output
  grid(5,1);
  camera.at(4,3,1);

  plain(Red(1.6));

  // Original
  screen all(P(-1.5,0.5), P(1.5,3.5));
  activate(all);
  set_crop();

  surface(f, R, color);
  inset(all, P(0,0), P(1,1));

  // Cyan
  screen cyn(P(-1.5,0.5), P(1.5,3.5));
  activate(cyn);
  set_crop();
  camera.filter(C_Process()); // get cyan layer

  surface(f, R, color);
  inset(cyn, P(1,0), P(2,1));

  // Magenta
  screen mgn(P(-1.5,0.5), P(1.5,3.5));
  activate(mgn);
  set_crop();
  camera.filter(M_Process());

  surface(f, R, color);
  inset(mgn, P(2,0), P(3,1));

  // Yellow
  screen ylw(P(-1.5,0.5), P(1.5,3.5));
  activate(ylw);
  set_crop();
  camera.filter(Y_Process());

  surface(f, R, color);
  inset(ylw, P(3,0), P(4,1));

  // Black
  screen blk(P(-1.5,0.5), P(1.5,3.5));
  activate(blk);
  set_crop();
  camera.filter(K_Process());

  surface(f, R, color);
  inset(blk, P(4,0), P(5,1));

  end();
}