Example usage for android.graphics Path moveTo

List of usage examples for android.graphics Path moveTo

Introduction

In this page you can find the example usage for android.graphics Path moveTo.

Prototype

public void moveTo(float x, float y) 

Source Link

Document

Set the beginning of the next contour to the point (x,y).

Usage

From source file:com.kmagic.solitaire.DrawMaster.java

/**
 * Draw a pedestal ( clubs and spades stand on this )
 * @param canvas canvas to draw on/*from   w  ww . jav a2s .c om*/
 * @param width width of the pedestal
 * @param height height of the pedestal
 */
public void drawPedestal(final Canvas canvas, final float width, final float height) {
    final Paint paint = getBlackPaint();
    final float width_half = width / 2;
    final float width_fifth = width / 5;
    final float width_3_5ths = width_fifth * 3;
    final float height_5th = height / 5;
    canvas.drawRect(width_3_5ths, height_5th, width - width_3_5ths, height, paint);
    final Path path = new Path();
    path.moveTo(width_fifth, height);
    path.lineTo(width_half, height - height_5th);
    path.lineTo(width - width_fifth, height);
    path.lineTo(width_fifth, height);
    path.close();
    canvas.drawPath(path, paint);
}

From source file:com.kmagic.solitaire.DrawMaster.java

/**
 * Draw a heart/*from w  w  w . j ava2  s.  c  om*/
 * @param canvas canvas to draw on
 * @param width width of the heart
 * @param height height of the heart
 */
public void drawHeart(final Canvas canvas, final float width, final float height) {
    final Paint paint = getRedPaint();
    final float width_half = width / 2;
    final float width_quarter = width / 4;
    final float height_quarter = height / 4;
    final float height_third = height / 3;
    canvas.drawCircle(width_quarter, height_quarter, width_quarter, paint);
    canvas.drawCircle(width_quarter * 3, height_quarter, width_quarter, paint);
    final Path path = new Path();
    path.moveTo(0, height_third);
    path.lineTo(width_half, height);
    path.lineTo(width, height_third);
    path.lineTo(0, height_third);
    path.close();
    canvas.drawPath(path, paint);
}

From source file:com.kmagic.solitaire.DrawMaster.java

/**
 * Draw a spade/*from ww w .j  a  va 2  s.  c  o m*/
 * @param canvas canvas to draw on
 * @param width width of the spade
 * @param height height of the spade
 */
public void drawSpade(final Canvas canvas, final float width, final float height) {
    final Paint paint = getBlackPaint();
    final float width_half = width / 2;
    final float width_quarter = width / 4;
    final float width_fifth = width / 5;
    final float width_25th = width / 25;
    final float height_3_5th = height / 5 * 3;
    final Path path = new Path();
    path.moveTo(width_half, 0);
    path.lineTo(width - width_25th, height_3_5th);
    path.lineTo(width_25th, height_3_5th);
    path.lineTo(width_half, 0);
    path.close();
    canvas.drawPath(path, paint);
    canvas.drawCircle(width_quarter, height_3_5th, width_fifth, paint);
    canvas.drawCircle(width_quarter * 3, height_3_5th, width_fifth, paint);
    drawPedestal(canvas, width, height);
}

From source file:com.semfapp.adamdilger.semf.Take5PdfDocument.java

