저는 모든 색이 바뀌게 하고 싶지만, 비트맵이어서 그런지,, 잘은 모르겠지만 색이 부분만 바뀌더라고요. 이걸 해결할 수 있는 방법이 있나요?
class DrawLine extends View {
private Paint paint = null;
private Bitmap bitmap = null;
private Canvas canvas = null;
private Path path;
private float oldX, oldY;
...
public DrawLine(Context context, Rect rect) {
this(context);
bitmap = Bitmap.createBitmap(rect.width(),rect.height(),Bitmap.Config.ARGB_8888); //bitmap 객체 생성
canvas = new Canvas(bitmap);
path = new Path(); //
paint = new Paint();
penSetting();
}
...
@Override
public void onDraw(Canvas canvas){
//bitmap 있으면 bitmap 그림
if(bitmap != null) {
canvas.drawBitmap(bitmap, 0, 0, null);
}
setcolor();
}
@Override
public boolean onTouchEvent(MotionEvent event){
...}
public void penSetting(){
setcolor();
paint.setDither(true);
paint.setStyle(Paint.Style.STROKE);
paint.setAntiAlias(true);
paint.setStrokeWidth(20f);
}
public void setcolor(){
paint.setColor(MainActivity.DefaultColor);
}
}