Project

General

Profile

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

library / src / main / java / org / distorted / library / DistortedObject.java @ 9361b337

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