59 this.maxTileAlphaSum = TILE_SIZE*TILE_SIZE*maxalpha;
60 }
61
62 private static byte[] buildAlphaMap(int maxalpha) {
63 byte[] alMap = new byte[maxalpha+1];
64 int halfmaxalpha = maxalpha>>2;
65 for (int i = 0; i <= maxalpha; i++) {
66 alMap[i] = (byte) ((i * 255 + halfmaxalpha) / maxalpha);
67 }
68 return alMap;
69 }
70
71 public static byte[] getAlphaMap(int maxalpha) {
72 if (!alphaMapsCache.containsKey(maxalpha)) {
73 alphaMapsCache.put(maxalpha, buildAlphaMap(maxalpha));
74 }
75 return alphaMapsCache.get(maxalpha);
76 }
77
78 public void getBbox(int bbox[]) {
79 cache.getBBox(bbox);
80 //System.out.println("bbox["+bbox[0]+", "+bbox[1]+" => "+bbox[2]+", "+bbox[3]+"]");
81 }
82
83 /**
84 * Gets the width of the tiles that the generator batches output into.
85 * @return the width of the standard alpha tile
86 */
87 public int getTileWidth() {
88 return TILE_SIZE;
89 }
90
91 /**
92 * Gets the height of the tiles that the generator batches output into.
93 * @return the height of the standard alpha tile
94 */
95 public int getTileHeight() {
96 return TILE_SIZE;
97 }
98
99 /**
|
59 this.maxTileAlphaSum = TILE_SIZE*TILE_SIZE*maxalpha;
60 }
61
62 private static byte[] buildAlphaMap(int maxalpha) {
63 byte[] alMap = new byte[maxalpha+1];
64 int halfmaxalpha = maxalpha>>2;
65 for (int i = 0; i <= maxalpha; i++) {
66 alMap[i] = (byte) ((i * 255 + halfmaxalpha) / maxalpha);
67 }
68 return alMap;
69 }
70
71 public static byte[] getAlphaMap(int maxalpha) {
72 if (!alphaMapsCache.containsKey(maxalpha)) {
73 alphaMapsCache.put(maxalpha, buildAlphaMap(maxalpha));
74 }
75 return alphaMapsCache.get(maxalpha);
76 }
77
78 public void getBbox(int bbox[]) {
79 bbox[0] = cache.bboxX0;
80 bbox[1] = cache.bboxY0;
81 bbox[2] = cache.bboxX1;
82 bbox[3] = cache.bboxY1;
83 //System.out.println("bbox["+bbox[0]+", "+bbox[1]+" => "+bbox[2]+", "+bbox[3]+"]");
84 }
85
86 /**
87 * Gets the width of the tiles that the generator batches output into.
88 * @return the width of the standard alpha tile
89 */
90 public int getTileWidth() {
91 return TILE_SIZE;
92 }
93
94 /**
95 * Gets the height of the tiles that the generator batches output into.
96 * @return the height of the standard alpha tile
97 */
98 public int getTileHeight() {
99 return TILE_SIZE;
100 }
101
102 /**
|