Example #1
0
 public void shiftImage(int leftDPIs) {
   if (leftDPIs > 0) {
     DisplayMetrics metrics = new DisplayMetrics();
     surfaceView.getWindowManager().getDefaultDisplay().getMetrics(metrics);
     pixels = (int) (leftDPIs * metrics.density + 0.5f);
     Log.i("frodo64", "pixels: " + pixels);
     scaleX = (float) (width - pixels) / bufferWidth;
     scaleY = (float) height / bufferHeight;
     coordsChanged = true;
     if (bitmap != null) bitmap.changeCoords(pixels, 0, scaleX, scaleY);
   } else {
     pixels = 0;
     scaleX = (float) width / bufferWidth;
     scaleY = (float) height / bufferHeight;
     coordsChanged = true;
     if (bitmap != null) bitmap.changeCoords(0, 0, scaleX, scaleY);
   }
   Log.i("UAE", "new scale: " + scaleX + "-" + scaleY + "-" + pixels);
   if (width < height) {
     scaleY = scaleX;
   }
 }