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