Project

General

Profile

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

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

1
package org.distorted.library;
2

    
3
import android.graphics.Bitmap;
4
import android.opengl.GLES20;
5
import android.opengl.GLUtils;
6

    
7
///////////////////////////////////////////////////////////////////////////////////////////////////
8
/**
9
 * All Objects to which Distorted Graphics effects can be applied need to be extended from here.
10
 */
11
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

    
31
///////////////////////////////////////////////////////////////////////////////////////////////////
32

    
33
    protected abstract DistortedObject deepCopy(int flags);
34

    
35
///////////////////////////////////////////////////////////////////////////////////////////////////
36

    
37
    protected void initializeData(int size)
38
      {
39
      mID             = DistortedObjectList.add(this);
40
      mSize           = size;
41
      mTextureDataH   = new int[1];
42
      mTextureDataH[0]= 0;
43
      mBmp            = new Bitmap[1];
44
      mBmp[0]         = null;
45
      mBitmapSet      = new boolean[1];
46
      mBitmapSet[0]   = false;
47
      
48
      initializeEffectLists(this,0);
49
      
50
      if( Distorted.isInitialized() ) resetTexture();    
51
      }
52
    
53
///////////////////////////////////////////////////////////////////////////////////////////////////
54
    
55
    protected void initializeEffectLists(DistortedObject d, int flags)
56
      {
57
      if( (flags & Distorted.CLONE_MATRIX) != 0 )
58
        {
59
        mM = d.mM;
60
        matrixCloned = true;
61
        } 
62
      else
63
        {
64
        mM = new EffectListMatrix(d);
65
        matrixCloned = false;  
66
        }
67
    
68
      if( (flags & Distorted.CLONE_VERTEX) != 0 )
69
        {
70
        mV = d.mV;
71
        vertexCloned = true;
72
        } 
73
      else
74
        {
75
        mV = new EffectListVertex(d);
76
        vertexCloned = false;  
77
        }
78
    
79
      if( (flags & Distorted.CLONE_FRAGMENT) != 0 )
80
        {
81
        mF = d.mF;
82
        fragmentCloned = true;
83
        } 
84
      else
85
        {
86
        mF = new EffectListFragment(d);
87
        fragmentCloned = false;   
88
        }
89
      }
90
    
91
///////////////////////////////////////////////////////////////////////////////////////////////////
92
// this will be called on startup and every time OpenGL context has been lost
93
// also call this from the constructor if the OpenGL context has been created already.
94
    
95
    void resetTexture()
96
      {
97
      if( mTextureDataH!=null ) 
98
        {
99
        if( mTextureDataH[0]==0 ) GLES20.glGenTextures(1, mTextureDataH, 0);
100

    
101
        GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mTextureDataH[0]);       
102
        GLES20.glTexParameteri ( GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR );
103
        GLES20.glTexParameteri ( GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR );
104
        GLES20.glTexParameteri ( GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE );
105
        GLES20.glTexParameteri ( GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE );
106
       
107
        if( mBmp!=null && mBmp[0]!=null)
108
          {
109
          GLUtils.texImage2D(GLES20.GL_TEXTURE_2D, 0, mBmp[0], 0);
110
          mBmp[0] = null;
111
          }
112
        }
113
      }
114
  
115
///////////////////////////////////////////////////////////////////////////////////////////////////
116
   
117
    void drawPriv(long currTime, DistortedProjection dp)
118
      {
119
      GLES20.glViewport(0, 0, dp.width, dp.height); 
120
      
121
      mM.compute(currTime);
122
      mM.send(mViewMatrix, dp);
123
      
124
      mV.compute(currTime);
125
      mV.postprocess();
126
      mV.send();
127
        
128
      mF.compute(currTime);
129
      mF.postprocess(mViewMatrix);
130
      mF.send();
131
       
132
      mGrid.draw();
133
      }
134

    
135
///////////////////////////////////////////////////////////////////////////////////////////////////
136
   
137
    void drawNoEffectsPriv(DistortedProjection dp)
138
      {
139
      GLES20.glViewport(0, 0, dp.width, dp.height);
140
      mM.sendNoEffects(dp);
141
      mV.sendZero();
142
      mF.sendZero();
143
      mGrid.draw();
144
      }
145
    
146
///////////////////////////////////////////////////////////////////////////////////////////////////
147
   
148
    void releasePriv()
149
      {
150
      if( matrixCloned  ==false) mM.abortAll();
151
      if( vertexCloned  ==false) mV.abortAll();
152
      if( fragmentCloned==false) mF.abortAll();
153

    
154
      mBmp          = null;
155
      mGrid         = null;
156
      mM            = null;
157
      mV            = null;
158
      mF            = null;
159
      mTextureDataH = null;
160
      }
161
 
162
///////////////////////////////////////////////////////////////////////////////////////////////////
163

    
164
    long getBitmapID()
165
      {
166
      return mBmp==null ? 0 : mBmp.hashCode();
167
      }
168

    
169
///////////////////////////////////////////////////////////////////////////////////////////////////
170

    
171
  /**
172
   * Default empty constructor so that derived classes can call it
173
   */
174
    public DistortedObject()
175
      {
176

    
177
      }
178

    
179
///////////////////////////////////////////////////////////////////////////////////////////////////
180
  /**
181
   * Copy constructor used to create a DistortedObject based on various parts of another object.
182
   * <p>
183
   * Whatever we do not clone gets created just like in the default constructor.
184
   *
185
   * @param dc    Source object to create our object from
186
   * @param flags A bitmask of values specifying what to copy.
187
   *              For example, CLONE_BITMAP | CLONE_MATRIX.
188
   */
189
    public DistortedObject(DistortedObject dc, int flags)
190
      {
191
      initializeEffectLists(dc,flags);
192

    
193
      mID = DistortedObjectList.add(this);
194

    
195
      mSizeX = dc.mSizeX;
196
      mSizeY = dc.mSizeY;
197
      mSizeZ = dc.mSizeZ;
198
      mSize  = dc.mSize;
199
      mGrid  = dc.mGrid;
200

    
201
      if( (flags & Distorted.CLONE_BITMAP) != 0 )
202
        {
203
        mTextureDataH = dc.mTextureDataH;
204
        mBmp          = dc.mBmp;
205
        mBitmapSet    = dc.mBitmapSet;
206
        }
207
      else
208
        {
209
        mTextureDataH   = new int[1];
210
        mTextureDataH[0]= 0;
211
        mBitmapSet      = new boolean[1];
212
        mBitmapSet[0]   = false;
213
        mBmp            = new Bitmap[1];
214
        mBmp[0]         = null;
215

    
216
        if( Distorted.isInitialized() ) resetTexture();
217
        }
218
      }
219

    
220
///////////////////////////////////////////////////////////////////////////////////////////////////
221
/**
222
 * Draw the DistortedObject to the location specified by current Matrix effects.    
223
 *     
224
 * @param currTime current time, in milliseconds, as returned by System.currentTimeMillis().
225
 *        This gets passed on to Interpolators inside the Effects that are currently applied to the 
226
 *        Object.
227
 */
228
   public void draw(long currTime)
229
     {
230
     GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
231
     GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, 0);
232
     GLES20.glUniform1i(Distorted.mTextureUniformH, 0);  
233
     GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mTextureDataH[0]); 
234
      
235
     drawPriv(currTime, Distorted.mProjection);
236
     }
237
 
238
///////////////////////////////////////////////////////////////////////////////////////////////////
239
/**
240
 * Releases all resources.
241
 */
242
   public synchronized void release()
243
     {
244
     releasePriv();  
245
     DistortedObjectList.remove(this);
246
     }
247

    
248
///////////////////////////////////////////////////////////////////////////////////////////////////
249
/**
250
 * Sets the underlying android.graphics.Bitmap object and uploads it to the GPU. 
251
 * <p>
252
 * You can only recycle() the passed Bitmap once the OpenGL context gets created (i.e. after call 
253
 * to onSurfaceCreated) because only after this point can the Library upload it to the GPU!
254
 * 
255
 * @param bmp The android.graphics.Bitmap object to apply effects to and display.
256
 */
257
   
258
   public void setBitmap(Bitmap bmp)
259
     {
260
     mBitmapSet[0] = true; 
261
      
262
     if( Distorted.isInitialized() )
263
       {
264
       GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
265
       GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mTextureDataH[0]);        
266
       GLUtils.texImage2D(GLES20.GL_TEXTURE_2D, 0, bmp, 0);
267
       }
268
     else
269
       {
270
       mBmp[0] = bmp;  
271
       }
272
     }
273
    
274
///////////////////////////////////////////////////////////////////////////////////////////////////
275
/**
276
 * Adds the calling class to the list of Listeners that get notified each time some event happens 
277
 * to one of the Effects that are currently applied to the DistortedBitmap.
278
 * 
279
 * @param el A class implementing the EffectListener interface that wants to get notifications.
280
 */
281
   public void addEventListener(EffectListener el)
282
     {
283
     mV.addListener(el);
284
     mF.addListener(el);
285
     mM.addListener(el);
286
     }
287

    
288
///////////////////////////////////////////////////////////////////////////////////////////////////
289
/**
290
 * Removes the calling class from the list of Listeners.
291
 * 
292
 * @param el A class implementing the EffectListener interface that no longer wants to get notifications.
293
 */
294
   public void removeEventListener(EffectListener el)
295
     {
296
     mV.removeListener(el);
297
     mF.removeListener(el);
298
     mM.removeListener(el);
299
     }
300
   
301
///////////////////////////////////////////////////////////////////////////////////////////////////
302
/**
303
 * Returns the height of the DistortedObject.
304
 *    
305
 * @return height of the object, in pixels.
306
 */
307
   public int getWidth()
308
     {
309
     return mSizeX;   
310
     }
311

    
312
///////////////////////////////////////////////////////////////////////////////////////////////////
313
/**
314
 * Returns the width of the DistortedObject.
315
 * 
316
 * @return width of the Object, in pixels.
317
 */
318
    public int getHeight()
319
      {
320
      return mSizeY;  
321
      }
322
    
323
///////////////////////////////////////////////////////////////////////////////////////////////////
324
/**
325
 * Returns the depth of the DistortedObject.
326
 * 
327
 * @return depth of the Object, in pixels.
328
 */
329
    public int getDepth()
330
      {
331
      return mSizeZ;  
332
      }
333
        
334
///////////////////////////////////////////////////////////////////////////////////////////////////
335
/**
336
 * Returns unique ID of this instance.
337
 * 
338
 * @return ID of the object.
339
 */
340
    public long getID()
341
      {
342
      return mID;  
343
      }
344
    
345
///////////////////////////////////////////////////////////////////////////////////////////////////
346
/**
347
 * Aborts all Effects. 
348
 */
349
    public void abortAllEffects()
350
      {
351
      mM.abortAll();
352
      mV.abortAll();
353
      mF.abortAll();
354
      }
355

    
356
///////////////////////////////////////////////////////////////////////////////////////////////////
357
/**
358
 * Aborts a subset of Effects.
359
 * 
360
 * @param mask Bitmask of the types of effects we want to abort, e.g. TYPE_MATR | TYPE_VERT | TYPE_FRAG.
361
 */
362
    public void abortAllEffects(int mask)
363
      {
364
      if( (mask & Distorted.TYPE_MATR) != 0 ) mM.abortAll();
365
      if( (mask & Distorted.TYPE_VERT) != 0 ) mV.abortAll();
366
      if( (mask & Distorted.TYPE_FRAG) != 0 ) mF.abortAll();
367
      }
368
    
369
///////////////////////////////////////////////////////////////////////////////////////////////////
370
/**
371
 * Aborts a single Effect.
372
 * 
373
 * @param id ID of the Effect we want to abort.
374
 * @return <code>true</code> if the Effect was found and successfully aborted.
375
 */
376
    public boolean abortEffect(long id)
377
      {
378
      switch( (int)(id&TYPE_MASK) )
379
        {
380
        case Distorted.TYPE_MATR: return mM.removeByID(id>>TYPE_NUM);
381
        case Distorted.TYPE_VERT: return mV.removeByID(id>>TYPE_NUM);
382
        case Distorted.TYPE_FRAG: return mF.removeByID(id>>TYPE_NUM);
383
        default                 : return false;
384
        }
385
      }
386

    
387
///////////////////////////////////////////////////////////////////////////////////////////////////
388
/**
389
 * Abort all Effects of a given type, for example all rotations.
390
 * 
391
 * @param effectType one of the constants defined in {@link EffectNames}
392
 * @return <code>true</code> if a single Effect of type effectType has been found and aborted. 
393
 */
394
    public boolean abortEffectType(EffectNames effectType)
395
      {
396
      switch(effectType.getType())
397
        {
398
        case Distorted.TYPE_MATR: return mM.removeByType(effectType);
399
        case Distorted.TYPE_VERT: return mV.removeByType(effectType);
400
        case Distorted.TYPE_FRAG: return mF.removeByType(effectType);
401
        default                 : return false;
402
        }
403
      }
404
    
405
///////////////////////////////////////////////////////////////////////////////////////////////////
406
/**
407
 * Print some info about a given Effect to Android's standard out. Used for debugging only.
408
 * 
409
 * @param id Effect ID we want to print info about
410
 * @return <code>true</code> if a single Effect of type effectType has been found.
411
 */
412
    
413
    public boolean printEffect(long id)
414
      {
415
      switch( (int)(id&TYPE_MASK) )
416
        {
417
        case Distorted.TYPE_MATR: return mM.printByID(id>>TYPE_NUM);
418
        case Distorted.TYPE_VERT: return mV.printByID(id>>TYPE_NUM);
419
        case Distorted.TYPE_FRAG: return mF.printByID(id>>TYPE_NUM);
420
        default                 : return false;
421
        }
422
      }
423
   
424
///////////////////////////////////////////////////////////////////////////////////////////////////   
425
///////////////////////////////////////////////////////////////////////////////////////////////////
426
// Individual effect functions.
427
///////////////////////////////////////////////////////////////////////////////////////////////////
428
// Matrix-based effects
429
///////////////////////////////////////////////////////////////////////////////////////////////////
430
// MOVE
431
/**
432
 * Moves the Object by a vector that changes in time as interpolated by the Interpolator.
433
 * 
434
 * @param di 3-dimensional Interpolator which at any given time will return a Float3D
435
 *           representing the current coordinates of the vector we want to move the Object with.
436
 * @return   ID of the effect added, or -1 if we failed to add one. 
437
 */
