Project

General

Profile

Download (110 KB) Statistics
| Branch: | Revision:

library / src / main / java / org / distorted / library / DistortedObject.java @ e0a16874

1 d333eb6b Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2016 Leszek Koltunski                                                               //
3
//                                                                                               //
4
// This file is part of Distorted.                                                               //
5
//                                                                                               //
6
// Distorted is free software: you can redistribute it and/or modify                             //
7
// it under the terms of the GNU General Public License as published by                          //
8
// the Free Software Foundation, either version 2 of the License, or                             //
9
// (at your option) any later version.                                                           //
10
//                                                                                               //
11
// Distorted is distributed in the hope that it will be useful,                                  //
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of                                //
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                 //
14
// GNU General Public License for more details.                                                  //
15
//                                                                                               //
16
// You should have received a copy of the GNU General Public License                             //
17
// along with Distorted.  If not, see <http://www.gnu.org/licenses/>.                            //
18
///////////////////////////////////////////////////////////////////////////////////////////////////
19
20 6a06a912 Leszek Koltunski
package org.distorted.library;
21
22
import android.graphics.Bitmap;
23
import android.opengl.GLES20;
24
import android.opengl.GLUtils;
25
26
///////////////////////////////////////////////////////////////////////////////////////////////////
27 b329f352 Leszek Koltunski
/**
28 437bc43e Leszek Koltunski
 * All Objects to which Distorted Graphics effects can be applied need to be extended from here.
29 b329f352 Leszek Koltunski
 */
30 6a06a912 Leszek Koltunski
public abstract class DistortedObject 
31 1e438fc7 Leszek Koltunski
{
32 e0a16874 Leszek Koltunski
    private static final Float2D mZero2D = new Float2D(0,0);
33
    private static final Float3D mZero3D = new Float3D(0,0,0);
34
35
    private static float[] mViewMatrix   = new float[16];
36 6a06a912 Leszek Koltunski
   
37 d07f2950 Leszek Koltunski
    protected EffectQueueMatrix    mM;
38
    protected EffectQueueFragment  mF;
39
    protected EffectQueueVertex    mV;
40
    protected EffectQueueOther mO;
41 6a06a912 Leszek Koltunski
42
    protected boolean matrixCloned, vertexCloned, fragmentCloned;
43
 
44
    protected GridObject mGrid = null;
45
    protected long mID;
46
    protected int mSizeX, mSizeY, mSizeZ, mSize; // in screen space
47
48
    protected Bitmap[] mBmp= null; // 
49
    int[] mTextureDataH;           // have to be shared among all the cloned Objects
50
    boolean[] mBitmapSet;          // 
51 9361b337 Leszek Koltunski
52
///////////////////////////////////////////////////////////////////////////////////////////////////
53
54 ada90d33 Leszek Koltunski
    protected abstract DistortedObject deepCopy(int flags);
55 9361b337 Leszek Koltunski
56 6a06a912 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
57
58
    protected void initializeData(int size)
59
      {
60
      mID             = DistortedObjectList.add(this);
61
      mSize           = size;
62
      mTextureDataH   = new int[1];
63
      mTextureDataH[0]= 0;
64
      mBmp            = new Bitmap[1];
65
      mBmp[0]         = null;
66
      mBitmapSet      = new boolean[1];
67
      mBitmapSet[0]   = false;
68
      
69
      initializeEffectLists(this,0);
70
      
71
      if( Distorted.isInitialized() ) resetTexture();    
72
      }
73
    
74
///////////////////////////////////////////////////////////////////////////////////////////////////
75
    
76
    protected void initializeEffectLists(DistortedObject d, int flags)
77
      {
78 b3618cb5 Leszek Koltunski
      if( (flags & Distorted.CLONE_PRESHADER) != 0 )
79 6a06a912 Leszek Koltunski
        {
80
        mM = d.mM;
81
        matrixCloned = true;
82
        } 
83
      else
84
        {
85 d07f2950 Leszek Koltunski
        mM = new EffectQueueMatrix(d);
86 6a06a912 Leszek Koltunski
        matrixCloned = false;  
87
        }
88
    
89
      if( (flags & Distorted.CLONE_VERTEX) != 0 )
90
        {
91
        mV = d.mV;
92
        vertexCloned = true;
93
        } 
94
      else
95
        {
96 d07f2950 Leszek Koltunski
        mV = new EffectQueueVertex(d);
97 6a06a912 Leszek Koltunski
        vertexCloned = false;  
98
        }
99
    
100
      if( (flags & Distorted.CLONE_FRAGMENT) != 0 )
101
        {
102
        mF = d.mF;
103
        fragmentCloned = true;
104
        } 
105
      else
106
        {
107 d07f2950 Leszek Koltunski
        mF = new EffectQueueFragment(d);
108 6a06a912 Leszek Koltunski
        fragmentCloned = false;   
109
        }
110 b3618cb5 Leszek Koltunski
111 d07f2950 Leszek Koltunski
      mO= new EffectQueueOther(d); // Other effects are never cloned.
112 6a06a912 Leszek Koltunski
      }
113
    
114
///////////////////////////////////////////////////////////////////////////////////////////////////
115
// this will be called on startup and every time OpenGL context has been lost
116
// also call this from the constructor if the OpenGL context has been created already.
117
    
118
    void resetTexture()
119
      {
120
      if( mTextureDataH!=null ) 
121
        {
122
        if( mTextureDataH[0]==0 ) GLES20.glGenTextures(1, mTextureDataH, 0);
123
124
        GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mTextureDataH[0]);       
125
        GLES20.glTexParameteri ( GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR );
126
        GLES20.glTexParameteri ( GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR );
127
        GLES20.glTexParameteri ( GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE );
128
        GLES20.glTexParameteri ( GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE );
129
       
130
        if( mBmp!=null && mBmp[0]!=null)
131
          {
132
          GLUtils.texImage2D(GLES20.GL_TEXTURE_2D, 0, mBmp[0], 0);
133
          mBmp[0] = null;
134
          }
135
        }
136
      }
137
  
138
///////////////////////////////////////////////////////////////////////////////////////////////////
139
   
140
    void drawPriv(long currTime, DistortedProjection dp)
141
      {
142
      GLES20.glViewport(0, 0, dp.width, dp.height); 
143
      
144
      mM.compute(currTime);
145
      mM.send(mViewMatrix, dp);
146
      
147
      mV.compute(currTime);
148
      mV.postprocess();
149
      mV.send();
150
        
151
      mF.compute(currTime);
152
      mF.postprocess(mViewMatrix);
153
      mF.send();
154
       
155
      mGrid.draw();
156 b3618cb5 Leszek Koltunski
157 1e438fc7 Leszek Koltunski
      mO.send();
158 6a06a912 Leszek Koltunski
      }
159
160
///////////////////////////////////////////////////////////////////////////////////////////////////
161
   
162
    void drawNoEffectsPriv(DistortedProjection dp)
163
      {
164
      GLES20.glViewport(0, 0, dp.width, dp.height);
165
      mM.sendNoEffects(dp);
166
      mV.sendZero();
167
      mF.sendZero();
168
      mGrid.draw();
169
      }
170
    
171
///////////////////////////////////////////////////////////////////////////////////////////////////
172
   
173
    void releasePriv()
174
      {
175
      if( matrixCloned  ==false) mM.abortAll();
176
      if( vertexCloned  ==false) mV.abortAll();
177
      if( fragmentCloned==false) mF.abortAll();
178
179 1e438fc7 Leszek Koltunski
      mO.abortAll();
180 b3618cb5 Leszek Koltunski
181 6a06a912 Leszek Koltunski
      mBmp          = null;
182
      mGrid         = null;
183
      mM            = null;
184
      mV            = null;
185
      mF            = null;
186 1e438fc7 Leszek Koltunski
      mO            = null;
187 6a06a912 Leszek Koltunski
      mTextureDataH = null;
188
      }
189
 
190
///////////////////////////////////////////////////////////////////////////////////////////////////
191
192
    long getBitmapID()
193
      {
194
      return mBmp==null ? 0 : mBmp.hashCode();
195
      }
196
197 ada90d33 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
198
199
  /**
200
   * Default empty constructor so that derived classes can call it
201
   */
202
    public DistortedObject()
203
      {
204
205
      }
206
207
///////////////////////////////////////////////////////////////////////////////////////////////////
208
  /**
209
   * Copy constructor used to create a DistortedObject based on various parts of another object.
210
   * <p>
211
   * Whatever we do not clone gets created just like in the default constructor.
212 d07f2950 Leszek Koltunski
   * We only call this from the descendant's classes' constructors where we have to pay attention
213
   * to give it the appropriate type of a DistortedObject!
214 ada90d33 Leszek Koltunski
   *
215
   * @param dc    Source object to create our object from
216
   * @param flags A bitmask of values specifying what to copy.
217 d07f2950 Leszek Koltunski
   *              For example, CLONE_BITMAP | CLONE_MATRIX.
218 ada90d33 Leszek Koltunski
   */
219
    public DistortedObject(DistortedObject dc, int flags)
220
      {
221
      initializeEffectLists(dc,flags);
222
223
      mID = DistortedObjectList.add(this);
224
225
      mSizeX = dc.mSizeX;
226
      mSizeY = dc.mSizeY;
227
      mSizeZ = dc.mSizeZ;
228
      mSize  = dc.mSize;
229
      mGrid  = dc.mGrid;
230
231
      if( (flags & Distorted.CLONE_BITMAP) != 0 )
232
        {
233
        mTextureDataH = dc.mTextureDataH;
234
        mBmp          = dc.mBmp;
235
        mBitmapSet    = dc.mBitmapSet;
236
        }
237
      else
238
        {
239
        mTextureDataH   = new int[1];
240
        mTextureDataH[0]= 0;
241
        mBitmapSet      = new boolean[1];
242
        mBitmapSet[0]   = false;
243
        mBmp            = new Bitmap[1];
244
        mBmp[0]         = null;
245
246
        if( Distorted.isInitialized() ) resetTexture();
247
        }
248
      }
249
250 6a06a912 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
251
/**
252
 * Draw the DistortedObject to the location specified by current Matrix effects.    
253
 *     
254
 * @param currTime current time, in milliseconds, as returned by System.currentTimeMillis().
255
 *        This gets passed on to Interpolators inside the Effects that are currently applied to the 
256
 *        Object.
257
 */
258
   public void draw(long currTime)
259
     {
260
     GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
261
     GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, 0);
262
     GLES20.glUniform1i(Distorted.mTextureUniformH, 0);  
263
     GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mTextureDataH[0]); 
264
      
265
     drawPriv(currTime, Distorted.mProjection);
266
     }
267
 
268
///////////////////////////////////////////////////////////////////////////////////////////////////
269
/**
270
 * Releases all resources.
271
 */
272
   public synchronized void release()
273
     {
274
     releasePriv();  
275
     DistortedObjectList.remove(this);
276
     }
277
278
///////////////////////////////////////////////////////////////////////////////////////////////////
279
/**
280
 * Sets the underlying android.graphics.Bitmap object and uploads it to the GPU. 
281
 * <p>
282
 * You can only recycle() the passed Bitmap once the OpenGL context gets created (i.e. after call 
283
 * to onSurfaceCreated) because only after this point can the Library upload it to the GPU!
284
 * 
285
 * @param bmp The android.graphics.Bitmap object to apply effects to and display.
286
 */
287
   
288
   public void setBitmap(Bitmap bmp)
289
     {
290
     mBitmapSet[0] = true; 
291
      
292
     if( Distorted.isInitialized() )
293
       {
294
       GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
295
       GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mTextureDataH[0]);        
296
       GLUtils.texImage2D(GLES20.GL_TEXTURE_2D, 0, bmp, 0);
297
       }
298
     else
299
       {
300
       mBmp[0] = bmp;  
301
       }
302
     }
303
    
304
///////////////////////////////////////////////////////////////////////////////////////////////////
305
/**
306
 * Adds the calling class to the list of Listeners that get notified each time some event happens 
307
 * to one of the Effects that are currently applied to the DistortedBitmap.
308
 * 
309
 * @param el A class implementing the EffectListener interface that wants to get notifications.
310
 */
311
   public void addEventListener(EffectListener el)
312
     {
313
     mV.addListener(el);
314
     mF.addListener(el);
315
     mM.addListener(el);
316 1e438fc7 Leszek Koltunski
     mO.addListener(el);
317 6a06a912 Leszek Koltunski
     }
318
319
///////////////////////////////////////////////////////////////////////////////////////////////////
320
/**
321
 * Removes the calling class from the list of Listeners.
322
 * 
323
 * @param el A class implementing the EffectListener interface that no longer wants to get notifications.
324
 */
325
   public void removeEventListener(EffectListener el)
326
     {
327
     mV.removeListener(el);
328
     mF.removeListener(el);
329
     mM.removeListener(el);
330 1e438fc7 Leszek Koltunski
     mO.removeListener(el);
331 6a06a912 Leszek Koltunski
     }
332
   
333
///////////////////////////////////////////////////////////////////////////////////////////////////
334
/**
335
 * Returns the height of the DistortedObject.
336
 *    
337
 * @return height of the object, in pixels.
338
 */
339
   public int getWidth()
340
     {
341
     return mSizeX;   
342
     }
343
344
///////////////////////////////////////////////////////////////////////////////////////////////////
345
/**
346
 * Returns the width of the DistortedObject.
347
 * 
348
 * @return width of the Object, in pixels.
349
 */
350
    public int getHeight()
351
      {
352
      return mSizeY;  
353
      }
354
    
355
///////////////////////////////////////////////////////////////////////////////////////////////////
356
/**
357
 * Returns the depth of the DistortedObject.
358
 * 
359
 * @return depth of the Object, in pixels.
360
 */
361
    public int getDepth()
362
      {
363
      return mSizeZ;  
364
      }
365
        
366
///////////////////////////////////////////////////////////////////////////////////////////////////
367
/**
368
 * Returns unique ID of this instance.
369
 * 
370
 * @return ID of the object.
371
 */
372
    public long getID()
373
      {
374
      return mID;  
375
      }
376
    
377
///////////////////////////////////////////////////////////////////////////////////////////////////
378
/**
379 d07f2950 Leszek Koltunski
 * Aborts all Effects.
380
 * @return Number of effects aborted.
381 6a06a912 Leszek Koltunski
 */
382 d07f2950 Leszek Koltunski
    public int abortAllEffects()
383 6a06a912 Leszek Koltunski
      {
384 d07f2950 Leszek Koltunski
      return mM.abortAll() + mV.abortAll() + mF.abortAll() + mO.abortAll();
385 6a06a912 Leszek Koltunski
      }
386
387
///////////////////////////////////////////////////////////////////////////////////////////////////
388
/**
389 d07f2950 Leszek Koltunski
 * Aborts all Effects of a given type, for example all MATRIX Effects.
390 6a06a912 Leszek Koltunski
 * 
391 d07f2950 Leszek Koltunski
 * @param type one of the constants defined in {@link EffectTypes}
392
 * @return Number of effects aborted.
393 6a06a912 Leszek Koltunski
 */
394 d07f2950 Leszek Koltunski
    public int abortEffects(EffectTypes type)
395 6a06a912 Leszek Koltunski
      {
396 d07f2950 Leszek Koltunski
      switch(type)
397
        {
398
        case MATRIX  : return mM.abortAll();
399
        case VERTEX  : return mV.abortAll();
400
        case FRAGMENT: return mF.abortAll();
401
        case OTHER   : return mO.abortAll();
402
        default      : return 0;
403
        }
404 6a06a912 Leszek Koltunski
      }
405
    
406
///////////////////////////////////////////////////////////////////////////////////////////////////
407
/**
408
 * Aborts a single Effect.
409
 * 
410
 * @param id ID of the Effect we want to abort.
411 476bbc81 Leszek Koltunski
 * @return number of Effects aborted. Always either 0 or 1.
412 6a06a912 Leszek Koltunski
 */
413 476bbc81 Leszek Koltunski
    public int abortEffect(long id)
414 6a06a912 Leszek Koltunski
      {
415 1e438fc7 Leszek Koltunski
      int type = (int)(id&EffectTypes.MASK);
416
417 476bbc81 Leszek Koltunski
      if( type==EffectTypes.MATRIX.type   ) return mM.removeByID(id>>EffectTypes.LENGTH);
418
      if( type==EffectTypes.VERTEX.type   ) return mV.removeByID(id>>EffectTypes.LENGTH);
419
      if( type==EffectTypes.FRAGMENT.type ) return mF.removeByID(id>>EffectTypes.LENGTH);
420
      if( type==EffectTypes.OTHER.type    ) return mO.removeByID(id>>EffectTypes.LENGTH);
421 1e438fc7 Leszek Koltunski
422 476bbc81 Leszek Koltunski
      return 0;
423 6a06a912 Leszek Koltunski
      }
424
425
///////////////////////////////////////////////////////////////////////////////////////////////////
426
/**
427
 * Abort all Effects of a given type, for example all rotations.
428
 * 
429 d07f2950 Leszek Koltunski
 * @param name one of the constants defined in {@link EffectNames}
430 476bbc81 Leszek Koltunski
 * @return number of Effects aborted.
431 6a06a912 Leszek Koltunski
 */
432 476bbc81 Leszek Koltunski
    public int abortEffects(EffectNames name)
433 6a06a912 Leszek Koltunski
      {
434 d07f2950 Leszek Koltunski
      switch(name.getType())
435 6a06a912 Leszek Koltunski
        {
436 d07f2950 Leszek Koltunski
        case MATRIX  : return mM.removeByType(name);
437
        case VERTEX  : return mV.removeByType(name);
438
        case FRAGMENT: return mF.removeByType(name);
439
        case OTHER   : return mO.removeByType(name);
440 476bbc81 Leszek Koltunski
        default      : return 0;
441 6a06a912 Leszek Koltunski
        }
442
      }
443
    
444
///////////////////////////////////////////////////////////////////////////////////////////////////
445
/**
446
 * Print some info about a given Effect to Android's standard out. Used for debugging only.
447
 * 
448
 * @param id Effect ID we want to print info about
449
 * @return <code>true</code> if a single Effect of type effectType has been found.
450
 */
451
    
452
    public boolean printEffect(long id)
453
      {
454 1e438fc7 Leszek Koltunski
      int type = (int)(id&EffectTypes.MASK);
455
456
      if( type==EffectTypes.MATRIX.type   )  return mM.printByID(id>>EffectTypes.LENGTH);
457
      if( type==EffectTypes.VERTEX.type   )  return mV.printByID(id>>EffectTypes.LENGTH);
458
      if( type==EffectTypes.FRAGMENT.type )  return mF.printByID(id>>EffectTypes.LENGTH);
459
      if( type==EffectTypes.OTHER.type    )  return mO.printByID(id>>EffectTypes.LENGTH);
460
461
      return false;
462 6a06a912 Leszek Koltunski
      }
463
   
464
///////////////////////////////////////////////////////////////////////////////////////////////////   
465
///////////////////////////////////////////////////////////////////////////////////////////////////
466
// Individual effect functions.
467
///////////////////////////////////////////////////////////////////////////////////////////////////
468
// Matrix-based effects
469
///////////////////////////////////////////////////////////////////////////////////////////////////
470
// MOVE
471
/**
472
 * Moves the Object by a vector that changes in time as interpolated by the Interpolator.
473
 * 
474 e0a16874 Leszek Koltunski
 * @param vector 3-dimensional Interpolator which at any given time will return a Float3D
475
 *               representing the current coordinates of the vector we want to move the Object with.
476
 * @return       ID of the effect added, or -1 if we failed to add one.
477 6a06a912 Leszek Koltunski
 */
