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