public int[] getAvgColorAsRgba(Point p1, Point p2, Point p3) {
        Edge[] edges = new Edge[3];
        edges[0] = new Edge(p1, p2);
        edges[1] = new Edge(p2, p3);
        edges[2] = new Edge(p3, p1);

        List<Integer> endPoints = new ArrayList();
        boolean onRightSide = gatherEndPoints(edges, endPoints);
        int i = 0;
        int[] rgba = new int[4];
        int[] pixels = {0};
        i = scanLineToRGBA(edges[0], rgba, endPoints, onRightSide, i, pixels);
        scanLineToRGBA(edges[1], rgba, endPoints, onRightSide, i, pixels);

        if (pixels[0] == 0) {
            rgba[0] = 0;
            rgba[1] = 0;
            rgba[2] = 0;
            rgba[3] = 0;
        } else {
            for (i = 0; i < 3; i++) {
                rgba[i] = rgba[i] / pixels[0];
            }
            rgba[3] = 255;
        }

        return rgba;
    }