478 e0a16874 Leszek Koltunski
  public long move(Interpolator3D vector)
479 6a06a912 Leszek Koltunski
    {   
480 e0a16874 Leszek Koltunski
    return mM.add(EffectNames.MOVE,vector);
481 6a06a912 Leszek Koltunski
    }
482
483
///////////////////////////////////////////////////////////////////////////////////////////////////
484
/**
485 e0a16874 Leszek Koltunski
 * Moves the Object by a vector that smoothly changes from (0,0,0) to (x,y,z).
486 6a06a912 Leszek Koltunski
 *  
487 d7bbef2f Leszek Koltunski
 * @param x        The x-coordinate of the vector we want to move the Object with. 
488
 * @param y        The y-coordinate of the vector we want to move the Object with.
489
 * @param z        The z-coordinate of the vector we want to move the Object with.
490 6a06a912 Leszek Koltunski
 * @param duration The time, in milliseconds, it takes to complete the movement.
491 d7bbef2f Leszek Koltunski
 * @return         ID of the effect added, or -1 if we failed to add one. 
492 6a06a912 Leszek Koltunski
 */
493
  public long move(float x,float y,float z, int duration)
494
    {   
495
    Interpolator3D di = new Interpolator3D();  
496
    di.setCount(0.5f);
497
    di.setDuration(duration);
498
    di.add(new Float3D(0.0f,0.0f,0.0f));                             
499
    di.add(new Float3D(x,y,z));                        
500
501 e0a16874 Leszek Koltunski
    return mM.add(EffectNames.MOVE,di);
502 6a06a912 Leszek Koltunski
    }
503
504
///////////////////////////////////////////////////////////////////////////////////////////////////
505
/**
506 e0a16874 Leszek Koltunski
 * Moves the Object by vector (x,y,z) immediately.
507 6a06a912 Leszek Koltunski
 *   
508
 * @param x The x-coordinate of the vector we want to move the Object with. 
509
 * @param y The y-coordinate of the vector we want to move the Object with.
510
 * @param z The z-coordinate of the vector we want to move the Object with.
511 d7bbef2f Leszek Koltunski
 * @return  ID of the effect added, or -1 if we failed to add one. 
512 6a06a912 Leszek Koltunski
 */
513
  public long move(float x,float y,float z)
514
    {   
515 e0a16874 Leszek Koltunski
    return mM.add(EffectNames.MOVE,mZero3D,x,y,z,0.0f);
516 6a06a912 Leszek Koltunski
    }
517
518
///////////////////////////////////////////////////////////////////////////////////////////////////
519
// SCALE
520
/**
521
 * Scales the Object by factors that change in time as returned by the Interpolator.
522
 * 
523 e0a16874 Leszek Koltunski
 * @param scale 3-dimensional Interpolator which at any given time returns a Float3D
524
 *              representing the current x- , y- and z- scale factors.
525
 * @return      ID of the effect added, or -1 if we failed to add one.
526 6a06a912 Leszek Koltunski
 */
527 e0a16874 Leszek Koltunski
  public long scale(Interpolator3D scale)
528 6a06a912 Leszek Koltunski
    {   
529 e0a16874 Leszek Koltunski
    return mM.add(EffectNames.SCALE,scale);
530 6a06a912 Leszek Koltunski
    }
531
532
///////////////////////////////////////////////////////////////////////////////////////////////////
533
/**
534
 * Scales the Object by a factor that smoothly changes from (1,1,1) at time 0 to (xscale,yscale,zscale)
535
 * after 'duration' milliseconds. 
536
 *    
537 d7bbef2f Leszek Koltunski
 * @param xscale   After time 'duration' passes, Bitmap's width will get multiplied by xscale; e.g. if 
538
 *                 xscale=2, after 'duration' milliseconds the Object will become twice broader.
539
 * @param yscale   Factor to scale Object's height with.
540
 * @param zscale   Factor to scale Object's depth with.
541 6a06a912 Leszek Koltunski
 * @param duration Time, in milliseconds, it takes to interpolate to the full (xscale,yscale,zscale) scaling factors.
542 d7bbef2f Leszek Koltunski
 * @return         ID of the effect added, or -1 if we failed to add one. 
543 6a06a912 Leszek Koltunski
 */
544
  public long scale(float xscale,float yscale,float zscale, int duration)
545
    {   
546
    Interpolator3D di = new Interpolator3D();  
547
    di.setCount(0.5f);
548
    di.setDuration(duration);
549
    di.add(new Float3D(1.0f,1.0f,1.0f));                             
550
    di.add(new Float3D(xscale,yscale,zscale));                        
551
552 e0a16874 Leszek Koltunski
    return mM.add(EffectNames.SCALE,di);
553 6a06a912 Leszek Koltunski
    }
554
555
///////////////////////////////////////////////////////////////////////////////////////////////////
556
/**
557
 * Immediately scales the Object's width by (xscale,yscale,zscale).   
558
 *   
559
 * @param xscale Object's width gets multiplied by this factor; e.g. if 
560
 *               xscale=2, the Object immediately becomes twice broader.
561
 * @param yscale factor to scale Object's height with.
562
 * @param zscale factor to scale Object's depth with. 
563 d7bbef2f Leszek Koltunski
 * @return       ID of the effect added, or -1 if we failed to add one. 
564 6a06a912 Leszek Koltunski
 */
565
  public long scale(float xscale,float yscale,float zscale)
566
    {   
567 e0a16874 Leszek Koltunski
    return mM.add(EffectNames.SCALE,mZero3D,xscale,yscale,zscale,0.0f);
568 6a06a912 Leszek Koltunski
    }
569
570
///////////////////////////////////////////////////////////////////////////////////////////////////
571
/**
572
 * Convenience function - scale the Object by the same factor in all 3 dimensions.   
573
 *   
574 d7bbef2f Leszek Koltunski
 * @param scale all 3 Object's dimensions get multiplied by this factor; e.g. if 
575 6a06a912 Leszek Koltunski
 *              scale=2, the Object immediately becomes twice larger.
576 d7bbef2f Leszek Koltunski
 * @return      ID of the effect added, or -1 if we failed to add one. 
577 6a06a912 Leszek Koltunski
 */
578
  public long scale(float scale)
579
    {   
580 e0a16874 Leszek Koltunski
    return mM.add(EffectNames.SCALE,mZero3D,scale,scale,scale,0.0f);
581 6a06a912 Leszek Koltunski
    }
582
    
583
///////////////////////////////////////////////////////////////////////////////////////////////////
584
// ROTATE
585
/**
586
 * Rotates the Object around a (possibly moving) point, with angle and axis that change in time.
587
 * 
588 e0a16874 Leszek Koltunski
 * @param center    3-dimensional Interpolator which at any given time will return the current center
589
 *                  of the rotation
590
 * @param angleAxis 4-dimensional Interpolator which at any given time will return a Float4D
591
 *                  representing the current rotation in the (angle,axisX,axisY,axisY) form.
592
 * @return          ID of the effect added, or -1 if we failed to add one.
593 6a06a912 Leszek Koltunski
 */
594 e0a16874 Leszek Koltunski
  public long rotate(Interpolator3D center, Interpolator4D angleAxis)
595 6a06a912 Leszek Koltunski
    {   
596 e0a16874 Leszek Koltunski
    return mM.add(EffectNames.ROTATE, center, angleAxis);
597 6a06a912 Leszek Koltunski
    }
598
599
///////////////////////////////////////////////////////////////////////////////////////////////////  
600
/**
601
 * Rotates the Object around a static point, with angle and axis that change in time.
602
 * 
603 e0a16874 Leszek Koltunski
 * @param center    Center of the rotation
604
 * @param angleAxis 4-dimensional Interpolator which at any given time will return a Float4D
605
 *                  representing the current rotation in the (angle,axisX,axisY,axisY) form.
606
 * @return          ID of the effect added, or -1 if we failed to add one.
607 6a06a912 Leszek Koltunski
 */
608 e0a16874 Leszek Koltunski
  public long rotate(Float3D center, Interpolator4D angleAxis)
609 6a06a912 Leszek Koltunski
    {   
610 e0a16874 Leszek Koltunski
    return mM.add(EffectNames.ROTATE, center , angleAxis);
611 6a06a912 Leszek Koltunski
    }
612
  
613
///////////////////////////////////////////////////////////////////////////////////////////////////  
614
/**
615 d7bbef2f Leszek Koltunski
 * Rotates the Object around a static point, with angle that changes in time, around axis 
616
 * (axisX, axisY, axisZ). 
617 6a06a912 Leszek Koltunski
 * 
618 e0a16874 Leszek Koltunski
 * @param center Center of the rotation
619
 * @param angle  1-dimensional Interpolator which at any given time will return the current rotation
620
 *               angle.
621
 * @param axisX  Rotation vector: x-coordinate
622
 * @param axisY  Rotation vector: y-coordinate
623
 * @param axisZ  Rotation vector: z-coordinate
624
 * @return       ID of the effect added, or -1 if we failed to add one.
625
 */
626
  public long rotate(Float3D center, Interpolator1D angle, float axisX, float axisY, float axisZ)
627 6a06a912 Leszek Koltunski
    {   
628 e0a16874 Leszek Koltunski
    return mM.add(EffectNames.ROTATE, center , angle, axisX, axisY, axisZ);
629 6a06a912 Leszek Koltunski
    }
630
  
631
///////////////////////////////////////////////////////////////////////////////////////////////////
632
/**
633
 * Rotates the Object around a (possibly moving) point, with angle that changes in time.
634
 * Axis of rotation is the vector (0,0,1), i.e. a vector normal to the screen surface.
635
 * 
636 e0a16874 Leszek Koltunski
 * @param center 3-dimensional Interpolator which at any given time will return the current center
637
 *               of the rotation.
638
 * @param angle  1-dimensional Interpolator which returns the current rotation angle.
639
 * @return       ID of the effect added, or -1 if we failed to add one.
640 6a06a912 Leszek Koltunski
 */
641 e0a16874 Leszek Koltunski
  public long rotate(Interpolator3D center, Interpolator1D angle)
642 6a06a912 Leszek Koltunski
    {   
643 e0a16874 Leszek Koltunski
    return mM.add(EffectNames.ROTATE, center, angle, 0.0f,0.0f,1.0f);
644 6a06a912 Leszek Koltunski
    }
645
646
///////////////////////////////////////////////////////////////////////////////////////////////////
647
/**
648
 * Rotates the Object around a constant point, with angle that changes in time.  
649
 * Axis of rotation is the vector (0,0,1), i.e. a vector normal to the screen surface.
650
 *   
651 e0a16874 Leszek Koltunski
 * @param center   Coordinates of the Point we are rotating around.
652 d7bbef2f Leszek Koltunski
 * @param angle    Angle that we want to rotate the Bitmap to. Unit: degrees
653 6a06a912 Leszek Koltunski
 * @param duration Time, in milliseconds, it takes to complete one rotation from 0 to 'angle' degrees.
654 d7bbef2f Leszek Koltunski
 * @return         ID of the effect added, or -1 if we failed to add one. 
655 6a06a912 Leszek Koltunski
 */
656 e0a16874 Leszek Koltunski
  public long rotate(Float3D center, int angle, int duration)
657 6a06a912 Leszek Koltunski
    {   
658
    Interpolator1D di = new Interpolator1D();  
659
    di.setCount(0.5f);
660
    di.setDuration(duration);
661
    di.add(new Float1D(    0));                             
662
    di.add(new Float1D(angle));                        
663
664 e0a16874 Leszek Koltunski
    return mM.add(EffectNames.ROTATE, center, di, 0.0f,0.0f,1.0f);
665 6a06a912 Leszek Koltunski
    }
666
667
///////////////////////////////////////////////////////////////////////////////////////////////////
668
/**
669
 * Rotates the Object immediately by 'angle' degrees around point p.   
670
 * Axis of rotation is given by the last 3 floats.
671
 *   
672 e0a16874 Leszek Koltunski
 * @param center Coordinates of the Point we are rotating around.
673
 * @param angle  Angle that we want to rotate the Bitmap to. Unit: degrees
674
 * @param axisX  Axis of rotation: x-coordinate
675
 * @param axisY  Axis of rotation: y-coordinate
676
 * @param axisZ  Axis of rotation: z-coordinate
677
 * @return       ID of the effect added, or -1 if we failed to add one.
678
 */
679
  public long rotate(Float3D center, float angle, float axisX, float axisY, float axisZ)
680 6a06a912 Leszek Koltunski
    {   
681 e0a16874 Leszek Koltunski
    return mM.add(EffectNames.ROTATE, center, angle, axisX, axisY, axisZ);
682 6a06a912 Leszek Koltunski
    }
683
  
684
///////////////////////////////////////////////////////////////////////////////////////////////////
685
/**
686
 * Rotates the Object immediately by 'angle' degrees around point p.   
687
 *   
688 e0a16874 Leszek Koltunski
 * @param center Coordinates of the Point we are rotating around.
689 d7bbef2f Leszek Koltunski
 * @param angle  The angle that we want to rotate the Bitmap to. Unit: degrees
690 6a06a912 Leszek Koltunski
 * @return       ID of the effect added, or -1 if we failed to add one. 
691
 */
692 e0a16874 Leszek Koltunski
  public long rotate(Float3D center, int angle)
693 6a06a912 Leszek Koltunski
    {   
694 e0a16874 Leszek Koltunski
    return mM.add(EffectNames.ROTATE, center, angle,0.0f,0.0f,1.0f);
695 6a06a912 Leszek Koltunski
    }
696
697
///////////////////////////////////////////////////////////////////////////////////////////////////
698
// QUATERNION
699
/**
700
 * Rotates the Object immediately by quaternion (qX,qY,qZ,qW).
701
 *   
702 e0a16874 Leszek Koltunski
 * @param center Coordinates of the Point we are rotating around.
703
 * @param qX     Quaternion: x-coordinate
704
 * @param qY     Quaternion: y-coordinate
705
 * @param qZ     Quaternion: z-coordinate
706
 * @param qW     Quaternion: w-coordinate
707
 * @return       ID of the effect added, or -1 if we failed to add one.
708
 */
709
  public long quaternion(Float3D center, float qX, float qY, float qZ, float qW)
710 6a06a912 Leszek Koltunski
    {   
711 e0a16874 Leszek Koltunski
    return mM.add(EffectNames.QUATERNION,center,qX,qY,qZ,qW);
712 6a06a912 Leszek Koltunski
    }
713
714
///////////////////////////////////////////////////////////////////////////////////////////////////
715
/**
716
 * Rotates the Object by a quaternion that's at the moment returned by the InterpolatorQuat.
717
 *   
718 e0a16874 Leszek Koltunski
 * @param center Coordinates of the Point we are rotating around.
719
 * @param quat   Interpolator that's going to, at any given moment, return a quaternion.
720
 * @return       ID of the effect added, or -1 if we failed to add one.
721 6a06a912 Leszek Koltunski
 */
722 e0a16874 Leszek Koltunski
  public long quaternion(Float3D center, InterpolatorQuat quat)
723 6a06a912 Leszek Koltunski
    {   
724 e0a16874 Leszek Koltunski
    return mM.add(EffectNames.QUATERNION, center, quat);
725 6a06a912 Leszek Koltunski
    }
726
727
///////////////////////////////////////////////////////////////////////////////////////////////////
728
/**
729
 * Rotates the Object around a moving point by a quaternion that's at the moment returned by the InterpolatorQuat.
730
 *   
731 e0a16874 Leszek Koltunski
 * @param center Interpolator that returns the current center of rotation.
732
 * @param quat   Interpolator that's going to, at any given moment, return a quaternion representing
733
 *               the current rotation.
734
 * @return       ID of the effect added, or -1 if we failed to add one.
735 6a06a912 Leszek Koltunski
 */
736 e0a16874 Leszek Koltunski
  public long quaternion(Interpolator3D center, InterpolatorQuat quat)
737 6a06a912 Leszek Koltunski
    {   
738 e0a16874 Leszek Koltunski
    return mM.add(EffectNames.QUATERNION,center,quat);
739 6a06a912 Leszek Koltunski
    }
740
  
741
///////////////////////////////////////////////////////////////////////////////////////////////////
742
// SHEAR
743
/**
744
 * Shears the Object. If the Interpolator is 1D, it will shear along the X-axis. 2D Interpolator adds
745
 * shearing along the Y-axis, 3D one along Z axis.
746
 *
747 e0a16874 Leszek Koltunski
 * @param center  Center of shearing, i.e. the point which stays unmoved.
748
 * @param shear   1- 2- or 3D Interpolator which, at any given point, returns the ordered 1-, 2-
749
 *                or 3-tuple of shear factors.
750
 * @return        ID of the effect added, or -1 if we failed to add one.
751 6a06a912 Leszek Koltunski
 */
752 e0a16874 Leszek Koltunski
  public long shear(Float3D center, Interpolator shear)
753 6a06a912 Leszek Koltunski
    {
754 e0a16874 Leszek Koltunski
    return mM.add(EffectNames.SHEAR, center, shear);
755 6a06a912 Leszek Koltunski
    }
756
757
///////////////////////////////////////////////////////////////////////////////////////////////////
758
/**
759
 * Shears the Object in 3D. Order: first X shearing, then Y, then Z.
760
 * 
761 e0a16874 Leszek Koltunski
 * @param center Center of shearing, i.e. the point which stays unmoved.
762
 * @param shear  ordered 3-tuple (x-degree, y-degree, z-degree) of shearing (tangent of the angle with
763 d7bbef2f Leszek Koltunski
 *               which the X,Y and Z axis get slanted) 
764
 * @return       ID of the effect added, or -1 if we failed to add one. 
765 6a06a912 Leszek Koltunski
 */
766 e0a16874 Leszek Koltunski
  public long shear(Float3D center, Float3D shear)
767 6a06a912 Leszek Koltunski
    {
768
    Interpolator3D di = new Interpolator3D(); 
769
    di.setCount(0.5f);
770
    di.setDuration(0);
771
    di.add(new Float3D(0.0f,0.0f,0.0f));              
772 e0a16874 Leszek Koltunski
    di.add(shear);
773 6a06a912 Leszek Koltunski
        
774 e0a16874 Leszek Koltunski
    return mM.add(EffectNames.SHEAR, center, di );
775 6a06a912 Leszek Koltunski
    }
776
777
///////////////////////////////////////////////////////////////////////////////////////////////////
778
// Fragment-based effects  
779
///////////////////////////////////////////////////////////////////////////////////////////////////
780
// MACROBLOCK
781
/**
782
 * Creates macroblocks at and around point defined by the Interpolator2D and the Region. 
783
 * Size of the macroblocks at any given time is returned by the Interpolator1D.
784
 * 
785 e0a16874 Leszek Koltunski
 * @param size   1-dimensional Interpolator which, at any given time, returns the size of the macroblocks.
786 d7bbef2f Leszek Koltunski
 * @param region Region this Effect is limited to.
787
 *               Null here means 'apply the effect to the whole Bitmap'.
788 e0a16874 Leszek Koltunski
 * @param center 2-dimensional Interpolator which, at any given time, returns a Float2D representing the
789 d7bbef2f Leszek Koltunski
 *               current center of the effect.
790
 * @return       ID of the effect added, or -1 if we failed to add one. 
791 6a06a912 Leszek Koltunski
 */
792 e0a16874 Leszek Koltunski
  public long macroblock(Interpolator1D size, Float4D region, Interpolator2D center)
