I am watching this sample drawing application from Google, and when I run the application in the simulator and try to draw with the mouse, the drawing does not display smoothly. Circles appear between them. Only when I move the mouse slowly does I get a solid line. I donβt have an actual device yet to test this, so I want to know if this will be the case on the device itself or is this the behavior of the simulator?
If it will be displayed on the device, what should I do to make the touch smooth?
UPDATE:
Actual code that makes the drawing:
private void drawPoint(float x, float y, float pressure, float width) { if (width < 1) width = 6; if (mBitmap != null) { float radius = width / 2; int pressureLevel = (int)(pressure * 255); mPaint.setARGB(pressureLevel, 255, 255, 255); mCanvas.drawCircle(x, y, radius, mPaint); mRect.set((int) (x - radius - 2), (int) (y - radius - 2), (int) (x + radius + 2), (int) (y + radius + 2)); invalidate(mRect); } } @Override public boolean onTouchEvent(MotionEvent event) { int N = event.getHistorySize(); int P = event.getPointerCount(); for (int i = 0; i < N; i++) { for (int j = 0; j < P; j++) { mCurX = event.getHistoricalX(j, i); mCurY = event.getHistoricalY(j, i); drawPoint(mCurX, mCurY, event.getHistoricalPressure(j, i), event.getHistoricalTouchMajor(j, i)); } } for (int j = 0; j < P; j++) { mCurX = event.getX(j); mCurY = event.getY(j); drawPoint(mCurX, mCurY, event.getPressure(j), event.getTouchMajor(j)); } }
Any help in improving it will be greatly appreciated.

source share