438
  public long move(Interpolator3D di)
439
    {   
440
    return mM.add(EffectNames.MOVE,null,di);  
441
    }
442

    
443
///////////////////////////////////////////////////////////////////////////////////////////////////
444
/**
445
 * Moves the Bitmap by a vector that smoothly changes from (0,0,0) to (x,y,z).
446
 *  
447
 * @param x        The x-coordinate of the vector we want to move the Object with. 
448
 * @param y        The y-coordinate of the vector we want to move the Object with.
449
 * @param z        The z-coordinate of the vector we want to move the Object with.
450
 * @param duration The time, in milliseconds, it takes to complete the movement.
451
 * @return         ID of the effect added, or -1 if we failed to add one. 
452
 */
453
  public long move(float x,float y,float z, int duration)
454
    {   
455
    Interpolator3D di = new Interpolator3D();  
456
    di.setCount(0.5f);
457
    di.setDuration(duration);
458
    di.add(new Float3D(0.0f,0.0f,0.0f));                             
459
    di.add(new Float3D(x,y,z));                        
460

    
461
    return mM.add(EffectNames.MOVE,null,di);  
462
    }
463

    
464
///////////////////////////////////////////////////////////////////////////////////////////////////
465
/**
466
 * Moves the Bitmap by vector (x,y,z) immediately.
467
 *   
468
 * @param x The x-coordinate of the vector we want to move the Object with. 
469
 * @param y The y-coordinate of the vector we want to move the Object with.
470
 * @param z The z-coordinate of the vector we want to move the Object with.
471
 * @return  ID of the effect added, or -1 if we failed to add one. 
472
 */
473
  public long move(float x,float y,float z)
474
    {   
475
    return mM.add(EffectNames.MOVE,0.0f,0.0f,0.0f,x,y,z,0.0f);  
476
    }
477

    
478
///////////////////////////////////////////////////////////////////////////////////////////////////
479
// SCALE
480
/**
481
 * Scales the Object by factors that change in time as returned by the Interpolator.
482
 * 
483
 * @param di 3-dimensional Interpolator which at any given time returns a Float3D
484
 *           representing the current x- , y- and z- scale factors.
485
 * @return   ID of the effect added, or -1 if we failed to add one. 
486
 */
487
  public long scale(Interpolator3D di)
488
    {   
489
    return mM.add(EffectNames.SCALE,null,di);  
490
    }
491

    
492
///////////////////////////////////////////////////////////////////////////////////////////////////
493
/**
494
 * Scales the Object by a factor that smoothly changes from (1,1,1) at time 0 to (xscale,yscale,zscale)
495
 * after 'duration' milliseconds. 
496
 *    
497
 * @param xscale   After time 'duration' passes, Bitmap's width will get multiplied by xscale; e.g. if 
498
 *                 xscale=2, after 'duration' milliseconds the Object will become twice broader.
499
 * @param yscale   Factor to scale Object's height with.
500
 * @param zscale   Factor to scale Object's depth with.
501
 * @param duration Time, in milliseconds, it takes to interpolate to the full (xscale,yscale,zscale) scaling factors.
502
 * @return         ID of the effect added, or -1 if we failed to add one. 
503
 */
504
  public long scale(float xscale,float yscale,float zscale, int duration)
505
    {   
506
    Interpolator3D di = new Interpolator3D();  
507
    di.setCount(0.5f);
508
    di.setDuration(duration);
509
    di.add(new Float3D(1.0f,1.0f,1.0f));                             
510
    di.add(new Float3D(xscale,yscale,zscale));                        
511

    
512
    return mM.add(EffectNames.SCALE,null,di);  
513
    }
514

    
515
///////////////////////////////////////////////////////////////////////////////////////////////////
516
/**
517
 * Immediately scales the Object's width by (xscale,yscale,zscale).   
518
 *   
519
 * @param xscale Object's width gets multiplied by this factor; e.g. if 
520
 *               xscale=2, the Object immediately becomes twice broader.
521
 * @param yscale factor to scale Object's height with.
522
 * @param zscale factor to scale Object's depth with. 
523
 * @return       ID of the effect added, or -1 if we failed to add one. 
524
 */
525
  public long scale(float xscale,float yscale,float zscale)
526
    {   
527
    return mM.add(EffectNames.SCALE,0.0f,0.0f,0.0f,xscale,yscale,zscale,0.0f);  
528
    }
529

    
530
///////////////////////////////////////////////////////////////////////////////////////////////////
531
/**
532
 * Convenience function - scale the Object by the same factor in all 3 dimensions.   
533
 *   
534
 * @param scale all 3 Object's dimensions get multiplied by this factor; e.g. if 
535
 *              scale=2, the Object immediately becomes twice larger.
536
 * @return      ID of the effect added, or -1 if we failed to add one. 
537
 */
538
  public long scale(float scale)
539
    {   
540
    return mM.add(EffectNames.SCALE,0.0f,0.0f,0.0f,scale,scale,scale,0.0f);  
541
    }
542
    
543
///////////////////////////////////////////////////////////////////////////////////////////////////
544
// ROTATE
545
/**
546
 * Rotates the Object around a (possibly moving) point, with angle and axis that change in time.
547
 * 
548
 * @param i 3-dimensional Interpolator which at any given time will return the current center of 
549
 *          the rotation
550
 * @param v 4-dimensional Interpolator which at any given time will return a Float4D
551
 *          representing the current rotation in the (angle,axisX,axisY,axisY) form. 
552
 * @return  ID of the effect added, or -1 if we failed to add one. 
553
 */
554
  public long rotate(Interpolator3D i, Interpolator4D v)
555
    {   
556
    return mM.add(EffectNames.ROTATE, i, v);  
557
    }
558

    
559
///////////////////////////////////////////////////////////////////////////////////////////////////  
560
/**
561
 * Rotates the Object around a static point, with angle and axis that change in time.
562
 * 
563
 * @param point Center of the rotation
564
 * @param v     4-dimensional Interpolator which at any given time will return a Float4D
565
 *              representing the current rotation in the (angle,axisX,axisY,axisY) form. 
566
 * @return      ID of the effect added, or -1 if we failed to add one. 
567
 */
568
  public long rotate(Float3D point, Interpolator4D v)
569
    {   
570
    return mM.add(EffectNames.ROTATE, point.x, point.y, point.z , v);  
571
    }
572
  
573
///////////////////////////////////////////////////////////////////////////////////////////////////  
574
/**
575
 * Rotates the Object around a static point, with angle that changes in time, around axis 
576
 * (axisX, axisY, axisZ). 
577
 * 
578
 * @param point Center of the rotation
579
 * @param v     1-dimensional Interpolator which at any given time will return the current rotation 
580
 *              angle.
581
 * @param axisX Rotation vector: x-coordinate
582
 * @param axisY Rotation vector: y-coordinate         
583
 * @param axisZ Rotation vector: z-coordinate         
584
 * @return      ID of the effect added, or -1 if we failed to add one. 
585
 */
586
  public long rotate(Float3D point, Interpolator1D v, float axisX, float axisY, float axisZ)
587
    {   
588
    return mM.add(EffectNames.ROTATE, point.x, point.y, point.z , v, axisX, axisY, axisZ);  
589
    }
590
  
591
///////////////////////////////////////////////////////////////////////////////////////////////////
592
/**
593
 * Rotates the Object around a (possibly moving) point, with angle that changes in time.
594
 * Axis of rotation is the vector (0,0,1), i.e. a vector normal to the screen surface.
595
 * 
596
 * @param i 3-dimensional Interpolator which at any given time will return the current center
597
 *          of the rotation.
598
 * @param a 1-dimensional Interpolator which returns the current rotation angle.         
599
 * @return  ID of the effect added, or -1 if we failed to add one. 
600
 */
601
  public long rotate(Interpolator3D i, Interpolator1D a)
602
    {   
603
    return mM.add(EffectNames.ROTATE, i, a, 0.0f,0.0f,1.0f);  
604
    }
605

    
606
///////////////////////////////////////////////////////////////////////////////////////////////////
607
/**
608
 * Rotates the Object around a constant point, with angle that changes in time.  
609
 * Axis of rotation is the vector (0,0,1), i.e. a vector normal to the screen surface.
610
 *   
611
 * @param point    Coordinates of the Point we are rotating around.
612
 * @param angle    Angle that we want to rotate the Bitmap to. Unit: degrees
613
 * @param duration Time, in milliseconds, it takes to complete one rotation from 0 to 'angle' degrees.
614
 * @return         ID of the effect added, or -1 if we failed to add one. 
615
 */
616
  public long rotate(Float3D point, int angle, int duration)
617
    {   
618
    Interpolator1D di = new Interpolator1D();  
619
    di.setCount(0.5f);
620
    di.setDuration(duration);
621
    di.add(new Float1D(    0));                             
622
    di.add(new Float1D(angle));                        
623

    
624
    return mM.add(EffectNames.ROTATE,point.x,point.y,point.z, di, 0.0f,0.0f,1.0f);  
625
    }
626

    
627
///////////////////////////////////////////////////////////////////////////////////////////////////
628
/**
629
 * Rotates the Object immediately by 'angle' degrees around point p.   
630
 * Axis of rotation is given by the last 3 floats.
631
 *   
632
 * @param point Coordinates of the Point we are rotating around.
633
 * @param angle Angle that we want to rotate the Bitmap to. Unit: degrees
634
 * @param axisX Axis of rotation: x-coordinate
635
 * @param axisY Axis of rotation: y-coordinate
636
 * @param axisZ Axis of rotation: z-coordinate
637
 * @return      ID of the effect added, or -1 if we failed to add one. 
638
 */
639
  public long rotate(Float3D point, float angle, float axisX, float axisY, float axisZ)
640
    {   
641
    return mM.add(EffectNames.ROTATE, point.x, point.y, point.z, angle, axisX, axisY, axisZ);  
642
    }
643
  
644
///////////////////////////////////////////////////////////////////////////////////////////////////
645
/**
646
 * Rotates the Object immediately by 'angle' degrees around point p.   
647
 *   
648
 * @param point  Coordinates of the Point we are rotating around.
649
 * @param angle  The angle that we want to rotate the Bitmap to. Unit: degrees
650
 * @return       ID of the effect added, or -1 if we failed to add one. 
651
 */
652
  public long rotate(Float3D point, int angle)
653
    {   
654
    return mM.add(EffectNames.ROTATE,point.x,point.y,point.z,angle,0.0f,0.0f,1.0f);  
655
    }
656

    
657
///////////////////////////////////////////////////////////////////////////////////////////////////
658
// QUATERNION
659
/**
660
 * Rotates the Object immediately by quaternion (qX,qY,qZ,qW).
661
 *   
662
 * @param point Coordinates of the Point we are rotating around.
663
 * @param qX    Quaternion: x-coordinate
664
 * @param qY    Quaternion: y-coordinate
665
 * @param qZ    Quaternion: z-coordinate
666
 * @param qW    Quaternion: w-coordinate
667
 * @return      ID of the effect added, or -1 if we failed to add one. 
668
 */
669
  public long quaternion(Float3D point, float qX, float qY, float qZ, float qW)
670
    {   
671
    return mM.add(EffectNames.QUATERNION,point.x,point.y,point.z,qX,qY,qZ,qW);   
672
    }
673

    
674
///////////////////////////////////////////////////////////////////////////////////////////////////
675
/**
676
 * Rotates the Object by a quaternion that's at the moment returned by the InterpolatorQuat.
677
 *   
678
 * @param point Coordinates of the Point we are rotating around.
679
 * @param iq    Interpolator that's going to, at any given moment, return a quaternion.
680
 * @return      ID of the effect added, or -1 if we failed to add one. 
681
 */
682
  public long quaternion(Float3D point, InterpolatorQuat iq)
683
    {   
684
    return mM.add(EffectNames.QUATERNION,point.x,point.y,point.z,iq);  
685
    }
686

    
687
///////////////////////////////////////////////////////////////////////////////////////////////////
688
/**
689
 * Rotates the Object around a moving point by a quaternion that's at the moment returned by the InterpolatorQuat.
690
 *   
691
 * @param i  Interpolator that returns the current center of rotation.
692
 * @param iq Interpolator that's going to, at any given moment, return a quaternion representing the current rotation.
693
 * @return   ID of the effect added, or -1 if we failed to add one. 
694
 */
695
  public long quaternion(Interpolator3D i, InterpolatorQuat iq)
696
    {   
697
    return mM.add(EffectNames.QUATERNION,i,iq);  
698
    }
699
  
700
///////////////////////////////////////////////////////////////////////////////////////////////////
701
// SHEAR
702
/**
703
 * Shears the Object. If the Interpolator is 1D, it will shear along the X-axis. 2D Interpolator adds
704
 * shearing along the Y-axis, 3D one along Z axis.
705
 *
706
 * @param point  Center of shearing, i.e. the point which stays unmoved. 
707
 * @param di     1- 2- or 3D Interpolator which, at any given point, returns the ordered 1-, 2- 
708
 *               or 3-tuple of shear factors.
709
 * @return       ID of the effect added, or -1 if we failed to add one. 
710
 */
711
  public long shear(Float3D point, Interpolator di)
712
    {
713
    return mM.add(EffectNames.SHEAR, point.x, point.y, point.z, di);  
714
    }
715

    
716
///////////////////////////////////////////////////////////////////////////////////////////////////
717
/**
718
 * Shears the Object in 3D. Order: first X shearing, then Y, then Z.
719
 * 
720
 * @param point  Center of shearing, i.e. the point which stays unmoved. 
721
 * @param vector ordered 3-tuple (x-degree, y-degree, z-degree) of shearing (tangent of the angle with 
722
 *               which the X,Y and Z axis get slanted) 
723
 * @return       ID of the effect added, or -1 if we failed to add one. 
724
 */
725
  public long shear(Float3D point, Float3D vector)
726
    {
727
    Interpolator3D di = new Interpolator3D(); 
728
    di.setCount(0.5f);
729
    di.setDuration(0);
730
    di.add(new Float3D(0.0f,0.0f,0.0f));              
731
    di.add(vector);                                                
732
        
733
    return mM.add(EffectNames.SHEAR, point.x, point.y, point.z, di );  
734
    }
