Hi all,
Now I'm developing a drawing app. I want to save the path as bitmap
file.
Please see following code. This is a part of the app.
I can't draw path, but I can draw path when I make
'canvas.setBitmap(bitmap);' comment out.
I have no idea why it can't draw.
private void onDraw(Canvas canvas){
Paint paint=new Paint();
paint.setAntiAlias(true);
paint.setStyle(Paint.Style.STROKE);
paint.setStrokeWidth(5);
paint.setColor(Color.BLACK);
Path path=new Path();
for(int i=0;i<pointList.size();i++){
PointF point=pointList.get(i);
if((i>0 && pointList.get(i-1).x==-1) || i==0){
path.moveTo(point.x,point.y);
}else if(point.x==-1){
}else{
path.lineTo(point.x,point.y);
}
}
bitmap=Bitmap.createBitmap(getWidth(),
getHeight(),
Bitmap.Config.ARGB_8888);
canvas.setBitmap(bitmap);
canvas.drawPath(path,paint);
}
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en