793 6a06a912 Leszek Koltunski
    {
794 e0a16874 Leszek Koltunski
    return mF.add(EffectNames.MACROBLOCK, size, region, center);
795 6a06a912 Leszek Koltunski
    }
796
797
///////////////////////////////////////////////////////////////////////////////////////////////////
798
/**
799
 * Creates macroblocks at and around point defined by the Point2D and the Region. 
800
 * Size of the macroblocks at any given time is returned by the Interpolator1D.
801
 * <p>
802
 * The difference between this and the previous method is that here the center of the Effect stays constant.
803
 *    
804 e0a16874 Leszek Koltunski
 * @param size   1-dimensional Interpolator which, at any given time, returns the size of the macroblocks.
805 d7bbef2f Leszek Koltunski
 * @param region Region this Effect is limited to. 
806
 *               Null here means 'apply the effect to the whole Bitmap'.
807 e0a16874 Leszek Koltunski
 * @param center Center of the Effect.
808 d7bbef2f Leszek Koltunski
 * @return       ID of the effect added, or -1 if we failed to add one. 
809 6a06a912 Leszek Koltunski
 */
810 e0a16874 Leszek Koltunski
  public long macroblock(Interpolator1D size, Float4D region, Float2D center)
811 6a06a912 Leszek Koltunski
    {
812 e0a16874 Leszek Koltunski
    return mF.add(EffectNames.MACROBLOCK, size, region, center);
813 6a06a912 Leszek Koltunski
    }
814
  
815
///////////////////////////////////////////////////////////////////////////////////////////////////
816
/**
817
 * Creates macroblocks at and around point defined by the Interpolator2D and the Region. 
818
 * <p>
819
 * The macroblocks change in size; at time 0 there are none, and after 'duration/2' milliseconds 
820
 * they are of (pixels X pixels) size; after 'duration' milliseconds there are again none (i.e. their
821
 * size is 1X1, i.e. 1 pixel).   
822
 * 
823 d7bbef2f Leszek Koltunski
 * @param pixels   Maximum size, in pixels, of the Macroblocks we want to see.
824
 * @param region   Region this Effect is limited to. 
825
 *                 Null here means 'apply the effect to the whole Bitmap'.
826 e0a16874 Leszek Koltunski
 * @param center   2-dimensional Interpolator which, at any given time, returns a Float2D representing the
827 d7bbef2f Leszek Koltunski
 *                 current center of the effect.
828 6a06a912 Leszek Koltunski
 * @param duration Time, in milliseconds, it takes to do one full interpolation.
829 d7bbef2f Leszek Koltunski
 * @param count    Controls how many interpolations we want to do. See {@link Interpolator#setCount(float)}
830
 * @return         ID of the effect added, or -1 if we failed to add one. 
831 6a06a912 Leszek Koltunski
 */
832 e0a16874 Leszek Koltunski
  public long macroblock(int pixels, Float4D region, Interpolator2D center, int duration, float count)
833 6a06a912 Leszek Koltunski
    {
834
    Interpolator1D di = new Interpolator1D();
835
    di.setCount(count);
836
    di.setDuration(duration);
837
    di.add(new Float1D(1));                             
838
    di.add(new Float1D(pixels));                        
839
840 e0a16874 Leszek Koltunski
    return mF.add(EffectNames.MACROBLOCK, di, region, center);
841 6a06a912 Leszek Koltunski
    }
842
843
///////////////////////////////////////////////////////////////////////////////////////////////////
844
/**
845
 * Creates macroblocks at and around point defined by the Point2D and the Region. 
846
 * <p>
847
 * The macroblocks change in size; at time 0 there are none, and after 'duration/2' milliseconds 
848
 * they are of (pixels X pixels) size; after 'duration' milliseconds there are again none (i.e. their
849
 * size is 1X1, i.e. 1 pixel).   
850
 * <p>
851
 * The difference between this and the previous method is that here the center of the Effect stays constant.
852
 *    
853 d7bbef2f Leszek Koltunski
 * @param pixels   Maximum size, in pixels, of the Macroblocks we want to see.
854
 * @param region   Region this Effect is limited to. 
855
 *                 Null here means 'apply the effect to the whole Bitmap'.
856 e0a16874 Leszek Koltunski
 * @param center   Center of the Effect.
857 6a06a912 Leszek Koltunski
 * @param duration Time, in milliseconds, it takes to do one full interpolation.
858 d7bbef2f Leszek Koltunski
 * @param count    Controls how many interpolations we want to do. See {@link Interpolator#setCount(float)}
859
 * @return         ID of the effect added, or -1 if we failed to add one. 
860 6a06a912 Leszek Koltunski
 */
861 e0a16874 Leszek Koltunski
  public long macroblock(int pixels, Float4D region, Float2D center, int duration, float count)
862 6a06a912 Leszek Koltunski
    {
863
    Interpolator1D di = new Interpolator1D();
864
    di.setCount(count);
865
    di.setDuration(duration);
866
    di.add(new Float1D(1));                             
867
    di.add(new Float1D(pixels));                        
868
869 e0a16874 Leszek Koltunski
    return mF.add(EffectNames.MACROBLOCK, di, region, center);
870 6a06a912 Leszek Koltunski
    }
871
872
///////////////////////////////////////////////////////////////////////////////////////////////////
873
/**
874 e0a16874 Leszek Koltunski
 * Creates macroblocks on the whole Object.
875 6a06a912 Leszek Koltunski
 * <p>
876
 * The macroblocks change in size; at time 0 there are none, and after 'duration/2' milliseconds 
877
 * they are of (pixels X pixels) size; after 'duration' milliseconds there are again none (i.e. their
878
 * size is 1X1, i.e. 1 pixel).   
879
 * <p>
880
 * The difference between this and the previous method is that here there is no masking Region; thus
881
 * there is also no center of the Effect. 
882
 *    
883 d7bbef2f Leszek Koltunski
 * @param pixels   Maximum size, in pixels, of the Macroblocks we want to see.
884 6a06a912 Leszek Koltunski
 * @param duration Time, in milliseconds, it takes to do one full interpolation.
885 d7bbef2f Leszek Koltunski
 * @param count    Controls how many interpolations we want to do. See {@link Interpolator#setCount(float)}
886
 * @return         ID of the effect added, or -1 if we failed to add one. 
887 6a06a912 Leszek Koltunski
 */
888
  public long macroblock(int pixels, int duration, float count) 
889
    {
890
    Interpolator1D di = new Interpolator1D(); 
891
    di.setCount(count);
892
    di.setDuration(duration);
893
    di.add(new Float1D(1));                            
894
    di.add(new Float1D(pixels));                        
895
   
896 e0a16874 Leszek Koltunski
    return mF.add(EffectNames.MACROBLOCK, di, null, mZero2D);
897 6a06a912 Leszek Koltunski
    }
898
899
///////////////////////////////////////////////////////////////////////////////////////////////////
900
///////////////////////////////////////////////////////////////////////////////////////////////////
901
// CHROMA
902
/**
903 e0a16874 Leszek Koltunski
 * Makes a certain sub-region of the Object smoothly change all three of its RGB components.
904 6a06a912 Leszek Koltunski
 *        
905 e0a16874 Leszek Koltunski
 * @param blend  1-dimensional Interpolator that returns the level of blend a given pixel will be
906 d7bbef2f Leszek Koltunski
 *               mixed with the next parameter 'color': pixel = (1-level)*pixel + level*color
907 b1e91f2c Leszek Koltunski
 * @param color  Color to mix. (1,0,0) is RED.
908 d7bbef2f Leszek Koltunski
 * @param region Region this Effect is limited to. 
909
 *               Null here means 'apply the Effect to the whole Bitmap'.
910 e0a16874 Leszek Koltunski
 * @param center 2-dimensional Interpolator which, at any given time, returns a Float2D representing
911 d7bbef2f Leszek Koltunski
 *               the current center of the effect.
912
 * @return       ID of the effect added, or -1 if we failed to add one. 
913 6a06a912 Leszek Koltunski
 */
914 e0a16874 Leszek Koltunski
  public long chroma(Interpolator1D blend, Float3D color, Float4D region, Interpolator2D center)
915 6a06a912 Leszek Koltunski
    {
916 e0a16874 Leszek Koltunski
    return mF.add(EffectNames.CHROMA, blend, color, region, center);
917 6a06a912 Leszek Koltunski
    }
918
919
///////////////////////////////////////////////////////////////////////////////////////////////////
920
/**
921 e0a16874 Leszek Koltunski
 * Makes a certain sub-region of the Object smoothly change all three of its RGB components.
922 6a06a912 Leszek Koltunski
 * <p>
923
 * Here the center of the Effect stays constant.
924
 *         
925 e0a16874 Leszek Koltunski
 * @param blend  1-dimensional Interpolator that returns the level of blend a given pixel will be
926 d7bbef2f Leszek Koltunski
 *               mixed with the next parameter 'color': pixel = (1-level)*pixel + level*color
927 b1e91f2c Leszek Koltunski
 * @param color  Color to mix. (1,0,0) is RED.
928 d7bbef2f Leszek Koltunski
 * @param region Region this Effect is limited to. 
929
 *               Null here means 'apply the Effect to the whole Bitmap'.
930 e0a16874 Leszek Koltunski
 * @param center Center of the Effect.
931 d7bbef2f Leszek Koltunski
 * @return       ID of the effect added, or -1 if we failed to add one. 
932 6a06a912 Leszek Koltunski
 */
933 e0a16874 Leszek Koltunski
  public long chroma(Interpolator1D blend, Float3D color, Float4D region, Float2D center)
934 6a06a912 Leszek Koltunski
    {
935 e0a16874 Leszek Koltunski
    return mF.add(EffectNames.CHROMA, blend, color, region, center);
936 6a06a912 Leszek Koltunski
    }
937
938
///////////////////////////////////////////////////////////////////////////////////////////////////  
939
/**
940 e0a16874 Leszek Koltunski
 * Makes a certain sub-region of the Object smoothly change all three of its RGB components.
941 6a06a912 Leszek Koltunski
 *        
942 e0a16874 Leszek Koltunski
 * @param blend  Level of blend a given pixel will be mixed with the next parameter 'color':
943 d7bbef2f Leszek Koltunski
 *               pixel = (1-t)*pixel + t*color
944 b1e91f2c Leszek Koltunski
 * @param color  Color to mix. (1,0,0) is RED.
945 d7bbef2f Leszek Koltunski
 * @param region Region this Effect is limited to.
946
 *               Null here means 'apply the Effect to the whole Bitmap'.
947 e0a16874 Leszek Koltunski
 * @param center 2-dimensional Interpolator which, at any given time, returns a Float2D representing the
948 d7bbef2f Leszek Koltunski
 *               current center of the effect.
949
 * @return       ID of the effect added, or -1 if we failed to add one. 
950 6a06a912 Leszek Koltunski
 */
951 e0a16874 Leszek Koltunski
  public long chroma(float blend, Float3D color, Float4D region, Interpolator2D center)
952 6a06a912 Leszek Koltunski
    {
953 e0a16874 Leszek Koltunski
    return mF.add(EffectNames.CHROMA, blend, color, region, center);
954 6a06a912 Leszek Koltunski
    }
955
956 d7bbef2f Leszek Koltunski
///// //////////////////////////////////////////////////////////////////////////////////////////////
957 6a06a912 Leszek Koltunski
/**
958 e0a16874 Leszek Koltunski
 * Makes a certain sub-region of the Object smoothly change all three of its RGB components.
959 6a06a912 Leszek Koltunski
 * <p>
960
 * Here the center of the Effect stays constant.
961
 *         
962 e0a16874 Leszek Koltunski
 * @param blend  Level of blend a given pixel will be mixed with the next parameter 'color':
963 d7bbef2f Leszek Koltunski
 *               pixel = (1-t)*pixel + t*color
964 b1e91f2c Leszek Koltunski
 * @param color  Color to mix. (1,0,0) is RED.
965 d7bbef2f Leszek Koltunski
 * @param region The Region this Effect is limited to. 
966
 *               Null here means 'apply the Effect to the whole Bitmap'.
967 e0a16874 Leszek Koltunski
 * @param center Center of the Effect.
968 d7bbef2f Leszek Koltunski
 * @return       ID of the effect added, or -1 if we failed to add one. 
969 6a06a912 Leszek Koltunski
 */
970 e0a16874 Leszek Koltunski
  public long chroma(float blend, Float3D color, Float4D region, Float2D center)
971 6a06a912 Leszek Koltunski
    {
972 e0a16874 Leszek Koltunski
    return mF.add(EffectNames.CHROMA, blend, color, region, center);
973 6a06a912 Leszek Koltunski
    }
974
975
///////////////////////////////////////////////////////////////////////////////////////////////////
976
/**
977 e0a16874 Leszek Koltunski
 * Makes a certain sub-region of the Object smoothly change all three of its RGB components.
978 6a06a912 Leszek Koltunski
 * <p>
979
 * Here the Effect applies to the whole bitmap.
980
 *         
981 e0a16874 Leszek Koltunski
 * @param blend Level of blend a given pixel will be mixed with the next parameter 'color':
982 d7bbef2f Leszek Koltunski
 *              pixel = (1-t)*pixel + t*color
983 b1e91f2c Leszek Koltunski
 * @param color Color to mix. (1,0,0) is RED.
984 d7bbef2f Leszek Koltunski
 * @return      ID of the effect added, or -1 if we failed to add one. 
985 6a06a912 Leszek Koltunski
 */
986 e0a16874 Leszek Koltunski
  public long chroma(float blend, Float3D color)
987 6a06a912 Leszek Koltunski
    {
988 e0a16874 Leszek Koltunski
    return mF.add(EffectNames.CHROMA, blend, color, null, mZero2D);
989 6a06a912 Leszek Koltunski
    }
990
991
///////////////////////////////////////////////////////////////////////////////////////////////////  
992
/**
993 e0a16874 Leszek Koltunski
 * Makes a certain sub-region of the Object smoothly change all three of its RGB components.
994 6a06a912 Leszek Koltunski
 * 
995
 * See {@link #chroma(Interpolator1D, Float3D, Float4D, Interpolator2D)}
996
 */
997 e0a16874 Leszek Koltunski
  public long smooth_chroma(Interpolator1D blend, Float3D color, Float4D region, Interpolator2D center)
998 6a06a912 Leszek Koltunski
    {
999 e0a16874 Leszek Koltunski
    return mF.add(EffectNames.SMOOTH_CHROMA, blend, color, region, center);
1000 6a06a912 Leszek Koltunski
    }
1001
1002
///////////////////////////////////////////////////////////////////////////////////////////////////
1003
/**
1004 e0a16874 Leszek Koltunski
 * Makes a certain sub-region of the Object smoothly change all three of its RGB components.
1005 6a06a912 Leszek Koltunski
 * 
1006
 * See {@link #chroma(Interpolator1D, Float3D, Float4D, Float2D)}
1007
 */
1008 e0a16874 Leszek Koltunski
  public long smooth_chroma(Interpolator1D blend, Float3D color, Float4D region, Float2D center)
1009 6a06a912 Leszek Koltunski
    {
1010 e0a16874 Leszek Koltunski
    return mF.add(EffectNames.SMOOTH_CHROMA, blend, color, region, center);
1011 6a06a912 Leszek Koltunski
    }
1012
  
1013
///////////////////////////////////////////////////////////////////////////////////////////////////  
1014
/**
1015 e0a16874 Leszek Koltunski
 * Makes a certain sub-region of the Object smoothly change all three of its RGB components.
1016 6a06a912 Leszek Koltunski
 * 
1017
 * See {@link #chroma(float, Float3D, Float4D, Interpolator2D)}
1018
 */
1019 e0a16874 Leszek Koltunski
  public long smooth_chroma(float blend, Float3D color, Float4D region, Interpolator2D center)
1020 6a06a912 Leszek Koltunski
    {
1021 e0a16874 Leszek Koltunski
    return mF.add(EffectNames.SMOOTH_CHROMA, blend, color, region, center);
1022 6a06a912 Leszek Koltunski
    }
1023
1024
///////////////////////////////////////////////////////////////////////////////////////////////////
1025
/**
1026 e0a16874 Leszek Koltunski
 * Makes a certain sub-region of the Object smoothly change all three of its RGB components.
1027 6a06a912 Leszek Koltunski
 * 
1028
 * See {@link #chroma(float, Float3D, Float4D, Float2D)}
1029
 */
1030 e0a16874 Leszek Koltunski
  public long smooth_chroma(float blend, Float3D color, Float4D region, Float2D center)
1031 6a06a912 Leszek Koltunski
    {
1032 e0a16874 Leszek Koltunski
    return mF.add(EffectNames.SMOOTH_CHROMA, blend, color, region, center);
1033 6a06a912 Leszek Koltunski
    }
1034
  
1035
///////////////////////////////////////////////////////////////////////////////////////////////////
1036
/**
1037 e0a16874 Leszek Koltunski
 * Makes a certain sub-region of the Object smoothly change all three of its RGB components.
1038 6a06a912 Leszek Koltunski
 * 
1039
 * See {@link #chroma(float, Float3D)}
1040
 */
1041 e0a16874 Leszek Koltunski
  public long smooth_chroma(float blend, Float3D color)
1042 6a06a912 Leszek Koltunski
    {
1043 e0a16874 Leszek Koltunski
    return mF.add(EffectNames.SMOOTH_CHROMA, blend, color, null, mZero2D);
1044 6a06a912 Leszek Koltunski
    }
1045
  
1046
///////////////////////////////////////////////////////////////////////////////////////////////////
1047
///////////////////////////////////////////////////////////////////////////////////////////////////
1048
// ALPHA
1049
/**
1050 e0a16874 Leszek Koltunski
 * Makes a certain sub-region of the Object smoothly change its transparency level.
1051 6a06a912 Leszek Koltunski
 *        
1052 e0a16874 Leszek Koltunski
 * @param alpha  1-dimensional Interpolator that returns the level of transparency we want to have at any given
1053 d7bbef2f Leszek Koltunski
 *               moment.
1054
 * @param region Region this Effect is limited to. 
1055 e0a16874 Leszek Koltunski
 *               Null here means 'apply the Effect to the whole Object'.
1056
 * @param center 2-dimensional Interpolator which, at any given time, returns a Float2D representing the
1057 d7bbef2f Leszek Koltunski
 *               current center of the effect.
1058
 * @return       ID of the effect added, or -1 if we failed to add one. 
1059 6a06a912 Leszek Koltunski
 */
1060 e0a16874 Leszek Koltunski
  public long alpha(Interpolator1D alpha, Float4D region, Interpolator2D center)
1061 6a06a912 Leszek Koltunski
    {
1062 e0a16874 Leszek Koltunski
    return mF.add(EffectNames.ALPHA, alpha, region, center);
1063 6a06a912 Leszek Koltunski
    }
1064
1065
///////////////////////////////////////////////////////////////////////////////////////////////////
1066
/**
1067 e0a16874 Leszek Koltunski
 * Makes a certain sub-region of the Object smoothly change its transparency level.
1068 6a06a912 Leszek Koltunski
 * <p>
1069
 * Here the center of the Effect stays constant.
1070
 *         
1071 e0a16874 Leszek Koltunski
 * @param alpha  1-dimensional Interpolator that returns the level of transparency we want to have at any given
1072 d7bbef2f Leszek Koltunski
 *               moment.
1073
 * @param region Region this Effect is limited to. 
1074 e0a16874 Leszek Koltunski
 *               Null here means 'apply the Effect to the whole Object'.
1075
 * @param center Center of the Effect.
1076 d7bbef2f Leszek Koltunski
 * @return       ID of the effect added, or -1 if we failed to add one. 
1077 6a06a912 Leszek Koltunski
 */