public PdfDocument createDocument() {
    //create new document
    PdfDocument document = new PdfDocument();

    // crate a page description
    PdfDocument.PageInfo pageInfo = new PdfDocument.PageInfo.Builder(A4_WIDTH, A4_HEIGHT, 1).create();

    // start a page
    PdfDocument.Page page = document.startPage(pageInfo);

    can = page.getCanvas();//www  .j  av  a 2s  . c o m
    Paint paint = new Paint();
    paint.setStrokeWidth(0.5f);
    paint.setColor(Color.BLACK);
    paint.setStyle(Paint.Style.STROKE);
    can.drawRect(1, 1, 594, 395, paint);

    /**
     * Page one Text Fields
     */
    drawText("Job Reference:", 9, 21, FONT14, carlitoBold);
    drawText("Date:", 354, 21, FONT14, carlitoBold);
    drawText("Time:", 473, 21, FONT14, carlitoBold);
    drawText("Location:", 9, 48, FONT14, carlitoBold);
    drawText("Task:", 261, 48, FONT14, carlitoBold);

    paint.setPathEffect(new DashPathEffect(new float[] { 1.5f, 1 }, 0));
    can.drawLine(85, 36, 350, 36, paint);
    can.drawLine(386, 36, 468, 36, paint);
    can.drawLine(506, 36, 585, 36, paint);
    can.drawLine(59, 60, 256, 60, paint);
    can.drawLine(291, 60, 585, 60, paint);

    if (mEditTextValues[0] != null) {
        drawText(mEditTextValues[0], 98, 19, FONT14, roboto);
    }
    if (mEditTextValues[1] != null) {
        drawText(mEditTextValues[1], 65, 44, FONT14, roboto);
    }
    if (mEditTextValues[2] != null) {
        drawText(mEditTextValues[2], 297, 44, FONT14, roboto);
    }
    drawText(mDateString, 390, 19, FONT14, roboto);
    drawText(mTimeString, 509, 19, FONT14, roboto);

    /**
     * Section One (Stop, step back...)
     */
    drawHeader1(8, 69, 202, "Stop, step back and think", 1);
    paint.setStyle(Paint.Style.STROKE);
    paint.setStrokeWidth(0.35f);
    paint.setPathEffect(null);
    int left, top;

    //draw left boxes
    left = 177;
    top = 108;
    for (int x = 0; x < mCheckBoxSectionOne.size(); x++) {
        Take5Data.CheckValue isYes = mCheckBoxSectionOne.get(x).getCheckValue();
        float topLoc = top + (x * 33);

        if (x < 1) { //allowing for different 1st row size
            drawBox(left, topLoc, paint, true, isYes);
        } else {
            float newTop = topLoc - 6;
            if (x < 3) {
                drawBox(left, newTop, paint, false, isYes);
            } else {
                drawBox(left, newTop, paint, true, isYes);
            }
        }
    }

    DashPathEffect pathEffect = new DashPathEffect(new float[] { 1, 1.5f }, 0);

    drawText(mCheckBoxSectionOne.get(0).getHeading(), 13, 113, FONT12, carlitoBold);

    for (int x = 1; x < mCheckBoxSectionOne.size(); x++) {
        int height = 132 + ((x - 1) * 33);
        drawText(mCheckBoxSectionOne.get(x).getHeading(), 13, height, FONT12, carlitoBold);
        paint.setPathEffect(pathEffect);
        can.drawLine(10, height - 6, 222, height - 6, paint);
        paint.setPathEffect(null);
    }

    /**
     * Section Two (Identidy the Hazards...)
     */
    drawHeader1(230, 69, 345, "Identify the hazard(s)", 2);

    //draw right boxes
    left = 542;
    top = 104;
    for (int x = 0; x < mCheckBoxSectionTwo.size(); x++) {
        float topLoc = top + (x * 20.7f);
        Take5Data.CheckValue isYes = mCheckBoxSectionTwo.get(x).getCheckValue();
        drawBox(left, topLoc, paint, false, isYes);
    }

    for (int x = 0; x < mCheckBoxSectionTwo.size(); x++) {
        float height = 105 + (x * 20.7f);
        drawText(mCheckBoxSectionTwo.get(x).getHeading(), 238, height + 3, FONT12, carlitoBold);
        if (x > 0) {
            paint.setPathEffect(pathEffect);
            can.drawLine(238, height - 4, 581, height - 4, paint);
            paint.setPathEffect(null);
        }
    }

    /**
     * draw section 3,4,5 (including checkboxes)
     */
    drawSmallCircle(8, 331, "Assess the level of risk", 3);
    drawSmallCircle(202, 331, "Control the hazards", 4);
    drawSmallCircle(398, 331, "Proceed safely", 5);

    /**
     * Draw Page Two
     */
    int xLoc = 7;
    int yLoc = 420;
    int height;
    int width = 565;
    int RADIUS = 14;
    float INNER_RADIUS = 13;
    int centre = yLoc + 7 + RADIUS;
    width = xLoc + width;
    int middle = width - 340;
    can.drawRect(1, 420, 594, 420 + 395, paint);

    paint.setStyle(Paint.Style.FILL);
    paint.setTypeface(impact);
    paint.setTextSize(12);

    can.drawCircle(xLoc + RADIUS, centre, RADIUS, paint);
    can.drawRect(xLoc + RADIUS, centre - RADIUS, width, centre + RADIUS, paint);
    can.drawCircle(width, centre, RADIUS, paint);
    paint.setColor(Color.WHITE);
    can.drawCircle(xLoc + RADIUS, centre, INNER_RADIUS, paint);
    can.drawCircle(width, centre, INNER_RADIUS, paint);
    can.drawRect(middle, centre - INNER_RADIUS, width, centre + INNER_RADIUS, paint);
    paint.setColor(Color.BLACK);
    can.drawCircle(middle, centre, RADIUS, paint);

    paint.setColor(Color.WHITE);
    can.drawText("SAFE WORK METHOD STATEMENT (SWMS)", xLoc + 31, centre + 5, paint);
    paint.setTextSize(16);
    paint.setColor(Color.BLACK);
    can.drawText(String.valueOf(4), xLoc + RADIUS - 4, centre + 6, paint);

    height = 50;
    drawText("What are the hazards and risks?", 25, yLoc + height, FONT12, carlitoBold);
    drawText("Risk\nRating", 267, yLoc + 47, FONT12, carlitoBold);
    drawText("How will hazards and risks be controlled?", 319, yLoc + height, FONT12, carlitoBold);

    paint.setPathEffect(pathEffect);
    can.drawLine(262, yLoc + 45, 262, yLoc + 320, paint);
    can.drawLine(302, yLoc + 45, 302, yLoc + 320, paint);
    paint.setPathEffect(null);

    float currentItemHeight = yLoc + 75;
    float padding = 5;

    for (int x = 0; x < mRiskElements.size(); x++) {
        int textHeight = (int) currentItemHeight;
        float totalItemHeight = drawRiskElement(textHeight, mRiskElements.get(x));
        currentItemHeight += totalItemHeight + padding;
    }

    paint.setPathEffect(pathEffect);
    height = yLoc + 350;
    drawText("Name/s:", 12, height, FONT12, carlitoBold);
    drawText(mEditTextValues[3], 55, height - 3, FONT14, roboto);
    paint.setPathEffect(pathEffect);
    can.drawLine(50, height + 12, 580, height + 12, paint);
    paint.setPathEffect(null);

    height = yLoc + 372;
    drawText("Signatures:", 12, height, FONT12, carlitoBold);
    drawText("Date:", 468, height, FONT12, carlitoBold);
    drawText(mDateString, 497, height - 3, FONT14, roboto);
    paint.setPathEffect(pathEffect);
    can.drawLine(60, height + 12, 464, height + 12, paint);
    can.drawLine(492, height + 12, 580, height + 12, paint);
    paint.setPathEffect(null);

    // finish the page
    document.finishPage(page);

    int imagePageCount = 2;

    for (Take5RiskElement risk : mRiskElements) {

        if (risk.imagePath != null) {

            // crate a page description
            PdfDocument.PageInfo pageInfo1 = new PdfDocument.PageInfo.Builder(A4_WIDTH, A4_HEIGHT,
                    imagePageCount).create();

            PdfDocument.Page imagePage = document.startPage(pageInfo1);
            Canvas canvas = imagePage.getCanvas();

            try {

                Bitmap original = BitmapFactory.decodeFile(risk.imagePath);

                Bitmap b = resize(original, canvas.getWidth() - 100, canvas.getHeight() - 100);
                canvas.drawBitmap(b, 50, 60, new Paint());
                //                    canvas.drawText(risk.getOne(), 50, 40, new Paint());

                Path textPath = new Path();
                textPath.moveTo(50, 50);
                textPath.lineTo(canvas.getWidth() - 100, 50);

                canvas.drawTextOnPath(risk.getOne(), textPath, 0, 0, new Paint());

            } catch (Exception e) {
                e.printStackTrace();
            }

            document.finishPage(imagePage);

            imagePageCount++;

            new File(risk.imagePath).delete();
        }
    }

    // add more pages
    return document;
}

