@Override public Color clone() { try { Color c = (Color) super.clone(); c.intColor = null; return c; } catch (CloneNotSupportedException e) { throw new IllegalStateException(e); } }
/** * @param buffer * @param tile * @param pool * @return */ private Tile createTile( FloatBuffer buffer, Rectangle tile, GL gl, Deque<Texture> pool, TablePerspective tablePerspective) { final VirtualArray recordVA = tablePerspective.getRecordPerspective().getVirtualArray(); final VirtualArray dimVA = tablePerspective.getDimensionPerspective().getVirtualArray(); final ATableBasedDataDomain dataDomain = tablePerspective.getDataDomain(); final int ilast = tile.y + tile.height; final int jlast = tile.x + tile.width; // fill buffer buffer.rewind(); for (int i = tile.y; i < ilast; ++i) { int recordID = recordVA.get(i); for (int j = tile.x; j < jlast; ++j) { int dimensionID = dimVA.get(j); Color color = blockColorer.apply(recordID, dimensionID, dataDomain, false); buffer.put(color.getRGBA()); } } // load to texture buffer.rewind(); Texture texture; if (!pool.isEmpty()) texture = pool.poll(); else texture = TextureIO.newTexture(GL.GL_TEXTURE_2D); TextureData texData = asTextureData(buffer, tile.width, tile.height); texture.updateImage(gl, texData); gl.glFlush(); texData.destroy(); return new Tile(tile, texture); }