1078 e0a16874 Leszek Koltunski
  public long alpha(Interpolator1D alpha, Float4D region, Float2D center)
1079 6a06a912 Leszek Koltunski
    {
1080 e0a16874 Leszek Koltunski
    return mF.add(EffectNames.ALPHA, alpha, region, center);
1081 6a06a912 Leszek Koltunski
    }
1082
1083
///////////////////////////////////////////////////////////////////////////////////////////////////  
1084
/**
1085 e0a16874 Leszek Koltunski
 * Makes a certain sub-region of the Object smoothly change its transparency level.
1086 6a06a912 Leszek Koltunski
 *        
1087 d7bbef2f Leszek Koltunski
 * @param alpha  Level of Alpha (between 0 and 1) we want to interpolate to.
1088
 * @param region Region this Effect is limited to. 
1089 e0a16874 Leszek Koltunski
 *               Null here means 'apply the Effect to the whole Object'.
1090
 * @param center 2-dimensional Interpolator which, at any given time, returns a Float2D representing the
1091 d7bbef2f Leszek Koltunski
 *               current center of the effect.
1092 6a06a912 Leszek Koltunski
 * @param duration Time, in milliseconds, it takes to do one full interpolation.
1093 d7bbef2f Leszek Koltunski
 * @param count  Controls how many interpolations we want to do. See {@link Interpolator#setCount(float)}
1094
 * @return       ID of the effect added, or -1 if we failed to add one. 
1095 6a06a912 Leszek Koltunski
 */
1096 e0a16874 Leszek Koltunski
  public long alpha(float alpha, Float4D region, Interpolator2D center, int duration, float count)
1097 6a06a912 Leszek Koltunski
    {
1098
    Interpolator1D di = new Interpolator1D(); 
1099
    di.setCount(count);
1100
    di.setDuration(duration);
1101
    di.add(new Float1D(1));                          
1102
    di.add(new Float1D(alpha));                         
1103
   
1104 e0a16874 Leszek Koltunski
    return mF.add(EffectNames.ALPHA, di, region, center);
1105 6a06a912 Leszek Koltunski
    }
1106
1107
///////////////////////////////////////////////////////////////////////////////////////////////////
1108
/**
1109 e0a16874 Leszek Koltunski
 * Makes a certain sub-region of the Object smoothly change its transparency level.
1110 6a06a912 Leszek Koltunski
 * <p>
1111
 * Here the center of the Effect stays constant.
1112
 *         
1113 e0a16874 Leszek Koltunski
 * @param alpha    Level of Alpha (between 0 and 1) we want to interpolate to.
1114
 * @param region   Region this Effect is limited to.
1115
 *                 Null here means 'apply the Effect to the whole Object'.
1116
 * @param center   Center of the Effect.
1117 6a06a912 Leszek Koltunski
 * @param duration Time, in milliseconds, it takes to do one full interpolation.
1118 e0a16874 Leszek Koltunski
 * @param count    Controls how many interpolations we want to do. See {@link Interpolator#setCount(float)}
1119
 * @return         ID of the effect added, or -1 if we failed to add one.
1120 6a06a912 Leszek Koltunski
 */
1121 e0a16874 Leszek Koltunski
  public long alpha(float alpha, Float4D region, Float2D center, int duration, float count)
1122 6a06a912 Leszek Koltunski
    {
1123
    Interpolator1D di = new Interpolator1D(); 
1124
    di.setCount(count);
1125
    di.setDuration(duration);
1126
    di.add(new Float1D(1));                          
1127
    di.add(new Float1D(alpha));                         
1128
   
1129 e0a16874 Leszek Koltunski
    return mF.add(EffectNames.ALPHA, di, region, center);
1130 6a06a912 Leszek Koltunski
    }
1131
1132
///////////////////////////////////////////////////////////////////////////////////////////////////
1133
/**
1134 e0a16874 Leszek Koltunski
 * Makes a certain sub-region of the Object smoothly change its transparency level.
1135 6a06a912 Leszek Koltunski
 * <p>
1136
 * Here the center of the Effect stays constant and the effect for now change in time.
1137
 *         
1138 d7bbef2f Leszek Koltunski
 * @param alpha  Level of Alpha (between 0 and 1) we want to interpolate to.
1139
 * @param region Region this Effect is limited to.
1140 e0a16874 Leszek Koltunski
 *               Null here means 'apply the Effect to the whole Object'.
1141
 * @param center Center of the Effect.
1142 d7bbef2f Leszek Koltunski
 * @return       ID of the effect added, or -1 if we failed to add one. 
1143 6a06a912 Leszek Koltunski
 */
1144 e0a16874 Leszek Koltunski
  public long alpha(float alpha, Float4D region, Float2D center)
1145 6a06a912 Leszek Koltunski
    {
1146
    Interpolator1D di = new Interpolator1D(); 
1147
    di.setCount(0.5f);
1148
    di.setDuration(0);
1149
    di.add(new Float1D(1));                          
1150
    di.add(new Float1D(alpha));                         
1151
   
1152 e0a16874 Leszek Koltunski
    return mF.add(EffectNames.ALPHA, di, region, center);
1153 6a06a912 Leszek Koltunski
    }
1154
  
1155
///////////////////////////////////////////////////////////////////////////////////////////////////
1156
/**
1157 e0a16874 Leszek Koltunski
 * Makes the whole Object change its transparency level.
1158 6a06a912 Leszek Koltunski
 * 
1159 d7bbef2f Leszek Koltunski
 * @param alpha    Level of Alpha (between 0 and 1) we want to interpolate to.
1160 6a06a912 Leszek Koltunski
 * @param duration Time, in milliseconds, it takes to do one full interpolation.
1161 d7bbef2f Leszek Koltunski
 * @param count    Controls how many interpolations we want to do. See {@link Interpolator#setCount(float)}
1162
 * @return         ID of the effect added, or -1 if we failed to add one. 
1163 6a06a912 Leszek Koltunski
 */
1164
  public long alpha(float alpha, int duration, float count) 
1165
    {
1166
    Interpolator1D di = new Interpolator1D(); 
1167
    di.setCount(count);
1168
    di.setDuration(duration);
1169
    di.add(new Float1D(1));                            
1170
    di.add(new Float1D(alpha));                        
1171
         
1172 e0a16874 Leszek Koltunski
    return mF.add(EffectNames.ALPHA, di,null, mZero2D);
1173 6a06a912 Leszek Koltunski
    }
1174
1175
///////////////////////////////////////////////////////////////////////////////////////////////////  
1176
/**
1177 e0a16874 Leszek Koltunski
 * Makes a certain sub-region of the Object smoothly change its transparency level.
1178 6a06a912 Leszek Koltunski
 * 
1179
 * See {@link #alpha(Interpolator1D, Float4D, Interpolator2D)}
1180
 */
1181 e0a16874 Leszek Koltunski
  public long smooth_alpha(Interpolator1D alpha, Float4D region, Interpolator2D center)
1182 6a06a912 Leszek Koltunski
    {
1183 e0a16874 Leszek Koltunski
    return mF.add(EffectNames.SMOOTH_ALPHA, alpha, region, center);
1184 6a06a912 Leszek Koltunski
    }
1185
1186
///////////////////////////////////////////////////////////////////////////////////////////////////
1187
/**
1188 e0a16874 Leszek Koltunski
 * Makes a certain sub-region of the Object smoothly change its transparency level.
1189 6a06a912 Leszek Koltunski
 * 
1190 da7ce0d8 LeszekKoltunski
 * See {@link #alpha(Interpolator1D, Float4D, Float2D)}
1191 6a06a912 Leszek Koltunski
 */
1192 e0a16874 Leszek Koltunski
  public long smooth_alpha(Interpolator1D alpha, Float4D region, Float2D center)
1193 6a06a912 Leszek Koltunski
    {
1194 e0a16874 Leszek Koltunski
    return mF.add(EffectNames.SMOOTH_ALPHA, alpha, region, center);
1195 6a06a912 Leszek Koltunski
    }
1196
  
1197
///////////////////////////////////////////////////////////////////////////////////////////////////  
1198
/**
1199 e0a16874 Leszek Koltunski
 * Makes a certain sub-region of the Object smoothly change its transparency level.
1200 6a06a912 Leszek Koltunski
 * 
1201 da7ce0d8 LeszekKoltunski
 * See {@link #alpha(float, Float4D, Interpolator2D, int, float)}
1202 6a06a912 Leszek Koltunski
 */
1203 e0a16874 Leszek Koltunski
  public long smooth_alpha(float alpha, Float4D region, Interpolator2D center, int duration, float count)
1204 6a06a912 Leszek Koltunski
    {
1205
    Interpolator1D di = new Interpolator1D(); 
1206
    di.setCount(count);
1207
    di.setDuration(duration);
1208
    di.add(new Float1D(1));                          
1209
    di.add(new Float1D(alpha));                         
1210
   
1211 e0a16874 Leszek Koltunski
    return mF.add(EffectNames.SMOOTH_ALPHA, di, region, center);
1212 6a06a912 Leszek Koltunski
    }
1213
1214
///////////////////////////////////////////////////////////////////////////////////////////////////
1215
/**
1216 e0a16874 Leszek Koltunski
 * Makes a certain sub-region of the Object smoothly change its transparency level.
1217 6a06a912 Leszek Koltunski
 * 
1218 da7ce0d8 LeszekKoltunski
 * See {@link #alpha(float, Float4D, Float2D, int, float)}
1219 6a06a912 Leszek Koltunski
 */
1220 e0a16874 Leszek Koltunski
  public long smooth_alpha(float alpha, Float4D region, Float2D center, int duration, float count)
1221 6a06a912 Leszek Koltunski
    {
1222
    Interpolator1D di = new Interpolator1D(); 
1223
    di.setCount(count);
1224
    di.setDuration(duration);
1225
    di.add(new Float1D(1));                          
1226
    di.add(new Float1D(alpha));                         
1227
   
1228 e0a16874 Leszek Koltunski
    return mF.add(EffectNames.SMOOTH_ALPHA, di, region, center);
1229 6a06a912 Leszek Koltunski
    }
1230
  
1231
///////////////////////////////////////////////////////////////////////////////////////////////////
1232
/**
1233 e0a16874 Leszek Koltunski
 * Makes a certain sub-region of the Object smoothly change its transparency level.
1234 6a06a912 Leszek Koltunski
 * 
1235 da7ce0d8 LeszekKoltunski
 * See {@link #alpha(float, Float4D, Float2D)}
1236 6a06a912 Leszek Koltunski
 */
1237 e0a16874 Leszek Koltunski
  public long smooth_alpha(float alpha, Float4D region, Float2D center)
1238 6a06a912 Leszek Koltunski
    {
1239
    Interpolator1D di = new Interpolator1D(); 
1240
    di.setCount(0.5f);
1241
    di.setDuration(0);
1242
    di.add(new Float1D(1));                          
1243
    di.add(new Float1D(alpha));                         
1244
   
1245 e0a16874 Leszek Koltunski
    return mF.add(EffectNames.SMOOTH_ALPHA, di, region, center);
1246 6a06a912 Leszek Koltunski
    }
1247
  
1248
///////////////////////////////////////////////////////////////////////////////////////////////////
1249
///////////////////////////////////////////////////////////////////////////////////////////////////
1250
// BRIGHTNESS
1251
/**
1252 e0a16874 Leszek Koltunski
 * Makes a certain sub-region of the Object smoothly change its brightness level.
1253 6a06a912 Leszek Koltunski
 *        
1254 e0a16874 Leszek Koltunski
 * @param brightness 1-dimensional Interpolator that returns the level of brightness we want to have
1255
 *                   at any given moment.
1256
 * @param region     Region this Effect is limited to.
1257
 *                   Null here means 'apply the Effect to the whole Object'.
1258
 * @param center     2-dimensional Interpolator which, at any given time, returns a Float2D representing
1259
 *                   the current center of the effect.
1260
 * @return           ID of the effect added, or -1 if we failed to add one.
1261 6a06a912 Leszek Koltunski
 */
1262 e0a16874 Leszek Koltunski
  public long brightness(Interpolator1D brightness, Float4D region, Interpolator2D center)
1263 6a06a912 Leszek Koltunski
    {
1264 e0a16874 Leszek Koltunski
    return mF.add(EffectNames.BRIGHTNESS, brightness, region, center);
1265 6a06a912 Leszek Koltunski
    }
1266
1267
///////////////////////////////////////////////////////////////////////////////////////////////////
1268
/**
1269 e0a16874 Leszek Koltunski
 * Makes a certain sub-region of the Object smoothly change its brightness level.
1270 6a06a912 Leszek Koltunski
 * <p>
1271
 * Here the center of the Effect stays constant.
1272
 *         
1273 e0a16874 Leszek Koltunski
 * @param brightness 1-dimensional Interpolator that returns the level of brightness we want to have
1274
 *                   at any given moment.
1275
 * @param region     Region this Effect is limited to.
1276
 *                   Null here means 'apply the Effect to the whole Object'.
1277
 * @param center     Center of the Effect.
1278
 * @return           ID of the effect added, or -1 if we failed to add one.
1279 6a06a912 Leszek Koltunski
 */
1280 e0a16874 Leszek Koltunski
  public long brightness(Interpolator1D brightness, Float4D region, Float2D center)
1281 6a06a912 Leszek Koltunski
    {
1282 e0a16874 Leszek Koltunski
    return mF.add(EffectNames.BRIGHTNESS, brightness, region, center);
1283 6a06a912 Leszek Koltunski
    }
1284
1285
///////////////////////////////////////////////////////////////////////////////////////////////////  
1286
/**
1287 e0a16874 Leszek Koltunski
 * Makes a certain sub-region of the Object smoothly change its brightness level.
1288 6a06a912 Leszek Koltunski
 *        
1289 d7bbef2f Leszek Koltunski
 * @param brightness Level of Brightness (between 0 and infinity) we want to interpolate to.
1290
 *                   1 - level of brightness unchanged, anything less than 1 - 'darken the image',
1291
 *                   anything more than 1- lighten it up. 
1292
 * @param region     Region this Effect is limited to.
1293 e0a16874 Leszek Koltunski
 *                   Null here means 'apply the Effect to the whole Object'.
1294
 * @param center     2-dimensional Interpolator which, at any given time, returns a Float2D
1295 d7bbef2f Leszek Koltunski
 *                   representing the current center of the effect.
1296
 * @param duration   Time, in milliseconds, it takes to do one full interpolation.
1297
 * @param count      Controls how many interpolations we want to do. See {@link Interpolator#setCount(float)}
1298
 * @return           ID of the effect added, or -1 if we failed to add one. 
1299 6a06a912 Leszek Koltunski
 */
1300 e0a16874 Leszek Koltunski
  public long brightness(float brightness, Float4D region, Interpolator2D center, int duration, float count)
1301 6a06a912 Leszek Koltunski
    {
1302
    Interpolator1D di = new Interpolator1D(); 
1303
    di.setCount(count);
1304
    di.setDuration(duration);
1305
    di.add(new Float1D(1));                          
1306
    di.add(new Float1D(brightness));                         
1307
   
1308 e0a16874 Leszek Koltunski
    return mF.add(EffectNames.BRIGHTNESS, di, region, center);
1309 6a06a912 Leszek Koltunski
    }
1310
1311
///////////////////////////////////////////////////////////////////////////////////////////////////
1312
/**
1313 e0a16874 Leszek Koltunski
 * Makes a certain sub-region of the Object smoothly change its brightness level.
1314 6a06a912 Leszek Koltunski
 * <p>
1315
 * Here the center of the Effect stays constant.
1316
 *         
1317 d7bbef2f Leszek Koltunski
 * @param brightness Level of Brightness (between 0 and infinity) we want to interpolate to.
1318
 *                   1 - level of brightness unchanged, anything less than 1 - 'darken the image',
1319
 *                   anything more than 1 - lighten it up.
1320
 * @param region     Region this Effect is limited to. 
1321 e0a16874 Leszek Koltunski
 *                   Null here means 'apply the Effect to the whole Object'.
1322
 * @param center     Center of the Effect.
1323 d7bbef2f Leszek Koltunski
 * @param duration   Time, in milliseconds, it takes to do one full interpolation.
1324
 * @param count      Controls how many interpolations we want to do. See {@link Interpolator#setCount(float)}
1325
 * @return           ID of the effect added, or -1 if we failed to add one. 
1326 6a06a912 Leszek Koltunski
 */
1327 e0a16874 Leszek Koltunski
  public long brightness(float brightness, Float4D region, Float2D center, int duration, float count)
1328 6a06a912 Leszek Koltunski
    {
1329
    Interpolator1D di = new Interpolator1D(); 
1330
    di.setCount(count);
1331
    di.setDuration(duration);
1332
    di.add(new Float1D(1));                          
1333
    di.add(new Float1D(brightness));                         
1334
   
1335 e0a16874 Leszek Koltunski
    return mF.add(EffectNames.BRIGHTNESS, di, region, center);
1336 6a06a912 Leszek Koltunski
    }
1337
1338
///////////////////////////////////////////////////////////////////////////////////////////////////
1339
/**
1340 e0a16874 Leszek Koltunski
 * Makes a certain sub-region of the Object smoothly change its brightness level.
1341 6a06a912 Leszek Koltunski
 * <p>
1342
 * Here the center of the Effect stays constant and the effect for now change in time.
1343
 *         
1344 d7bbef2f Leszek Koltunski
 * @param brightness Level of Brightness (between 0 and infinity) we want to interpolate to.
1345
 *                   1 - level of brightness unchanged, anything less than 1 - 'darken the image',
1346
 *                   anything more than 1 - lighten it up.
1347
 * @param region     Region this Effect is limited to.
1348 e0a16874 Leszek Koltunski
 *                   Null here means 'apply the Effect to the whole Object'.
1349
 * @param center     Center of the Effect.
1350 d7bbef2f Leszek Koltunski
 * @return           ID of the effect added, or -1 if we failed to add one. 
1351 6a06a912 Leszek Koltunski
 */
1352 e0a16874 Leszek Koltunski
  public long brightness(float brightness, Float4D region, Float2D center)
1353 6a06a912 Leszek Koltunski
    {
1354
    Interpolator1D di = new Interpolator1D(); 
1355
    di.setCount(0.5f);
1356
    di.setDuration(0);
1357
    di.add(new Float1D(1));                          
1358
    di.add(new Float1D(brightness));                         
1359
   
1360 e0a16874 Leszek Koltunski
    return mF.add(EffectNames.BRIGHTNESS, di, region, center);
1361 6a06a912 Leszek Koltunski
    }
1362
 
1363
///////////////////////////////////////////////////////////////////////////////////////////////////
1364
///////////////////////////////////////////////////////////////////////////////////////////////////
1365
// SMOOTH BRIGHTNESS
1366
/**
1367 e0a16874 Leszek Koltunski
 * Makes a certain sub-region of the Object smoothly change its brightness level.
1368 6a06a912 Leszek Koltunski
 *        
1369 e0a16874 Leszek Koltunski
 * @param brightness 1-dimensional Interpolator that returns the level of brightness we want to have
1370
 *                   at any given moment.
1371
 * @param region     Region this Effect is limited to.
1372
 *                   Null here means 'apply the Effect to the whole Object'.
1373
 * @param center     2-dimensional Interpolator which, at any given time, returns a Float2D
1374
 *                   representing the current center of the effect.
1375
 * @return           ID of the effect added, or -1 if we failed to add one.
1376 6a06a912 Leszek Koltunski
 */
