Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import android.graphics.Path;

public class Main {
    /**
     * Coordinates of the Star
        
          A
         / \
        /   \
     C-----B     J-----I
       \             /
     D         H
    /     F     \
       /   /     \   \
      E               G
        
     * */
    //coord_POINT [coordOut_X, coordOut_Y, coordIn_X, coordIn_Y]
    private static float[] coord_A = new float[4];
    private static float[] coord_B = new float[4];
    private static float[] coord_C = new float[4];
    private static float[] coord_D = new float[4];
    private static float[] coord_E = new float[4];
    private static float[] coord_F = new float[4];
    private static float[] coord_G = new float[4];
    private static float[] coord_H = new float[4];
    private static float[] coord_I = new float[4];
    private static float[] coord_J = new float[4];

    private static Path drawOutLine() {
        //Draw the outline
        Path outline = new Path();
        outline.moveTo(coord_A[0], coord_A[1]); /*A*/
        outline.lineTo(coord_B[0], coord_B[1]); /*B*/
        outline.lineTo(coord_C[0], coord_C[1]); /*C*/
        outline.lineTo(coord_D[0], coord_D[1]); /*D*/
        outline.lineTo(coord_E[0], coord_E[1]); /*E*/
        outline.lineTo(coord_F[0], coord_F[1]); /*F*/
        outline.lineTo(coord_G[0], coord_G[1]); /*G*/
        outline.lineTo(coord_H[0], coord_H[1]); /*H*/
        outline.lineTo(coord_I[0], coord_I[1]); /*I*/
        outline.lineTo(coord_J[0], coord_J[1]); /*J*/
        outline.moveTo(coord_A[2], coord_A[3]); /*A*/
        outline.lineTo(coord_B[2], coord_B[3]); /*J*/
        outline.lineTo(coord_C[2], coord_C[3]); /*I*/
        outline.lineTo(coord_D[2], coord_D[3]); /*H*/
        outline.lineTo(coord_E[2], coord_E[3]); /*G*/
        outline.lineTo(coord_F[2], coord_F[3]); /*F*/
        outline.lineTo(coord_G[2], coord_G[3]); /*E*/
        outline.lineTo(coord_H[2], coord_H[3]); /*D*/
        outline.lineTo(coord_I[2], coord_I[3]); /*C*/
        outline.lineTo(coord_J[2], coord_J[3]); /*B*/
        outline.close();

        return outline;
    }
}