(PGraphics g)
| 1788 | */ |
| 1789 | |
| 1790 | protected void drawPath(PGraphics g) { |
| 1791 | // Paths might be empty (go figure) |
| 1792 | // http://dev.processing.org/bugs/show_bug.cgi?id=982 |
| 1793 | if (vertices == null) return; |
| 1794 | |
| 1795 | boolean insideContour = false; |
| 1796 | g.beginShape(); |
| 1797 | |
| 1798 | if (vertexCodeCount == 0) { // each point is a simple vertex |
| 1799 | if (vertices[0].length == 2) { // drawing 2D vertices |
| 1800 | for (int i = 0; i < vertexCount; i++) { |
| 1801 | g.vertex(vertices[i][X], vertices[i][Y]); |
| 1802 | } |
| 1803 | } else { // drawing 3D vertices |
| 1804 | for (int i = 0; i < vertexCount; i++) { |
| 1805 | g.vertex(vertices[i][X], vertices[i][Y], vertices[i][Z]); |
| 1806 | } |
| 1807 | } |
| 1808 | |
| 1809 | } else { // coded set of vertices |
| 1810 | int index = 0; |
| 1811 | |
| 1812 | if (vertices[0].length == 2) { // drawing a 2D path |
| 1813 | for (int j = 0; j < vertexCodeCount; j++) { |
| 1814 | switch (vertexCodes[j]) { |
| 1815 | |
| 1816 | case VERTEX: |
| 1817 | g.vertex(vertices[index][X], vertices[index][Y]); |
| 1818 | index++; |
| 1819 | break; |
| 1820 | |
| 1821 | case QUADRATIC_VERTEX: |
| 1822 | g.quadraticVertex(vertices[index+0][X], vertices[index+0][Y], |
| 1823 | vertices[index+1][X], vertices[index+1][Y]); |
| 1824 | index += 2; |
| 1825 | break; |
| 1826 | |
| 1827 | case BEZIER_VERTEX: |
| 1828 | g.bezierVertex(vertices[index+0][X], vertices[index+0][Y], |
| 1829 | vertices[index+1][X], vertices[index+1][Y], |
| 1830 | vertices[index+2][X], vertices[index+2][Y]); |
| 1831 | index += 3; |
| 1832 | break; |
| 1833 | |
| 1834 | case CURVE_VERTEX: |
| 1835 | g.curveVertex(vertices[index][X], vertices[index][Y]); |
| 1836 | index++; |
| 1837 | break; |
| 1838 | |
| 1839 | case BREAK: |
| 1840 | if (insideContour) { |
| 1841 | g.endContour(); |
| 1842 | } |
| 1843 | g.beginContour(); |
| 1844 | insideContour = true; |
| 1845 | } |
| 1846 | } |
| 1847 | } else { // drawing a 3D path |
no test coverage detected