1377 e0a16874 Leszek Koltunski
  public long smooth_brightness(Interpolator1D brightness, Float4D region, Interpolator2D center)
1378 6a06a912 Leszek Koltunski
    {
1379 e0a16874 Leszek Koltunski
    return mF.add(EffectNames.SMOOTH_BRIGHTNESS, brightness, region, center);
1380 6a06a912 Leszek Koltunski
    }
1381
1382
///////////////////////////////////////////////////////////////////////////////////////////////////
1383
/**
1384 e0a16874 Leszek Koltunski
 * Makes a certain sub-region of the Object smoothly change its brightness level.
1385 6a06a912 Leszek Koltunski
 * <p>
1386
 * Here the center of the Effect stays constant.
1387
 *         
1388 e0a16874 Leszek Koltunski
 * @param brightness 1-dimensional Interpolator that returns the level of brightness we want to have
1389
 *                   at any given moment.
1390
 * @param region     Region this Effect is limited to.
1391
 *                   Null here means 'apply the Effect to the whole Object'.
1392
 * @param center     Center of the Effect.
1393
 * @return           ID of the effect added, or -1 if we failed to add one.
1394 6a06a912 Leszek Koltunski
 */
1395 e0a16874 Leszek Koltunski
  public long smooth_brightness(Interpolator1D brightness, Float4D region, Float2D center)
1396 6a06a912 Leszek Koltunski
    {
1397 e0a16874 Leszek Koltunski
    return mF.add(EffectNames.SMOOTH_BRIGHTNESS, brightness, region, center);
1398 6a06a912 Leszek Koltunski
    }
1399
1400
///////////////////////////////////////////////////////////////////////////////////////////////////  
1401
/**
1402 e0a16874 Leszek Koltunski
 * Makes a certain sub-region of the Object smoothly change its brightness level.
1403 6a06a912 Leszek Koltunski
 *        
1404 d7bbef2f Leszek Koltunski
 * @param brightness Level of Brightness (between 0 and infinity) we want to interpolate to.
1405
 *                   1 - level of brightness unchanged, anything less than 1 - 'darken the image',
1406
 *                   anything more than 1 - lighten it up. 
1407
 * @param region     Region this Effect is limited to. 
1408 e0a16874 Leszek Koltunski
 *                   Null here means 'apply the Effect to the whole Object'.
1409
 * @param center     2-dimensional Interpolator which, at any given time, returns a Float2D
1410 d7bbef2f Leszek Koltunski
 *                   represention the current center of the effect.
1411
 * @param duration   Time, in milliseconds, it takes to do one full interpolation.
1412
 * @param count      Controls how many interpolations we want to do. See {@link Interpolator#setCount(float)}
1413
 * @return           ID of the effect added, or -1 if we failed to add one. 
1414 6a06a912 Leszek Koltunski
 */
1415 e0a16874 Leszek Koltunski
  public long smooth_brightness(float brightness, Float4D region, Interpolator2D center, int duration, float count)
1416 6a06a912 Leszek Koltunski
    {
1417
    Interpolator1D di = new Interpolator1D(); 
1418
    di.setCount(count);
1419
    di.setDuration(duration);
1420
    di.add(new Float1D(1));                          
1421
    di.add(new Float1D(brightness));                         
1422
   
1423 e0a16874 Leszek Koltunski
    return mF.add(EffectNames.SMOOTH_BRIGHTNESS, di, region, center);
1424 6a06a912 Leszek Koltunski
    }
1425
1426
///////////////////////////////////////////////////////////////////////////////////////////////////
1427
/**
1428 e0a16874 Leszek Koltunski
 * Makes a certain sub-region of the Object smoothly change its brightness level.
1429 6a06a912 Leszek Koltunski
 * <p>
1430
 * Here the center of the Effect stays constant.
1431
 *         
1432 d7bbef2f Leszek Koltunski
 * @param brightness Level of Brightness (between 0 and infinity) we want to interpolate to.
1433
 *                   1 - level of brightness unchanged, anything less than 1 - 'darken the image',
1434
 *                   anything more than 1 - lighten it up.
1435
 * @param region     Region this Effect is limited to. 
1436 e0a16874 Leszek Koltunski
 *                   Null here means 'apply the Effect to the whole Object'.
1437
 * @param center     Center of the Effect.
1438 d7bbef2f Leszek Koltunski
 * @param duration   Time, in milliseconds, it takes to do one full interpolation.
1439
 * @param count      Controls how many interpolations we want to do. See {@link Interpolator#setCount(float)}
1440
 * @return           ID of the effect added, or -1 if we failed to add one. 
1441 6a06a912 Leszek Koltunski
 */
1442 e0a16874 Leszek Koltunski
  public long smooth_brightness(float brightness, Float4D region, Float2D center, int duration, float count)
1443 6a06a912 Leszek Koltunski
    {
1444
    Interpolator1D di = new Interpolator1D(); 
1445
    di.setCount(count);
1446
    di.setDuration(duration);
1447
    di.add(new Float1D(1));                          
1448
    di.add(new Float1D(brightness));                         
1449
   
1450 e0a16874 Leszek Koltunski
    return mF.add(EffectNames.SMOOTH_BRIGHTNESS, di, region, center);
1451 6a06a912 Leszek Koltunski
    }
1452
1453
///////////////////////////////////////////////////////////////////////////////////////////////////
1454
/**
1455 e0a16874 Leszek Koltunski
 * Makes a certain sub-region of the Object smoothly change its brightness level.
1456 6a06a912 Leszek Koltunski
 * <p>
1457
 * Here the center of the Effect stays constant and the effect for now change in time.
1458
 *         
1459 d7bbef2f Leszek Koltunski
 * @param brightness Level of Brightness (between 0 and infinity) we want to interpolate to.
1460
 *                   1 - level of brightness unchanged, anything less than 1 - 'darken the image',
1461
 *                   anything more than 1 - lighten it up.
1462
 * @param region     Region this Effect is limited to. 
1463 e0a16874 Leszek Koltunski
 *                   Null here means 'apply the Effect to the whole Object'.
1464
 * @param center     Center of the Effect.
1465 d7bbef2f Leszek Koltunski
 * @return           ID of the effect added, or -1 if we failed to add one. 
1466 6a06a912 Leszek Koltunski
 */
1467 e0a16874 Leszek Koltunski
  public long smooth_brightness(float brightness, Float4D region, Float2D center)
1468 6a06a912 Leszek Koltunski
    {
1469
    Interpolator1D di = new Interpolator1D(); 
1470
    di.setCount(0.5f);
1471
    di.setDuration(0);
1472
    di.add(new Float1D(1));                          
1473
    di.add(new Float1D(brightness));                         
1474
   
1475 e0a16874 Leszek Koltunski
    return mF.add(EffectNames.SMOOTH_BRIGHTNESS, di, region, center);
1476 6a06a912 Leszek Koltunski
    }
1477
    
1478
///////////////////////////////////////////////////////////////////////////////////////////////////
1479
/**
1480 e0a16874 Leszek Koltunski
 * Makes the whole Object change its brightness level.
1481 6a06a912 Leszek Koltunski
 * 
1482 d7bbef2f Leszek Koltunski
 * @param brightness Level of Brightness (between 0 and infinity) we want to interpolate to.
1483
 *                   1 - level of brightness unchanged, anything less than 1 - 'darken the image',
1484
 *                   anything more than 1- lighten it up.
1485
 * @param duration   Time, in milliseconds, it takes to do one full interpolation.
1486
 * @param count      Controls how many interpolations we want to do. See {@link Interpolator#setCount(float)}
1487
 * @return           ID of the effect added, or -1 if we failed to add one. 
1488 6a06a912 Leszek Koltunski
 */
1489
  public long smooth_brightness(float brightness, int duration, float count) 
1490
    {
1491
    Interpolator1D di = new Interpolator1D(); 
1492
    di.setCount(count);
1493
    di.setDuration(duration);
1494
    di.add(new Float1D(1));                            
1495
    di.add(new Float1D(brightness));                        
1496
         
1497 e0a16874 Leszek Koltunski
    return mF.add(EffectNames.SMOOTH_BRIGHTNESS, di,null, mZero2D);
1498 6a06a912 Leszek Koltunski
    }
1499
1500
///////////////////////////////////////////////////////////////////////////////////////////////////
1501
///////////////////////////////////////////////////////////////////////////////////////////////////
1502
// CONTRAST
1503
/**
1504 e0a16874 Leszek Koltunski
 * Makes a certain sub-region of the Object smoothly change its contrast level.
1505 6a06a912 Leszek Koltunski
 *        
1506 e0a16874 Leszek Koltunski
 * @param contrast 1-dimensional Interpolator that returns the level of contrast we want to have
1507
 *                 at any given moment.
1508
 * @param region   Region this Effect is limited to.
1509
 *                 Null here means 'apply the Effect to the whole Object'.
1510
 * @param center   2-dimensional Interpolator which, at any given time, returns a Float2D
1511
 *                 representing the current center of the effect.
1512
 * @return         ID of the effect added, or -1 if we failed to add one.
1513 6a06a912 Leszek Koltunski
 */
1514 e0a16874 Leszek Koltunski
  public long contrast(Interpolator1D contrast, Float4D region, Interpolator2D center)
1515 6a06a912 Leszek Koltunski
    {
1516 e0a16874 Leszek Koltunski
    return mF.add(EffectNames.CONTRAST, contrast, region, center);
1517 6a06a912 Leszek Koltunski
    }
1518
1519
///////////////////////////////////////////////////////////////////////////////////////////////////
1520
/**
1521 e0a16874 Leszek Koltunski
 * Makes a certain sub-region of the Object smoothly change its contrast level.
1522 6a06a912 Leszek Koltunski
 * <p>
1523
 * Here the center of the Effect stays constant.
1524
 *         
1525 e0a16874 Leszek Koltunski
 * @param contrast 1-dimensional Interpolator that returns the level of contrast we want to have
1526
 *                 at any given moment.
1527
 * @param region   Region this Effect is limited to.
1528
 *                 Null here means 'apply the Effect to the whole Object'.
1529
 * @param center  Center of the Effect.
1530
 * @return        ID of the effect added, or -1 if we failed to add one.
1531 6a06a912 Leszek Koltunski
 */
1532 e0a16874 Leszek Koltunski
  public long contrast(Interpolator1D contrast, Float4D region, Float2D center)
1533 6a06a912 Leszek Koltunski
    {
1534 e0a16874 Leszek Koltunski
    return mF.add(EffectNames.CONTRAST, contrast, region, center);
1535 6a06a912 Leszek Koltunski
    }
1536
1537
///////////////////////////////////////////////////////////////////////////////////////////////////  
1538
/**
1539 e0a16874 Leszek Koltunski
 * Makes a certain sub-region of the Object smoothly change its contrast level.
1540 6a06a912 Leszek Koltunski
 *        
1541 d7bbef2f Leszek Koltunski
 * @param contrast Level of contrast (between 0 and infinity) we want to interpolate to.
1542
 *                 1 - level of contrast unchanged, anything less than 1 - reduce contrast,
1543
 *                 anything more than 1 - increase the contrast. 
1544
 * @param region   Region this Effect is limited to.
1545 e0a16874 Leszek Koltunski
 *                 Null here means 'apply the Effect to the whole Object'.
1546
 * @param center   2-dimensional Interpolator which, at any given time, returns a Float2D
1547 d7bbef2f Leszek Koltunski
 *                 represention the current center of the effect.
1548 6a06a912 Leszek Koltunski
 * @param duration Time, in milliseconds, it takes to do one full interpolation.
1549 d7bbef2f Leszek Koltunski
 * @param count    Controls how many interpolations we want to do. See {@link Interpolator#setCount(float)}
1550
 * @return         ID of the effect added, or -1 if we failed to add one. 
1551 6a06a912 Leszek Koltunski
 */
1552 e0a16874 Leszek Koltunski
  public long contrast(float contrast, Float4D region, Interpolator2D center, int duration, float count)
1553 6a06a912 Leszek Koltunski
    {
1554
    Interpolator1D di = new Interpolator1D(); 
1555
    di.setCount(count);
1556
    di.setDuration(duration);
1557
    di.add(new Float1D(1));                          
1558
    di.add(new Float1D(contrast));                         
1559
   
1560 e0a16874 Leszek Koltunski
    return mF.add(EffectNames.CONTRAST, di, region, center);
1561 6a06a912 Leszek Koltunski
    }
1562
1563
///////////////////////////////////////////////////////////////////////////////////////////////////
1564
/**
1565 e0a16874 Leszek Koltunski
 * Makes a certain sub-region of the Object smoothly change its contrast level.
1566 6a06a912 Leszek Koltunski
 * <p>
1567
 * Here the center of the Effect stays constant.
1568
 *         
1569 d7bbef2f Leszek Koltunski
 * @param contrast Level of contrast (between 0 and infinity) we want to interpolate to.
1570
 *                 1 - level of contrast unchanged, anything less than 1 - reduce contrast,
1571
 *                 anything more than 1 -increase the contrast. 
1572
 * @param region   Region this Effect is limited to. 
1573 e0a16874 Leszek Koltunski
 *                 Null here means 'apply the Effect to the whole Object'.
1574
 * @param center   Center of the Effect.
1575 6a06a912 Leszek Koltunski
 * @param duration Time, in milliseconds, it takes to do one full interpolation.
1576 d7bbef2f Leszek Koltunski
 * @param count    Controls how many interpolations we want to do. See {@link Interpolator#setCount(float)}
1577
 * @return         ID of the effect added, or -1 if we failed to add one. 
1578 6a06a912 Leszek Koltunski
 */
1579 e0a16874 Leszek Koltunski
  public long contrast(float contrast, Float4D region, Float2D center, int duration, float count)
1580 6a06a912 Leszek Koltunski
    {
1581
    Interpolator1D di = new Interpolator1D(); 
1582
    di.setCount(count);
1583
    di.setDuration(duration);
1584
    di.add(new Float1D(1));                          
1585
    di.add(new Float1D(contrast));                         
1586
   
1587 e0a16874 Leszek Koltunski
    return mF.add(EffectNames.CONTRAST, di, region, center);
1588 6a06a912 Leszek Koltunski
    }
1589
1590
///////////////////////////////////////////////////////////////////////////////////////////////////
1591
/**
1592 e0a16874 Leszek Koltunski
 * Makes a certain sub-region of the Object smoothly change its contrast level.
1593 6a06a912 Leszek Koltunski
 * <p>
1594
 * Here the center of the Effect stays constant and the effect for now change in time.
1595
 *         
1596 d7bbef2f Leszek Koltunski
 * @param contrast Level of contrast (between 0 and infinity) we want to interpolate to.
1597
 *                 1 - level of contrast unchanged, anything less than 1 - reduce contrast,
1598
 *                 anything more than 1 - increase the contrast. 
1599
 * @param region   Region this Effect is limited to. 
1600 e0a16874 Leszek Koltunski
 *                 Null here means 'apply the Effect to the whole Object'.
1601
 * @param center   Center of the Effect.
1602 d7bbef2f Leszek Koltunski
 * @return         ID of the effect added, or -1 if we failed to add one. 
1603 6a06a912 Leszek Koltunski
 */
1604 e0a16874 Leszek Koltunski
  public long contrast(float contrast, Float4D region, Float2D center)
1605 6a06a912 Leszek Koltunski
    {
1606
    Interpolator1D di = new Interpolator1D(); 
1607
    di.setCount(0.5f);
1608
    di.setDuration(0);
1609
    di.add(new Float1D(1));                          
1610
    di.add(new Float1D(contrast));                         
1611
   
1612 e0a16874 Leszek Koltunski
    return mF.add(EffectNames.CONTRAST, di, region, center);
1613 6a06a912 Leszek Koltunski
    }
1614
 
1615
///////////////////////////////////////////////////////////////////////////////////////////////////
1616
///////////////////////////////////////////////////////////////////////////////////////////////////
1617
// SMOOTH CONTRAST
1618
/**
1619 e0a16874 Leszek Koltunski
 * Makes a certain sub-region of the Object smoothly change its contrast level.
1620 6a06a912 Leszek Koltunski
 *        
1621 e0a16874 Leszek Koltunski
 * @param contrast 1-dimensional Interpolator that returns the level of contrast we want to have
1622
 *                 at any given moment.
1623
 * @param region   Region this Effect is limited to.
1624
 *                 Null here means 'apply the Effect to the whole Object'.
1625
 * @param center   2-dimensional Interpolator which, at any given time, returns a Float2D
1626
 *                 representing the current center of the effect.
1627
 * @return         ID of the effect added, or -1 if we failed to add one.
1628 6a06a912 Leszek Koltunski
 */
1629 e0a16874 Leszek Koltunski
  public long smooth_contrast(Interpolator1D contrast, Float4D region, Interpolator2D center)
1630 6a06a912 Leszek Koltunski
    {
1631 e0a16874 Leszek Koltunski
    return mF.add(EffectNames.SMOOTH_CONTRAST, contrast, region, center);
1632 6a06a912 Leszek Koltunski
    }
1633
1634
///////////////////////////////////////////////////////////////////////////////////////////////////
1635
/**
1636 e0a16874 Leszek Koltunski
 * Makes a certain sub-region of the Object smoothly change its contrast level.
1637 6a06a912 Leszek Koltunski
 * <p>
1638
 * Here the center of the Effect stays constant.
1639
 *         
1640 e0a16874 Leszek Koltunski
 * @param contrast 1-dimensional Interpolator that returns the level of contrast we want to have
1641
 *                 at any given moment.
1642
 * @param region   Region this Effect is limited to.
1643
 *                 Null here means 'apply the Effect to the whole Object'.
1644
 * @param center   Center of the Effect.
1645
 * @return         ID of the effect added, or -1 if we failed to add one.
1646 6a06a912 Leszek Koltunski
 */
1647 e0a16874 Leszek Koltunski
  public long smooth_contrast(Interpolator1D contrast, Float4D region, Float2D center)
1648 6a06a912 Leszek Koltunski
    {
1649 e0a16874 Leszek Koltunski
    return mF.add(EffectNames.SMOOTH_CONTRAST, contrast, region, center);
1650 6a06a912 Leszek Koltunski
    }
1651
1652
///////////////////////////////////////////////////////////////////////////////////////////////////  
1653
/**
1654 e0a16874 Leszek Koltunski
 * Makes a certain sub-region of the Object smoothly change its contrast level.
1655 6a06a912 Leszek Koltunski
 *        
1656 d7bbef2f Leszek Koltunski
 * @param contrast Level of contrast (between 0 and infinity) we want to interpolate to.
1657
 *                 1 - level of contrast unchanged, anything less than 1 - reduce contrast,
1658
 *                 anything more than 1 - increase the contrast. 
1659
 * @param region   Region this Effect is limited to. 
1660 e0a16874 Leszek Koltunski
 *                 Null here means 'apply the Effect to the whole Object'.
1661
 * @param center   2-dimensional Interpolator which, at any given time, returns a Float2D
1662 d7bbef2f Leszek Koltunski
 *                 representing the current center of the effect.
1663 6a06a912 Leszek Koltunski
 * @param duration Time, in milliseconds, it takes to do one full interpolation.
1664 d7bbef2f Leszek Koltunski
 * @param count    Controls how many interpolations we want to do. See {@link Interpolator#setCount(float)}
1665
 * @return         ID of the effect added, or -1 if we failed to add one. 
1666 6a06a912 Leszek Koltunski
 */