From source file:com.hobby.uiframework.widget.PagerSlidingTab.java

@Override
protected void onDraw(Canvas canvas) {
    super.onDraw(canvas);

    if (isInEditMode() || tabCount == 0) {
        return;//from   www  .j  ava 2  s .  com
    }

    final int height = getHeight();

    // draw underline
    rectPaint.setColor(underlineColor);
    canvas.drawRect(0, height - underlineHeight, tabsContainer.getWidth(), height, rectPaint);

    // draw indicator line
    rectPaint.setColor(indicatorColor);

    // default: line below current tab
    View currentTab = tabsContainer.getChildAt(currentPosition);
    float lineLeft = currentTab.getLeft();
    float lineRight = currentTab.getRight();

    // if there is an offset, start interpolating left and right coordinates
    // between current and next tab
    if (currentPositionOffset > 0f && currentPosition < tabCount - 1) {

        View nextTab = tabsContainer.getChildAt(currentPosition + 1);
        final float nextTabLeft = nextTab.getLeft();
        final float nextTabRight = nextTab.getRight();

        lineLeft = (currentPositionOffset * nextTabLeft + (1f - currentPositionOffset) * lineLeft);
        lineRight = (currentPositionOffset * nextTabRight + (1f - currentPositionOffset) * lineRight);
    }
    if (lineIndicator) {
        canvas.drawRect(lineLeft, height - indicatorHeight, lineRight, height, rectPaint);
    } else {
        rectPaint.setStyle(Style.FILL);
        Path path = new Path();
        float mid = (lineLeft + lineRight) * 0.5f;
        float triangleheight = getContext().getResources().getDimension(R.dimen.indicator_triangle_height);
        float left = mid - triangleheight;
        float right = mid + triangleheight;
        path.moveTo(left, height);
        path.lineTo(mid, height - triangleheight);
        path.lineTo(right, height);
        path.close();
        canvas.drawPath(path, rectPaint);
    }

    // draw divider
    dividerPaint.setColor(dividerColor);
    for (int i = 0; i < tabCount - 1; i++) {
        View tab = tabsContainer.getChildAt(i);
        canvas.drawLine(tab.getRight(), dividerPadding, tab.getRight(), height - dividerPadding, dividerPaint);
    }
}

