create Bound Lines - Android Graphics

Android examples for Graphics:Path

Description

create Bound Lines

Demo Code


//package com.java2s;
import java.util.ArrayList;
import java.util.List;

import android.graphics.RectF;
import android.util.Log;

public class Main {
    public static List<RectF> createBoundLines(RectF baseRect,
            final float graphSideZoom) {
        Log.d("GammaGraph", "function createBoundLines");
        List<RectF> boundLines = new ArrayList<RectF>();
        final float drawRectSide = baseRect.right - baseRect.left;
        final float rectSideQuadDiv = drawRectSide / 4;
        for (int i = 1; i <= 3; i++) {
            final float linePos = i * rectSideQuadDiv;
            RectF boundLine1 = new RectF(baseRect.left + linePos,
                    baseRect.top + 1, baseRect.left + linePos,
                    baseRect.bottom - 1);
            RectF boundLine2 = new RectF(baseRect.left + 1, baseRect.top
                    + linePos, baseRect.right - 1, baseRect.top + linePos);
            boundLines.add(boundLine1);//ww w.j ava 2 s  .c  o  m
            boundLines.add(boundLine2);
        }
        return boundLines;
    }
}

Related Tutorials