(float x, float y)
| 237 | |
| 238 | |
| 239 | @Override |
| 240 | public void vertex(float x, float y) { |
| 241 | if (vertexCount == vertices.length) { |
| 242 | float temp[][] = new float[vertexCount<<1][VERTEX_FIELD_COUNT]; |
| 243 | System.arraycopy(vertices, 0, temp, 0, vertexCount); |
| 244 | vertices = temp; |
| 245 | //message(CHATTER, "allocating more vertices " + vertices.length); |
| 246 | } |
| 247 | // not everyone needs this, but just easier to store rather |
| 248 | // than adding another moving part to the code... |
| 249 | vertices[vertexCount][X] = x; |
| 250 | vertices[vertexCount][Y] = y; |
| 251 | vertexCount++; |
| 252 | |
| 253 | switch (shape) { |
| 254 | |
| 255 | case POINTS: |
| 256 | point(x, y); |
| 257 | break; |
| 258 | |
| 259 | case LINES: |
| 260 | if ((vertexCount % 2) == 0) { |
| 261 | line(vertices[vertexCount-2][X], |
| 262 | vertices[vertexCount-2][Y], x, y); |
| 263 | } |
| 264 | break; |
| 265 | |
| 266 | case TRIANGLES: |
| 267 | if ((vertexCount % 3) == 0) { |
| 268 | triangle(vertices[vertexCount - 3][X], |
| 269 | vertices[vertexCount - 3][Y], |
| 270 | vertices[vertexCount - 2][X], |
| 271 | vertices[vertexCount - 2][Y], |
| 272 | x, y); |
| 273 | } |
| 274 | break; |
| 275 | |
| 276 | case TRIANGLE_STRIP: |
| 277 | if (vertexCount >= 3) { |
| 278 | triangle(vertices[vertexCount - 2][X], |
| 279 | vertices[vertexCount - 2][Y], |
| 280 | vertices[vertexCount - 1][X], |
| 281 | vertices[vertexCount - 1][Y], |
| 282 | vertices[vertexCount - 3][X], |
| 283 | vertices[vertexCount - 3][Y]); |
| 284 | } |
| 285 | break; |
| 286 | |
| 287 | case TRIANGLE_FAN: |
| 288 | if (vertexCount >= 3) { |
| 289 | // This is an unfortunate implementation because the stroke for an |
| 290 | // adjacent triangle will be repeated. However, if the stroke is not |
| 291 | // redrawn, it will replace the adjacent line (when it lines up |
| 292 | // perfectly) or show a faint line (when off by a small amount). |
| 293 | // The alternative would be to wait, then draw the shape as a |
| 294 | // polygon fill, followed by a series of vertices. But that's a |
| 295 | // poor method when used with PDF, DXF, or other recording objects, |
| 296 | // since discrete triangles would likely be preferred. |
nothing calls this directly
no test coverage detected