iPhone smooth sketch drawing algorithm

CGPoint midPoint(CGPoint p1, CGPoint p2) { return CGPointMake((p1.x + p2.x) * 0.5, (p1.y + p2.y) * 0.5); } -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch = [touches anyObject]; previousPoint1 = [touch previousLocationInView:self]; previousPoint2 = [touch previousLocationInView:self]; currentPoint = [touch locationInView:self]; } -(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch = [touches anyObject]; previousPoint2 = previousPoint1; previousPoint1 … Read more

c# write text on bitmap

Bitmap bmp = new Bitmap(“filename.bmp”); RectangleF rectf = new RectangleF(70, 90, 90, 50); Graphics g = Graphics.FromImage(bmp); g.SmoothingMode = SmoothingMode.AntiAlias; g.InterpolationMode = InterpolationMode.HighQualityBicubic; g.PixelOffsetMode = PixelOffsetMode.HighQuality; g.DrawString(“yourText”, new Font(“Tahoma”,8), Brushes.Black, rectf); g.Flush(); image.Image=bmp;

Draw in Canvas by finger, Android

Start By going through the Fingerpaint demo in the sdk sample. Another Sample: public class MainActivity extends Activity { DrawingView dv ; private Paint mPaint; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); dv = new DrawingView(this); setContentView(dv); mPaint = new Paint(); mPaint.setAntiAlias(true); mPaint.setDither(true); mPaint.setColor(Color.GREEN); mPaint.setStyle(Paint.Style.STROKE); mPaint.setStrokeJoin(Paint.Join.ROUND); mPaint.setStrokeCap(Paint.Cap.ROUND); mPaint.setStrokeWidth(12); } public class DrawingView extends View { … Read more

Draw line on canvas and modify the position after it’s been drawn

Please try this.In this you can draw and edit the line. class Drawing extends View{ private Canvas mCanvas = null; private Path mPath = null; private Paint mBitmapPaint = null; private Bitmap mBitmap = null; private Bitmap bit=null; private Paint mPaint = null; private MainActivity baseMainActivity = null; public interface onDrawingViewSingleTap{ void onDrawingViewTap(float x , … Read more