Project

General

Profile

« Previous | Next » 

Revision 2e18813f

Added by Leszek Koltunski almost 8 years ago

Beginnings of support for the SavePNG effect.

View differences:

src/main/java/org/distorted/library/DistortedObject.java
2518 2518
// WAVE
2519 2519

  
2520 2520
///////////////////////////////////////////////////////////////////////////////////////////////////   
2521
///////////////////////////////////////////////////////////////////////////////////////////////////
2522
// Other-based effects
2523
///////////////////////////////////////////////////////////////////////////////////////////////////
2524
// SAVE_PNG
2525
/**
2526
 * Save the current state of the Bitmap that's backing up our DistortedObject to a PNG file.
2527
 *
2528
 * @param filename Full path to the file.
2529
 * @return         ID of the effect added, or -1 if we failed to add one.
2530
 */
2531
 public long savePNG(String filename)
2532
   {
2533
   return mO.add(EffectNames.SAVE_PNG, filename);
2534
   }
2521 2535
}
src/main/java/org/distorted/library/EffectQueue.java
166 166
  
167 167
///////////////////////////////////////////////////////////////////////////////////////////////////
168 168
  
169
  protected synchronized int getEffectIndex(long id)
169
  private synchronized int getEffectIndex(long id)
170 170
    {
171 171
    int index = mIDIndex[(int)(id%mMax[mMaxIndex])];
172 172
    return (index<mNumEffects && mID[index]==id ? index : -1);
src/main/java/org/distorted/library/EffectQueueOther.java
6 6
  {
7 7
  private static final int NUM_UNIFORMS = 0;
8 8
  private static final int INDEX = EffectTypes.OTHER.ordinal();
9
  private String[] mFilename;
9 10

  
10 11
///////////////////////////////////////////////////////////////////////////////////////////////////
11 12

  
12 13
  public EffectQueueOther(DistortedObject obj)
13 14
    {
14 15
    super(obj,NUM_UNIFORMS, INDEX );
16

  
17
    if( mMax[INDEX]>0 )
18
      {
19
      mFilename= new String[mMax[INDEX]];
20
      }
15 21
    }
16 22

  
17 23
///////////////////////////////////////////////////////////////////////////////////////////////////
18
// There are no Uniforms, nothing to move
19 24

  
20 25
  protected void moveEffect(int index)
21 26
    {
22

  
27
    mFilename[index] = mFilename[index+1];
23 28
    }
24 29

  
25 30
///////////////////////////////////////////////////////////////////////////////////////////////////
26 31

  
27 32
  synchronized void send()
28 33
    {
29

  
34
    for(int i=0; i<mNumEffects; i++)
35
      {
36
      if (mType[i] == EffectNames.SAVE_PNG.ordinal() )
37
        {
38
        // TODO: Implement SAVE_PNG HERE
39
        }
40
      else if (mType[i] == EffectNames.SAVE_MP4.ordinal() )
41
        {
42
        // TODO: Implement SAVE_MP4 HERE
43
        }
44
      }
30 45
    }
31 46

  
32 47
///////////////////////////////////////////////////////////////////////////////////////////////////
33 48

  
34 49
  synchronized long add(EffectNames eln, String filename)
35 50
    {
36
    return 0;
51
    if( mMax[INDEX]>mNumEffects )
52
      {
53
      mFilename[mNumEffects] = filename;
54
      mInterI[mNumEffects] = null;
55
      mInterP[mNumEffects] = null;
56

  
57
      return addBase(eln);
58
      }
59

  
60
    return -1;
37 61
    }
38 62
  }

Also available in: Unified diff