Project

General

Profile

« Previous | Next » 

Revision e8b6aa95

Added by Leszek Koltunski over 7 years ago

Major change in API: separate the GRID from DistortedObject; completely remove classes derived from DistortedObject.

View differences:

src/main/java/org/distorted/examples/effectqueue/EffectQueueRenderer.java
29 29
import android.opengl.GLES20;
30 30
import android.opengl.GLSurfaceView;
31 31

  
32
import org.distorted.library.DistortedBitmap;
32
import org.distorted.library.DistortedBitmapGrid;
33
import org.distorted.library.DistortedObject;
33 34
import org.distorted.library.Distorted;
34 35
import org.distorted.library.EffectNames;
35 36
import org.distorted.library.EffectTypes;
......
49 50
  private Paint mPaint;
50 51
  private int texWidth, texHeight;
51 52

  
52
  DistortedBitmap mBackground;
53
  DistortedObject mBackground;
54
  DistortedBitmapGrid mGrid;
53 55

  
54 56
///////////////////////////////////////////////////////////////////////////////////////////////////
55 57

  
......
64 66
      
65 67
    texWidth = BWID;
66 68
    texHeight= BHEI;
69

  
70
    mGrid      = new DistortedBitmapGrid(80,80*texHeight/texWidth);
71
    mBackground= new DistortedObject(texWidth,texHeight,1);
72

  
73
    mBackground.addEventListener(this);
67 74
    }
68 75

  
69 76
///////////////////////////////////////////////////////////////////////////////////////////////////
70 77
   
71 78
  public void onSurfaceCreated(GL10 glUnused, EGLConfig config) 
72
    {      
73
    mBackground = new DistortedBitmap(texWidth,texHeight, 80);
79
    {
74 80
    Bitmap bitmap = Bitmap.createBitmap(texWidth,texHeight, Bitmap.Config.ARGB_8888);
75
    Canvas canvas = new Canvas(bitmap);  
76
      
81
    Canvas canvas = new Canvas(bitmap);
82

  
77 83
    mPaint.setColor(0xff008800);
78 84
    canvas.drawRect(0, 0, texWidth, texHeight, mPaint);
79 85
    mPaint.setColor(0xffffffff);
80
         
86

  
81 87
    for(int i=0; i<=NUMLINES ; i++ )
82 88
      {
83 89
      canvas.drawRect(texWidth*i/NUMLINES - 1,                       0,  texWidth*i/NUMLINES + 1,  texHeight               , mPaint);
84
      canvas.drawRect(                      0, texHeight*i/NUMLINES -1,  texWidth               ,  texHeight*i/NUMLINES + 1, mPaint);  
90
      canvas.drawRect(                      0, texHeight*i/NUMLINES -1,  texWidth               ,  texHeight*i/NUMLINES + 1, mPaint);
85 91
      }
86
          
87
    mBackground.setBitmap(bitmap);
88
    mBackground.addEventListener(this);
92
    mBackground.setTexture(bitmap);
89 93

  
90 94
    try
91 95
      {
......
93 97
      }
94 98
    catch(Exception ex)
95 99
      {
96
      android.util.Log.e("Effects2D", ex.getMessage() );
100
      android.util.Log.e("EffectQueue", ex.getMessage() );
97 101
      }
98 102
    }
99 103

  
......
112 116
  public void onDrawFrame(GL10 glUnused)
113 117
    {   
114 118
    GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT);
115
    mBackground.draw(System.currentTimeMillis());
119
    mBackground.draw(System.currentTimeMillis(), mGrid);
116 120
    }
117 121

  
118 122
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff