1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
|
namespace TwoDDrawing
{
public class myPathShape : View , ISurfaceHolderCallback
{
ISurfaceHolder surfaceHolder;
private ISurfaceHolder mHolder = null;
private readonly ShapeDrawable _shape;
Paint p;
Bitmap b;
Canvas c;
public myPathShape(Context context): base(context)
{
var paint = new Paint();
paint.SetARGB(255 , 200, 20, 0);
paint.SetStyle(Paint.Style.Stroke);
paint.StrokeWidth = 10;
Path myPath = new Path();
p = new Paint();
p.SetStyle(Paint.Style.FillAndStroke);
p.SetARGB(255, 120,110, 155);
b = Bitmap.CreateBitmap(128, 128,Bitmap.Config.Argb8888);
c = new Canvas(b);
// myPath.AddRect(2, 4, 3, 5,Path.Direction.Ccw);
//_shape = new ShapeDrawable(new PathShape(myPath,2,4));
// _shape.Paint.Set(paint);
//_shape.SetBounds(0,0, 0, 0);
c.DrawRect(new Rect(10,10,10,10) , p);
}
void ISurfaceHolderCallback.SurfaceChanged(ISurfaceHolder holder, Format format, int width, int height)
{
throw new NotImplementedException();
}
void ISurfaceHolderCallback.SurfaceCreated(ISurfaceHolder holder)
{
throw new NotImplementedException();
}
void ISurfaceHolderCallback.SurfaceDestroyed(ISurfaceHolder holder)
{
throw new NotImplementedException();
}
IntPtr IJavaObject.Handle
{
get { throw new NotImplementedException(); }
}
void IDisposable.Dispose()
{
throw new NotImplementedException();
}
public void init()
{
}
}
} |
Partager