/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
// perhaps we should be using weak references here, but right now
// that's not necessary. The way the renderer is, this map will
// never contain more than one element - the one with key 64, since
// we only do 8x8 supersampling.
ConcurrentHashMap<Integer, byte[]>();
int x, y;
final int maxalpha;
private final int maxTileAlphaSum;
// The alpha map used by this object (taken out of our map cache) to convert
// pixel coverage counts gotten from PiscesCache (which are in the range
// [0, maxalpha]) into alpha values, which are in [0,256).
byte alphaMap[];
}
for (int i = 0; i <= maxalpha; i++) {
}
return alMap;
}
}
}
//System.out.println("bbox["+bbox[0]+", "+bbox[1]+" => "+bbox[2]+", "+bbox[3]+"]");
}
/**
* Gets the width of the tiles that the generator batches output into.
* @return the width of the standard alpha tile
*/
public int getTileWidth() {
return TILE_SIZE;
}
/**
* Gets the height of the tiles that the generator batches output into.
* @return the height of the standard alpha tile
*/
public int getTileHeight() {
return TILE_SIZE;
}
/**
* Gets the typical alpha value that will characterize the current
* tile.
* The answer may be 0x00 to indicate that the current tile has
* no coverage in any of its pixels, or it may be 0xff to indicate
* that the current tile is completely covered by the path, or any
* other value to indicate non-trivial coverage cases.
* @return 0x00 for no coverage, 0xff for total coverage, or any other
* value for partial coverage of the tile
*/
public int getTypicalAlpha() {
// Note: if we have a filled rectangle that doesn't end on a tile
// border, we could still return 0xff, even though al!=maxTileAlphaSum
// This is because if we return 0xff, our users will fill a rectangle
// starting at x,y that has width = Math.min(TILE_SIZE, bboxX1-x),
// and height min(TILE_SIZE,bboxY1-y), which is what should happen.
// However, to support this, we would have to use 2 Math.min's
// and 2 multiplications per tile, instead of just 2 multiplications
// to compute maxTileAlphaSum. The savings offered would probably
// not be worth it, considering how rare this case is.
// Note: I have not tested this, so in the future if it is determined
// that it is worth it, it should be implemented. Perhaps this method's
// interface should be changed to take arguments the width and height
// of the current tile. This would eliminate the 2 Math.min calls that
// would be needed here, since our caller needs to compute these 2
// values anyway.
}
/**
* Skips the current tile and moves on to the next tile.
* Either this method, or the getAlpha() method should be called
* once per tile, but not both.
*/
public void nextTile() {
y += TILE_SIZE;
}
}
/**
* Gets the alpha coverage values for the current tile.
* Either this method, or the nextTile() method should be called
* once per tile, but not both.
*/
// Decode run-length encoded alpha mask data
// The data for row j begins at cache.rowOffsetsRLE[j]
// and is encoded as a set of 2-byte pairs (val, runLen)
// terminated by a (0, 0) pair.
int x0 = this.x;
int y0 = this.y;
}
int pos = 2;
byte val;
int runLen = 0;
try {
assert runLen > 0;
} catch (RuntimeException e0) {
throw e0;
}
//System.out.println("M["+runLen+"]");
while (--runLen >= 0) {
try {
} catch (RuntimeException e) {
e.printStackTrace();
throw e;
}
}
pos += 2;
}
cx++;
}
/*
for (int i = idx - (x1-x0); i < idx; i++) {
System.out.print(hex(tile[i], 2));
}
System.out.println();
*/
}
nextTile();
}
while (s.length() < d) {
s = "0"+s;
}
return s.substring(0, d);
}
/**
* Disposes this tile generator.
* No further calls will be made on this instance.
*/
public void dispose() {}
}