1667 e0a16874 Leszek Koltunski
  public long smooth_contrast(float contrast, Float4D region, Interpolator2D center, int duration, float count)
1668 6a06a912 Leszek Koltunski
    {
1669
    Interpolator1D di = new Interpolator1D(); 
1670
    di.setCount(count);
1671
    di.setDuration(duration);
1672
    di.add(new Float1D(1));                          
1673
    di.add(new Float1D(contrast));                         
1674
   
1675 e0a16874 Leszek Koltunski
    return mF.add(EffectNames.SMOOTH_CONTRAST, di, region, center);
1676 6a06a912 Leszek Koltunski
    }
1677
1678
///////////////////////////////////////////////////////////////////////////////////////////////////
1679
/**
1680 e0a16874 Leszek Koltunski
 * Makes a certain sub-region of the Object smoothly change its contrast level.
1681 6a06a912 Leszek Koltunski
 * <p>
1682
 * Here the center of the Effect stays constant.
1683
 *         
1684 d7bbef2f Leszek Koltunski
 * @param contrast Level of contrast (between 0 and infinity) we want to interpolate to.
1685
 *                 1 - level of contrast unchanged, anything less than 1 - reduce contrast,
1686
 *                 anything more than 1 - increase the contrast. 
1687
 * @param region   Region this Effect is limited to. 
1688 e0a16874 Leszek Koltunski
 *                 Null here means 'apply the Effect to the whole Object'.
1689
 * @param center   Center of the Effect.
1690 6a06a912 Leszek Koltunski
 * @param duration Time, in milliseconds, it takes to do one full interpolation.
1691 d7bbef2f Leszek Koltunski
 * @param count    Controls how many interpolations we want to do. See {@link Interpolator#setCount(float)}
1692
 * @return         ID of the effect added, or -1 if we failed to add one. 
1693 6a06a912 Leszek Koltunski
 */
1694 e0a16874 Leszek Koltunski
  public long smooth_contrast(float contrast, Float4D region, Float2D center, int duration, float count)
1695 6a06a912 Leszek Koltunski
    {
1696
    Interpolator1D di = new Interpolator1D(); 
1697
    di.setCount(count);
1698
    di.setDuration(duration);
1699
    di.add(new Float1D(1));                          
1700
    di.add(new Float1D(contrast));                         
1701
   
1702 e0a16874 Leszek Koltunski
    return mF.add(EffectNames.SMOOTH_CONTRAST, di, region, center);
1703 6a06a912 Leszek Koltunski
    }
1704
1705
///////////////////////////////////////////////////////////////////////////////////////////////////
1706
/**
1707 e0a16874 Leszek Koltunski
 * Makes a certain sub-region of the Object smoothly change its contrast level.
1708 6a06a912 Leszek Koltunski
 * <p>
1709
 * Here the center of the Effect stays constant and the effect for now change in time.
1710
 *         
1711 d7bbef2f Leszek Koltunski
 * @param contrast Level of contrast (between 0 and infinity) we want to interpolate to.
1712
 *                 1 - level of contrast unchanged, anything less than 1 - reduce contrast,
1713
 *                 anything more than 1 - increase the contrast. 
1714
 * @param region   Region this Effect is limited to. 
1715 e0a16874 Leszek Koltunski
 *                 Null here means 'apply the Effect to the whole Object'.
1716
 * @param center   Center of the Effect.
1717 d7bbef2f Leszek Koltunski
 * @return         ID of the effect added, or -1 if we failed to add one. 
1718 6a06a912 Leszek Koltunski
 */
1719 e0a16874 Leszek Koltunski
  public long smooth_contrast(float contrast, Float4D region, Float2D center)
1720 6a06a912 Leszek Koltunski
    {
1721
    Interpolator1D di = new Interpolator1D(); 
1722
    di.setCount(0.5f);
1723
    di.setDuration(0);
1724
    di.add(new Float1D(1));                          
1725
    di.add(new Float1D(contrast));                         
1726
   
1727 e0a16874 Leszek Koltunski
    return mF.add(EffectNames.SMOOTH_CONTRAST, di, region, center);
1728 6a06a912 Leszek Koltunski
    }
1729
    
1730
///////////////////////////////////////////////////////////////////////////////////////////////////
1731
/**
1732 e0a16874 Leszek Koltunski
 * Makes the whole Object change its contrast level.
1733 6a06a912 Leszek Koltunski
 * 
1734 d7bbef2f Leszek Koltunski
 * @param contrast Level of contrast (between 0 and infinity) we want to interpolate to.
1735
 *                 1 - level of contrast unchanged, anything less than 1 - reduce contrast,
1736 e0a16874 Leszek Koltunski
 *                 anything more than 1 - increase the contrast.
1737 6a06a912 Leszek Koltunski
 * @param duration Time, in milliseconds, it takes to do one full interpolation.
1738 d7bbef2f Leszek Koltunski
 * @param count    Controls how many interpolations we want to do. See {@link Interpolator#setCount(float)}
1739
 * @return         ID of the effect added, or -1 if we failed to add one. 
1740 6a06a912 Leszek Koltunski
 */
1741
  public long smooth_contrast(float contrast, int duration, float count) 
1742
    {
1743
    Interpolator1D di = new Interpolator1D(); 
1744
    di.setCount(count);
1745
    di.setDuration(duration);
1746
    di.add(new Float1D(1));                            
1747
    di.add(new Float1D(contrast));                        
1748
         
1749 e0a16874 Leszek Koltunski
    return mF.add(EffectNames.SMOOTH_CONTRAST, di,null, mZero2D);
1750 6a06a912 Leszek Koltunski
    }
1751
1752
1753
///////////////////////////////////////////////////////////////////////////////////////////////////
1754
///////////////////////////////////////////////////////////////////////////////////////////////////
1755
// SATURATION
1756
/**
1757 e0a16874 Leszek Koltunski
 * Makes a certain sub-region of the Object smoothly change its saturation level.
1758 6a06a912 Leszek Koltunski
 *        
1759 e0a16874 Leszek Koltunski
 * @param saturation 1-dimensional Interpolator that returns the level of saturation we want to have
1760
 *                   at any given moment.
1761
 * @param region     Region this Effect is limited to.
1762
 *                   Null here means 'apply the Effect to the whole Object'.
1763
 * @param center     2-dimensional Interpolator which, at any given time, returns a Float2D
1764
 *                   representing the current center of the effect.
1765
 * @return           ID of the effect added, or -1 if we failed to add one.
1766 6a06a912 Leszek Koltunski
 */
1767 e0a16874 Leszek Koltunski
  public long saturation(Interpolator1D saturation, Float4D region, Interpolator2D center)
1768 6a06a912 Leszek Koltunski
    {
1769 e0a16874 Leszek Koltunski
    return mF.add(EffectNames.SATURATION, saturation, region, center);
1770 6a06a912 Leszek Koltunski
    }
1771
1772
///////////////////////////////////////////////////////////////////////////////////////////////////
1773
/**
1774 e0a16874 Leszek Koltunski
 * Makes a certain sub-region of the Object smoothly change its saturation level.
1775 6a06a912 Leszek Koltunski
 * <p>
1776
 * Here the center of the Effect stays constant.
1777
 *         
1778 e0a16874 Leszek Koltunski
 * @param saturation 1-dimensional Interpolator that returns the level of saturation we want to have
1779
 *                   at any given moment.
1780
 * @param region     Region this Effect is limited to.
1781
 *                   Null here means 'apply the Effect to the whole Object'.
1782
 * @param center     Center of the Effect.
1783
 * @return           ID of the effect added, or -1 if we failed to add one.
1784 6a06a912 Leszek Koltunski
 */
1785 e0a16874 Leszek Koltunski
  public long saturation(Interpolator1D saturation, Float4D region, Float2D center)
1786 6a06a912 Leszek Koltunski
    {
1787 e0a16874 Leszek Koltunski
    return mF.add(EffectNames.SATURATION, saturation, region, center);
1788 6a06a912 Leszek Koltunski
    }
1789
1790
///////////////////////////////////////////////////////////////////////////////////////////////////  
1791
/**
1792 e0a16874 Leszek Koltunski
 * Makes a certain sub-region of the Object smoothly change its saturation level.
1793 6a06a912 Leszek Koltunski
 *        
1794 d7bbef2f Leszek Koltunski
 * @param saturation Level of saturation (between 0 and infinity) we want to interpolate to.
1795
 *                   1 - level of saturation unchanged, anything less than 1 - reduce saturation,
1796
 *                   anything more than 1 - increase the saturation. 
1797
 * @param region     Region this Effect is limited to.
1798 e0a16874 Leszek Koltunski
 *                   Null here means 'apply the Effect to the whole Object'.
1799
 * @param center     2-dimensional Interpolator which, at any given time, returns a Float2D
1800 d7bbef2f Leszek Koltunski
 *                   representing the current center of the effect.
1801
 * @param duration   Time, in milliseconds, it takes to do one full interpolation.
1802
 * @param count      Controls how many interpolations we want to do. See {@link Interpolator#setCount(float)}
1803
 * @return           ID of the effect added, or -1 if we failed to add one. 
1804 6a06a912 Leszek Koltunski
 */
1805 e0a16874 Leszek Koltunski
  public long saturation(float saturation, Float4D region, Interpolator2D center, int duration, float count)
1806 6a06a912 Leszek Koltunski
    {
1807
    Interpolator1D di = new Interpolator1D(); 
1808
    di.setCount(count);
1809
    di.setDuration(duration);
1810
    di.add(new Float1D(1));                          
1811
    di.add(new Float1D(saturation));                         
1812
   
1813 e0a16874 Leszek Koltunski
    return mF.add(EffectNames.SATURATION, di, region, center);
1814 6a06a912 Leszek Koltunski
    }
1815
1816
///////////////////////////////////////////////////////////////////////////////////////////////////
1817
/**
1818 e0a16874 Leszek Koltunski
 * Makes a certain sub-region of the Object smoothly change its saturation level.
1819 6a06a912 Leszek Koltunski
 * <p>
1820
 * Here the center of the Effect stays constant.
1821
 *         
1822 d7bbef2f Leszek Koltunski
 * @param saturation Level of saturation (between 0 and infinity) we want to interpolate to.
1823
 *                   1 - level of saturation unchanged, anything less than 1 - reduce saturation,
1824
 *                   anything more than 1 - increase the saturation. 
1825
 * @param region     Region this Effect is limited to. 
1826 e0a16874 Leszek Koltunski
 *                   Null here means 'apply the Effect to the whole Object'.
1827
 * @param center     Center of the Effect.
1828 d7bbef2f Leszek Koltunski
 * @param duration   Time, in milliseconds, it takes to do one full interpolation.
1829
 * @param count      Controls how many interpolations we want to do. See {@link Interpolator#setCount(float)}
1830
 * @return           ID of the effect added, or -1 if we failed to add one. 
1831 6a06a912 Leszek Koltunski
 */
1832 e0a16874 Leszek Koltunski
  public long saturation(float saturation, Float4D region, Float2D center, int duration, float count)
1833 6a06a912 Leszek Koltunski
    {
1834
    Interpolator1D di = new Interpolator1D(); 
1835
    di.setCount(count);
1836
    di.setDuration(duration);
1837
    di.add(new Float1D(1));                          
1838
    di.add(new Float1D(saturation));                         
1839
   
1840 e0a16874 Leszek Koltunski
    return mF.add(EffectNames.SATURATION, di, region, center);
1841 6a06a912 Leszek Koltunski
    }
1842
1843
///////////////////////////////////////////////////////////////////////////////////////////////////
1844
/**
1845 e0a16874 Leszek Koltunski
 * Makes a certain sub-region of the Object smoothly change its saturation level.
1846 6a06a912 Leszek Koltunski
 * <p>
1847
 * Here the center of the Effect stays constant and the effect for now change in time.
1848
 *         
1849 d7bbef2f Leszek Koltunski
 * @param saturation Level of saturation (between 0 and infinity) we want to interpolate to.
1850
 *                   1 - level of saturation unchanged, anything less than 1 - reduce saturation,
1851
 *                   anything more than 1- increase the saturation. 
1852
 * @param region     Region this Effect is limited to. 
1853 e0a16874 Leszek Koltunski
 *                   Null here means 'apply the Effect to the whole Object'.
1854
 * @param center     Center of the Effect.
1855 d7bbef2f Leszek Koltunski
 * @return           ID of the effect added, or -1 if we failed to add one. 
1856 6a06a912 Leszek Koltunski
 */
1857 e0a16874 Leszek Koltunski
  public long saturation(float saturation, Float4D region, Float2D center)
1858 6a06a912 Leszek Koltunski
    {
1859
    Interpolator1D di = new Interpolator1D(); 
1860
    di.setCount(0.5f);
1861
    di.setDuration(0);
1862
    di.add(new Float1D(1));                          
1863
    di.add(new Float1D(saturation));                         
1864
   
1865 e0a16874 Leszek Koltunski
    return mF.add(EffectNames.SATURATION, di, region, center);
1866 6a06a912 Leszek Koltunski
    }
1867
 
1868
///////////////////////////////////////////////////////////////////////////////////////////////////
1869
///////////////////////////////////////////////////////////////////////////////////////////////////
1870
// SMOOTH_SATURATION
1871
/**
1872 e0a16874 Leszek Koltunski
 * Makes a certain sub-region of the Object smoothly change its saturation level.
1873 6a06a912 Leszek Koltunski
 *        
1874 e0a16874 Leszek Koltunski
 * @param saturation 1-dimensional Interpolator that returns the level of saturation we want to have
1875
 *                   at any given moment.
1876
 * @param region     Region this Effect is limited to.
1877
 *                   Null here means 'apply the Effect to the whole Object'.
1878
 * @param center     2-dimensional Interpolator which, at any given time, returns a Float2D
1879
 *                   representing the current center of the effect.
1880
 * @return           ID of the effect added, or -1 if we failed to add one.
1881 6a06a912 Leszek Koltunski
 */
1882 e0a16874 Leszek Koltunski
  public long smooth_saturation(Interpolator1D saturation, Float4D region, Interpolator2D center)
1883 6a06a912 Leszek Koltunski
    {
1884 e0a16874 Leszek Koltunski
    return mF.add(EffectNames.SMOOTH_SATURATION, saturation, region, center);
1885 6a06a912 Leszek Koltunski
    }
1886
1887
///////////////////////////////////////////////////////////////////////////////////////////////////
1888
/**
1889 e0a16874 Leszek Koltunski
 * Makes a certain sub-region of the Object smoothly change its saturation level.
1890 6a06a912 Leszek Koltunski
 * <p>
1891
 * Here the center of the Effect stays constant.
1892
 *         
1893 e0a16874 Leszek Koltunski
 * @param saturation 1-dimensional Interpolator that returns the level of saturation we want to have
1894
 *                   at any given moment.
1895
 * @param region     Region this Effect is limited to.
1896
 *                   Null here means 'apply the Effect to the whole Object'.
1897
 * @param center     Center of the Effect.
1898
 * @return           ID of the effect added, or -1 if we failed to add one.
1899 6a06a912 Leszek Koltunski
 */
1900 e0a16874 Leszek Koltunski
  public long smooth_saturation(Interpolator1D saturation, Float4D region, Float2D center)
1901 6a06a912 Leszek Koltunski
    {
1902 e0a16874 Leszek Koltunski
    return mF.add(EffectNames.SMOOTH_SATURATION, saturation, region, center);
1903 6a06a912 Leszek Koltunski
    }
1904
1905
///////////////////////////////////////////////////////////////////////////////////////////////////  
1906
/**
1907 e0a16874 Leszek Koltunski
 * Makes a certain sub-region of the Object smoothly change its saturation level.
1908 6a06a912 Leszek Koltunski
 *        
1909 d7bbef2f Leszek Koltunski
 * @param saturation Level of saturation (between 0 and infinity) we want to interpolate to.
1910
 *                   1 - level of saturation unchanged, anything less than 1 - reduce saturation,
1911
 *                   anything more than 1 -increase the saturation. 
1912
 * @param region     Region this Effect is limited to. 
1913 e0a16874 Leszek Koltunski
 *                   Null here means 'apply the Effect to the whole Object'.
1914
 * @param center     2-dimensional Interpolator which, at any given time, returns a Float2D
1915 d7bbef2f Leszek Koltunski
 *                   representing the current center of the effect.
1916
 * @param duration   Time, in milliseconds, it takes to do one full interpolation.
1917
 * @param count      Controls how many interpolations we want to do. See {@link Interpolator#setCount(float)}
1918
 * @return           ID of the effect added, or -1 if we failed to add one. 
1919 6a06a912 Leszek Koltunski
 */
1920 e0a16874 Leszek Koltunski
  public long smooth_saturation(float saturation, Float4D region, Interpolator2D center, int duration, float count)
1921 6a06a912 Leszek Koltunski
    {
1922
    Interpolator1D di = new Interpolator1D(); 
1923
    di.setCount(count);
1924
    di.setDuration(duration);
1925
    di.add(new Float1D(1));                          
1926
    di.add(new Float1D(saturation));                         
1927
   
1928 e0a16874 Leszek Koltunski
    return mF.add(EffectNames.SMOOTH_SATURATION, di, region, center);
1929 6a06a912 Leszek Koltunski
    }
1930
1931
///////////////////////////////////////////////////////////////////////////////////////////////////
1932
/**
1933 e0a16874 Leszek Koltunski
 * Makes a certain sub-region of the Object smoothly change its saturation level.
1934 6a06a912 Leszek Koltunski
 * <p>
1935
 * Here the center of the Effect stays constant.
1936
 *         
1937 d7bbef2f Leszek Koltunski
 * @param saturation Level of saturation (between 0 and infinity) we want to interpolate to.
1938
 *                   1 - level of saturation unchanged, anything less than 1 - reduce saturation,
1939
 *                   anything more than 1 - increase the saturation. 
1940
 * @param region     Region this Effect is limited to. 
1941 e0a16874 Leszek Koltunski
 *                   Null here means 'apply the Effect to the whole Object'.
1942
 * @param center     Center of the Effect.
1943 d7bbef2f Leszek Koltunski
 * @param duration   Time, in milliseconds, it takes to do one full interpolation.
1944
 * @param count      Controls how many interpolations we want to do. See {@link Interpolator#setCount(float)}
1945
 * @return           ID of the effect added, or -1 if we failed to add one. 
1946 6a06a912 Leszek Koltunski
 */
1947 e0a16874 Leszek Koltunski
  public long smooth_saturation(float saturation, Float4D region, Float2D center, int duration, float count)
1948 6a06a912 Leszek Koltunski
    {
1949
    Interpolator1D di = new Interpolator1D(); 
1950
    di.setCount(count);
1951
    di.setDuration(duration);
1952
    di.add(new Float1D(1));                          
1953
    di.add(new Float1D(saturation));                         
1954
   
1955 e0a16874 Leszek Koltunski
    return mF.add(EffectNames.SMOOTH_SATURATION, di, region, center);
1956 6a06a912 Leszek Koltunski
    }
1957
1958
///////////////////////////////////////////////////////////////////////////////////////////////////
1959
/**
1960 e0a16874 Leszek Koltunski
 * Makes a certain sub-region of the Object smoothly change its saturation level.
1961 6a06a912 Leszek Koltunski
 * <p>
1962
 * Here the center of the Effect stays constant and the effect for now change in time.
1963
 *         
1964 d7bbef2f Leszek Koltunski
 * @param saturation Level of saturation (between 0 and infinity) we want to interpolate to.
1965
 *                   1 - level of saturation unchanged, anything less than 1 - reduce saturation,
1966
 *                   anything more than 1 - increase the saturation. 
1967
 * @param region     Region this Effect is limited to. 
1968 e0a16874 Leszek Koltunski
 *                   Null here means 'apply the Effect to the whole Object'.
1969
 * @param center     Center of the Effect.
1970 d7bbef2f Leszek Koltunski
 * @return           ID of the effect added, or -1 if we failed to add one. 
1971 6a06a912 Leszek Koltunski
 */