From source file:com.sinyuk.jianyimaterial.widgets.FloatingToolbar.java

@TargetApi(21)
private void hideLollipopImpl() {
    int rootWidth = mRoot.getWidth();

    float controlX;

    if (mFabOriginalX > rootWidth / 2f) {
        controlX = mFabOriginalX * 0.98f;
    } else {//w w w.ja v  a2  s  .  c o m
        controlX = mFabOriginalX * 1.02f;
    }

    final Path path = new Path();
    path.moveTo(mFab.getX(), mFab.getY());
    final float x2 = controlX;
    final float y2 = getY();
    path.quadTo(x2, y2, mFabOriginalX, mFabOriginalY + getTranslationY());
    ObjectAnimator anim = ObjectAnimator.ofFloat(mFab, View.X, View.Y, path);
    anim.setInterpolator(new AccelerateDecelerateInterpolator());
    anim.setDuration(FAB_UNMORPH_DURATION);
    anim.setStartDelay(FAB_UNMORPH_DELAY);
    anim.start();

    /**
     * Animate FAB elevation back to 6dp
     */
    anim = ObjectAnimator.ofFloat(mFab, View.TRANSLATION_Z, 0);
    anim.setInterpolator(new AccelerateDecelerateInterpolator());
    anim.setDuration(FAB_UNMORPH_DURATION);
    anim.setStartDelay(FAB_UNMORPH_DELAY);
    anim.start();

    /**
     * Restore alpha of FAB drawable
     */
    Drawable drawable = mFab.getDrawable();
    if (drawable != null) {
        anim = ObjectAnimator.ofPropertyValuesHolder(drawable, PropertyValuesHolder.ofInt("alpha", 255));
        anim.setInterpolator(new AccelerateDecelerateInterpolator());
        anim.setDuration(FAB_UNMORPH_DURATION);
        anim.setStartDelay(FAB_UNMORPH_DELAY);
        anim.start();
    }

    Animator toolbarReveal = ViewAnimationUtils.createCircularReveal(this, getWidth() / 2, getHeight() / 2,
            (float) (Math.hypot(getWidth() / 2, getHeight() / 2)), (float) mFab.getWidth() / 2f);

    toolbarReveal.setTarget(this);
    toolbarReveal.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            setVisibility(View.INVISIBLE);
            mFab.setVisibility(View.VISIBLE);
            mMorphing = false;
        }
    });
    toolbarReveal.setDuration(CIRCULAR_UNREVEAL_DURATION);
    toolbarReveal.setInterpolator(new AccelerateInterpolator());
    toolbarReveal.setStartDelay(CIRCULAR_UNREVEAL_DELAY);
    toolbarReveal.start();

    /**
     * Animate FloatingToolbar animation back to 6dp
     */
    anim = ObjectAnimator.ofFloat(this, View.TRANSLATION_Z, 0);
    anim.setDuration(CIRCULAR_UNREVEAL_DURATION);
    anim.setStartDelay(CIRCULAR_UNREVEAL_DELAY);
    anim.start();
}

