private void onTouchEnd() { mPath.lineTo(mLastX * PIXEL_SIZE, mLastY * PIXEL_SIZE); mBuffer.drawPath(mPath, mPaint); mPath.reset(); Firebase segmentRef = mFirebaseRef.push(); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final String segmentName = segmentRef.getKey(); string segmentName = segmentRef.Key; mOutstandingSegments.Add(segmentName); // create a scaled version of the segment, so that it matches the size of the board Segment segment = new Segment(mCurrentSegment.Color); foreach (Point point in mCurrentSegment.Points) { segment.addPoint((int)Math.Round(point.x / mScale), (int)Math.Round(point.y / mScale)); } // Save our segment into Firebase. This will let other clients see the data and add it to their own canvases. // Also make a note of the outstanding segment name so we don't do a duplicate draw in our onChildAdded callback. // We can remove the name from mOutstandingSegments once the completion listener is triggered, since we will have // received the child added event by then. segmentRef.setValue(segment, new CompletionListenerAnonymousInnerClassHelper(this, segmentName)); }
private void drawSegment(Segment segment, Paint paint) { if (mBuffer != null) { mBuffer.drawPath(getPathForPoints(segment.Points, mScale), paint); } }
private void onTouchStart(float x, float y) { mPath.reset(); mPath.moveTo(x, y); mCurrentSegment = new Segment(mCurrentColor); mLastX = (int) x / PIXEL_SIZE; mLastY = (int) y / PIXEL_SIZE; mCurrentSegment.addPoint(mLastX, mLastY); }
public virtual void clear() { mBitmap = Bitmap.createBitmap(mBitmap.Width, mBitmap.Height, Bitmap.Config.ARGB_8888); mBuffer = new Canvas(mBitmap); mCurrentSegment = null; mOutstandingSegments.Clear(); invalidate(); }