1972 e0a16874 Leszek Koltunski
  public long smooth_saturation(float saturation, Float4D region, Float2D center)
1973 6a06a912 Leszek Koltunski
    {
1974
    Interpolator1D di = new Interpolator1D(); 
1975
    di.setCount(0.5f);
1976
    di.setDuration(0);
1977
    di.add(new Float1D(1));                          
1978
    di.add(new Float1D(saturation));                         
1979
   
1980 e0a16874 Leszek Koltunski
    return mF.add(EffectNames.SMOOTH_SATURATION, di, region, center);
1981 6a06a912 Leszek Koltunski
    }
1982
    
1983
///////////////////////////////////////////////////////////////////////////////////////////////////
1984
/**
1985 e0a16874 Leszek Koltunski
 * Makes the whole Object change its saturation level.
1986 6a06a912 Leszek Koltunski
 * 
1987 d7bbef2f Leszek Koltunski
 * @param saturation Level of saturation (between 0 and infinity) we want to interpolate to.
1988
 *                   1 - level of saturation unchanged, anything less than 1 - reduce saturation,
1989
 *                   anything more than 1 - increase the saturation. 
1990
 * @param duration   Time, in milliseconds, it takes to do one full interpolation.
1991
 * @param count      Controls how many interpolations we want to do. See {@link Interpolator#setCount(float)}
1992
 * @return           ID of the effect added, or -1 if we failed to add one. 
1993 6a06a912 Leszek Koltunski
 */
1994
  public long smooth_saturation(float saturation, int duration, float count) 
1995
    {
1996
    Interpolator1D di = new Interpolator1D(); 
1997
    di.setCount(count);
1998
    di.setDuration(duration);
1999
    di.add(new Float1D(1));                            
2000
    di.add(new Float1D(saturation));                        
2001
         
2002 e0a16874 Leszek Koltunski
    return mF.add(EffectNames.SMOOTH_SATURATION, di,null, mZero2D);
2003 6a06a912 Leszek Koltunski
    }
2004
            
2005
///////////////////////////////////////////////////////////////////////////////////////////////////
2006
// Vertex-based effects  
2007
///////////////////////////////////////////////////////////////////////////////////////////////////
2008
// DISTORT
2009
/**
2010 e0a16874 Leszek Koltunski
 * Distort a (possibly changing in time) part of the Object by a (possibly changing in time) vector of force.
2011 6a06a912 Leszek Koltunski
 * 
2012 e0a16874 Leszek Koltunski
 * @param vector 2- or 3-dimensional Interpolator that returns a 2- or 3-dimensional Point which
2013 d7bbef2f Leszek Koltunski
 *               represents the vector the Center of the Effect is currently being dragged with.
2014
 * @param region Region that masks the effect of the Distortion.
2015 e0a16874 Leszek Koltunski
 * @param center 2-dimensional Interpolator that, at any given time, returns a Point2D representing
2016 d7bbef2f Leszek Koltunski
 *               the Center of the Effect.
2017
 * @return       ID of the effect added, or -1 if we failed to add one. 
2018 6a06a912 Leszek Koltunski
 */
2019 e0a16874 Leszek Koltunski
  public long distort(Interpolator vector, Float4D region, Interpolator2D center)
2020 6a06a912 Leszek Koltunski
    {  
2021 e0a16874 Leszek Koltunski
    return mV.add(EffectNames.DISTORT, vector, region, center);
2022 6a06a912 Leszek Koltunski
    }
2023
2024
///////////////////////////////////////////////////////////////////////////////////////////////////
2025
/**
2026 e0a16874 Leszek Koltunski
 * Distort part of the Object by a (possibly changing in time) vector of force.
2027 6a06a912 Leszek Koltunski
 * <p>
2028
 * Difference between this and the previous method is that here the center of the Effect stays constant.
2029
 *   
2030 e0a16874 Leszek Koltunski
 * @param vector 2- or 3-dimensional Interpolator that returns a 2- or 3-dimensional Point which
2031 d7bbef2f Leszek Koltunski
 *               represents the vector the Center of the Effect is currently being dragged with.
2032
 * @param region Region that masks the effect of the Distortion.
2033 e0a16874 Leszek Koltunski
 * @param center Center of the Effect.
2034 d7bbef2f Leszek Koltunski
 * @return       ID of the effect added, or -1 if we failed to add one. 
2035 6a06a912 Leszek Koltunski
 */
2036 e0a16874 Leszek Koltunski
  public long distort(Interpolator vector, Float4D region, Float2D center)
2037 6a06a912 Leszek Koltunski
    {  
2038 e0a16874 Leszek Koltunski
    return mV.add(EffectNames.DISTORT, vector, region, center);
2039 6a06a912 Leszek Koltunski
    }
2040
2041
///////////////////////////////////////////////////////////////////////////////////////////////////
2042
/**
2043 e0a16874 Leszek Koltunski
 * Distort the whole Object by a (possibly changing in time) vector of force.
2044 6a06a912 Leszek Koltunski
 * 
2045 e0a16874 Leszek Koltunski
 * @param vector 2- or 3-dimensional Interpolator that returns a 2- or 3-dimensional Point which
2046
 *               represents the vector the Center of the Effect is currently being dragged with.
2047
 * @param center Center of the Effect.
2048
 * @return       ID of the effect added, or -1 if we failed to add one.
2049 6a06a912 Leszek Koltunski
 */
2050 e0a16874 Leszek Koltunski
  public long distort(Interpolator vector, Float2D center)
2051 6a06a912 Leszek Koltunski
    {
2052 e0a16874 Leszek Koltunski
    return mV.add(EffectNames.DISTORT, vector, null, center);
2053 6a06a912 Leszek Koltunski
    }
2054
2055
///////////////////////////////////////////////////////////////////////////////////////////////////
2056
/**
2057 e0a16874 Leszek Koltunski
 * Distort part of the Object by a vector of force that changes from (0,0,0) to v.
2058 6a06a912 Leszek Koltunski
 * 
2059 d7bbef2f Leszek Koltunski
 * @param vector   Maximum vector of force. 
2060
 * @param region   Region that masks the effect of the Distortion.
2061 e0a16874 Leszek Koltunski
 * @param center   Center of the Effect.
2062 6a06a912 Leszek Koltunski
 * @param duration Time, in milliseconds, it takes to do one full interpolation.
2063 d7bbef2f Leszek Koltunski
 * @param count    Controls how many interpolations we want to do. See {@link Interpolator#setCount(float)}
2064
 * @return         ID of the effect added, or -1 if we failed to add one. 
2065 6a06a912 Leszek Koltunski
 */
2066 e0a16874 Leszek Koltunski
  public long distort(Float3D vector, Float4D region, Float2D center, int duration, float count)
2067 6a06a912 Leszek Koltunski
    {  
2068
    Interpolator3D di = new Interpolator3D(); 
2069
    di.setCount(count);
2070
    di.setDuration(duration);
2071
    di.add(new Float3D(0.0f,0.0f,0.0f));               
2072
    di.add(vector);                                                  
2073
           
2074 e0a16874 Leszek Koltunski
    return mV.add(EffectNames.DISTORT, di, region, center);
2075 6a06a912 Leszek Koltunski
    }
2076
2077
///////////////////////////////////////////////////////////////////////////////////////////////////
2078
/**
2079 e0a16874 Leszek Koltunski
 * Distort the whole Object by a vector of force that changes from (0,0,0) to v.
2080 6a06a912 Leszek Koltunski
 * 
2081 d7bbef2f Leszek Koltunski
 * @param vector   Maximum vector of force.
2082 e0a16874 Leszek Koltunski
 * @param center   Center of the Effect.
2083 6a06a912 Leszek Koltunski
 * @param duration Time, in milliseconds, it takes to do one full interpolation.
2084 d7bbef2f Leszek Koltunski
 * @param count    Controls how many interpolations we want to do. See {@link Interpolator#setCount(float)}
2085
 * @return         ID of the effect added, or -1 if we failed to add one. 
2086 6a06a912 Leszek Koltunski
 */
2087 e0a16874 Leszek Koltunski
  public long distort(Float3D vector, Float2D center, int duration, float count)
2088 6a06a912 Leszek Koltunski
    {
2089
    Interpolator3D di = new Interpolator3D(); 
2090
    di.setCount(count);
2091
    di.setDuration(duration);
2092
    di.add(new Float3D(0.0f,0.0f,0.0f));               
2093
    di.add(vector);                                                 
2094
           
2095 e0a16874 Leszek Koltunski
    return mV.add(EffectNames.DISTORT, di, null, center);
2096 6a06a912 Leszek Koltunski
    }
2097
2098
///////////////////////////////////////////////////////////////////////////////////////////////////
2099
/**
2100 e0a16874 Leszek Koltunski
 * Distort the whole Object by a vector of force that changes from (0,0,0) to v.
2101 6a06a912 Leszek Koltunski
 * <p>
2102
 * Difference between this and the previous method is that here the vector of force will get interpolated
2103
 * to the maximum v and the effect will end. We are thus limited to count=0.5.
2104
 * 
2105 d7bbef2f Leszek Koltunski
 * @param vector   Maximum, final vector of force.
2106 e0a16874 Leszek Koltunski
 * @param center   Center of the Effect.
2107 6a06a912 Leszek Koltunski
 * @param duration Time, in milliseconds, it takes to do one full interpolation.
2108 d7bbef2f Leszek Koltunski
 * @return         ID of the effect added, or -1 if we failed to add one. 
2109 6a06a912 Leszek Koltunski
 */
2110 e0a16874 Leszek Koltunski
  public long distort(Float3D vector, Float2D center, int duration)
2111 6a06a912 Leszek Koltunski
    {
2112
    Interpolator3D di = new Interpolator3D();  
2113
    di.setCount(0.5f);
2114
    di.setDuration(duration);
2115
    di.add(new Float3D(0.0f,0.0f,0.0f));              
2116
    di.add(vector);                 
2117
           
2118 e0a16874 Leszek Koltunski
    return mV.add(EffectNames.DISTORT, di, null, center);
2119 6a06a912 Leszek Koltunski
    }
2120
2121
///////////////////////////////////////////////////////////////////////////////////////////////////
2122
/**
2123 e0a16874 Leszek Koltunski
 * Distort the whole Object by a vector of force v.
2124 6a06a912 Leszek Koltunski
 * <p>
2125
 * Here we apply a constant vector of force.
2126
 * 
2127 d7bbef2f Leszek Koltunski
 * @param vector Vector of force.
2128 e0a16874 Leszek Koltunski
 * @param center Center of the Effect.
2129 d7bbef2f Leszek Koltunski
 * @return       ID of the effect added, or -1 if we failed to add one. 
2130 6a06a912 Leszek Koltunski
 */
2131 e0a16874 Leszek Koltunski
  public long distort(Float3D vector, Float2D center )
2132 6a06a912 Leszek Koltunski
    {
2133
    Interpolator3D di = new Interpolator3D(); 
2134
    di.setCount(0.5f);
2135
    di.setDuration(0);
2136
    di.add(new Float3D(0.0f,0.0f,0.0f));              
2137
    di.add(vector);           
2138
           
2139 e0a16874 Leszek Koltunski
    return mV.add(EffectNames.DISTORT, di, null, center);
2140 6a06a912 Leszek Koltunski
    }
2141
2142
///////////////////////////////////////////////////////////////////////////////////////////////////
2143
///////////////////////////////////////////////////////////////////////////////////////////////////
2144
// DEFORM
2145
/**
2146 e0a16874 Leszek Koltunski
 * Deform the shape of the whole Object with a (possibly changing in time) vector of force applied to
2147 6a06a912 Leszek Koltunski
 * a (possibly changing in time) point on the Bitmap.
2148
 *     
2149 e0a16874 Leszek Koltunski
 * @param vector Interpolator that, at any given time, returns a Float2D representing vector of
2150
 *               force that deforms the shape of the whole Bitmap.
2151
 * @param center 2-dimensional Interpolator that, at any given time, returns a Point2D representing
2152
 *               the Center of the Effect.
2153
 * @return       ID of the effect added, or -1 if we failed to add one.
2154 6a06a912 Leszek Koltunski
 */
2155 e0a16874 Leszek Koltunski
  public long deform(Interpolator vector, Interpolator2D center)
2156 6a06a912 Leszek Koltunski
    {  
2157 e0a16874 Leszek Koltunski
    return mV.add(EffectNames.DEFORM, vector, null, center);
2158 6a06a912 Leszek Koltunski
    }
2159
2160
///////////////////////////////////////////////////////////////////////////////////////////////////
2161
/**
2162 e0a16874 Leszek Koltunski
 * Deform the shape of the whole Object with a (possibly changing in time) vector of force applied to
2163 6a06a912 Leszek Koltunski
 * a constant point on the Bitmap.
2164
 * 
2165 e0a16874 Leszek Koltunski
 * @param vector Interpolator that, at any given time, returns a Float2D representing
2166
 *               vector of force that deforms the shape of the whole Bitmap.
2167
 * @param center Center of the Effect.
2168
 * @return       ID of the effect added, or -1 if we failed to add one.
2169 6a06a912 Leszek Koltunski
 */
2170 e0a16874 Leszek Koltunski
  public long deform(Interpolator vector, Float2D center)
2171 6a06a912 Leszek Koltunski
    {
2172 e0a16874 Leszek Koltunski
    return mV.add(EffectNames.DEFORM, vector, null, center);
2173 6a06a912 Leszek Koltunski
    }
2174
2175
///////////////////////////////////////////////////////////////////////////////////////////////////
2176
/**
2177 e0a16874 Leszek Koltunski
 * Deform the shape of the whole Object with a vector of force smoothly changing from (0,0,0) to v
2178
 * applied to a constant point on the Object.
2179 6a06a912 Leszek Koltunski
 * 
2180 d7bbef2f Leszek Koltunski
 * @param vector   Vector of force.
2181 e0a16874 Leszek Koltunski
 * @param center   Center of the Effect.
2182 6a06a912 Leszek Koltunski
 * @param duration Time, in milliseconds, it takes to do one full interpolation.
2183 d7bbef2f Leszek Koltunski
 * @param count    Controls how many interpolations we want to do. See {@link Interpolator#setCount(float)}
2184
 * @return         ID of the effect added, or -1 if we failed to add one. 
2185 6a06a912 Leszek Koltunski
 */
2186 e0a16874 Leszek Koltunski
  public long deform(Float3D vector, Float2D center, int duration, float count)
2187 6a06a912 Leszek Koltunski
    {
2188
    Interpolator3D di = new Interpolator3D(); 
2189
    di.setCount(count);
2190
    di.setDuration(duration);
2191
    di.add(new Float3D(0.0f,0.0f,0.0f));               
2192
    di.add(vector);                
2193
           
2194 e0a16874 Leszek Koltunski
    return mV.add(EffectNames.DEFORM, di, null, center);
2195 6a06a912 Leszek Koltunski
    }
2196
2197
///////////////////////////////////////////////////////////////////////////////////////////////////
2198
/**
2199 e0a16874 Leszek Koltunski
 * Deform the shape of the whole Object with a vector of force smoothly changing from (0,0,0) to v
2200
 * applied to a constant point on the Object.
2201 6a06a912 Leszek Koltunski
 * <p>
2202
 * Identical to calling the previous method with count=0.5.
2203
 * 
2204 d7bbef2f Leszek Koltunski
 * @param vector   Final vector of force.
2205 e0a16874 Leszek Koltunski
 * @param center   Center of the Effect.
2206 6a06a912 Leszek Koltunski
 * @param duration Time, in milliseconds, it takes to do one full interpolation.
2207 d7bbef2f Leszek Koltunski
 * @return         ID of the effect added, or -1 if we failed to add one. 
2208 6a06a912 Leszek Koltunski
 */
2209 e0a16874 Leszek Koltunski
  public long deform(Float3D vector, Float2D center, int duration)
2210 6a06a912 Leszek Koltunski
    {
2211
    Interpolator3D di = new Interpolator3D();  
2212
    di.setCount(0.5f);
2213
    di.setDuration(duration);
2214
    di.add(new Float3D(0.0f,0.0f,0.0f));              
2215
    di.add(vector);             
2216
           
2217 e0a16874 Leszek Koltunski
    return mV.add(EffectNames.DEFORM, di, null, center);
2218 6a06a912 Leszek Koltunski
    }
2219
2220
///////////////////////////////////////////////////////////////////////////////////////////////////
2221
/**
2222 e0a16874 Leszek Koltunski
 * Deform the shape of the whole Object with a constant vector of force applied to a constant
2223
 * point on the Object.
2224 6a06a912 Leszek Koltunski
 * 
2225 d7bbef2f Leszek Koltunski
 * @param vector Vector of force.
2226 e0a16874 Leszek Koltunski
 * @param center Center of the Effect.
2227 d7bbef2f Leszek Koltunski
 * @return       ID of the effect added, or -1 if we failed to add one. 
2228 6a06a912 Leszek Koltunski
 */
2229 e0a16874 Leszek Koltunski
  public long deform(Float3D vector, Float2D center )
2230 6a06a912 Leszek Koltunski
    {
2231
    Interpolator3D di = new Interpolator3D(); 
2232
    di.setCount(0.5f);
2233
    di.setDuration(0);
2234
    di.add(new Float3D(0.0f,0.0f,0.0f));              
2235
    di.add(vector);            
2236
           
2237 e0a16874 Leszek Koltunski
    return mV.add(EffectNames.DEFORM, di, null, center);
2238 6a06a912 Leszek Koltunski
    }
2239
   
2240
///////////////////////////////////////////////////////////////////////////////////////////////////  
2241
///////////////////////////////////////////////////////////////////////////////////////////////////
2242
// SINK
2243
/**
2244
 * Pull all points around the center of the effect towards the center (if degree>=1) or push them 
2245
 * away from the center (degree<=1)
2246
 *    
2247 e0a16874 Leszek Koltunski
 * @param sink   1-dimensional Interpolator which, at any given time, returns a Point1D representing
2248 d7bbef2f Leszek Koltunski
 *               the current degree of the effect.
2249
 * @param region Region that masks the effect of the Sink.
2250 e0a16874 Leszek Koltunski
 * @param center 2-dimensional Interpolator that, at any given time, returns a Point2D representing
2251 d7bbef2f Leszek Koltunski
 *               the Center of the Effect.
2252
 * @return       ID of the effect added, or -1 if we failed to add one. 
2253 6a06a912 Leszek Koltunski
 */
2254 e0a16874 Leszek Koltunski
  public long sink(Interpolator1D sink, Float4D region, Interpolator2D center)
2255 6a06a912 Leszek Koltunski
    {
2256 e0a16874 Leszek Koltunski
    return mV.add(EffectNames.SINK, sink, region, center);
2257 6a06a912 Leszek Koltunski
    }