From source file:com.morninz.ninepinview.widget.NinePINView.java

/**
 * Compute the coordinates of 9 center points and wrong triangles.
 *///www  . j  a v a 2s.c o m
protected void computePointsAndWrongTriangleCoordinate() {
    int drawWidth = getWidth() - getPaddingLeft() - getPaddingRight();
    int drawHeight = getHeight() - getPaddingTop() - getPaddingBottom();

    float baseX = getPaddingLeft() + mCircleRadius;
    float baseY = getPaddingTop() + mCircleRadius;
    float gapX = drawWidth / 2.0f - mCircleRadius;
    float gapY = drawHeight / 2.0f - mCircleRadius;

    float r = mCircleRadius;

    for (int i = 0; i < POINT_COUNT; i++) {
        // compute center point's coordinate
        Point point = new Point();
        point.x = baseX + gapX * (i % 3);
        point.y = baseY + gapY * (i / 3);
        point.index = i;
        mCenterPoints[i] = point;
        // compute wrong triangle path of this point.
        Path path = new Path();
        float x1, y1, x2, y2, x3, y3;
        x1 = point.x + r;
        y1 = point.y;
        x2 = point.x + r * (2.0f / 3);
        y2 = point.y - r * (1.0f / 3);
        x3 = x2;
        y3 = point.y + r * (1.0f / 3);
        path.moveTo(x1, y1);
        path.lineTo(x2, y2);
        path.lineTo(x3, y3);
        path.lineTo(x1, y1);
        path.close();
        mWrongPaths[i] = path;
        Log.d(TAG,
                "[ " + x1 + ", " + y1 + " ], " + "[ " + x2 + ", " + y2 + " ], " + "[ " + x3 + ", " + y3 + " ]");
    }
}

From source file:org.mdc.chess.ChessBoard.java

private void drawMoveHints(Canvas canvas) {
    if ((moveHints == null) || blindMode) {
        return;/*from  w w  w  . j a  v a 2s  .co m*/
    }
    float h = (float) (sqSize / 2.0);
    float d = (float) (sqSize / 8.0);
    double v = 35 * Math.PI / 180;
    double cosv = Math.cos(v);
    double sinv = Math.sin(v);
    double tanv = Math.tan(v);
    int n = Math.min(moveMarkPaint.size(), moveHints.size());
    for (int i = 0; i < n; i++) {
        Move m = moveHints.get(i);
        if ((m == null) || (m.from == m.to)) {
            continue;
        }
        float x0 = getXCrd(Position.getX(m.from)) + h;
        float y0 = getYCrd(Position.getY(m.from)) + h;
        float x1 = getXCrd(Position.getX(m.to)) + h;
        float y1 = getYCrd(Position.getY(m.to)) + h;

        float x2 = (float) (Math.hypot(x1 - x0, y1 - y0) + d);
        float y2 = 0;
        float x3 = (float) (x2 - h * cosv);
        float y3 = (float) (y2 - h * sinv);
        float x4 = (float) (x3 - d * sinv);
        float y4 = (float) (y3 + d * cosv);
        float x5 = (float) (x4 + (-d / 2 - y4) / tanv);
        float y5 = -d / 2;
        float x6 = 0;
        float y6 = y5 / 2;
        Path path = new Path();
        path.moveTo(x2, y2);
        path.lineTo(x3, y3);
        //          path.lineTo(x4, y4);
        path.lineTo(x5, y5);
        path.lineTo(x6, y6);
        path.lineTo(x6, -y6);
        path.lineTo(x5, -y5);
        //          path.lineTo(x4, -y4);
        path.lineTo(x3, -y3);
        path.close();
        Matrix mtx = new Matrix();
        mtx.postRotate((float) (Math.atan2(y1 - y0, x1 - x0) * 180 / Math.PI));
        mtx.postTranslate(x0, y0);
        path.transform(mtx);
        Paint p = moveMarkPaint.get(i);
        canvas.drawPath(path, p);
    }
}

