Christian Heimke commited on 2011-07-15 09:18:13
Showing 11 changed files, with 97 additions and 84 deletions.
... | ... |
@@ -1,5 +1,5 @@ |
1 | 1 |
/* BlinkenLightsInteractiveMovieProgram |
2 |
- * version 1.1 date 2005-04-16 |
|
2 |
+ * version 1.2 date 2005-12-19 |
|
3 | 3 |
* Copyright (C) 2004-2005: Stefan Schuermans <1stein@schuermans.info> |
4 | 4 |
* Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html |
5 | 5 |
* a blinkenarea.org project |
... | ... |
@@ -150,7 +150,7 @@ public class Blimp extends JApplet |
150 | 150 |
labelStatus.setText( "new movie..." ); |
151 | 151 |
curFile = null; |
152 | 152 |
curMovie = new BlinkenMovie( defHeight, defWidth, defChannels, defMaxval ); |
153 |
- curMovie.insertInfo( 0, "creator", "Blimp (version 1.1 date 2005-04-16)" ); |
|
153 |
+ curMovie.insertInfo( 0, "creator", "Blimp (version 1.2 date 2005-12-19)" ); |
|
154 | 154 |
curMovie.insertFrame( 0, new BlinkenFrame( defHeight, defWidth, defChannels, defMaxval, defDuration ) ); |
155 | 155 |
curMovieChanged = false; |
156 | 156 |
|
... | ... |
@@ -944,7 +944,7 @@ public class Blimp extends JApplet |
944 | 944 |
{ |
945 | 945 |
JOptionPane.showMessageDialog( dialogParent, |
946 | 946 |
"BlinkenLightsInteractiveMovieProgram\n" + |
947 |
- "version 1.1 date 2005-04-16\n" + |
|
947 |
+ "version 1.2 date 2005-12-19\n" + |
|
948 | 948 |
"Copyright (C) 2004-2005: Stefan Schuermans <1stein@schuermans.info>\n" + |
949 | 949 |
"Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html\n" + |
950 | 950 |
"a blinkenarea.org project\n" + |
... | ... |
@@ -1637,7 +1637,7 @@ public class Blimp extends JApplet |
1637 | 1637 |
//initialize current movie, frame |
1638 | 1638 |
curDir = new File( "." ); |
1639 | 1639 |
curMovie = new BlinkenMovie( defHeight, defWidth, defChannels, defMaxval ); |
1640 |
- curMovie.insertInfo( 0, "creator", "Blimp (version 1.1 date 2005-04-16)" ); |
|
1640 |
+ curMovie.insertInfo( 0, "creator", "Blimp (version 1.2 date 2005-12-19)" ); |
|
1641 | 1641 |
curMovie.insertFrame( 0, new BlinkenFrame( defHeight, defWidth, defChannels, defMaxval, defDuration ) ); |
1642 | 1642 |
curFrame = null; |
1643 | 1643 |
|
... | ... |
@@ -2220,7 +2220,7 @@ public class Blimp extends JApplet |
2220 | 2220 |
|
2221 | 2221 |
//running as command line tool |
2222 | 2222 |
System.out.println( "BlinkenLightsInteractiveMovieProgram\n" + |
2223 |
- "version 1.1 date 2005-04-16\n" + |
|
2223 |
+ "version 1.2 date 2005-12-19\n" + |
|
2224 | 2224 |
"Copyright (C) 2004-2005: Stefan Schuermans <1stein@schuermans.info>\n" + |
2225 | 2225 |
"Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html\n" + |
2226 | 2226 |
"a blinkenarea.org project\n" + |
... | ... |
@@ -2232,7 +2232,7 @@ public class Blimp extends JApplet |
2232 | 2232 |
|
2233 | 2233 |
//get initial movie |
2234 | 2234 |
movie = new BlinkenMovie( defHeight, defWidth, defChannels, defMaxval ); |
2235 |
- movie.insertInfo( 0, "creator", "Blimp (version 1.1 date 2005-04-16)" ); |
|
2235 |
+ movie.insertInfo( 0, "creator", "Blimp (version 1.2 date 2005-12-19)" ); |
|
2236 | 2236 |
movie.insertFrame( 0, new BlinkenFrame( defHeight, defWidth, defChannels, defMaxval, defDuration ) ); |
2237 | 2237 |
|
2238 | 2238 |
//process parameters |
... | ... |
@@ -1,5 +1,5 @@ |
1 | 1 |
/* BlinkenLightsInteractiveMovieProgram |
2 |
- * version 1.1 date 2005-04-16 |
|
2 |
+ * version 1.2 date 2005-12-19 |
|
3 | 3 |
* Copyright (C) 2004-2005: Stefan Schuermans <1stein@schuermans.info> |
4 | 4 |
* Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html |
5 | 5 |
* a blinkenarea.org project |
... | ... |
@@ -1,5 +1,5 @@ |
1 | 1 |
/* BlinkenLightsInteractiveMovieProgram |
2 |
- * version 1.1 date 2005-04-16 |
|
2 |
+ * version 1.2 date 2005-12-19 |
|
3 | 3 |
* Copyright (C) 2004-2005: Stefan Schuermans <1stein@schuermans.info> |
4 | 4 |
* Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html |
5 | 5 |
* a blinkenarea.org project |
... | ... |
@@ -16,7 +16,7 @@ public class BlinkenFrame |
16 | 16 |
private int channels; |
17 | 17 |
private int maxval; |
18 | 18 |
private int duration; |
19 |
- private byte[][][] data; |
|
19 |
+ private byte[][] data; |
|
20 | 20 |
|
21 | 21 |
BlinkenFrame( int height, int width, int channels, int maxval, int duration ) |
22 | 22 |
{ |
... | ... |
@@ -36,31 +36,31 @@ public class BlinkenFrame |
36 | 36 |
this.channels = channels; |
37 | 37 |
this.maxval = maxval; |
38 | 38 |
this.duration = duration; |
39 |
- data = new byte[height][width][channels]; |
|
39 |
+ data = new byte[height][width * channels]; |
|
40 | 40 |
} |
41 | 41 |
|
42 | 42 |
BlinkenFrame( BlinkenFrame frame ) |
43 | 43 |
{ |
44 |
- int y, x, c; |
|
44 |
+ int y, x, c, i; |
|
45 | 45 |
height = frame.height; |
46 | 46 |
width = frame.width; |
47 | 47 |
channels = frame.channels; |
48 | 48 |
maxval = frame.maxval; |
49 | 49 |
duration = frame.duration; |
50 |
- data = new byte[height][width][channels]; |
|
50 |
+ data = new byte[height][width * channels]; |
|
51 | 51 |
for( y = 0; y < height; y++ ) |
52 |
- for( x = 0; x < width; x++ ) |
|
53 |
- for( c = 0; c < channels; c++ ) |
|
54 |
- data[y][x][c] = frame.data[y][x][c]; |
|
52 |
+ for( x = 0, i = 0; x < width; x++ ) |
|
53 |
+ for( c = 0; c < channels; c++, i++ ) |
|
54 |
+ data[y][i] = frame.data[y][i]; |
|
55 | 55 |
} |
56 | 56 |
|
57 | 57 |
public void clear( ) |
58 | 58 |
{ |
59 |
- int x, y, c; |
|
59 |
+ int x, y, c, i; |
|
60 | 60 |
for( y = 0; y < height; y++ ) |
61 |
- for( x = 0; x < width; x++ ) |
|
62 |
- for( c = 0; c < channels; c++ ) |
|
63 |
- data[y][x][c] = 0; |
|
61 |
+ for( x = 0, i = 0; x < width; x++ ) |
|
62 |
+ for( c = 0; c < channels; c++, i++ ) |
|
63 |
+ data[y][i] = 0; |
|
64 | 64 |
} |
65 | 65 |
|
66 | 66 |
public int getHeight( ) |
... | ... |
@@ -101,7 +101,7 @@ public class BlinkenFrame |
101 | 101 |
x < 0 || x >= width || |
102 | 102 |
c < 0 || c >= channels ) |
103 | 103 |
return 0; |
104 |
- return data[y][x][c]; |
|
104 |
+ return data[y][x * channels + c]; |
|
105 | 105 |
} |
106 | 106 |
|
107 | 107 |
public void setPixel( int y, int x, int c, byte val ) |
... | ... |
@@ -112,7 +112,7 @@ public class BlinkenFrame |
112 | 112 |
return; |
113 | 113 |
if( val > maxval ) |
114 | 114 |
val = (byte)maxval; |
115 |
- data[y][x][c] = val; |
|
115 |
+ data[y][x * channels + c] = val; |
|
116 | 116 |
} |
117 | 117 |
|
118 | 118 |
public Color getColor( int y, int x ) |
... | ... |
@@ -122,15 +122,16 @@ public class BlinkenFrame |
122 | 122 |
channels < 1 ) |
123 | 123 |
return new Color( 0, 0, 0 ); |
124 | 124 |
if( channels == 1 ) |
125 |
- return new Color( (((int)data[y][x][0] & 0xFF) * 255 + maxval / 2) / maxval, |
|
126 |
- (((int)data[y][x][0] & 0xFF) * 255 + maxval / 2) / maxval, |
|
127 |
- (((int)data[y][x][0] & 0xFF) * 255 + maxval / 2) / maxval ); |
|
125 |
+ return new Color( (((int)data[y][x * 1 + 0] & 0xFF) * 255 + maxval / 2) / maxval, |
|
126 |
+ (((int)data[y][x * 1 + 0] & 0xFF) * 255 + maxval / 2) / maxval, |
|
127 |
+ (((int)data[y][x * 1 + 0] & 0xFF) * 255 + maxval / 2) / maxval ); |
|
128 | 128 |
if( channels == 2 ) |
129 |
- return new Color( (((int)data[y][x][0] & 0xFF) * 255 + maxval / 2) / maxval, |
|
130 |
- (((int)data[y][x][1] & 0xFF) * 255 + maxval / 2) / maxval, 0 ); |
|
131 |
- return new Color( (((int)data[y][x][0] & 0xFF) * 255 + maxval / 2) / maxval, |
|
132 |
- (((int)data[y][x][1] & 0xFF) * 255 + maxval / 2) / maxval, |
|
133 |
- (((int)data[y][x][2] & 0xFF) * 255 + maxval / 2) / maxval ); |
|
129 |
+ return new Color( (((int)data[y][x * 2 + 0] & 0xFF) * 255 + maxval / 2) / maxval, |
|
130 |
+ (((int)data[y][x * 2 + 1] & 0xFF) * 255 + maxval / 2) / maxval, 0 ); |
|
131 |
+ int i = x * channels; |
|
132 |
+ return new Color( (((int)data[y][i + 0] & 0xFF) * 255 + maxval / 2) / maxval, |
|
133 |
+ (((int)data[y][i + 1] & 0xFF) * 255 + maxval / 2) / maxval, |
|
134 |
+ (((int)data[y][i + 2] & 0xFF) * 255 + maxval / 2) / maxval ); |
|
134 | 135 |
} |
135 | 136 |
|
136 | 137 |
public void setColor( int y, int x, Color color ) |
... | ... |
@@ -139,30 +140,31 @@ public class BlinkenFrame |
139 | 140 |
if( y < 0 || y >= height || |
140 | 141 |
x < 0 || x >= width ) |
141 | 142 |
return; |
143 |
+ int i = x * channels; |
|
142 | 144 |
alpha = color.getAlpha( ); |
143 | 145 |
alpha_ = 255 - alpha; |
144 | 146 |
if( channels >= 1 ) |
145 |
- data[y][x][0] = (byte)(( ((color.getRed( ) * maxval + 127) / 255) * alpha |
|
146 |
- + ((int)data[y][x][0] & 0xFF) * alpha_ |
|
147 |
+ data[y][i + 0] = (byte)(( ((color.getRed( ) * maxval + 127) / 255) * alpha |
|
148 |
+ + ((int)data[y][i + 0] & 0xFF) * alpha_ |
|
147 | 149 |
) / 255); |
148 | 150 |
if( channels >= 2 ) |
149 |
- data[y][x][1] = (byte)(( ((color.getGreen( ) * maxval + 127) / 255) * alpha |
|
150 |
- + ((int)data[y][x][1] & 0xFF) * alpha_ |
|
151 |
+ data[y][i + 1] = (byte)(( ((color.getGreen( ) * maxval + 127) / 255) * alpha |
|
152 |
+ + ((int)data[y][i + 1] & 0xFF) * alpha_ |
|
151 | 153 |
) / 255); |
152 | 154 |
if( channels >= 3 ) |
153 |
- data[y][x][2] = (byte)(( ((color.getBlue( ) * maxval + 127) / 255) * alpha |
|
154 |
- + ((int)data[y][x][2] & 0xFF) * alpha_ |
|
155 |
+ data[y][i + 2] = (byte)(( ((color.getBlue( ) * maxval + 127) / 255) * alpha |
|
156 |
+ + ((int)data[y][i + 2] & 0xFF) * alpha_ |
|
155 | 157 |
) / 255); |
156 | 158 |
for( c = 3; c < channels; c++ ) |
157 |
- data[y][x][c] = (byte)(( 0 |
|
158 |
- + ((int)data[y][x][c] & 0xFF) * alpha_ |
|
159 |
+ data[y][i + c] = (byte)(( 0 |
|
160 |
+ + ((int)data[y][i + c] & 0xFF) * alpha_ |
|
159 | 161 |
) / 255); |
160 | 162 |
} |
161 | 163 |
|
162 | 164 |
public void resize( int height, int width, int channels, int maxval ) |
163 | 165 |
{ |
164 |
- byte[][][] data; |
|
165 |
- int y, x, c; |
|
166 |
+ byte[][] data; |
|
167 |
+ int y, x, c, i; |
|
166 | 168 |
int emptyY, emptyX, skipY, skipX, rangeY, rangeX, val, div; |
167 | 169 |
|
168 | 170 |
if( height < 1 ) height = 1; |
... | ... |
@@ -181,11 +183,11 @@ public class BlinkenFrame |
181 | 183 |
return; |
182 | 184 |
|
183 | 185 |
//allocate new data array |
184 |
- data = new byte[height][width][channels]; |
|
186 |
+ data = new byte[height][width * channels]; |
|
185 | 187 |
for( y = 0; y < height; y++ ) |
186 |
- for( x = 0; x < width; x++ ) |
|
187 |
- for( c = 0; c < channels; c++ ) |
|
188 |
- data[y][x][c] = 0; |
|
188 |
+ for( x = 0, i = 0; x < width; x++ ) |
|
189 |
+ for( c = 0; c < channels; c++, i++ ) |
|
190 |
+ data[y][i] = 0; |
|
189 | 191 |
|
190 | 192 |
//get number of pixels to skip / to leave empty in X and Y direction |
191 | 193 |
if( height > this.height ) |
... | ... |
@@ -218,22 +220,24 @@ public class BlinkenFrame |
218 | 220 |
{ |
219 | 221 |
for( x = 0; x < rangeX; x++ ) |
220 | 222 |
{ |
223 |
+ int srcI = (skipX + x) * this.channels; |
|
224 |
+ int destI = (emptyX + x) * channels; |
|
221 | 225 |
if( channels >= this.channels ) //add channels: copy last channel into new channels |
222 | 226 |
{ |
223 | 227 |
for( c = 0; c < this.channels; c++ ) |
224 |
- data[emptyY + y][emptyX + x][c] = (byte)((((int)this.data[skipY + y][skipX + x][c] & 0xFF) * maxval + this.maxval / 2) / this.maxval); |
|
228 |
+ data[emptyY + y][destI + c] = (byte)((((int)this.data[skipY + y][srcI + c] & 0xFF) * maxval + this.maxval / 2) / this.maxval); |
|
225 | 229 |
for( ; c < channels; c++ ) |
226 |
- data[emptyY + y][emptyX + x][c] = data[emptyY + y][emptyX + x][this.channels - 1]; |
|
230 |
+ data[emptyY + y][destI + c] = data[emptyY + y][destI + this.channels - 1]; |
|
227 | 231 |
} |
228 | 232 |
else //remove channels: merge leftover channels with last kept channel |
229 | 233 |
{ |
230 | 234 |
val = 0; |
231 | 235 |
for( c = 0; c < channels - 1; c++ ) |
232 |
- data[emptyY + y][emptyX + x][c] = (byte)((((int)this.data[skipY + y][skipX + x][c] & 0xFF) * maxval + this.maxval / 2) / this.maxval); |
|
236 |
+ data[emptyY + y][destI + c] = (byte)((((int)this.data[skipY + y][srcI + c] & 0xFF) * maxval + this.maxval / 2) / this.maxval); |
|
233 | 237 |
for( c = channels - 1; c < this.channels; c++ ) |
234 |
- val += (int)this.data[skipY + y][skipX + x][c] & 0xFF; |
|
238 |
+ val += (int)this.data[skipY + y][srcI + c] & 0xFF; |
|
235 | 239 |
div = this.maxval * (this.channels - channels + 1); |
236 |
- data[emptyY + y][emptyX + x][channels - 1] = (byte)((val * maxval + div / 2) / div); |
|
240 |
+ data[emptyY + y][destI + channels - 1] = (byte)((val * maxval + div / 2) / div); |
|
237 | 241 |
} |
238 | 242 |
} |
239 | 243 |
} |
... | ... |
@@ -247,9 +251,9 @@ public class BlinkenFrame |
247 | 251 |
|
248 | 252 |
public void scale( int height, int width ) |
249 | 253 |
{ |
250 |
- byte[][][] data; |
|
254 |
+ byte[][] data; |
|
251 | 255 |
double scaleHor, scaleVer, ox, oy, ox1, oy1, val; |
252 |
- int c, nx, ny, x, y, oxi, oyi, ox1i, oy1i; |
|
256 |
+ int c, nx, nx_c, ny, x, x_c, y, oxi, oxi_c, oyi, ox1i, ox1i_c, oy1i; |
|
253 | 257 |
|
254 | 258 |
if( height < 1 ) height = 1; |
255 | 259 |
if( height > 1024 ) height = 1024; |
... | ... |
@@ -264,39 +268,41 @@ public class BlinkenFrame |
264 | 268 |
scaleVer = (double)height / (double)this.height; |
265 | 269 |
|
266 | 270 |
//allocate new data array |
267 |
- data = new byte[height][width][channels]; |
|
271 |
+ data = new byte[height][width * channels]; |
|
268 | 272 |
|
269 | 273 |
//scale every channel |
270 | 274 |
for( c = 0; c < channels; c++ ) |
271 | 275 |
{ |
272 | 276 |
for( ny = 0; ny < height; ny++ ) |
273 | 277 |
{ |
274 |
- for( nx = 0; nx < width; nx++ ) |
|
278 |
+ for( nx = 0, nx_c = c; nx < width; nx++, nx_c += channels ) |
|
275 | 279 |
{ |
276 | 280 |
oy = (double)ny / scaleVer; //sub-pixel exact range in old picture |
277 | 281 |
ox = (double)nx / scaleHor; |
278 | 282 |
oy1 = (double)(ny + 1) / scaleVer - 0.000001; |
279 | 283 |
ox1 = (double)(nx + 1) / scaleHor - 0.000001; |
280 | 284 |
if( oy < 0 || ox < 0 || oy1 >= this.height || ox1 >= this.width) //out of old picture |
281 |
- data[ny][nx][c] = 0; |
|
285 |
+ data[ny][nx_c] = 0; |
|
282 | 286 |
else |
283 | 287 |
{ |
284 | 288 |
oyi = (int)oy; |
285 | 289 |
oxi = (int)ox; |
290 |
+ oxi_c = oxi * channels + c; |
|
286 | 291 |
oy1i = (int)oy1; |
287 | 292 |
ox1i = (int)ox1; |
293 |
+ ox1i_c = ox1i * channels + c; |
|
288 | 294 |
if( oyi == oy1i ) |
289 | 295 |
{ |
290 | 296 |
if( oxi == ox1i) //one source pixel |
291 | 297 |
{ |
292 |
- val = (double)((int)this.data[oyi][oxi][c] & 0xFF); |
|
298 |
+ val = (double)((int)this.data[oyi][oxi_c] & 0xFF); |
|
293 | 299 |
} |
294 | 300 |
else //one line of source pixels |
295 | 301 |
{ |
296 |
- val = (double)((int)this.data[oyi][oxi][c] & 0xFF) * (1 - ox + oxi) |
|
297 |
- + (double)((int)this.data[oyi][ox1i][c] & 0xFF) * (ox1 - ox1i); |
|
298 |
- for( x = oxi + 1; x < ox1i; x++ ) |
|
299 |
- val += (double)((int)this.data[oyi][x][c] & 0xFF); |
|
302 |
+ val = (double)((int)this.data[oyi][oxi_c] & 0xFF) * (1 - ox + oxi) |
|
303 |
+ + (double)((int)this.data[oyi][ox1i_c] & 0xFF) * (ox1 - ox1i); |
|
304 |
+ for( x_c = oxi_c + channels; x_c < ox1i_c; x_c += channels ) |
|
305 |
+ val += (double)((int)this.data[oyi][x_c] & 0xFF); |
|
300 | 306 |
val /= ox1 - ox; |
301 | 307 |
} |
302 | 308 |
} |
... | ... |
@@ -304,35 +310,35 @@ public class BlinkenFrame |
304 | 310 |
{ |
305 | 311 |
if( oxi == ox1i ) |
306 | 312 |
{ |
307 |
- val = (double)((int)this.data[oyi][oxi][c] & 0xFF) * (1 - oy + oyi) |
|
308 |
- + (double)((int)this.data[oy1i][oxi][c] & 0xFF) * (oy1 - oy1i); |
|
313 |
+ val = (double)((int)this.data[oyi][oxi_c] & 0xFF) * (1 - oy + oyi) |
|
314 |
+ + (double)((int)this.data[oy1i][oxi_c] & 0xFF) * (oy1 - oy1i); |
|
309 | 315 |
for( y = oyi + 1; y < oy1i; y++ ) |
310 |
- val += (double)((int)this.data[y][oxi][c] & 0xFF); |
|
316 |
+ val += (double)((int)this.data[y][oxi_c] & 0xFF); |
|
311 | 317 |
val /= oy1 - oy; |
312 | 318 |
} |
313 | 319 |
else //rectangle of source pixels |
314 | 320 |
{ |
315 |
- val = (double)((int)this.data[oyi][oxi][c] & 0xFF) * (1 - oy + oyi) * (1 - ox + oxi) |
|
316 |
- + (double)((int)this.data[oyi][ox1i][c] & 0xFF) * (1 - oy + oyi) * (ox1 - ox1i) |
|
317 |
- + (double)((int)this.data[oy1i][oxi][c] & 0xFF) * (oy1 - oy1i) * (1 - ox + oxi) |
|
318 |
- + (double)((int)this.data[oy1i][ox1i][c] & 0xFF) * (oy1 - oy1i) * (ox1 - ox1i); |
|
321 |
+ val = (double)((int)this.data[oyi][oxi_c] & 0xFF) * (1 - oy + oyi) * (1 - ox + oxi) |
|
322 |
+ + (double)((int)this.data[oyi][ox1i_c] & 0xFF) * (1 - oy + oyi) * (ox1 - ox1i) |
|
323 |
+ + (double)((int)this.data[oy1i][oxi_c] & 0xFF) * (oy1 - oy1i) * (1 - ox + oxi) |
|
324 |
+ + (double)((int)this.data[oy1i][ox1i_c] & 0xFF) * (oy1 - oy1i) * (ox1 - ox1i); |
|
319 | 325 |
for( y = oyi + 1; y < oy1i; y++ ) |
320 | 326 |
{ |
321 |
- val += (double)((int)this.data[y][oxi][c] & 0xFF) * (1 - ox + oxi) |
|
322 |
- + (double)((int)this.data[y][ox1i][c] & 0xFF) * (ox1 - ox1i); |
|
327 |
+ val += (double)((int)this.data[y][oxi_c] & 0xFF) * (1 - ox + oxi) |
|
328 |
+ + (double)((int)this.data[y][ox1i_c] & 0xFF) * (ox1 - ox1i); |
|
323 | 329 |
} |
324 |
- for( x = oxi + 1; x < ox1i; x++ ) |
|
330 |
+ for( x_c = oxi_c + channels; x_c < ox1i_c; x_c += channels ) |
|
325 | 331 |
{ |
326 |
- val += (double)((int)this.data[oyi][x][c] & 0xFF) * (1 - oy + oyi) |
|
327 |
- + (double)((int)this.data[oy1i][x][c] & 0xFF) * (oy1 - oy1i); |
|
332 |
+ val += (double)((int)this.data[oyi][x_c] & 0xFF) * (1 - oy + oyi) |
|
333 |
+ + (double)((int)this.data[oy1i][x_c] & 0xFF) * (oy1 - oy1i); |
|
328 | 334 |
} |
329 | 335 |
for( y = oyi + 1; y < oy1i; y++ ) |
330 |
- for( x = oxi + 1; x < ox1i; x++ ) |
|
331 |
- val += (double)((int)this.data[y][x][c] & 0xFF); |
|
336 |
+ for( x_c = oxi_c + channels; x_c < ox1i_c; x_c += channels ) |
|
337 |
+ val += (double)((int)this.data[y][x_c] & 0xFF); |
|
332 | 338 |
val /= (oy1 - oy) * (ox1 - ox); |
333 | 339 |
} |
334 | 340 |
} |
335 |
- data[ny][nx][c] = (byte)(int)(val + 0.5); |
|
341 |
+ data[ny][nx_c] = (byte)(int)(val + 0.5); |
|
336 | 342 |
} |
337 | 343 |
} //for( nx ... |
338 | 344 |
} //for( ny ... |
... | ... |
@@ -346,14 +352,14 @@ public class BlinkenFrame |
346 | 352 |
public String toString( ) |
347 | 353 |
{ |
348 | 354 |
String str = ""; |
349 |
- int h, w, c, val; |
|
355 |
+ int h, w, c, i, val; |
|
350 | 356 |
for( h = 0; h < height; h++ ) |
351 | 357 |
{ |
352 |
- for( w = 0; w < width; w++ ) |
|
358 |
+ for( w = 0, i = 0; w < width; w++ ) |
|
353 | 359 |
{ |
354 | 360 |
val = 0; |
355 |
- for( val = 0, c = 0; c < channels; c++ ) |
|
356 |
- val += ((int)data[h][w][c] & 0xFF); |
|
361 |
+ for( val = 0, c = 0; c < channels; c++, i++ ) |
|
362 |
+ val += ((int)data[h][i] & 0xFF); |
|
357 | 363 |
val = val * 7 / maxval / channels; |
358 | 364 |
str = str + " -+*%#&@".substring( val, val + 1); |
359 | 365 |
} |
... | ... |
@@ -1,5 +1,5 @@ |
1 | 1 |
/* BlinkenLightsInteractiveMovieProgram |
2 |
- * version 1.1 date 2005-04-16 |
|
2 |
+ * version 1.2 date 2005-12-19 |
|
3 | 3 |
* Copyright (C) 2004-2005: Stefan Schuermans <1stein@schuermans.info> |
4 | 4 |
* Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html |
5 | 5 |
* a blinkenarea.org project |
... | ... |
@@ -1,5 +1,5 @@ |
1 | 1 |
/* BlinkenLightsInteractiveMovieProgram |
2 |
- * version 1.1 date 2005-04-16 |
|
2 |
+ * version 1.2 date 2005-12-19 |
|
3 | 3 |
* Copyright (C) 2004-2005: Stefan Schuermans <1stein@schuermans.info> |
4 | 4 |
* Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html |
5 | 5 |
* a blinkenarea.org project |
... | ... |
@@ -1,5 +1,5 @@ |
1 | 1 |
/* BlinkenLightsInteractiveMovieProgram |
2 |
- * version 1.1 date 2005-04-16 |
|
2 |
+ * version 1.2 date 2005-12-19 |
|
3 | 3 |
* Copyright (C) 2004-2005: Stefan Schuermans <1stein@schuermans.info> |
4 | 4 |
* Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html |
5 | 5 |
* a blinkenarea.org project |
... | ... |
@@ -1,5 +1,5 @@ |
1 | 1 |
/* BlinkenLightsInteractiveMovieProgram |
2 |
- * version 1.1 date 2005-04-16 |
|
2 |
+ * version 1.2 date 2005-12-19 |
|
3 | 3 |
* Copyright (C) 2004-2005: Stefan Schuermans <1stein@schuermans.info> |
4 | 4 |
* Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html |
5 | 5 |
* a blinkenarea.org project |
... | ... |
@@ -1,5 +1,5 @@ |
1 | 1 |
/* BlinkenLightsInteractiveMovieProgram |
2 |
- * version 1.1 date 2005-04-16 |
|
2 |
+ * version 1.2 date 2005-12-19 |
|
3 | 3 |
* Copyright (C) 2004-2005: Stefan Schuermans <1stein@schuermans.info> |
4 | 4 |
* Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html |
5 | 5 |
* a blinkenarea.org project |
... | ... |
@@ -1,5 +1,5 @@ |
1 | 1 |
/* BlinkenLightsInteractiveMovieProgram |
2 |
- * version 1.1 date 2005-04-16 |
|
2 |
+ * version 1.2 date 2005-12-19 |
|
3 | 3 |
* Copyright (C) 2004-2005: Stefan Schuermans <1stein@schuermans.info> |
4 | 4 |
* Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html |
5 | 5 |
* a blinkenarea.org project |
... | ... |
@@ -4,6 +4,13 @@ Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html |
4 | 4 |
a blinkenarea.org project |
5 | 5 |
powered by eventphone.de |
6 | 6 |
|
7 |
+version 1.2 data 2005-12-19 |
|
8 |
+--------------------------- |
|
9 |
+ - changed internal format of pixel data |
|
10 |
+ - old format: data[y][x][c] |
|
11 |
+ - new format: data[y][x * channels + c] |
|
12 |
+ - faster and uses less memory |
|
13 |
+ |
|
7 | 14 |
version 1.1 date 2005-04-16 |
8 | 15 |
--------------------------- |
9 | 16 |
- frame scroll bar now has block increment of 1 |
... | ... |
@@ -1,5 +1,5 @@ |
1 | 1 |
# BlinkenLightsInteractiveMovieProgram |
2 |
-# version 1.1 date 2005-04-16 |
|
2 |
+# version 1.2 date 2005-12-19 |
|
3 | 3 |
# Copyright (C) 2004-2005: Stefan Schuermans <1stein@schuermans.info> |
4 | 4 |
# Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html |
5 | 5 |
# a blinkenarea.org project |
6 | 6 |