File: ChannelMixer.java

package info (click to toggle)
natbraille 2.0rc3-14
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 7,080 kB
  • sloc: java: 31,266; xml: 7,747; sh: 165; haskell: 50; makefile: 32
file content (243 lines) | stat: -rw-r--r-- 7,114 bytes parent folder | download | duplicates (7)
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
/**************************************************************************
/* This class is a wrapper to a channel-mixer.
/*
/* Copyright (c) 2009 by Bernhard Bablok (mail@bablokb.de)
/*
/* This program is free software; you can redistribute it and/or modify
/* it under the terms of the GNU Library General Public License as published
/* by  the Free Software Foundation; either version 2 of the License or
/* (at your option) any later version.
/*
/* This program is distributed in the hope that it will be useful, but
/* WITHOUT ANY WARRANTY; without even the implied warranty of
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
/* GNU Library General Public License for more details.
/*
/* You should have received a copy of the GNU Library General Public License
/* along with this program; see the file COPYING.LIB.  If not, write to
/* the Free Software Foundation Inc., 59 Temple Place - Suite 330,
/* Boston, MA  02111-1307 USA
/**************************************************************************/

package org.im4java.utils;

import org.im4java.core.*;

/**
   This class is a wrapper to a channel mixer. Note that ImageMagick does
   not natively define a channel-mixer operation, but you can implement
   a channel-mixer with standard ImageMagick operations.

   @version $Revision: 1.6 $
   @author  $Author: bablokb $
*/

public class ChannelMixer extends IMOperation {

  //////////////////////////////////////////////////////////////////////////////

  /**
     This channel-mixer simulates a  yellow-filter.
  */

  public static final ChannelMixer YELLOW = new ChannelMixer(.60, .28, .12); 

  //////////////////////////////////////////////////////////////////////////////

  /**
     This channel-mixer simulates an orange-filter.
  */

  public static final ChannelMixer ORANGE = new ChannelMixer(.78, .22, 0);

  //////////////////////////////////////////////////////////////////////////////

  /**
     This channel-mixer simulates a red-filter.
  */

  public static final ChannelMixer RED = new ChannelMixer(.90, .10, 0);

  //////////////////////////////////////////////////////////////////////////////

  /**
     This channel-mixer simulates a green-filter.
  */

  public static final ChannelMixer GREEN = new ChannelMixer(.10, .70, .20);

  //////////////////////////////////////////////////////////////////////////////

  /**
     This channel-mixer simulates an agfapan-25 film.
  */

  public static final ChannelMixer AGFAPAN_25 = new ChannelMixer(.25, .39, .36);

  //////////////////////////////////////////////////////////////////////////////

  /**
     This channel-mixer simulates an agfapan-100 film.
  */

  public static final ChannelMixer
      AGFAPAN_100 = new ChannelMixer(.21, .40, .39);

  //////////////////////////////////////////////////////////////////////////////

  /**
     This channel-mixer simulates an agfapan-400 film.
  */

  public static final ChannelMixer
      AGFAPAN_400 = new ChannelMixer(.20, .41, .39);

  //////////////////////////////////////////////////////////////////////////////

  /**
     This channel-mixer simulates an agfa-200x film.
  */

  public static final ChannelMixer
      AGFA_200X = new ChannelMixer(.18, .41, .41);

  //////////////////////////////////////////////////////////////////////////////

  /**
     This channel-mixer simulates an Ilford Delta400 film.
  */

  public static final ChannelMixer
      ILFORD_DELTA100 = new ChannelMixer(.21, .42, .37);

  //////////////////////////////////////////////////////////////////////////////

  /**
     This channel-mixer simulates a  film.
  */

  public static final ChannelMixer
      ILFORD_DELTA400 = new ChannelMixer(.22, .42, .36);

  //////////////////////////////////////////////////////////////////////////////

  /**
     This channel-mixer simulates an Ilford Delta400-Pro film.
  */

  public static final ChannelMixer
      ILFORD_DELTA400_PRO = new ChannelMixer(.31, .36, .33);

  //////////////////////////////////////////////////////////////////////////////

  /**
     This channel-mixer simulates an Ilford PANF film.
  */

  public static final ChannelMixer
      ILFORD_PANF = new ChannelMixer(.33, .36, .31);

  //////////////////////////////////////////////////////////////////////////////

  /**
     This channel-mixer simulates an Ilford FP4 film.
  */

  public static final ChannelMixer ILFORD_FP4 = new ChannelMixer(.28, .41, .31);

  //////////////////////////////////////////////////////////////////////////////

  /**
     This channel-mixer simulates an Ilford HP5 film.
  */

  public static final ChannelMixer ILFORD_HP5 = new ChannelMixer(.23, .37, .40);

  //////////////////////////////////////////////////////////////////////////////

  /**
     This channel-mixer simulates an Ilford SFX film.
  */

  public static final ChannelMixer ILFORD_SFX = new ChannelMixer(.36, .31, .33);

  //////////////////////////////////////////////////////////////////////////////

  /**
     This channel-mixer simulates an Ilford XP2 film.
  */

  public static final ChannelMixer  ILFORD_XP2 = new ChannelMixer(.21, .42, .37);

  //////////////////////////////////////////////////////////////////////////////

  /**
     This channel-mixer simulates a Kodak TMAX 100 film.
  */

  public static final ChannelMixer
      KODAK_TMAX100 = new ChannelMixer(.24, .37, .39);

  //////////////////////////////////////////////////////////////////////////////

  /**
     This channel-mixer simulates a Kodak TMAX 400 film.
  */

  public static final ChannelMixer
      KODAK_TMAX400 = new ChannelMixer(.27, .36, .37);

  //////////////////////////////////////////////////////////////////////////////

  /**
     This channel-mixer simulates a Kodak Tri-X film.
  */

  public static final ChannelMixer KODAK_TRIX = new ChannelMixer(.25, .35, .40);

  //////////////////////////////////////////////////////////////////////////////

  /**
     This channel-mixer simulates an infrared film.
  */

  public static final ChannelMixer INFRARED = new ChannelMixer(1,1,-1);

  //////////////////////////////////////////////////////////////////////////////

  /**
     This channel-mixer extracts the red-channel.
  */

  public static final ChannelMixer RED_CHANNEL = new ChannelMixer(1,0,0);

  //////////////////////////////////////////////////////////////////////////////

  /**
     This channel-mixer extracts the green-channel.
  */

  public static final ChannelMixer GREEN_CHANNEL = new ChannelMixer(0,1,0);

  //////////////////////////////////////////////////////////////////////////////

  /**
     This channel-mixer extracts the blue-channel.
  */

  public static final ChannelMixer BLUE_CHANNEL = new ChannelMixer(0,0,1);

  //////////////////////////////////////////////////////////////////////////////

  /**
     Constructor.
  */

  public ChannelMixer(double red, double green, double blue) {
    addRawArgs("-recolor",String.format("%g,%g,%g,%g,%g,%g,%g,%g,%g",
                                red,green,blue,
                                red,green,blue,
                                red,green,blue));
  }

}