Canvas

package com.test;


import android.app.Activity;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.RectF;
import android.os.Bundle;
import android.view.View;


public class NewActivity extends Activity
{
@Override
protected void onCreate(Bundle savedInstanceState)
{
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(new _view(this));
}

class _view extends View
{


public _view(Context context)
{
super(context);
// TODO Auto-generated constructor stub
}
@Override
public void onDraw(Canvas canvas)
{
RectF rectF = new RectF(30f, 300f, 400f, 800f);
// Matrix _Matrix = new Matrix();
Paint _Paint = new Paint();
_Paint.setColor(Color.BLUE);
canvas.drawArc(rectF, 0f, 180f, true, _Paint);
Bitmap bitmap = BitmapFactory.decodeFile("data/data/com.test/filse/you.jpg");
Rect _Rect = new Rect(0, 0, 200, 200);
Rect _Rect2 = new Rect(20, 20, 170, 170);
// canvas.drawBitmap(bitmap, null, _Rect, null);
canvas.drawBitmap(bitmap,null, _Rect2, _Paint);
canvas.drawCircle(100, 100, 50, _Paint);
canvas.drawLine(50, 50, 500, 500, _Paint);
canvas.drawOval(rectF, _Paint);
}
}
}

你可能感兴趣的:(null,Class,Constructor,Matrix)