Project

General

Profile

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

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

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