package csi.android.puchipuchi;

import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Rect;
import android.view.View;

public class Puchipuchi_imageView extends View{
	private Bitmap image_before;
	private Bitmap image_after;
	
	public Puchipuchi_imageView(Context context){
		super(context);
		setBackgroundColor(Color.WHITE);
		
		//画像の読み込み
		Resources r = context.getResources();
		image_before = BitmapFactory.decodeResource(
				r,R.drawable.puchi_before);

		image_after = BitmapFactory.decodeResource(
				r,R.drawable.puchi_after);
	}

	//おためし描画
	protected void onDraw(Canvas canvas){		
		//イメージの縮小&描画
		//before
		int w_b=image_before.getWidth();
		int h_b=image_before.getHeight();
		Rect src_b=new Rect(0,0,w_b,h_b);
		Rect dst_b=new Rect(0,0,w_b/2,h_b/2);
		canvas.drawBitmap(image_before, src_b,dst_b,null);
		
		//after
		int w_a=image_after.getWidth();
		int h_a=image_after.getHeight();
		Rect src_a=new Rect(0,0,w_a,h_a);
		Rect dst_a=new Rect(0,0,w_a/2,h_a/2);
		//canvas.drawBitmap(image_after, src_a,dst_a,null);
		
	}
	
	
}