735

    
736
///////////////////////////////////////////////////////////////////////////////////////////////////
737
// Fragment-based effects  
738
///////////////////////////////////////////////////////////////////////////////////////////////////
739
// MACROBLOCK
740
/**
741
 * Creates macroblocks at and around point defined by the Interpolator2D and the Region. 
742
 * Size of the macroblocks at any given time is returned by the Interpolator1D.
743
 * 
744
 * @param a      1-dimensional Interpolator which, at any given time, returns the size of the macroblocks.
745
 * @param region Region this Effect is limited to.
746
 *               Null here means 'apply the effect to the whole Bitmap'.
747
 * @param i      2-dimensional Interpolator which, at any given time, returns a Float2D representing the
748
 *               current center of the effect.
749
 * @return       ID of the effect added, or -1 if we failed to add one. 
750
 */
751
  public long macroblock(Interpolator1D a, Float4D region, Interpolator2D i)
752
    {
753
    return mF.add(EffectNames.MACROBLOCK, a, region, i);
754
    }
755

    
756
///////////////////////////////////////////////////////////////////////////////////////////////////
757
/**
758
 * Creates macroblocks at and around point defined by the Point2D and the Region. 
759
 * Size of the macroblocks at any given time is returned by the Interpolator1D.
760
 * <p>
761
 * The difference between this and the previous method is that here the center of the Effect stays constant.
762
 *    
763
 * @param a      1-dimensional Interpolator which, at any given time, returns the size of the macroblocks.
764
 * @param region Region this Effect is limited to. 
765
 *               Null here means 'apply the effect to the whole Bitmap'.
766
 * @param point  Center of the Effect.
767
 * @return       ID of the effect added, or -1 if we failed to add one. 
768
 */
769
  public long macroblock(Interpolator1D a, Float4D region, Float2D point)
770
    {
771
    return mF.add(EffectNames.MACROBLOCK, a, region, point.x, point.y);
772
    }
773
  
774
///////////////////////////////////////////////////////////////////////////////////////////////////
775
/**
776
 * Creates macroblocks at and around point defined by the Interpolator2D and the Region. 
777
 * <p>
778
 * The macroblocks change in size; at time 0 there are none, and after 'duration/2' milliseconds 
779
 * they are of (pixels X pixels) size; after 'duration' milliseconds there are again none (i.e. their
780
 * size is 1X1, i.e. 1 pixel).   
781
 * 
782
 * @param pixels   Maximum size, in pixels, of the Macroblocks we want to see.
783
 * @param region   Region this Effect is limited to. 
784
 *                 Null here means 'apply the effect to the whole Bitmap'.
785
 * @param i        2-dimensional Interpolator which, at any given time, returns a Float2D representing the
786
 *                 current center of the effect.
787
 * @param duration Time, in milliseconds, it takes to do one full interpolation.
788
 * @param count    Controls how many interpolations we want to do. See {@link Interpolator#setCount(float)}
789
 * @return         ID of the effect added, or -1 if we failed to add one. 
790
 */
791
  public long macroblock(int pixels, Float4D region, Interpolator2D i, int duration, float count)
792
    {
793
    Interpolator1D di = new Interpolator1D();
794
    di.setCount(count);
795
    di.setDuration(duration);
796
    di.add(new Float1D(1));                             
797
    di.add(new Float1D(pixels));                        
798

    
799
    return mF.add(EffectNames.MACROBLOCK, di, region, i);
800
    }
801

    
802
///////////////////////////////////////////////////////////////////////////////////////////////////
803
/**
804
 * Creates macroblocks at and around point defined by the Point2D and the Region. 
805
 * <p>
806
 * The macroblocks change in size; at time 0 there are none, and after 'duration/2' milliseconds 
807
 * they are of (pixels X pixels) size; after 'duration' milliseconds there are again none (i.e. their
808
 * size is 1X1, i.e. 1 pixel).   
809
 * <p>
810
 * The difference between this and the previous method is that here the center of the Effect stays constant.
811
 *    
812
 * @param pixels   Maximum size, in pixels, of the Macroblocks we want to see.
813
 * @param region   Region this Effect is limited to. 
814
 *                 Null here means 'apply the effect to the whole Bitmap'.
815
 * @param point    Center of the Effect.
816
 * @param duration Time, in milliseconds, it takes to do one full interpolation.
817
 * @param count    Controls how many interpolations we want to do. See {@link Interpolator#setCount(float)}
818
 * @return         ID of the effect added, or -1 if we failed to add one. 
819
 */
820
  public long macroblock(int pixels, Float4D region, Float2D point, int duration, float count)
821
    {
822
    Interpolator1D di = new Interpolator1D();
823
    di.setCount(count);
824
    di.setDuration(duration);
825
    di.add(new Float1D(1));                             
826
    di.add(new Float1D(pixels));                        
827

    
828
    return mF.add(EffectNames.MACROBLOCK, di, region, point.x, point.y);
829
    }
830

    
831
///////////////////////////////////////////////////////////////////////////////////////////////////
832
/**
833
 * Creates macroblocks on the whole Bitmap. 
834
 * <p>
835
 * The macroblocks change in size; at time 0 there are none, and after 'duration/2' milliseconds 
836
 * they are of (pixels X pixels) size; after 'duration' milliseconds there are again none (i.e. their
837
 * size is 1X1, i.e. 1 pixel).   
838
 * <p>
839
 * The difference between this and the previous method is that here there is no masking Region; thus
840
 * there is also no center of the Effect. 
841
 *    
842
 * @param pixels   Maximum size, in pixels, of the Macroblocks we want to see.
843
 * @param duration Time, in milliseconds, it takes to do one full interpolation.
844
 * @param count    Controls how many interpolations we want to do. See {@link Interpolator#setCount(float)}
845
 * @return         ID of the effect added, or -1 if we failed to add one. 
846
 */
847
  public long macroblock(int pixels, int duration, float count) 
848
    {
849
    Interpolator1D di = new Interpolator1D(); 
850
    di.setCount(count);
851
    di.setDuration(duration);
852
    di.add(new Float1D(1));                            
853
    di.add(new Float1D(pixels));                        
854
   
855
    return mF.add(EffectNames.MACROBLOCK, di, null, 0.0f, 0.0f);
856
    }
857

    
858
///////////////////////////////////////////////////////////////////////////////////////////////////
859
///////////////////////////////////////////////////////////////////////////////////////////////////
860
// CHROMA
861
/**
862
 * Makes a certain sub-region of the Bitmap smoothly change all three of its RGB components.
863
 *        
864
 * @param t      1-dimensional Interpolator that returns the level of blend a given pixel will be
865
 *               mixed with the next parameter 'color': pixel = (1-level)*pixel + level*color
866
 * @param color  Color to mix.         
867
 * @param region Region this Effect is limited to. 
868
 *               Null here means 'apply the Effect to the whole Bitmap'.
869
 * @param i      2-dimensional Interpolator which, at any given time, returns a Float2D representing 
870
 *               the current center of the effect.
871
 * @return       ID of the effect added, or -1 if we failed to add one. 
872
 */
873
  public long chroma(Interpolator1D t, Float3D color, Float4D region, Interpolator2D i)
874
    {
875
    return mF.add(EffectNames.CHROMA, t, color, region, i);
876
    }
877

    
878
///////////////////////////////////////////////////////////////////////////////////////////////////
879
/**
880
 * Makes a certain sub-region of the Bitmap smoothly change all three of its RGB components.
881
 * <p>
882
 * Here the center of the Effect stays constant.
883
 *         
884
 * @param t      1-dimensional Interpolator that returns the level of blend a given pixel will be 
885
 *               mixed with the next parameter 'color': pixel = (1-level)*pixel + level*color
886
 * @param color  Color to mix.         
887
 * @param region Region this Effect is limited to. 
888
 *               Null here means 'apply the Effect to the whole Bitmap'.
889
 * @param point  Center of the Effect.
890
 * @return       ID of the effect added, or -1 if we failed to add one. 
891
 */
892
  public long chroma(Interpolator1D t, Float3D color, Float4D region, Float2D point)
893
    {
894
    return mF.add(EffectNames.CHROMA, t, color, region, point.x, point.y);
895
    }
896

    
897
///////////////////////////////////////////////////////////////////////////////////////////////////  
898
/**
899
 * Makes a certain sub-region of the Bitmap smoothly change all three of its RGB components.
900
 *        
901
 * @param t      Level of blend a given pixel will be mixed with the next parameter 'color': 
902
 *               pixel = (1-t)*pixel + t*color
903
 * @param color  Color to mix.       
904
 * @param region Region this Effect is limited to.
905
 *               Null here means 'apply the Effect to the whole Bitmap'.
906
 * @param i      2-dimensional Interpolator which, at any given time, returns a Float2D representing the
907
 *               current center of the effect.
908
 * @return       ID of the effect added, or -1 if we failed to add one. 
909
 */
910
  public long chroma(float t, Float3D color, Float4D region, Interpolator2D i)
911
    {
912
    return mF.add(EffectNames.CHROMA, t, color, region, i);
913
    }
914

    
915
///// //////////////////////////////////////////////////////////////////////////////////////////////
916
/**
917
 * Makes a certain sub-region of the Bitmap smoothly change all three of its RGB components.
918
 * <p>
919
 * Here the center of the Effect stays constant.
920
 *         
921
 * @param t      Level of blend a given pixel will be mixed with the next parameter 'color': 
922
 *               pixel = (1-t)*pixel + t*color
923
 * @param color  Color to mix.       
924
 * @param region The Region this Effect is limited to. 
925
 *               Null here means 'apply the Effect to the whole Bitmap'.
926
 * @param point  Center of the Effect.
927
 * @return       ID of the effect added, or -1 if we failed to add one. 
928
 */
929
  public long chroma(float t, Float3D color, Float4D region, Float2D point)
930
    {
931
    return mF.add(EffectNames.CHROMA, t, color, region, point.x, point.y);
932
    }
933

    
934
///////////////////////////////////////////////////////////////////////////////////////////////////
935
/**
936
 * Makes a certain sub-region of the Bitmap smoothly change all three of its RGB components.
937
 * <p>
938
 * Here the Effect applies to the whole bitmap.
939
 *         
940
 * @param t     Level of blend a given pixel will be mixed with the next parameter 'color': 
941
 *              pixel = (1-t)*pixel + t*color
942
 * @param color Color to mix.       
943
 * @return      ID of the effect added, or -1 if we failed to add one. 
944
 */
945
  public long chroma(float t, Float3D color)
946
    {
947
    return mF.add(EffectNames.CHROMA, t, color, null, 0, 0);
948
    }
949

    
950
///////////////////////////////////////////////////////////////////////////////////////////////////  
951
/**
952
 * Makes a certain sub-region of the Bitmap smoothly change all three of its RGB components.
953
 * 
954
 * See {@link #chroma(Interpolator1D, Float3D, Float4D, Interpolator2D)}
955
 */
956
  public long smooth_chroma(Interpolator1D t, Float3D color, Float4D region, Interpolator2D i)
957
    {
958
    return mF.add(EffectNames.SMOOTH_CHROMA, t, color, region, i);
959
    }
960

    
961
///////////////////////////////////////////////////////////////////////////////////////////////////
962
/**
963
 * Makes a certain sub-region of the Bitmap smoothly change all three of its RGB components.
964
 * 
965
 * See {@link #chroma(Interpolator1D, Float3D, Float4D, Float2D)}
966
 */
967
  public long smooth_chroma(Interpolator1D t, Float3D color, Float4D region, Float2D point)
968
    {
969
    return mF.add(EffectNames.SMOOTH_CHROMA, t, color, region, point.x, point.y);
970
    }
971
  
972
///////////////////////////////////////////////////////////////////////////////////////////////////  
973
/**
974
 * Makes a certain sub-region of the Bitmap smoothly change all three of its RGB components.
975
 * 
976
 * See {@link #chroma(float, Float3D, Float4D, Interpolator2D)}
977
 */
978
  public long smooth_chroma(float t, Float3D color, Float4D region, Interpolator2D i)
979
    {
980
    return mF.add(EffectNames.SMOOTH_CHROMA, t, color, region, i);
981
    }
982

    
983
///////////////////////////////////////////////////////////////////////////////////////////////////
984
/**
985
 * Makes a certain sub-region of the Bitmap smoothly change all three of its RGB components.
986
 * 
987
 * See {@link #chroma(float, Float3D, Float4D, Float2D)}
988
 */
989
  public long smooth_chroma(float t, Float3D color, Float4D region, Float2D point)
990
    {
991
    return mF.add(EffectNames.SMOOTH_CHROMA, t, color, region, point.x, point.y);
992
    }
993
  
994
///////////////////////////////////////////////////////////////////////////////////////////////////
995
/**
996
 * Makes a certain sub-region of the Bitmap smoothly change all three of its RGB components.
997
 * 
998
 * See {@link #chroma(float, Float3D)}
999
 */
1000
  public long smooth_chroma(float t, Float3D color)
1001
    {
1002
    return mF.add(EffectNames.SMOOTH_CHROMA, t, color, null, 0, 0);
1003
    }
1004
  
1005
///////////////////////////////////////////////////////////////////////////////////////////////////
1006
///////////////////////////////////////////////////////////////////////////////////////////////////
1007
// ALPHA
1008
/**
1009
 * Makes a certain sub-region of the Bitmap smoothly change its transparency level.
1010
 *        
1011
 * @param a      1-dimensional Interpolator that returns the level of transparency we want to have at any given 
1012
 *               moment.
1013
 * @param region Region this Effect is limited to. 
1014
 *               Null here means 'apply the Effect to the whole Bitmap'.
1015
 * @param i      2-dimensional Interpolator which, at any given time, returns a Float2D representing the
1016
 *               current center of the effect.
1017
 * @return       ID of the effect added, or -1 if we failed to add one. 
1018
 */
1019
  public long alpha(Interpolator1D a, Float4D region, Interpolator2D i)
1020
    {
1021
    return mF.add(EffectNames.ALPHA, a, region, i);
1022
    }
1023

    
1024
///////////////////////////////////////////////////////////////////////////////////////////////////
1025
/**
1026
 * Makes a certain sub-region of the Bitmap smoothly change its transparency level.
1027
 * <p>
1028
 * Here the center of the Effect stays constant.
1029
 *         
1030
 * @param a      1-dimensional Interpolator that returns the level of transparency we want to have at any given 
1031
 *               moment.
1032
 * @param region Region this Effect is limited to. 
1033
 *               Null here means 'apply the Effect to the whole Bitmap'.
1034
 * @param point  Center of the Effect.
1035
 * @return       ID of the effect added, or -1 if we failed to add one. 
1036
 */
1037
  public long alpha(Interpolator1D a, Float4D region, Float2D point)
