package com.example.viewex01;
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.Paint;
import android.graphics.RectF;
import android.view.View;
public class MyView8 extends View {
public MyView8(Context context) {
super(context);
// TODO Auto-generated constructor stub
}
@Override
protected void onDraw(Canvas canvas) {
// TODO Auto-generated method stub
super.onDraw(canvas);
canvas.drawColor(Color.LTGRAY);
Paint paint = new Paint();
Bitmap BackBit = Bitmap.createBitmap(300, 200, Bitmap.Config.ARGB_8888);
Canvas offscreen = new Canvas(BackBit);
offscreen.drawColor(Color.GREEN);
paint.setColor(Color.RED);
for(int x=0 ; x<300; x+=10){
offscreen.drawLine(x, 0, 300-x, 200, paint);
}
canvas.drawBitmap(BackBit, 10, 10, null);
}
}
'Android' 카테고리의 다른 글
그리기 객체 - 택스트 Typeface (0) | 2013.03.29 |
---|---|
그리기 객체 - 텍스트 (0) | 2013.03.29 |
캔버스 - setStyle (0) | 2013.03.29 |
캔버스 - setStroke (0) | 2013.03.29 |
캔버스 -AntiAlias (0) | 2013.03.29 |