copy Pixels on Canvas - Android android.graphics

Android examples for android.graphics:Canvas

Description

copy Pixels on Canvas

Demo Code

import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Rect;

public class Main {

  private static Rect __src = new Rect();
  private static Rect __dst = new Rect();

  public static void copyPixels(Canvas c, int left, int top, int width, int height, Bitmap copy_image, int copy_left,
      int copy_top) {
    synchronized (Main.class) {
      __src.set(copy_left, copy_top, copy_left + width, copy_top + height);
      __dst.set(left, top, left + width, top + height);
      c.drawBitmap(copy_image, __src, __dst, null);
    }//www.  ja  va  2s . c  o m
  }

}

Related Tutorials