1038
    {
1039
    return mF.add(EffectNames.ALPHA, a, region, point.x, point.y);
1040
    }
1041

    
1042
///////////////////////////////////////////////////////////////////////////////////////////////////  
1043
/**
1044
 * Makes a certain sub-region of the Bitmap smoothly change its transparency level.
1045
 *        
1046
 * @param alpha  Level of Alpha (between 0 and 1) we want to interpolate to.
1047
 * @param region Region this Effect is limited to. 
1048
 *               Null here means 'apply the Effect to the whole Bitmap'.
1049
 * @param i      2-dimensional Interpolator which, at any given time, returns a Float2D representing the
1050
 *               current center of the effect.
1051
 * @param duration Time, in milliseconds, it takes to do one full interpolation.
1052
 * @param count  Controls how many interpolations we want to do. See {@link Interpolator#setCount(float)}
1053
 * @return       ID of the effect added, or -1 if we failed to add one. 
1054
 */
1055
  public long alpha(float alpha, Float4D region, Interpolator2D i, int duration, float count)
1056
    {
1057
    Interpolator1D di = new Interpolator1D(); 
1058
    di.setCount(count);
1059
    di.setDuration(duration);
1060
    di.add(new Float1D(1));                          
1061
    di.add(new Float1D(alpha));                         
1062
   
1063
    return mF.add(EffectNames.ALPHA, di, region, i);
1064
    }
1065

    
1066
///////////////////////////////////////////////////////////////////////////////////////////////////
1067
/**
1068
 * Makes a certain sub-region of the Bitmap smoothly change its transparency level.
1069
 * <p>
1070
 * Here the center of the Effect stays constant.
1071
 *         
1072
 * @param alpha  Level of Alpha (between 0 and 1) we want to interpolate to.
1073
 * @param region Region this Effect is limited to. 
1074
 *               Null here means 'apply the Effect to the whole Bitmap'.
1075
 * @param point  Center of the Effect.
1076
 * @param duration Time, in milliseconds, it takes to do one full interpolation.
1077
 * @param count  Controls how many interpolations we want to do. See {@link Interpolator#setCount(float)}
1078
 * @return       ID of the effect added, or -1 if we failed to add one. 
1079
 */
1080
  public long alpha(float alpha, Float4D region, Float2D point, int duration, float count)
1081
    {
1082
    Interpolator1D di = new Interpolator1D(); 
1083
    di.setCount(count);
1084
    di.setDuration(duration);
1085
    di.add(new Float1D(1));                          
1086
    di.add(new Float1D(alpha));                         
1087
   
1088
    return mF.add(EffectNames.ALPHA, di, region, point.x, point.y);
1089
    }
1090

    
1091
///////////////////////////////////////////////////////////////////////////////////////////////////
1092
/**
1093
 * Makes a certain sub-region of the Bitmap smoothly change its transparency level.
1094
 * <p>
1095
 * Here the center of the Effect stays constant and the effect for now change in time.
1096
 *         
1097
 * @param alpha  Level of Alpha (between 0 and 1) we want to interpolate to.
1098
 * @param region Region this Effect is limited to.
1099
 *               Null here means 'apply the Effect to the whole Bitmap'.
1100
 * @param point  Center of the Effect.
1101
 * @return       ID of the effect added, or -1 if we failed to add one. 
1102
 */
1103
  public long alpha(float alpha, Float4D region, Float2D point)
1104
    {
1105
    Interpolator1D di = new Interpolator1D(); 
1106
    di.setCount(0.5f);
1107
    di.setDuration(0);
1108
    di.add(new Float1D(1));                          
1109
    di.add(new Float1D(alpha));                         
1110
   
1111
    return mF.add(EffectNames.ALPHA, di, region, point.x, point.y);
1112
    }
1113
  
1114
///////////////////////////////////////////////////////////////////////////////////////////////////
1115
/**
1116
 * Makes the whole Bitmap change its transparency level.
1117
 * 
1118
 * @param alpha    Level of Alpha (between 0 and 1) we want to interpolate to.
1119
 * @param duration Time, in milliseconds, it takes to do one full interpolation.
1120
 * @param count    Controls how many interpolations we want to do. See {@link Interpolator#setCount(float)}
1121
 * @return         ID of the effect added, or -1 if we failed to add one. 
1122
 */
1123
  public long alpha(float alpha, int duration, float count) 
1124
    {
1125
    Interpolator1D di = new Interpolator1D(); 
1126
    di.setCount(count);
1127
    di.setDuration(duration);
1128
    di.add(new Float1D(1));                            
1129
    di.add(new Float1D(alpha));                        
1130
         
1131
    return mF.add(EffectNames.ALPHA, di,null, 0.0f, 0.0f);
1132
    }
1133

    
1134
///////////////////////////////////////////////////////////////////////////////////////////////////  
1135
/**
1136
 * Makes a certain sub-region of the Bitmap smoothly change its transparency level.
1137
 * 
1138
 * See {@link #alpha(Interpolator1D, Float4D, Interpolator2D)}
1139
 */
1140
  public long smooth_alpha(Interpolator1D a, Float4D region, Interpolator2D i)
1141
    {
1142
    return mF.add(EffectNames.SMOOTH_ALPHA, a, region, i);
1143
    }
1144

    
1145
///////////////////////////////////////////////////////////////////////////////////////////////////
1146
/**
1147
 * Makes a certain sub-region of the Bitmap smoothly change its transparency level.
1148
 * 
1149
 * See {@link #alpha(Interpolator1D, Float4D, Float2D)}
1150
 */
1151
  public long smooth_alpha(Interpolator1D a, Float4D region, Float2D point)
1152
    {
1153
    return mF.add(EffectNames.SMOOTH_ALPHA, a, region, point.x, point.y);
1154
    }
1155
  
1156
///////////////////////////////////////////////////////////////////////////////////////////////////  
1157
/**
1158
 * Makes a certain sub-region of the Bitmap smoothly change its transparency level.
1159
 * 
1160
 * See {@link #alpha(float, Float4D, Interpolator2D, int, float)}
1161
 */
1162
  public long smooth_alpha(float alpha, Float4D region, Interpolator2D i, int duration, float count)
1163
    {
1164
    Interpolator1D di = new Interpolator1D(); 
1165
    di.setCount(count);
1166
    di.setDuration(duration);
1167
    di.add(new Float1D(1));                          
1168
    di.add(new Float1D(alpha));                         
1169
   
1170
    return mF.add(EffectNames.SMOOTH_ALPHA, di, region, i);
1171
    }
1172

    
1173
///////////////////////////////////////////////////////////////////////////////////////////////////
1174
/**
1175
 * Makes a certain sub-region of the Bitmap smoothly change its transparency level.
1176
 * 
1177
 * See {@link #alpha(float, Float4D, Float2D, int, float)}
1178
 */
1179
  public long smooth_alpha(float alpha, Float4D region, Float2D point, int duration, float count)
1180
    {
1181
    Interpolator1D di = new Interpolator1D(); 
1182
    di.setCount(count);
1183
    di.setDuration(duration);
1184
    di.add(new Float1D(1));                          
1185
    di.add(new Float1D(alpha));                         
1186
   
1187
    return mF.add(EffectNames.SMOOTH_ALPHA, di, region, point.x, point.y);
1188
    }
1189
  
1190
///////////////////////////////////////////////////////////////////////////////////////////////////
1191
/**
1192
 * Makes a certain sub-region of the Bitmap smoothly change its transparency level.
1193
 * 
1194
 * See {@link #alpha(float, Float4D, Float2D)}
1195
 */
1196
  public long smooth_alpha(float alpha, Float4D region, Float2D point)
1197
    {
1198
    Interpolator1D di = new Interpolator1D(); 
1199
    di.setCount(0.5f);
1200
    di.setDuration(0);
1201
    di.add(new Float1D(1));                          
1202
    di.add(new Float1D(alpha));                         
1203
   
1204
    return mF.add(EffectNames.SMOOTH_ALPHA, di, region, point.x, point.y);
1205
    }
1206
  
1207
///////////////////////////////////////////////////////////////////////////////////////////////////
1208
///////////////////////////////////////////////////////////////////////////////////////////////////
1209
// BRIGHTNESS
1210
/**
1211
 * Makes a certain sub-region of the Bitmap smoothly change its brightness level.
1212
 *        
1213
 * @param a      1-dimensional Interpolator that returns the level of brightness we want to have at any given 
1214
 *               moment.
1215
 * @param region Region this Effect is limited to. 
1216
 *               Null here means 'apply the Effect to the whole Bitmap'.
1217
 * @param i      2-dimensional Interpolator which, at any given time, returns a Float2D representing the
1218
 *               current center of the effect.
1219
 * @return       ID of the effect added, or -1 if we failed to add one. 
1220
 */
1221
  public long brightness(Interpolator1D a, Float4D region, Interpolator2D i)
1222
    {
1223
    return mF.add(EffectNames.BRIGHTNESS, a, region, i);
1224
    }
1225

    
1226
///////////////////////////////////////////////////////////////////////////////////////////////////
1227
/**
1228
 * Makes a certain sub-region of the Bitmap smoothly change its brightness level.
1229
 * <p>
1230
 * Here the center of the Effect stays constant.
1231
 *         
1232
 * @param a      1-dimensional Interpolator that returns the level of brightness we want to have at any given 
1233
 *               moment.
1234
 * @param region Region this Effect is limited to.
1235
 *               Null here means 'apply the Effect to the whole Bitmap'.
1236
 * @param point  Center of the Effect.
1237
 * @return       ID of the effect added, or -1 if we failed to add one. 
1238
 */
1239
  public long brightness(Interpolator1D a, Float4D region, Float2D point)
1240
    {
1241
    return mF.add(EffectNames.BRIGHTNESS, a, region, point.x, point.y);
1242
    }
1243

    
1244
///////////////////////////////////////////////////////////////////////////////////////////////////  
1245
/**
1246
 * Makes a certain sub-region of the Bitmap smoothly change its brightness level.
1247
 *        
1248
 * @param brightness Level of Brightness (between 0 and infinity) we want to interpolate to.
1249
 *                   1 - level of brightness unchanged, anything less than 1 - 'darken the image',
1250
 *                   anything more than 1- lighten it up. 
1251
 * @param region     Region this Effect is limited to.
1252
 *                   Null here means 'apply the Effect to the whole Bitmap'.
1253
 * @param i          2-dimensional Interpolator which, at any given time, returns a Float2D
1254
 *                   representing the current center of the effect.
1255
 * @param duration   Time, in milliseconds, it takes to do one full interpolation.
1256
 * @param count      Controls how many interpolations we want to do. See {@link Interpolator#setCount(float)}
1257
 * @return           ID of the effect added, or -1 if we failed to add one. 
1258
 */
1259
  public long brightness(float brightness, Float4D region, Interpolator2D i, int duration, float count)
1260
    {
1261
    Interpolator1D di = new Interpolator1D(); 
1262
    di.setCount(count);
1263
    di.setDuration(duration);
1264
    di.add(new Float1D(1));                          
1265
    di.add(new Float1D(brightness));                         
1266
   
1267
    return mF.add(EffectNames.BRIGHTNESS, di, region, i);
1268
    }
1269

    
1270
///////////////////////////////////////////////////////////////////////////////////////////////////
1271
/**
1272
 * Makes a certain sub-region of the Bitmap smoothly change its brightness level.
1273
 * <p>
1274
 * Here the center of the Effect stays constant.
1275
 *         
1276
 * @param brightness Level of Brightness (between 0 and infinity) we want to interpolate to.
1277
 *                   1 - level of brightness unchanged, anything less than 1 - 'darken the image',
1278
 *                   anything more than 1 - lighten it up.
1279
 * @param region     Region this Effect is limited to. 
1280
 *                   Null here means 'apply the Effect to the whole Bitmap'.
1281
 * @param point      Center of the Effect.
1282
 * @param duration   Time, in milliseconds, it takes to do one full interpolation.
1283
 * @param count      Controls how many interpolations we want to do. See {@link Interpolator#setCount(float)}
1284
 * @return           ID of the effect added, or -1 if we failed to add one. 
1285
 */
1286
  public long brightness(float brightness, Float4D region, Float2D point, int duration, float count)
1287
    {
1288
    Interpolator1D di = new Interpolator1D(); 
1289
    di.setCount(count);
1290
    di.setDuration(duration);
1291
    di.add(new Float1D(1));                          
1292
    di.add(new Float1D(brightness));                         
1293
   
1294
    return mF.add(EffectNames.BRIGHTNESS, di, region, point.x, point.y);
1295
    }
1296

    
1297
///////////////////////////////////////////////////////////////////////////////////////////////////
1298
/**
1299
 * Makes a certain sub-region of the Bitmap smoothly change its brightness level.
1300
 * <p>
1301
 * Here the center of the Effect stays constant and the effect for now change in time.
1302
 *         
1303
 * @param brightness Level of Brightness (between 0 and infinity) we want to interpolate to.
1304
 *                   1 - level of brightness unchanged, anything less than 1 - 'darken the image',
1305
 *                   anything more than 1 - lighten it up.
1306
 * @param region     Region this Effect is limited to.
1307
 *                   Null here means 'apply the Effect to the whole Bitmap'.
1308
 * @param point      Center of the Effect.
1309
 * @return           ID of the effect added, or -1 if we failed to add one. 
1310
 */
1311
  public long brightness(float brightness, Float4D region, Float2D point)
1312
    {
1313
    Interpolator1D di = new Interpolator1D(); 
1314
    di.setCount(0.5f);
1315
    di.setDuration(0);
1316
    di.add(new Float1D(1));                          
1317
    di.add(new Float1D(brightness));                         
1318
   
1319
    return mF.add(EffectNames.BRIGHTNESS, di, region, point.x, point.y);
1320
    }
1321
 
1322
///////////////////////////////////////////////////////////////////////////////////////////////////
1323
///////////////////////////////////////////////////////////////////////////////////////////////////
1324
// SMOOTH BRIGHTNESS
1325
/**
1326
 * Makes a certain sub-region of the Bitmap smoothly change its brightness level.
1327
 *        
1328
 * @param a      1-dimensional Interpolator that returns the level of brightness we want to have at
1329
 *               any given moment.
1330
 * @param region Region this Effect is limited to. 
1331
 *               Null here means 'apply the Effect to the whole Bitmap'.
1332
 * @param i      2-dimensional Interpolator which, at any given time, returns a Float2D
1333
 *               representing the current center of the effect.
1334
 * @return       ID of the effect added, or -1 if we failed to add one. 
1335
 */
