Project

General

Profile

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

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

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