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.LinearGradient;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.RadialGradient;
import android.graphics.RectF;
import android.graphics.Shader.TileMode;
import android.graphics.Typeface;
import android.view.View;
public class MyView14 extends View {
public MyView14(Context context) {
super(context);
// TODO Auto-generated constructor stub
}
@Override
public void onDraw(Canvas canvas) {
Paint Pnt= new Paint();
Pnt.setAntiAlias(true);
int[] colors = { Color.RED, Color.GREEN, Color.BLUE, Color.YELLOW, Color.WHITE};
float[] pos = { 0.0f, 0.1f, 0.6f, 0.9f, 1.0f };
// 파란색흰색
Pnt.setShader(new RadialGradient(80, 80, 70,
Color.BLUE, Color.WHITE, TileMode.CLAMP));
canvas.drawCircle(80, 80, 70, Pnt);
// 흰색파란색
Pnt.setShader(new RadialGradient(230, 80, 70,
Color.WHITE, Color.BLUE, TileMode.CLAMP));
canvas.drawCircle(230, 80, 70, Pnt);
// 여러가지색균등
Pnt.setShader(new RadialGradient(80, 230, 70, colors, null, TileMode.CLAMP));
canvas.drawCircle(80, 230, 70, Pnt);
// 여러가지색차등
Pnt.setShader(new RadialGradient(230, 230, 70, colors, pos, TileMode.CLAMP));
canvas.drawCircle(230, 230, 70, Pnt);
}
}
'Android' 카테고리의 다른 글
셰이더 - ShapeDrawable (0) | 2013.03.29 |
---|---|
셰이더 - 스윕 그래디언트 SweepGradient (0) | 2013.03.29 |
셰이더 - 직선 그래디언트 LinearGradient (0) | 2013.03.29 |
그리기 객체 - Path (0) | 2013.03.29 |
그리기 객체 - 텍스트 FreeType라이브러리 (0) | 2013.03.29 |