1336
  public long smooth_brightness(Interpolator1D a, Float4D region, Interpolator2D i)
1337
    {
1338
    return mF.add(EffectNames.SMOOTH_BRIGHTNESS, a, region, i);
1339
    }
1340

    
1341
///////////////////////////////////////////////////////////////////////////////////////////////////
1342
/**
1343
 * Makes a certain sub-region of the Bitmap smoothly change its brightness level.
1344
 * <p>
1345
 * Here the center of the Effect stays constant.
1346
 *         
1347
 * @param a      1-dimensional Interpolator that returns the level of brightness we want to have at
1348
 *               any given moment.
1349
 * @param region Region this Effect is limited to. 
1350
 *               Null here means 'apply the Effect to the whole Bitmap'.
1351
 * @param point  Center of the Effect.
1352
 * @return       ID of the effect added, or -1 if we failed to add one. 
1353
 */
1354
  public long smooth_brightness(Interpolator1D a, Float4D region, Float2D point)
1355
    {
1356
    return mF.add(EffectNames.SMOOTH_BRIGHTNESS, a, region, point.x, point.y);
1357
    }
1358

    
1359
///////////////////////////////////////////////////////////////////////////////////////////////////  
1360
/**
1361
 * Makes a certain sub-region of the Bitmap smoothly change its brightness level.
1362
 *        
1363
 * @param brightness Level of Brightness (between 0 and infinity) we want to interpolate to.
1364
 *                   1 - level of brightness unchanged, anything less than 1 - 'darken the image',
1365
 *                   anything more than 1 - lighten it up. 
1366
 * @param region     Region this Effect is limited to. 
1367
 *                   Null here means 'apply the Effect to the whole Bitmap'.
1368
 * @param i          2-dimensional Interpolator which, at any given time, returns a Float2D
1369
 *                   represention the current center of the effect.
1370
 * @param duration   Time, in milliseconds, it takes to do one full interpolation.
1371
 * @param count      Controls how many interpolations we want to do. See {@link Interpolator#setCount(float)}
1372
 * @return           ID of the effect added, or -1 if we failed to add one. 
1373
 */
1374
  public long smooth_brightness(float brightness, Float4D region, Interpolator2D i, int duration, float count)
1375
    {
1376
    Interpolator1D di = new Interpolator1D(); 
1377
    di.setCount(count);
1378
    di.setDuration(duration);
1379
    di.add(new Float1D(1));                          
1380
    di.add(new Float1D(brightness));                         
1381
   
1382
    return mF.add(EffectNames.SMOOTH_BRIGHTNESS, di, region, i);
1383
    }
1384

    
1385
///////////////////////////////////////////////////////////////////////////////////////////////////
1386
/**
1387
 * Makes a certain sub-region of the Bitmap smoothly change its brightness level.
1388
 * <p>
1389
 * Here the center of the Effect stays constant.
1390
 *         
1391
 * @param brightness Level of Brightness (between 0 and infinity) we want to interpolate to.
1392
 *                   1 - level of brightness unchanged, anything less than 1 - 'darken the image',
1393
 *                   anything more than 1 - lighten it up.
1394
 * @param region     Region this Effect is limited to. 
1395
 *                   Null here means 'apply the Effect to the whole Bitmap'.
1396
 * @param point      Center of the Effect.
1397
 * @param duration   Time, in milliseconds, it takes to do one full interpolation.
1398
 * @param count      Controls how many interpolations we want to do. See {@link Interpolator#setCount(float)}
1399
 * @return           ID of the effect added, or -1 if we failed to add one. 
1400
 */
1401
  public long smooth_brightness(float brightness, Float4D region, Float2D point, int duration, float count)
1402
    {
1403
    Interpolator1D di = new Interpolator1D(); 
1404
    di.setCount(count);
1405
    di.setDuration(duration);
1406
    di.add(new Float1D(1));                          
1407
    di.add(new Float1D(brightness));                         
1408
   
1409
    return mF.add(EffectNames.SMOOTH_BRIGHTNESS, di, region, point.x, point.y);
1410
    }
1411

    
1412
///////////////////////////////////////////////////////////////////////////////////////////////////
1413
/**
1414
 * Makes a certain sub-region of the Bitmap smoothly change its brightness level.
1415
 * <p>
1416
 * Here the center of the Effect stays constant and the effect for now change in time.
1417
 *         
1418
 * @param brightness Level of Brightness (between 0 and infinity) we want to interpolate to.
1419
 *                   1 - level of brightness unchanged, anything less than 1 - 'darken the image',
1420
 *                   anything more than 1 - lighten it up.
1421
 * @param region     Region this Effect is limited to. 
1422
 *                   Null here means 'apply the Effect to the whole Bitmap'.
1423
 * @param point      Center of the Effect.
1424
 * @return           ID of the effect added, or -1 if we failed to add one. 
1425
 */
1426
  public long smooth_brightness(float brightness, Float4D region, Float2D point)
1427
    {
1428
    Interpolator1D di = new Interpolator1D(); 
1429
    di.setCount(0.5f);
1430
    di.setDuration(0);
1431
    di.add(new Float1D(1));                          
1432
    di.add(new Float1D(brightness));                         
1433
   
1434
    return mF.add(EffectNames.SMOOTH_BRIGHTNESS, di, region, point.x, point.y);
1435
    }
1436
    
1437
///////////////////////////////////////////////////////////////////////////////////////////////////
1438
/**
1439
 * Makes the whole Bitmap change its brightness level.
1440
 * 
1441
 * @param brightness Level of Brightness (between 0 and infinity) we want to interpolate to.
1442
 *                   1 - level of brightness unchanged, anything less than 1 - 'darken the image',
1443
 *                   anything more than 1- lighten it up.
1444
 * @param duration   Time, in milliseconds, it takes to do one full interpolation.
1445
 * @param count      Controls how many interpolations we want to do. See {@link Interpolator#setCount(float)}
1446
 * @return           ID of the effect added, or -1 if we failed to add one. 
1447
 */
1448
  public long smooth_brightness(float brightness, int duration, float count) 
1449
    {
1450
    Interpolator1D di = new Interpolator1D(); 
1451
    di.setCount(count);
1452
    di.setDuration(duration);
1453
    di.add(new Float1D(1));                            
1454
    di.add(new Float1D(brightness));                        
1455
         
1456
    return mF.add(EffectNames.SMOOTH_BRIGHTNESS, di,null, 0.0f, 0.0f);
1457
    }
1458

    
1459
///////////////////////////////////////////////////////////////////////////////////////////////////
1460
///////////////////////////////////////////////////////////////////////////////////////////////////
1461
// CONTRAST
1462
/**
1463
 * Makes a certain sub-region of the Bitmap smoothly change its contrast level.
1464
 *        
1465
 * @param a      1-dimensional Interpolator that returns the level of contrast we want to have
1466
 *               at any given moment.
1467
 * @param region Region this Effect is limited to. 
1468
 *               Null here means 'apply the Effect to the whole Bitmap'.
1469
 * @param i      2-dimensional Interpolator which, at any given time, returns a Float2D
1470
 *               representing the current center of the effect.
1471
 * @return       ID of the effect added, or -1 if we failed to add one. 
1472
 */
1473
  public long contrast(Interpolator1D a, Float4D region, Interpolator2D i)
1474
    {
1475
    return mF.add(EffectNames.CONTRAST, a, region, i);
1476
    }
1477

    
1478
///////////////////////////////////////////////////////////////////////////////////////////////////
1479
/**
1480
 * Makes a certain sub-region of the Bitmap smoothly change its contrast level.
1481
 * <p>
1482
 * Here the center of the Effect stays constant.
1483
 *         
1484
 * @param a      1-dimensional Interpolator that returns the level of contrast we want to have
1485
 *               at any given moment.
1486
 * @param region Region this Effect is limited to.
1487
 *               Null here means 'apply the Effect to the whole Bitmap'.
1488
 * @param point  Center of the Effect.
1489
 * @return       ID of the effect added, or -1 if we failed to add one. 
1490
 */
1491
  public long contrast(Interpolator1D a, Float4D region, Float2D point)
1492
    {
1493
    return mF.add(EffectNames.CONTRAST, a, region, point.x, point.y);
1494
    }
1495

    
1496
///////////////////////////////////////////////////////////////////////////////////////////////////  
1497
/**
1498
 * Makes a certain sub-region of the Bitmap smoothly change its contrast level.
1499
 *        
1500
 * @param contrast Level of contrast (between 0 and infinity) we want to interpolate to.
1501
 *                 1 - level of contrast unchanged, anything less than 1 - reduce contrast,
1502
 *                 anything more than 1 - increase the contrast. 
1503
 * @param region   Region this Effect is limited to.
1504
 *                 Null here means 'apply the Effect to the whole Bitmap'.
1505
 * @param i        2-dimensional Interpolator which, at any given time, returns a Float2D
1506
 *                 represention the current center of the effect.
1507
 * @param duration Time, in milliseconds, it takes to do one full interpolation.
1508
 * @param count    Controls how many interpolations we want to do. See {@link Interpolator#setCount(float)}
1509
 * @return         ID of the effect added, or -1 if we failed to add one. 
1510
 */
1511
  public long contrast(float contrast, Float4D region, Interpolator2D i, int duration, float count)
1512
    {
1513
    Interpolator1D di = new Interpolator1D(); 
1514
    di.setCount(count);
1515
    di.setDuration(duration);
1516
    di.add(new Float1D(1));                          
1517
    di.add(new Float1D(contrast));                         
1518
   
1519
    return mF.add(EffectNames.CONTRAST, di, region, i);
1520
    }
1521

    
1522
///////////////////////////////////////////////////////////////////////////////////////////////////
1523
/**
1524
 * Makes a certain sub-region of the Bitmap smoothly change its contrast level.
1525
 * <p>
1526
 * Here the center of the Effect stays constant.
1527
 *         
1528
 * @param contrast Level of contrast (between 0 and infinity) we want to interpolate to.
1529
 *                 1 - level of contrast unchanged, anything less than 1 - reduce contrast,
1530
 *                 anything more than 1 -increase the contrast. 
1531
 * @param region   Region this Effect is limited to. 
1532
 *                 Null here means 'apply the Effect to the whole Bitmap'.
1533
 * @param point    Center of the Effect.
1534
 * @param duration Time, in milliseconds, it takes to do one full interpolation.
1535
 * @param count    Controls how many interpolations we want to do. See {@link Interpolator#setCount(float)}
1536
 * @return         ID of the effect added, or -1 if we failed to add one. 
1537
 */
1538
  public long contrast(float contrast, Float4D region, Float2D point, int duration, float count)
1539
    {
1540
    Interpolator1D di = new Interpolator1D(); 
1541
    di.setCount(count);
1542
    di.setDuration(duration);
1543
    di.add(new Float1D(1));                          
1544
    di.add(new Float1D(contrast));                         
1545
   
1546
    return mF.add(EffectNames.CONTRAST, di, region, point.x, point.y);
1547
    }
1548

    
1549
///////////////////////////////////////////////////////////////////////////////////////////////////
1550
/**
1551
 * Makes a certain sub-region of the Bitmap smoothly change its contrast level.
1552
 * <p>
1553
 * Here the center of the Effect stays constant and the effect for now change in time.
1554
 *         
1555
 * @param contrast Level of contrast (between 0 and infinity) we want to interpolate to.
1556
 *                 1 - level of contrast unchanged, anything less than 1 - reduce contrast,
1557
 *                 anything more than 1 - increase the contrast. 
1558
 * @param region   Region this Effect is limited to. 
1559
 *                 Null here means 'apply the Effect to the whole Bitmap'.
1560
 * @param point    Center of the Effect.
1561
 * @return         ID of the effect added, or -1 if we failed to add one. 
1562
 */
1563
  public long contrast(float contrast, Float4D region, Float2D point)
1564
    {
1565
    Interpolator1D di = new Interpolator1D(); 
1566
    di.setCount(0.5f);
1567
    di.setDuration(0);
1568
    di.add(new Float1D(1));                          
1569
    di.add(new Float1D(contrast));                         
1570
   
1571
    return mF.add(EffectNames.CONTRAST, di, region, point.x, point.y);
1572
    }
1573
 
1574
///////////////////////////////////////////////////////////////////////////////////////////////////
1575
///////////////////////////////////////////////////////////////////////////////////////////////////
1576
// SMOOTH CONTRAST
1577
/**
1578
 * Makes a certain sub-region of the Bitmap smoothly change its contrast level.
1579
 *        
1580
 * @param a      1-dimensional Interpolator that returns the level of contrast we want to have
1581
 *               at any given moment.
1582
 * @param region Region this Effect is limited to. 
1583
 *               Null here means 'apply the Effect to the whole Bitmap'.
1584
 * @param i      2-dimensional Interpolator which, at any given time, returns a Float2D
1585
 *               representing the current center of the effect.
1586
 * @return       ID of the effect added, or -1 if we failed to add one. 
1587
 */
1588
  public long smooth_contrast(Interpolator1D a, Float4D region, Interpolator2D i)
1589
    {
1590
    return mF.add(EffectNames.SMOOTH_CONTRAST, a, region, i);
1591
    }
1592

    
1593
///////////////////////////////////////////////////////////////////////////////////////////////////
1594
/**
1595
 * Makes a certain sub-region of the Bitmap smoothly change its contrast level.
1596
 * <p>
1597
 * Here the center of the Effect stays constant.
1598
 *         
1599
 * @param a      1-dimensional Interpolator that returns the level of contrast we want to have
1600
 *               at any given moment.
1601
 * @param region Region this Effect is limited to. 
1602
 *               Null here means 'apply the Effect to the whole Bitmap'.
1603
 * @param point  Center of the Effect.
1604
 * @return       ID of the effect added, or -1 if we failed to add one. 
1605
 */
1606
  public long smooth_contrast(Interpolator1D a, Float4D region, Float2D point)
1607
    {
1608
    return mF.add(EffectNames.SMOOTH_CONTRAST, a, region, point.x, point.y);
1609
    }
