32 paint.setColor(Color.BLACK); |
32 paint.setColor(Color.BLACK); |
33 paint.setStyle(Paint.Style.STROKE); |
33 paint.setStyle(Paint.Style.STROKE); |
34 paint.setStrokeJoin(Paint.Join.ROUND); |
34 paint.setStrokeJoin(Paint.Join.ROUND); |
35 paint.setStrokeWidth(STROKE_WIDTH); |
35 paint.setStrokeWidth(STROKE_WIDTH); |
36 } |
36 } |
37 |
37 |
38 public void save(View parent, OutputStream os) |
38 public Bitmap getSignature() { |
39 { |
39 Log.v("log_tag", "Width: " + getWidth()); |
40 Log.v("log_tag", "Width: " + parent.getWidth()); |
40 Log.v("log_tag", "Height: " + getHeight()); |
41 Log.v("log_tag", "Height: " + parent.getHeight()); |
41 Bitmap bm = Bitmap.createBitmap(getWidth(), getHeight(), |
42 Bitmap bm = Bitmap.createBitmap(parent.getWidth(), parent.getHeight(), |
|
43 Bitmap.Config.RGB_565);; |
42 Bitmap.Config.RGB_565);; |
44 Canvas canvas = new Canvas(bm); |
43 Canvas canvas = new Canvas(bm); |
45 parent.draw(canvas); |
44 draw(canvas); |
46 bm.compress(Bitmap.CompressFormat.PNG, 90, os); |
45 return bm; |
|
46 } |
|
47 |
|
48 public boolean save(OutputStream os) |
|
49 { |
|
50 return getSignature().compress(Bitmap.CompressFormat.PNG, 90, os); |
47 } |
51 } |
48 |
52 |
49 public void clear() |
53 public void clear() |
50 { |
54 { |
51 path.reset(); |
55 path.reset(); |