From source file:com.sinyuk.jianyimaterial.widgets.FloatingToolbar.java

@TargetApi(21)
private void showLollipopImpl() {
    int rootWidth = mRoot.getWidth();

    float endFabX;
    float controlX;

    if (mFabOriginalX > rootWidth / 2f) {
        endFabX = rootWidth / 2f + (mFabOriginalX - rootWidth / 2f) / 4f;
        controlX = mFabOriginalX * 0.98f;
    } else {/*from   w ww. j a va2  s  . c o  m*/
        endFabX = rootWidth / 2f - (mFabOriginalX - rootWidth / 2f) / 4f;
        controlX = mFabOriginalX * 1.02f;
    }

    /**
     * Animate FAB movement
     */
    final Path path = new Path();
    path.moveTo(mFab.getX(), mFab.getY());
    final float x2 = controlX;
    final float y2 = getY();
    path.quadTo(x2, y2, endFabX, getY());
    ObjectAnimator anim = ObjectAnimator.ofFloat(mFab, View.X, View.Y, path);
    anim.setInterpolator(new AccelerateDecelerateInterpolator());
    anim.setDuration(FAB_MORPH_DURATION);
    anim.start();

    /**
     * Fade FAB drawable
     */
    Drawable drawable = mFab.getDrawable();
    if (drawable != null) {
        anim = ObjectAnimator.ofPropertyValuesHolder(drawable, PropertyValuesHolder.ofInt("alpha", 0));
        anim.setInterpolator(new AccelerateDecelerateInterpolator());
        anim.setDuration((long) (FAB_MORPH_DURATION / 3f));
        anim.start();
    }

    /**
     * Animate FAB elevation to 8dp
     */
    anim = ObjectAnimator.ofFloat(mFab, View.TRANSLATION_Z, dpToPixels(2));
    anim.setInterpolator(new AccelerateDecelerateInterpolator());
    anim.setDuration(FAB_MORPH_DURATION);
    anim.start();

    /**
     * Create circular reveal
     */
    Animator toolbarReveal = ViewAnimationUtils.createCircularReveal(this, getWidth() / 2, getHeight() / 2,
            (float) mFab.getWidth() / 2f, (float) (Math.hypot(getWidth() / 2, getHeight() / 2)));

    toolbarReveal.setDuration(CIRCULAR_REVEAL_DURATION);
    toolbarReveal.setTarget(this);
    toolbarReveal.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationStart(Animator animation) {
            super.onAnimationStart(animation);
            mFab.setVisibility(View.INVISIBLE);
            setVisibility(View.VISIBLE);
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            mMorphing = false;
        }
    });

    toolbarReveal.setInterpolator(new AccelerateInterpolator());
    toolbarReveal.setStartDelay(CIRCULAR_REVEAL_DELAY);
    toolbarReveal.start();

    /**
     * Animate FloatingToolbar elevation to 8dp
     */
    anim = ObjectAnimator.ofFloat(this, View.TRANSLATION_Z, dpToPixels(2));
    anim.setDuration(CIRCULAR_REVEAL_DURATION);
    anim.setStartDelay(CIRCULAR_REVEAL_DELAY);
    anim.start();
}

From source file:com.blestep.sportsbracelet.view.TimelineChartView.java

private void drawTargetLine(Canvas c) {
    if (mIsShowTargetDashedLine && mTargetValue > 0) {
        if (mTargetValue > mMaxValue) {
            Path path = new Path();
            path.moveTo(0, mTopSpaceHeight);
            path.lineTo(mGraphArea.width(), mTopSpaceHeight);
            c.drawPath(path, mGraphTargetDashedLinePaint);
        } else {/*from   www  . ja  v a  2  s.  c om*/
            float height = mGraphArea.height();
            float y = (float) (height - (height * ((mTargetValue * 100) / mMaxValue)) / 100) + mTopSpaceHeight;
            Path path = new Path();
            path.moveTo(0, y);
            path.lineTo(mGraphArea.width(), y);
            c.drawPath(path, mGraphTargetDashedLinePaint);
        }
    }
}