1610

    
1611
///////////////////////////////////////////////////////////////////////////////////////////////////  
1612
/**
1613
 * Makes a certain sub-region of the Bitmap smoothly change its contrast level.
1614
 *        
1615
 * @param contrast Level of contrast (between 0 and infinity) we want to interpolate to.
1616
 *                 1 - level of contrast unchanged, anything less than 1 - reduce contrast,
1617
 *                 anything more than 1 - increase the contrast. 
1618
 * @param region   Region this Effect is limited to. 
1619
 *                 Null here means 'apply the Effect to the whole Bitmap'.
1620
 * @param i        2-dimensional Interpolator which, at any given time, returns a Float2D
1621
 *                 representing the current center of the effect.
1622
 * @param duration Time, in milliseconds, it takes to do one full interpolation.
1623
 * @param count    Controls how many interpolations we want to do. See {@link Interpolator#setCount(float)}
1624
 * @return         ID of the effect added, or -1 if we failed to add one. 
1625
 */
1626
  public long smooth_contrast(float contrast, Float4D region, Interpolator2D i, int duration, float count)
1627
    {
1628
    Interpolator1D di = new Interpolator1D(); 
1629
    di.setCount(count);
1630
    di.setDuration(duration);
1631
    di.add(new Float1D(1));                          
1632
    di.add(new Float1D(contrast));                         
1633
   
1634
    return mF.add(EffectNames.SMOOTH_CONTRAST, di, region, i);
1635
    }
1636

    
1637
///////////////////////////////////////////////////////////////////////////////////////////////////
1638
/**
1639
 * Makes a certain sub-region of the Bitmap smoothly change its contrast level.
1640
 * <p>
1641
 * Here the center of the Effect stays constant.
1642
 *         
1643
 * @param contrast Level of contrast (between 0 and infinity) we want to interpolate to.
1644
 *                 1 - level of contrast unchanged, anything less than 1 - reduce contrast,
1645
 *                 anything more than 1 - increase the contrast. 
1646
 * @param region   Region this Effect is limited to. 
1647
 *                 Null here means 'apply the Effect to the whole Bitmap'.
1648
 * @param point    Center of the Effect.
1649
 * @param duration Time, in milliseconds, it takes to do one full interpolation.
1650
 * @param count    Controls how many interpolations we want to do. See {@link Interpolator#setCount(float)}
1651
 * @return         ID of the effect added, or -1 if we failed to add one. 
1652
 */
1653
  public long smooth_contrast(float contrast, Float4D region, Float2D point, int duration, float count)
1654
    {
1655
    Interpolator1D di = new Interpolator1D(); 
1656
    di.setCount(count);
1657
    di.setDuration(duration);
1658
    di.add(new Float1D(1));                          
1659
    di.add(new Float1D(contrast));                         
1660
   
1661
    return mF.add(EffectNames.SMOOTH_CONTRAST, di, region, point.x, point.y);
1662
    }
1663

    
1664
///////////////////////////////////////////////////////////////////////////////////////////////////
1665
/**
1666
 * Makes a certain sub-region of the Bitmap smoothly change its contrast level.
1667
 * <p>
1668
 * Here the center of the Effect stays constant and the effect for now change in time.
1669
 *         
1670
 * @param contrast Level of contrast (between 0 and infinity) we want to interpolate to.
1671
 *                 1 - level of contrast unchanged, anything less than 1 - reduce contrast,
1672
 *                 anything more than 1 - increase the contrast. 
1673
 * @param region   Region this Effect is limited to. 
1674
 *                 Null here means 'apply the Effect to the whole Bitmap'.
1675
 * @param point    Center of the Effect.
1676
 * @return         ID of the effect added, or -1 if we failed to add one. 
1677
 */
1678
  public long smooth_contrast(float contrast, Float4D region, Float2D point)
1679
    {
1680
    Interpolator1D di = new Interpolator1D(); 
1681
    di.setCount(0.5f);
1682
    di.setDuration(0);
1683
    di.add(new Float1D(1));                          
1684
    di.add(new Float1D(contrast));                         
1685
   
1686
    return mF.add(EffectNames.SMOOTH_CONTRAST, di, region, point.x, point.y);
1687
    }
1688
    
1689
///////////////////////////////////////////////////////////////////////////////////////////////////
1690
/**
1691
 * Makes the whole Bitmap change its contrast level.
1692
 * 
1693
 * @param contrast Level of contrast (between 0 and infinity) we want to interpolate to.
1694
 *                 1 - level of contrast unchanged, anything less than 1 - reduce contrast,
1695
 *                 anything omre than 1 - increase the contrast. 
1696
 * @param duration Time, in milliseconds, it takes to do one full interpolation.
1697
 * @param count    Controls how many interpolations we want to do. See {@link Interpolator#setCount(float)}
1698
 * @return         ID of the effect added, or -1 if we failed to add one. 
1699
 */
1700
  public long smooth_contrast(float contrast, int duration, float count) 
1701
    {
1702
    Interpolator1D di = new Interpolator1D(); 
1703
    di.setCount(count);
1704
    di.setDuration(duration);
1705
    di.add(new Float1D(1));                            
1706
    di.add(new Float1D(contrast));                        
1707
         
1708
    return mF.add(EffectNames.SMOOTH_CONTRAST, di,null, 0.0f, 0.0f);
1709
    }
1710

    
1711

    
1712
///////////////////////////////////////////////////////////////////////////////////////////////////
1713
///////////////////////////////////////////////////////////////////////////////////////////////////
1714
// SATURATION
1715
/**
1716
 * Makes a certain sub-region of the Bitmap smoothly change its saturation level.
1717
 *        
1718
 * @param a      1-dimensional Interpolator that returns the level of saturation we want to have
1719
 *               at any given moment.
1720
 * @param region Region this Effect is limited to. 
1721
 *               Null here means 'apply the Effect to the whole Bitmap'.
1722
 * @param i      2-dimensional Interpolator which, at any given time, returns a Float2D
1723
 *               representing the current center of the effect.
1724
 * @return       ID of the effect added, or -1 if we failed to add one. 
1725
 */
1726
  public long saturation(Interpolator1D a, Float4D region, Interpolator2D i)
1727
    {
1728
    return mF.add(EffectNames.SATURATION, a, region, i);
1729
    }
1730

    
1731
///////////////////////////////////////////////////////////////////////////////////////////////////
1732
/**
1733
 * Makes a certain sub-region of the Bitmap smoothly change its saturation level.
1734
 * <p>
1735
 * Here the center of the Effect stays constant.
1736
 *         
1737
 * @param a      1-dimensional Interpolator that returns the level of saturation we want to have
1738
 *               at any given moment.
1739
 * @param region Region this Effect is limited to. 
1740
 *               Null here means 'apply the Effect to the whole Bitmap'.
1741
 * @param point  Center of the Effect.
1742
 * @return       ID of the effect added, or -1 if we failed to add one. 
1743
 */
1744
  public long saturation(Interpolator1D a, Float4D region, Float2D point)
1745
    {
1746
    return mF.add(EffectNames.SATURATION, a, region, point.x, point.y);
1747
    }
1748

    
1749
///////////////////////////////////////////////////////////////////////////////////////////////////  
1750
/**
1751
 * Makes a certain sub-region of the Bitmap smoothly change its saturation level.
1752
 *        
1753
 * @param saturation Level of saturation (between 0 and infinity) we want to interpolate to.
1754
 *                   1 - level of saturation unchanged, anything less than 1 - reduce saturation,
1755
 *                   anything more than 1 - increase the saturation. 
1756
 * @param region     Region this Effect is limited to.
1757
 *                   Null here means 'apply the Effect to the whole Bitmap'.
1758
 * @param i          2-dimensional Interpolator which, at any given time, returns a Float2D
1759
 *                   representing the current center of the effect.
1760
 * @param duration   Time, in milliseconds, it takes to do one full interpolation.
1761
 * @param count      Controls how many interpolations we want to do. See {@link Interpolator#setCount(float)}
1762
 * @return           ID of the effect added, or -1 if we failed to add one. 
1763
 */
1764
  public long saturation(float saturation, Float4D region, Interpolator2D i, int duration, float count)
1765
    {
1766
    Interpolator1D di = new Interpolator1D(); 
1767
    di.setCount(count);
1768
    di.setDuration(duration);
1769
    di.add(new Float1D(1));                          
1770
    di.add(new Float1D(saturation));                         
1771
   
1772
    return mF.add(EffectNames.SATURATION, di, region, i);
1773
    }
1774

    
1775
///////////////////////////////////////////////////////////////////////////////////////////////////
1776
/**
1777
 * Makes a certain sub-region of the Bitmap smoothly change its saturation level.
1778
 * <p>
1779
 * Here the center of the Effect stays constant.
1780
 *         
1781
 * @param saturation Level of saturation (between 0 and infinity) we want to interpolate to.
1782
 *                   1 - level of saturation unchanged, anything less than 1 - reduce saturation,
1783
 *                   anything more than 1 - increase the saturation. 
1784
 * @param region     Region this Effect is limited to. 
1785
 *                   Null here means 'apply the Effect to the whole Bitmap'.
1786
 * @param point      Center of the Effect.
1787
 * @param duration   Time, in milliseconds, it takes to do one full interpolation.
1788
 * @param count      Controls how many interpolations we want to do. See {@link Interpolator#setCount(float)}
1789
 * @return           ID of the effect added, or -1 if we failed to add one. 
1790
 */
1791
  public long saturation(float saturation, Float4D region, Float2D point, int duration, float count)
1792
    {
1793
    Interpolator1D di = new Interpolator1D(); 
1794
    di.setCount(count);
1795
    di.setDuration(duration);
1796
    di.add(new Float1D(1));                          
1797
    di.add(new Float1D(saturation));                         
1798
   
1799
    return mF.add(EffectNames.SATURATION, di, region, point.x, point.y);
1800
    }
1801

    
1802
///////////////////////////////////////////////////////////////////////////////////////////////////
1803
/**
1804
 * Makes a certain sub-region of the Bitmap smoothly change its saturation level.
1805
 * <p>
1806
 * Here the center of the Effect stays constant and the effect for now change in time.
1807
 *         
1808
 * @param saturation Level of saturation (between 0 and infinity) we want to interpolate to.
1809
 *                   1 - level of saturation unchanged, anything less than 1 - reduce saturation,
1810
 *                   anything more than 1- increase the saturation. 
1811
 * @param region     Region this Effect is limited to. 
1812
 *                   Null here means 'apply the Effect to the whole Bitmap'.
1813
 * @param point      Center of the Effect.
1814
 * @return           ID of the effect added, or -1 if we failed to add one. 
1815
 */
1816
  public long saturation(float saturation, Float4D region, Float2D point)
1817
    {
1818
    Interpolator1D di = new Interpolator1D(); 
1819
    di.setCount(0.5f);
1820
    di.setDuration(0);
1821
    di.add(new Float1D(1));                          
1822
    di.add(new Float1D(saturation));                         
1823
   
1824
    return mF.add(EffectNames.SATURATION, di, region, point.x, point.y);
1825
    }
1826
 
1827
///////////////////////////////////////////////////////////////////////////////////////////////////
1828
///////////////////////////////////////////////////////////////////////////////////////////////////
1829
// SMOOTH_SATURATION
1830
/**
1831
 * Makes a certain sub-region of the Bitmap smoothly change its saturation level.
1832
 *        
1833
 * @param a      1-dimensional Interpolator that returns the level of saturation we want to have
1834
 *               at any given moment.
1835
 * @param region Region this Effect is limited to. 
1836
 *               Null here means 'apply the Effect to the whole Bitmap'.
1837
 * @param i      2-dimensional Interpolator which, at any given time, returns a Float2D 
1838
 *               representing the current center of the effect.
1839
 * @return       ID of the effect added, or -1 if we failed to add one. 
1840
 */
1841
  public long smooth_saturation(Interpolator1D a, Float4D region, Interpolator2D i)
1842
    {
1843
    return mF.add(EffectNames.SMOOTH_SATURATION, a, region, i);
1844
    }
1845

    
1846
///////////////////////////////////////////////////////////////////////////////////////////////////
1847
/**
1848
 * Makes a certain sub-region of the Bitmap smoothly change its saturation level.
1849
 * <p>
1850
 * Here the center of the Effect stays constant.
1851
 *         
1852
 * @param a      1-dimensional Interpolator that returns the level of saturation we want to have
1853
 *               at any given moment.
1854
 * @param region Region this Effect is limited to. 
1855
 *               Null here means 'apply the Effect to the whole Bitmap'.
1856
 * @param point  Center of the Effect.
1857
 * @return       ID of the effect added, or -1 if we failed to add one. 
1858
 */
1859
  public long smooth_saturation(Interpolator1D a, Float4D region, Float2D point)
1860
    {
1861
    return mF.add(EffectNames.SMOOTH_SATURATION, a, region, point.x, point.y);
1862
    }
1863

    
1864
///////////////////////////////////////////////////////////////////////////////////////////////////  
1865
/**
1866
 * Makes a certain sub-region of the Bitmap smoothly change its saturation level.
1867
 *        
1868
 * @param saturation Level of saturation (between 0 and infinity) we want to interpolate to.
1869
 *                   1 - level of saturation unchanged, anything less than 1 - reduce saturation,
1870
 *                   anything more than 1 -increase the saturation. 
1871
 * @param region     Region this Effect is limited to. 
1872
 *                   Null here means 'apply the Effect to the whole Bitmap'.
1873
 * @param i          2-dimensional Interpolator which, at any given time, returns a Float2D
1874
 *                   representing the current center of the effect.
1875
 * @param duration   Time, in milliseconds, it takes to do one full interpolation.
1876
 * @param count      Controls how many interpolations we want to do. See {@link Interpolator#setCount(float)}
1877
 * @return           ID of the effect added, or -1 if we failed to add one. 
1878
 */
1879
  public long smooth_saturation(float saturation, Float4D region, Interpolator2D i, int duration, float count)
1880
    {
1881
    Interpolator1D di = new Interpolator1D(); 
1882
    di.setCount(count);
1883
    di.setDuration(duration);
1884
    di.add(new Float1D(1));                          
1885
    di.add(new Float1D(saturation));                         
1886
   
1887
    return mF.add(EffectNames.SMOOTH_SATURATION, di, region, i);
1888
    }
1889

    
1890
///////////////////////////////////////////////////////////////////////////////////////////////////
1891
/**
1892
 * Makes a certain sub-region of the Bitmap smoothly change its saturation level.
1893
 * <p>
1894
 * Here the center of the Effect stays constant.
1895
 *         
1896
 * @param saturation Level of saturation (between 0 and infinity) we want to interpolate to.
1897
 *                   1 - level of saturation unchanged, anything less than 1 - reduce saturation,
1898
 *                   anything more than 1 - increase the saturation. 
1899
 * @param region     Region this Effect is limited to. 
1900
 *                   Null here means 'apply the Effect to the whole Bitmap'.
1901
 * @param point      Center of the Effect.
1902
 * @param duration   Time, in milliseconds, it takes to do one full interpolation.
1903
 * @param count      Controls how many interpolations we want to do. See {@link Interpolator#setCount(float)}
1904
 * @return           ID of the effect added, or -1 if we failed to add one. 
1905
 */
