summaryrefslogtreecommitdiff
path: root/samples/ApiDemos/src/com/example/android/apis/graphics/BitmapMesh.java
diff options
context:
space:
mode:
authorChristian Mehlmauer <FireFart@gmail.com>2010-05-20 21:02:04 +0200
committerChristian Mehlmauer <FireFart@gmail.com>2010-06-12 12:13:18 +0200
commit62e92d7a2a3fd2798901ec2e7c452ff0e4067163 (patch)
treef2e9f60c4735feb3a6e443a15578de58d0fb54d2 /samples/ApiDemos/src/com/example/android/apis/graphics/BitmapMesh.java
parent4b5c09f29e37c8d07dcba57e4c4da13089a9d63d (diff)
Cleaned up Samples by removing unsed imports and variables.
Changed deprecated Config.LOGD to Config.DEBUG Removed unnecessary whitespaces Change-Id: I01414dd83eb6f9a41e56762dd7fc00e7f1115039
Diffstat (limited to 'samples/ApiDemos/src/com/example/android/apis/graphics/BitmapMesh.java')
-rw-r--r--samples/ApiDemos/src/com/example/android/apis/graphics/BitmapMesh.java20
1 files changed, 10 insertions, 10 deletions
diff --git a/samples/ApiDemos/src/com/example/android/apis/graphics/BitmapMesh.java b/samples/ApiDemos/src/com/example/android/apis/graphics/BitmapMesh.java
index 4d48a1e37..12c79ca54 100644
--- a/samples/ApiDemos/src/com/example/android/apis/graphics/BitmapMesh.java
+++ b/samples/ApiDemos/src/com/example/android/apis/graphics/BitmapMesh.java
@@ -31,16 +31,16 @@ public class BitmapMesh extends GraphicsActivity {
super.onCreate(savedInstanceState);
setContentView(new SampleView(this));
}
-
+
private static class SampleView extends View {
private static final int WIDTH = 20;
private static final int HEIGHT = 20;
private static final int COUNT = (WIDTH + 1) * (HEIGHT + 1);
-
+
private final Bitmap mBitmap;
private final float[] mVerts = new float[COUNT*2];
private final float[] mOrig = new float[COUNT*2];
-
+
private final Matrix mMatrix = new Matrix();
private final Matrix mInverse = new Matrix();
@@ -55,7 +55,7 @@ public class BitmapMesh extends GraphicsActivity {
mBitmap = BitmapFactory.decodeResource(getResources(),
R.drawable.beach);
-
+
float w = mBitmap.getWidth();
float h = mBitmap.getHeight();
// construct our mesh
@@ -63,17 +63,17 @@ public class BitmapMesh extends GraphicsActivity {
for (int y = 0; y <= HEIGHT; y++) {
float fy = h * y / HEIGHT;
for (int x = 0; x <= WIDTH; x++) {
- float fx = w * x / WIDTH;
+ float fx = w * x / WIDTH;
setXY(mVerts, index, fx, fy);
setXY(mOrig, index, fx, fy);
index += 1;
}
}
-
+
mMatrix.setTranslate(10, 10);
mMatrix.invert(mInverse);
}
-
+
@Override protected void onDraw(Canvas canvas) {
canvas.drawColor(0xFFCCCCCC);
@@ -81,7 +81,7 @@ public class BitmapMesh extends GraphicsActivity {
canvas.drawBitmapMesh(mBitmap, WIDTH, HEIGHT, mVerts, 0,
null, 0, null);
}
-
+
private void warp(float cx, float cy) {
final float K = 10000;
float[] src = mOrig;
@@ -94,7 +94,7 @@ public class BitmapMesh extends GraphicsActivity {
float dd = dx*dx + dy*dy;
float d = FloatMath.sqrt(dd);
float pull = K / (dd + 0.000001f);
-
+
pull /= (d + 0.000001f);
// android.util.Log.d("skia", "index " + i + " dist=" + d + " pull=" + pull);
@@ -114,7 +114,7 @@ public class BitmapMesh extends GraphicsActivity {
@Override public boolean onTouchEvent(MotionEvent event) {
float[] pt = { event.getX(), event.getY() };
mInverse.mapPoints(pt);
-
+
int x = (int)pt[0];
int y = (int)pt[1];
if (mLastWarpX != x || mLastWarpY != y) {