2258
2259
///////////////////////////////////////////////////////////////////////////////////////////////////
2260
/**
2261
 * Pull all points around the center of the effect towards the center (if degree>=1) or push them 
2262
 * away from the center (degree<=1).
2263
 * <p>
2264
 * Here the Center stays constant.
2265
 *      
2266 e0a16874 Leszek Koltunski
 * @param sink   1-dimensional Interpolator which, at any given time, returns a Point1D
2267 d7bbef2f Leszek Koltunski
 *               representing the current degree of the effect.
2268
 * @param region Region that masks the effect of the Sink.
2269 e0a16874 Leszek Koltunski
 * @param center Center of the Effect.
2270 d7bbef2f Leszek Koltunski
 * @return       ID of the effect added, or -1 if we failed to add one. 
2271 6a06a912 Leszek Koltunski
 */
2272 e0a16874 Leszek Koltunski
  public long sink(Interpolator1D sink, Float4D region, Float2D center)
2273 6a06a912 Leszek Koltunski
    {
2274 e0a16874 Leszek Koltunski
    return mV.add(EffectNames.SINK, sink, region, center);
2275 6a06a912 Leszek Koltunski
    }
2276
  
2277
///////////////////////////////////////////////////////////////////////////////////////////////////
2278
/**
2279
 * Pull all points around the center of the effect towards the center (if degree>=1) or push them 
2280
 * away from the center (degree<=1).
2281
 * <p>
2282
 * Here we can only interpolate between 1 and degree.
2283
 * 
2284 e0a16874 Leszek Koltunski
 * @param sink     How much to push or pull. Between 0 and infinity.
2285 d7bbef2f Leszek Koltunski
 * @param region   Region that masks the effect of the Sink.
2286 e0a16874 Leszek Koltunski
 * @param center   2-dimensional Interpolator that, at any given time, returns a Point2D representing
2287 d7bbef2f Leszek Koltunski
 *                 the Center of the Effect.
2288 6a06a912 Leszek Koltunski
 * @param duration Time, in milliseconds, it takes to do one full interpolation.
2289 d7bbef2f Leszek Koltunski
 * @param count    Controls how many interpolations we want to do. See {@link Interpolator#setCount(float)}
2290
 * @return         ID of the effect added, or -1 if we failed to add one. 
2291 6a06a912 Leszek Koltunski
 */
2292 e0a16874 Leszek Koltunski
  public long sink(float sink, Float4D region, Interpolator2D center, int duration, float count)
2293 6a06a912 Leszek Koltunski
    {
2294
    Interpolator1D di = new Interpolator1D(); 
2295
    di.setCount(count);
2296
    di.setDuration(duration);
2297
    di.add(new Float1D(1));                                
2298 e0a16874 Leszek Koltunski
    di.add(new Float1D(sink));
2299 6a06a912 Leszek Koltunski
    
2300 e0a16874 Leszek Koltunski
    return mV.add(EffectNames.SINK, di, region, center);
2301 6a06a912 Leszek Koltunski
    }
2302
2303
///////////////////////////////////////////////////////////////////////////////////////////////////
2304
/**
2305
 * Pull all points around the center of the effect towards the center (if degree>=1) or push them 
2306
 * away from the center (degree<=1).
2307
 *   
2308 e0a16874 Leszek Koltunski
 * @param sink     How much to push or pull. Between 0 and infinity.
2309 d7bbef2f Leszek Koltunski
 * @param region   Region that masks the effect of the Sink.
2310 e0a16874 Leszek Koltunski
 * @param center   Center of the Effect.
2311 6a06a912 Leszek Koltunski
 * @param duration Time, in milliseconds, it takes to do one full interpolation.
2312 d7bbef2f Leszek Koltunski
 * @param count    Controls how many interpolations we want to do. See {@link Interpolator#setCount(float)}
2313
 * @return         ID of the effect added, or -1 if we failed to add one. 
2314 6a06a912 Leszek Koltunski
 */
2315 e0a16874 Leszek Koltunski
  public long sink(float sink, Float4D region, Float2D center, int duration, float count)
2316 6a06a912 Leszek Koltunski
    {
2317
    Interpolator1D di = new Interpolator1D(); 
2318
    di.setCount(count);
2319
    di.setDuration(duration);
2320
    di.add(new Float1D(1));                                
2321 e0a16874 Leszek Koltunski
    di.add(new Float1D(sink));
2322 6a06a912 Leszek Koltunski
    
2323 e0a16874 Leszek Koltunski
    return mV.add(EffectNames.SINK, di, region, center);
2324 6a06a912 Leszek Koltunski
    }
2325
2326
///////////////////////////////////////////////////////////////////////////////////////////////////
2327
/**
2328 e0a16874 Leszek Koltunski
 * Pull all points of the Object towards the center of the Effect (if degree>=1) or push them
2329 6a06a912 Leszek Koltunski
 * away from the center (degree<=1).
2330
 * 
2331 e0a16874 Leszek Koltunski
 * @param sink     How much to push or pull. Between 0 and infinity.
2332
 * @param center   Center of the Effect.
2333 6a06a912 Leszek Koltunski
 * @param duration Time, in milliseconds, it takes to do one full interpolation.
2334 d7bbef2f Leszek Koltunski
 * @param count    Controls how many interpolations we want to do. See {@link Interpolator#setCount(float)}
2335
 * @return         ID of the effect added, or -1 if we failed to add one. 
2336 6a06a912 Leszek Koltunski
 */
2337 e0a16874 Leszek Koltunski
  public long sink(float sink, Float2D center, int duration, float count)
2338 6a06a912 Leszek Koltunski
    {
2339
    Interpolator1D di = new Interpolator1D();  
2340
    di.setCount(count);
2341
    di.setDuration(duration);
2342
    di.add(new Float1D(1));                                
2343 e0a16874 Leszek Koltunski
    di.add(new Float1D(sink));
2344 6a06a912 Leszek Koltunski
         
2345 e0a16874 Leszek Koltunski
    return mV.add(EffectNames.SINK, di, null, center);
2346 6a06a912 Leszek Koltunski
    }
2347
2348
///////////////////////////////////////////////////////////////////////////////////////////////////
2349
/**
2350 e0a16874 Leszek Koltunski
 * Pull all points of the Object towards the center of the Effect (if degree>=1) or push them
2351 6a06a912 Leszek Koltunski
 * away from the center (degree<=1).
2352
 * <p>
2353
 * Equivalent to calling the previous method with count=0.5.
2354
 * 
2355 e0a16874 Leszek Koltunski
 * @param sink     How much to push or pull. Between 0 and infinity.
2356
 * @param center   Center of the Effect.
2357 6a06a912 Leszek Koltunski
 * @param duration Time, in milliseconds, it takes to do one full interpolation.
2358 d7bbef2f Leszek Koltunski
 * @return         ID of the effect added, or -1 if we failed to add one. 
2359 6a06a912 Leszek Koltunski
 */
2360 e0a16874 Leszek Koltunski
  public long sink(float sink, Float2D center, int duration)
2361 6a06a912 Leszek Koltunski
    {
2362
    Interpolator1D di = new Interpolator1D(); 
2363
    di.setCount(0.5f);
2364
    di.setDuration(duration);
2365
    di.add(new Float1D(1));                               
2366 e0a16874 Leszek Koltunski
    di.add(new Float1D(sink));
2367 6a06a912 Leszek Koltunski
        
2368 e0a16874 Leszek Koltunski
    return mV.add(EffectNames.SINK, di, null, center);
2369 6a06a912 Leszek Koltunski
    }
2370
2371
///////////////////////////////////////////////////////////////////////////////////////////////////
2372
/**
2373 e0a16874 Leszek Koltunski
 * Pull all points of the Object towards the center of the Effect (if degree>=1) or push them
2374 6a06a912 Leszek Koltunski
 * away from the center (degree<=1).
2375
 * <p>
2376
 * Equivalent of calling the previous method with duration=0; i.e. we pull immediately.
2377
 * 
2378 e0a16874 Leszek Koltunski
 * @param sink   How much to push or pull. Between 0 and infinity.
2379
 * @param center Center of the Effect.
2380 d7bbef2f Leszek Koltunski
 * @return       ID of the effect added, or -1 if we failed to add one. 
2381 6a06a912 Leszek Koltunski
 */
2382 e0a16874 Leszek Koltunski
  public long sink(float sink, Float2D center)
2383 6a06a912 Leszek Koltunski
    {
2384
    Interpolator1D di = new Interpolator1D(); 
2385
    di.setCount(0.5f);
2386
    di.setDuration(0);
2387
    di.add(new Float1D(1));                               
2388 e0a16874 Leszek Koltunski
    di.add(new Float1D(sink));
2389 6a06a912 Leszek Koltunski
        
2390 e0a16874 Leszek Koltunski
    return mV.add(EffectNames.SINK, di, null, center);
2391 6a06a912 Leszek Koltunski
    }
2392
  
2393
///////////////////////////////////////////////////////////////////////////////////////////////////  
2394
///////////////////////////////////////////////////////////////////////////////////////////////////
2395
// SWIRL
2396
/**
2397 e0a16874 Leszek Koltunski
 * Rotate part of the Object around the Center of the Effect by a certain angle (as returned by the
2398 6a06a912 Leszek Koltunski
 * Interpolator). 
2399
 *   
2400 e0a16874 Leszek Koltunski
 * @param swirl  1-dimensional Interpolator which, at any given time, returns a Point1D representing
2401 d7bbef2f Leszek Koltunski
 *               the degree of Swirl.
2402
 * @param region Region that masks the effect of the Swirl.
2403 e0a16874 Leszek Koltunski
 * @param center 2-dimensional Interpolator that, at any given time, returns a Point2D representing
2404 d7bbef2f Leszek Koltunski
 *               the Center of the Effect.
2405
 * @return       ID of the effect added, or -1 if we failed to add one. 
2406 6a06a912 Leszek Koltunski
 */
2407 e0a16874 Leszek Koltunski
  public long swirl(Interpolator1D swirl, Float4D region, Interpolator2D center)
2408 6a06a912 Leszek Koltunski
    {    
2409 e0a16874 Leszek Koltunski
    return mV.add(EffectNames.SWIRL, swirl, region, center);
2410 6a06a912 Leszek Koltunski
    }
2411
2412
///////////////////////////////////////////////////////////////////////////////////////////////////
2413
/**
2414 e0a16874 Leszek Koltunski
 * Rotate part of the Object around the Center of the Effect by a certain angle (as returned by the
2415 6a06a912 Leszek Koltunski
 * Interpolator).
2416
 * <p>
2417
 * Here the Center stays constant.
2418
 *      
2419 e0a16874 Leszek Koltunski
 * @param swirl  1-dimensional Interpolator which, at any given time, returns a Point1D representing
2420 d7bbef2f Leszek Koltunski
 *               the degree of Swirl.
2421
 * @param region Region that masks the effect of the Swirl.
2422 e0a16874 Leszek Koltunski
 * @param center Center of the Effect.
2423 d7bbef2f Leszek Koltunski
 * @return       ID of the effect added, or -1 if we failed to add one. 
2424 6a06a912 Leszek Koltunski
 */
2425 e0a16874 Leszek Koltunski
  public long swirl(Interpolator1D swirl, Float4D region, Float2D center)
2426 6a06a912 Leszek Koltunski
    {    
2427 e0a16874 Leszek Koltunski
    return mV.add(EffectNames.SWIRL, swirl, region, center);
2428 6a06a912 Leszek Koltunski
    }
2429
 
2430
///////////////////////////////////////////////////////////////////////////////////////////////////
2431
/**
2432 e0a16874 Leszek Koltunski
 * Rotate part of the Object around the Center of the Effect by 'degree' angle.
2433 6a06a912 Leszek Koltunski
 *   
2434 e0a16874 Leszek Koltunski
 * @param swirl    Angle of rotation. Unit: degrees.
2435 d7bbef2f Leszek Koltunski
 * @param region   Region that masks the effect of the Swirl.
2436 e0a16874 Leszek Koltunski
 * @param center   2-dimensional Interpolator that, at any given time, returns a Point2D representing
2437 d7bbef2f Leszek Koltunski
 *                 the Center of the Effect.
2438 b1e91f2c Leszek Koltunski
 * @return         ID of the effect added, or -1 if we failed to add one.
2439 6a06a912 Leszek Koltunski
 */
2440 e0a16874 Leszek Koltunski
  public long swirl(int swirl, Float4D region, Interpolator2D center)
2441 6a06a912 Leszek Koltunski
    {
2442 b1e91f2c Leszek Koltunski
    Interpolator1D di = new Interpolator1D();
2443
    di.setCount(0.5f);
2444
    di.setDuration(0);
2445 6a06a912 Leszek Koltunski
    di.add(new Float1D(0));                                
2446 e0a16874 Leszek Koltunski
    di.add(new Float1D(swirl));
2447 6a06a912 Leszek Koltunski
    
2448 e0a16874 Leszek Koltunski
    return mV.add(EffectNames.SWIRL, di, region, center);
2449 6a06a912 Leszek Koltunski
    }
2450
2451
///////////////////////////////////////////////////////////////////////////////////////////////////
2452
/**
2453 e0a16874 Leszek Koltunski
 * Rotate part of the Object around the Center of the Effect by 'degree' angle.
2454 6a06a912 Leszek Koltunski
 * <p>
2455
 * Here the Center stays constant.
2456
 *    
2457 e0a16874 Leszek Koltunski
 * @param swirl    Angle of rotation. Unit: degrees.
2458 d7bbef2f Leszek Koltunski
 * @param region   Region that masks the effect of the Swirl.
2459 e0a16874 Leszek Koltunski
 * @param center   Center of the Effect.
2460 6a06a912 Leszek Koltunski
 * @param duration Time, in milliseconds, it takes to do one full interpolation.
2461 d7bbef2f Leszek Koltunski
 * @param count    Controls how many interpolations we want to do. See {@link Interpolator#setCount(float)}
2462
 * @return         ID of the effect added, or -1 if we failed to add one. 
2463 6a06a912 Leszek Koltunski
 */
2464 e0a16874 Leszek Koltunski
  public long swirl(int swirl, Float4D region, Float2D center, int duration, float count)
2465 6a06a912 Leszek Koltunski
    {
2466
    Interpolator1D di = new Interpolator1D(); 
2467
    di.setCount(count);
2468
    di.setDuration(duration);
2469
    di.add(new Float1D(0));                                
2470 e0a16874 Leszek Koltunski
    di.add(new Float1D(swirl));
2471 6a06a912 Leszek Koltunski
    
2472 e0a16874 Leszek Koltunski
    return mV.add(EffectNames.SWIRL, di, region, center);
2473 6a06a912 Leszek Koltunski
    }
2474
2475
///////////////////////////////////////////////////////////////////////////////////////////////////
2476
/**
2477 e0a16874 Leszek Koltunski
 * Rotate the whole Object around the Center of the Effect by 'degree' angle.
2478 6a06a912 Leszek Koltunski
 * 
2479 e0a16874 Leszek Koltunski
 * @param swirl    Angle of rotation. Unit: degrees.
2480
 * @param center   Center of the Effect.
2481 6a06a912 Leszek Koltunski
 * @param duration Time, in milliseconds, it takes to do one full interpolation.
2482 d7bbef2f Leszek Koltunski
 * @param count    Controls how many interpolations we want to do. See {@link Interpolator#setCount(float)}
2483
 * @return         ID of the effect added, or -1 if we failed to add one. 
2484 6a06a912 Leszek Koltunski
 */
2485 e0a16874 Leszek Koltunski
  public long swirl(int swirl, Float2D center, int duration, float count)
2486 6a06a912 Leszek Koltunski
    {
2487
    Interpolator1D di = new Interpolator1D();  
2488
    di.setCount(count);
2489
    di.setDuration(duration);
2490
    di.add(new Float1D(0));                                
2491 e0a16874 Leszek Koltunski
    di.add(new Float1D(swirl));
2492 6a06a912 Leszek Koltunski
         
2493 e0a16874 Leszek Koltunski
    return mV.add(EffectNames.SWIRL, di, null, center);
2494 6a06a912 Leszek Koltunski
    }
2495
2496
///////////////////////////////////////////////////////////////////////////////////////////////////
2497
/**
2498 e0a16874 Leszek Koltunski
 * Rotate the whole Object around the Center of the Effect by 'degree' angle.
2499 6a06a912 Leszek Koltunski
 * <p>
2500
 * Equivalent to calling the previous method with count=0.5.
2501
 * 
2502 e0a16874 Leszek Koltunski
 * @param swirl    Angle of rotation. Unit: degrees.
2503
 * @param center   Center of the Effect.
2504 6a06a912 Leszek Koltunski
 * @param duration Time, in milliseconds, it takes to do one full interpolation.
2505 d7bbef2f Leszek Koltunski
 * @return         ID of the effect added, or -1 if we failed to add one. 
2506 6a06a912 Leszek Koltunski
 */
2507 e0a16874 Leszek Koltunski
  public long swirl(int swirl, Float2D center, int duration)
2508 6a06a912 Leszek Koltunski
    {
2509
    Interpolator1D di = new Interpolator1D(); 
2510
    di.setCount(0.5f);
2511
    di.setDuration(duration);
2512
    di.add(new Float1D(0));                               
2513 e0a16874 Leszek Koltunski
    di.add(new Float1D(swirl));
2514 6a06a912 Leszek Koltunski
        
2515 e0a16874 Leszek Koltunski
    return mV.add(EffectNames.SWIRL, di, null, center);
2516 6a06a912 Leszek Koltunski
    }
2517
2518
///////////////////////////////////////////////////////////////////////////////////////////////////
2519
/**
2520 e0a16874 Leszek Koltunski
 * Rotate the whole Object around the Center of the Effect by 'degree' angle.
2521 6a06a912 Leszek Koltunski
 * <p>
2522
 * Equivalent to calling the previous method with duration=0.
2523
 * 
2524 e0a16874 Leszek Koltunski
 * @param swirl  Angle of rotation. Unit: degrees.
2525
 * @param center Center of the Effect.
2526 d7bbef2f Leszek Koltunski
 * @return       ID of the effect added, or -1 if we failed to add one. 
2527 6a06a912 Leszek Koltunski
 */
2528 e0a16874 Leszek Koltunski
  public long swirl(int swirl, Float2D center)
2529 6a06a912 Leszek Koltunski
    {
2530
    Interpolator1D di = new Interpolator1D(); 
2531
    di.setCount(0.5f);
2532
    di.setDuration(0);
2533
    di.add(new Float1D(0));                               
2534 e0a16874 Leszek Koltunski
    di.add(new Float1D(swirl));
2535 6a06a912 Leszek Koltunski
        
2536 e0a16874 Leszek Koltunski
    return mV.add(EffectNames.SWIRL, di, null, center);
2537 6a06a912 Leszek Koltunski
    }
2538
2539
///////////////////////////////////////////////////////////////////////////////////////////////////
2540
///////////////////////////////////////////////////////////////////////////////////////////////////
2541
// WAVE
2542
2543
///////////////////////////////////////////////////////////////////////////////////////////////////   
2544 2e18813f Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
2545
// Other-based effects
2546
///////////////////////////////////////////////////////////////////////////////////////////////////
2547
// SAVE_PNG
2548
/**
2549 e0a16874 Leszek Koltunski
 * Save the current state of the Object that's backing up our DistortedObject to a PNG file.
2550 2e18813f Leszek Koltunski
 *
2551
 * @param filename Full path to the file.
2552
 * @return         ID of the effect added, or -1 if we failed to add one.
2553
 */
2554 c6e1c219 Leszek Koltunski
 public long savePNG(String filename, int left, int top, int width, int height)
2555 2e18813f Leszek Koltunski
   {
2556 c6e1c219 Leszek Koltunski
   return mO.add(EffectNames.SAVE_PNG, filename, left, top, width, height);
2557 2e18813f Leszek Koltunski
   }
2558 6a06a912 Leszek Koltunski
}