1906
  public long smooth_saturation(float saturation, Float4D region, Float2D point, int duration, float count)
1907
    {
1908
    Interpolator1D di = new Interpolator1D(); 
1909
    di.setCount(count);
1910
    di.setDuration(duration);
1911
    di.add(new Float1D(1));                          
1912
    di.add(new Float1D(saturation));                         
1913
   
1914
    return mF.add(EffectNames.SMOOTH_SATURATION, di, region, point.x, point.y);
1915
    }
1916

    
1917
///////////////////////////////////////////////////////////////////////////////////////////////////
1918
/**
1919
 * Makes a certain sub-region of the Bitmap smoothly change its saturation level.
1920
 * <p>
1921
 * Here the center of the Effect stays constant and the effect for now change in time.
1922
 *         
1923
 * @param saturation Level of saturation (between 0 and infinity) we want to interpolate to.
1924
 *                   1 - level of saturation unchanged, anything less than 1 - reduce saturation,
1925
 *                   anything more than 1 - increase the saturation. 
1926
 * @param region     Region this Effect is limited to. 
1927
 *                   Null here means 'apply the Effect to the whole Bitmap'.
1928
 * @param point      Center of the Effect.
1929
 * @return           ID of the effect added, or -1 if we failed to add one. 
1930
 */
1931
  public long smooth_saturation(float saturation, Float4D region, Float2D point)
1932
    {
1933
    Interpolator1D di = new Interpolator1D(); 
1934
    di.setCount(0.5f);
1935
    di.setDuration(0);
1936
    di.add(new Float1D(1));                          
1937
    di.add(new Float1D(saturation));                         
1938
   
1939
    return mF.add(EffectNames.SMOOTH_SATURATION, di, region, point.x, point.y);
1940
    }
1941
    
1942
///////////////////////////////////////////////////////////////////////////////////////////////////
1943
/**
1944
 * Makes the whole Bitmap change its saturation level.
1945
 * 
1946
 * @param saturation Level of saturation (between 0 and infinity) we want to interpolate to.
1947
 *                   1 - level of saturation unchanged, anything less than 1 - reduce saturation,
1948
 *                   anything more than 1 - increase the saturation. 
1949
 * @param duration   Time, in milliseconds, it takes to do one full interpolation.
1950
 * @param count      Controls how many interpolations we want to do. See {@link Interpolator#setCount(float)}
1951
 * @return           ID of the effect added, or -1 if we failed to add one. 
1952
 */
1953
  public long smooth_saturation(float saturation, int duration, float count) 
1954
    {
1955
    Interpolator1D di = new Interpolator1D(); 
1956
    di.setCount(count);
1957
    di.setDuration(duration);
1958
    di.add(new Float1D(1));                            
1959
    di.add(new Float1D(saturation));                        
1960
         
1961
    return mF.add(EffectNames.SMOOTH_SATURATION, di,null, 0.0f, 0.0f);
1962
    }
1963
            
1964
///////////////////////////////////////////////////////////////////////////////////////////////////
1965
// Vertex-based effects  
1966
///////////////////////////////////////////////////////////////////////////////////////////////////
1967
// DISTORT
1968
/**
1969
 * Distort a (possibly changing in time) part of the Bitmap by a (possibly changing in time) vector of force.
1970
 * 
1971
 * @param i      2- or 3-dimensional Interpolator that returns a 2- or 3-dimensional Point which
1972
 *               represents the vector the Center of the Effect is currently being dragged with.
1973
 * @param region Region that masks the effect of the Distortion.
1974
 * @param p      2-dimensional Interpolator that, at any given time, returns a Point2D representing 
1975
 *               the Center of the Effect.
1976
 * @return       ID of the effect added, or -1 if we failed to add one. 
1977
 */
1978
  public long distort(Interpolator i, Float4D region, Interpolator2D p)
1979
    {  
1980
    return mV.add(EffectNames.DISTORT, i, region, p);  
1981
    }
1982

    
1983
///////////////////////////////////////////////////////////////////////////////////////////////////
1984
/**
1985
 * Distort part of the Bitmap by a (possibly changing in time) vector of force.
1986
 * <p>
1987
 * Difference between this and the previous method is that here the center of the Effect stays constant.
1988
 *   
1989
 * @param i      2- or 3-dimensional Interpolator that returns a 2- or 3-dimensional Point which
1990
 *               represents the vector the Center of the Effect is currently being dragged with.
1991
 * @param region Region that masks the effect of the Distortion.
1992
 * @param point  Center of the Effect.
1993
 * @return       ID of the effect added, or -1 if we failed to add one. 
1994
 */
1995
  public long distort(Interpolator i, Float4D region, Float2D point)
1996
    {  
1997
    return mV.add(EffectNames.DISTORT, i, region, point.x, point.y);  
1998
    }
1999

    
2000
///////////////////////////////////////////////////////////////////////////////////////////////////
2001
/**
2002
 * Distort the whole Bitmap by a (possibly changing in time) vector of force.
2003
 * 
2004
 * @param i     2- or 3-dimensional Interpolator that returns a 2- or 3-dimensional Point which
2005
 *              represents the vector the Center of the Effect is currently being dragged with.
2006
 * @param point Center of the Effect.
2007
 * @return      ID of the effect added, or -1 if we failed to add one. 
2008
 */
2009
  public long distort(Interpolator i, Float2D point)
2010
    {
2011
    return mV.add(EffectNames.DISTORT, i, null, point.x, point.y);  
2012
    }
2013

    
2014
///////////////////////////////////////////////////////////////////////////////////////////////////
2015
/**
2016
 * Distort part of the Bitmap by a vector of force that changes from (0,0,0) to v.
2017
 * 
2018
 * @param vector   Maximum vector of force. 
2019
 * @param region   Region that masks the effect of the Distortion.
2020
 * @param point    Center of the Effect.
2021
 * @param duration Time, in milliseconds, it takes to do one full interpolation.
2022
 * @param count    Controls how many interpolations we want to do. See {@link Interpolator#setCount(float)}
2023
 * @return         ID of the effect added, or -1 if we failed to add one. 
2024
 */
2025
  public long distort(Float3D vector, Float4D region, Float2D point, int duration, float count)
2026
    {  
2027
    Interpolator3D di = new Interpolator3D(); 
2028
    di.setCount(count);
2029
    di.setDuration(duration);
2030
    di.add(new Float3D(0.0f,0.0f,0.0f));               
2031
    di.add(vector);                                                  
2032
           
2033
    return mV.add(EffectNames.DISTORT, di, region, point.x, point.y);  
2034
    }
2035

    
2036
///////////////////////////////////////////////////////////////////////////////////////////////////
2037
/**
2038
 * Distort the whole Bitmap by a vector of force that changes from (0,0,0) to v.
2039
 * 
2040
 * @param vector   Maximum vector of force.
2041
 * @param point    Center of the Effect.
2042
 * @param duration Time, in milliseconds, it takes to do one full interpolation.
2043
 * @param count    Controls how many interpolations we want to do. See {@link Interpolator#setCount(float)}
2044
 * @return         ID of the effect added, or -1 if we failed to add one. 
2045
 */
2046
  public long distort(Float3D vector, Float2D point, int duration, float count)
2047
    {
2048
    Interpolator3D di = new Interpolator3D(); 
2049
    di.setCount(count);
2050
    di.setDuration(duration);
2051
    di.add(new Float3D(0.0f,0.0f,0.0f));               
2052
    di.add(vector);                                                 
2053
           
2054
    return mV.add(EffectNames.DISTORT, di, null, point.x, point.y);  
2055
    }
2056

    
2057
///////////////////////////////////////////////////////////////////////////////////////////////////
2058
/**
2059
 * Distort the whole Bitmap by a vector of force that changes from (0,0,0) to v.
2060
 * <p>
2061
 * Difference between this and the previous method is that here the vector of force will get interpolated
2062
 * to the maximum v and the effect will end. We are thus limited to count=0.5.
2063
 * 
2064
 * @param vector   Maximum, final vector of force.
2065
 * @param point    Center of the Effect.
2066
 * @param duration Time, in milliseconds, it takes to do one full interpolation.
2067
 * @return         ID of the effect added, or -1 if we failed to add one. 
2068
 */
2069
  public long distort(Float3D vector, Float2D point, int duration)
2070
    {
2071
    Interpolator3D di = new Interpolator3D();  
2072
    di.setCount(0.5f);
2073
    di.setDuration(duration);
2074
    di.add(new Float3D(0.0f,0.0f,0.0f));              
2075
    di.add(vector);                 
2076
           
2077
    return mV.add(EffectNames.DISTORT, di, null, point.x, point.y);  
2078
    }
2079

    
2080
///////////////////////////////////////////////////////////////////////////////////////////////////
2081
/**
2082
 * Distort the whole Bitmap by a vector of force v.
2083
 * <p>
2084
 * Here we apply a constant vector of force.
2085
 * 
2086
 * @param vector Vector of force.
2087
 * @param point  Center of the Effect.
2088
 * @return       ID of the effect added, or -1 if we failed to add one. 
2089
 */
2090
  public long distort(Float3D vector, Float2D point )
2091
    {
2092
    Interpolator3D di = new Interpolator3D(); 
2093
    di.setCount(0.5f);
2094
    di.setDuration(0);
2095
    di.add(new Float3D(0.0f,0.0f,0.0f));              
2096
    di.add(vector);           
2097
           
2098
    return mV.add(EffectNames.DISTORT, di, null, point.x, point.y);  
2099
    }
2100

    
2101
///////////////////////////////////////////////////////////////////////////////////////////////////
2102
///////////////////////////////////////////////////////////////////////////////////////////////////
2103
// DEFORM
2104
/**
2105
 * Deform the shape of the whole Bitmap with a (possibly changing in time) vector of force applied to 
2106
 * a (possibly changing in time) point on the Bitmap.
2107
 *     
2108
 * @param i     Interpolator that, at any given time, returns a Point2D representing vector of 
2109
 *              force that deforms the shapre of the whole Bitmap.
2110
 * @param point 2-dimensional Interpolator that, at any given time, returns a Point2D representing 
2111
 *              the Center of the Effect.
2112
 * @return      ID of the effect added, or -1 if we failed to add one. 
2113
 */
2114
  public long deform(Interpolator i, Interpolator2D point)
2115
    {  
2116
    return mV.add(EffectNames.DEFORM, i, null, point);  
2117
    }
2118

    
2119
///////////////////////////////////////////////////////////////////////////////////////////////////
2120
/**
2121
 * Deform the shape of the whole Bitmap with a (possibly changing in time) vector of force applied to 
2122
 * a constant point on the Bitmap.
2123
 * 
2124
 * @param i     Interpolator that, at any given time, returns a Point2D representing 
2125
 *              vector of force that deforms the shapre of the whole Bitmap.
2126
 * @param point Center of the Effect.
2127
 * @return      ID of the effect added, or -1 if we failed to add one. 
2128
 */
2129
  public long deform(Interpolator i, Float2D point)
2130
    {
2131
    return mV.add(EffectNames.DEFORM, i, null, point.x, point.y);  
2132
    }
2133

    
2134
///////////////////////////////////////////////////////////////////////////////////////////////////
2135
/**
2136
 * Deform the shape of the whole Bitmap with a vector of force smoothly changing from (0,0,0) to v 
2137
 * applied to a constant point on the Bitmap. 
2138
 * 
2139
 * @param vector   Vector of force.
2140
 * @param point    Center of the Effect.
2141
 * @param duration Time, in milliseconds, it takes to do one full interpolation.
2142
 * @param count    Controls how many interpolations we want to do. See {@link Interpolator#setCount(float)}
2143
 * @return         ID of the effect added, or -1 if we failed to add one. 
2144
 */
2145
  public long deform(Float3D vector, Float2D point, int duration, float count)
2146
    {
2147
    Interpolator3D di = new Interpolator3D(); 
2148
    di.setCount(count);
2149
    di.setDuration(duration);
2150
    di.add(new Float3D(0.0f,0.0f,0.0f));               
2151
    di.add(vector);                
2152
           
2153
    return mV.add(EffectNames.DEFORM, di, null, point.x, point.y);  
2154
    }
2155

    
2156
///////////////////////////////////////////////////////////////////////////////////////////////////
2157
/**
2158
 * Deform the shape of the whole Bitmap with a vector of force smoothly changing from (0,0,0) to v 
2159
 * applied to a constant point on the Bitmap. 
2160
 * <p>
2161
 * Identical to calling the previous method with count=0.5.
2162
 * 
2163
 * @param vector   Final vector of force.
2164
 * @param point    Center of the Effect.
2165
 * @param duration Time, in milliseconds, it takes to do one full interpolation.
2166
 * @return         ID of the effect added, or -1 if we failed to add one. 
2167
 */
2168
  public long deform(Float3D vector, Float2D point, int duration)
2169
    {
2170
    Interpolator3D di = new Interpolator3D();  
2171
    di.setCount(0.5f);
2172
    di.setDuration(duration);
2173
    di.add(new Float3D(0.0f,0.0f,0.0f));              
2174
    di.add(vector);             
2175
           
2176
    return mV.add(EffectNames.DEFORM, di, null, point.x, point.y);  
2177
    }
2178

    
2179
///////////////////////////////////////////////////////////////////////////////////////////////////
2180
/**
2181
 * Deform the shape of the whole Bitmap with a constant vector of force applied to a constant 
2182
 * point on the Bitmap. 
2183
 * 
2184
 * @param vector Vector of force.
2185
 * @param point  Center of the Effect.
2186
 * @return       ID of the effect added, or -1 if we failed to add one. 
2187
 */
2188
  public long deform(Float3D vector, Float2D point )
2189
    {
2190
    Interpolator3D di = new Interpolator3D(); 
2191
    di.setCount(0.5f);
2192
    di.setDuration(0);
2193
    di.add(new Float3D(0.0f,0.0f,0.0f));              
2194
    di.add(vector);            
2195
           
2196
    return mV.add(EffectNames.DEFORM, di, null, point.x, point.y);  
2197
    }
2198
   
2199
///////////////////////////////////////////////////////////////////////////////////////////////////  
2200
///////////////////////////////////////////////////////////////////////////////////////////////////
2201
// SINK
2202
/**
2203
 * Pull all points around the center of the effect towards the center (if degree>=1) or push them 
2204
 * away from the center (degree<=1)
2205
 *    
2206
 * @param di     1-dimensional Interpolator which, at any given time, returns a Point1D representing
2207
 *               the current degree of the effect.
2208
 * @param region Region that masks the effect of the Sink.
2209
 * @param point  2-dimensional Interpolator that, at any given time, returns a Point2D representing 
2210
 *               the Center of the Effect.
2211
 * @return       ID of the effect added, or -1 if we failed to add one. 
2212
 */
2213
  public long sink(Interpolator1D di, Float4D region, Interpolator2D point)
2214
    {
2215
    return mV.add(EffectNames.SINK, di, region, point);  
2216
    }
2217

    
2218
///////////////////////////////////////////////////////////////////////////////////////////////////
2219
/**
2220
 * Pull all points around the center of the effect towards the center (if degree>=1) or push them 
2221
 * away from the center (degree<=1).
2222
 * <p>
2223
 * Here the Center stays constant.
2224
 *      
2225
 * @param di     1-dimensional Interpolator which, at any given time, returns a Point1D
2226
 *               representing the current degree of the effect.
2227
 * @param region Region that masks the effect of the Sink.
2228
 * @param point  Center of the Effect.
2229
 * @return       ID of the effect added, or -1 if we failed to add one. 
2230
 */
2231
  public long sink(Interpolator1D di, Float4D region, Float2D point)
2232
    {
2233
    return mV.add(EffectNames.SINK, di, region, point.x, point.y);  
2234
    }
2235
  
2236
///////////////////////////////////////////////////////////////////////////////////////////////////
2237
/**
2238
 * Pull all points around the center of the effect towards the center (if degree>=1) or push them 
2239
 * away from the center (degree<=1).
2240
 * <p>
2241
 * Here we can only interpolate between 1 and degree.
2242
 * 
2243
 * @param degree   How much to push or pull. Between 0 and infinity.
2244
 * @param region   Region that masks the effect of the Sink.
2245
 * @param p        2-dimensional Interpolator that, at any given time, returns a Point2D representing 
2246
 *                 the Center of the Effect.
2247
 * @param duration Time, in milliseconds, it takes to do one full interpolation.
2248
 * @param count    Controls how many interpolations we want to do. See {@link Interpolator#setCount(float)}
2249
 * @return         ID of the effect added, or -1 if we failed to add one. 
2250
 */
2251
  public long sink(float degree, Float4D region, Interpolator2D p, int duration, float count)
2252
    {
2253
    Interpolator1D di = new Interpolator1D(); 
2254
    di.setCount(count);
2255
    di.setDuration(duration);
2256
    di.add(new Float1D(1));                                
2257
    di.add(new Float1D(degree));                          
2258
    
2259
    return mV.add(EffectNames.SINK, di, region, p);  
2260
    }
2261

    
2262
///////////////////////////////////////////////////////////////////////////////////////////////////
2263
/**
2264
 * Pull all points around the center of the effect towards the center (if degree>=1) or push them 
2265
 * away from the center (degree<=1).
2266
 *   
2267
 * @param degree   How much to push or pull. Between 0 and infinity.
2268
 * @param region   Region that masks the effect of the Sink.
2269
 * @param point    Center of the Effect.
2270
 * @param duration Time, in milliseconds, it takes to do one full interpolation.
2271
 * @param count    Controls how many interpolations we want to do. See {@link Interpolator#setCount(float)}
2272
 * @return         ID of the effect added, or -1 if we failed to add one. 
2273
 */
2274
  public long sink(float degree, Float4D region, Float2D point, int duration, float count)
2275
    {
2276
    Interpolator1D di = new Interpolator1D(); 
2277
    di.setCount(count);
2278
    di.setDuration(duration);
2279
    di.add(new Float1D(1));                                
2280
    di.add(new Float1D(degree));                          
2281
    
2282
    return mV.add(EffectNames.SINK, di, region, point.x, point.y);  
2283
    }
2284

    
2285
///////////////////////////////////////////////////////////////////////////////////////////////////
2286
/**
2287
 * Pull all points of the Bitmap towards the center of the Effect (if degree>=1) or push them 
2288
 * away from the center (degree<=1).
2289
 * 
2290
 * @param degree   How much to push or pull. Between 0 and infinity.
2291
 * @param point    Center of the Effect.
2292
 * @param duration Time, in milliseconds, it takes to do one full interpolation.
2293
 * @param count    Controls how many interpolations we want to do. See {@link Interpolator#setCount(float)}
2294
 * @return         ID of the effect added, or -1 if we failed to add one. 
2295
 */
2296
  public long sink(float degree, Float2D point, int duration, float count) 
2297
    {
2298
    Interpolator1D di = new Interpolator1D();  
2299
    di.setCount(count);
2300
    di.setDuration(duration);
2301
    di.add(new Float1D(1));                                
2302
    di.add(new Float1D(degree));                          
2303
         
2304
    return mV.add(EffectNames.SINK, di, null, point.x, point.y);  
2305
    }
2306

    
2307
///////////////////////////////////////////////////////////////////////////////////////////////////
2308
/**
2309
 * Pull all points of the Bitmap towards the center of the Effect (if degree>=1) or push them 
2310
 * away from the center (degree<=1).
2311
 * <p>
2312
 * Equivalent to calling the previous method with count=0.5.
2313
 * 
2314
 * @param degree   How much to push or pull. Between 0 and infinity.
2315
 * @param point    Center of the Effect.
2316
 * @param duration Time, in milliseconds, it takes to do one full interpolation.
2317
 * @return         ID of the effect added, or -1 if we failed to add one. 
2318
 */
2319
  public long sink(float degree, Float2D point, int duration) 
2320
    {
2321
    Interpolator1D di = new Interpolator1D(); 
2322
    di.setCount(0.5f);
2323
    di.setDuration(duration);
2324
    di.add(new Float1D(1));                               
2325
    di.add(new Float1D(degree));                      
2326
        
2327
    return mV.add(EffectNames.SINK, di, null, point.x, point.y);  
2328
    }
2329

    
2330
///////////////////////////////////////////////////////////////////////////////////////////////////
2331
/**
2332
 * Pull all points of the Bitmap towards the center of the Effect (if degree>=1) or push them 
2333
 * away from the center (degree<=1).
2334
 * <p>
2335
 * Equivalent of calling the previous method with duration=0; i.e. we pull immediately.
2336
 * 
2337
 * @param degree How much to push or pull. Between 0 and infinity.
2338
 * @param point  Center of the Effect.
2339
 * @return       ID of the effect added, or -1 if we failed to add one. 
2340
 */
2341
  public long sink(float degree, Float2D point) 
2342
    {
2343
    Interpolator1D di = new Interpolator1D(); 
2344
    di.setCount(0.5f);
2345
    di.setDuration(0);
2346
    di.add(new Float1D(1));                               
2347
    di.add(new Float1D(degree));                      
2348
        
2349
    return mV.add(EffectNames.SINK, di, null, point.x, point.y);  
2350
    }
2351
  
2352
///////////////////////////////////////////////////////////////////////////////////////////////////  
2353
///////////////////////////////////////////////////////////////////////////////////////////////////
2354
// SWIRL
2355
/**
2356
 * Rotate part of the Bitmap around the Center of the Effect by a certain angle (as returned by the
2357
 * Interpolator). 
2358
 *   
2359
 * @param di     1-dimensional Interpolator which, at any given time, returns a Point1D representing 
2360
 *               the degree of Swirl.
2361
 * @param region Region that masks the effect of the Swirl.
2362
 * @param point  2-dimensional Interpolator that, at any given time, returns a Point2D representing 
2363
 *               the Center of the Effect.
2364
 * @return       ID of the effect added, or -1 if we failed to add one. 
2365
 */
2366
  public long swirl(Interpolator1D di, Float4D region, Interpolator2D point)
2367
    {    
2368
    return mV.add(EffectNames.SWIRL, di, region, point);  
2369
    }
2370

    
2371
///////////////////////////////////////////////////////////////////////////////////////////////////
2372
/**
2373
 * Rotate part of the Bitmap around the Center of the Effect by a certain angle (as returned by the
2374
 * Interpolator).
2375
 * <p>
2376
 * Here the Center stays constant.
2377
 *      
2378
 * @param di     1-dimensional Interpolator which, at any given time, returns a Point1D representing 
2379
 *               the degree of Swirl.
2380
 * @param region Region that masks the effect of the Swirl.
2381
 * @param point  Center of the Effect.
2382
 * @return       ID of the effect added, or -1 if we failed to add one. 
2383
 */
2384
  public long swirl(Interpolator1D di, Float4D region, Float2D point)
2385
    {    
2386
    return mV.add(EffectNames.SWIRL, di, region, point.x, point.y);  
2387
    }
2388
 
2389
///////////////////////////////////////////////////////////////////////////////////////////////////
2390
/**
2391
 * Rotate part of the Bitmap around the Center of the Effect by 'degree' angle.
2392
 *   
2393
 * @param degree   Angle of rotation. Unit: degrees.
2394
 * @param region   Region that masks the effect of the Swirl.
2395
 * @param point    2-dimensional Interpolator that, at any given time, returns a Point2D representing 
2396
 *                 the Center of the Effect.
2397
 * @param duration Time, in milliseconds, it takes to do one full interpolation.
2398
 * @param count    Controls how many interpolations we want to do. See {@link Interpolator#setCount(float)}
2399
 * @return         ID of the effect added, or -1 if we failed to add one. 
2400
 */
2401
  public long swirl(int degree, Float4D region, Interpolator2D point, int duration, float count)
2402
    {
2403
    Interpolator1D di = new Interpolator1D(); 
2404
    di.setCount(count);
2405
    di.setDuration(duration);
2406
    di.add(new Float1D(0));                                
2407
    di.add(new Float1D(degree));                          
2408
    
2409
    return mV.add(EffectNames.SWIRL, di, region, point);  
2410
    }
2411

    
2412
///////////////////////////////////////////////////////////////////////////////////////////////////
2413
/**
2414
 * Rotate part of the Bitmap around the Center of the Effect by 'degree' angle.
2415
 * <p>
2416
 * Here the Center stays constant.
2417
 *    
2418
 * @param degree   Angle of rotation. Unit: degrees.
2419
 * @param region   Region that masks the effect of the Swirl.
2420
 * @param point    Center of the Effect.
2421
 * @param duration Time, in milliseconds, it takes to do one full interpolation.
2422
 * @param count    Controls how many interpolations we want to do. See {@link Interpolator#setCount(float)}
2423
 * @return         ID of the effect added, or -1 if we failed to add one. 
2424
 */
2425
  public long swirl(int degree, Float4D region, Float2D point, int duration, float count)
2426
    {
2427
    Interpolator1D di = new Interpolator1D(); 
2428
    di.setCount(count);
2429
    di.setDuration(duration);
2430
    di.add(new Float1D(0));                                
2431
    di.add(new Float1D(degree));                          
2432
    
2433
    return mV.add(EffectNames.SWIRL, di, region, point.x, point.y);  
2434
    }
2435

    
2436
///////////////////////////////////////////////////////////////////////////////////////////////////
2437
/**
2438
 * Rotate the whole Bitmap around the Center of the Effect by 'degree' angle.
2439
 * 
2440
 * @param degree   Angle of rotation. Unit: degrees.
2441
 * @param point    Center of the Effect.
2442
 * @param duration Time, in milliseconds, it takes to do one full interpolation.
2443
 * @param count    Controls how many interpolations we want to do. See {@link Interpolator#setCount(float)}
2444
 * @return         ID of the effect added, or -1 if we failed to add one. 
2445
 */
2446
  public long swirl(int degree, Float2D point, int duration, float count) 
2447
    {
2448
    Interpolator1D di = new Interpolator1D();  
2449
    di.setCount(count);
2450
    di.setDuration(duration);
2451
    di.add(new Float1D(0));                                
2452
    di.add(new Float1D(degree));                          
2453
         
2454
    return mV.add(EffectNames.SWIRL, di, null, point.x, point.y);  
2455
    }
2456

    
2457
///////////////////////////////////////////////////////////////////////////////////////////////////
2458
/**
2459
 * Rotate the whole Bitmap around the Center of the Effect by 'degree' angle.
2460
 * <p>
2461
 * Equivalent to calling the previous method with count=0.5.
2462
 * 
2463
 * @param degree   Angle of rotation. Unit: degrees.
2464
 * @param point    Center of the Effect.
2465
 * @param duration Time, in milliseconds, it takes to do one full interpolation.
2466
 * @return         ID of the effect added, or -1 if we failed to add one. 
2467
 */
2468
  public long swirl(int degree, Float2D point, int duration) 
2469
    {
2470
    Interpolator1D di = new Interpolator1D(); 
2471
    di.setCount(0.5f);
2472
    di.setDuration(duration);
2473
    di.add(new Float1D(0));                               
2474
    di.add(new Float1D(degree));                      
2475
        
2476
    return mV.add(EffectNames.SWIRL, di, null, point.x, point.y);  
2477
    }
2478

    
2479
///////////////////////////////////////////////////////////////////////////////////////////////////
2480
/**
2481
 * Rotate the whole Bitmap around the Center of the Effect by 'degree' angle.
2482
 * <p>
2483
 * Equivalent to calling the previous method with duration=0.
2484
 * 
2485
 * @param degree Angle of rotation. Unit: degrees.
2486
 * @param point  Center of the Effect.
2487
 * @return       ID of the effect added, or -1 if we failed to add one. 
2488
 */
2489
  public long swirl(int degree, Float2D point) 
2490
    {
2491
    Interpolator1D di = new Interpolator1D(); 
2492
    di.setCount(0.5f);
2493
    di.setDuration(0);
2494
    di.add(new Float1D(0));                               
2495
    di.add(new Float1D(degree));                      
2496
        
2497
    return mV.add(EffectNames.SWIRL, di, null, point.x, point.y);  
2498
    }
2499

    
2500
///////////////////////////////////////////////////////////////////////////////////////////////////
2501
///////////////////////////////////////////////////////////////////////////////////////////////////
2502
// WAVE
2503

    
2504
///////////////////////////////////////////////////////////////////////////////////////////////////   
2505
}
(5-5/28)