You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by de...@apache.org on 2002/02/26 19:15:46 UTC
cvs commit: xml-batik/sources/org/apache/batik/ext/awt/image/rendered AbstractTiledRed.java TileCacheRed.java
deweese 02/02/26 10:15:46
Modified: sources/org/apache/batik/ext/awt/image/rendered
AbstractTiledRed.java TileCacheRed.java
Log:
Added an interface to set TileStore to use.
Revision Changes Path
1.13 +38 -3 xml-batik/sources/org/apache/batik/ext/awt/image/rendered/AbstractTiledRed.java
Index: AbstractTiledRed.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/ext/awt/image/rendered/AbstractTiledRed.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- AbstractTiledRed.java 14 Dec 2001 01:07:50 -0000 1.12
+++ AbstractTiledRed.java 26 Feb 2002 18:15:46 -0000 1.13
@@ -28,7 +28,7 @@
* the subclass implementation.
*
* @author <a href="mailto:Thomas.DeWeeese@Kodak.com">Thomas DeWeese</a>
- * @version $Id: AbstractTiledRed.java,v 1.12 2001/12/14 01:07:50 deweese Exp $
+ * @version $Id: AbstractTiledRed.java,v 1.13 2002/02/26 18:15:46 deweese Exp $
*/
public abstract class AbstractTiledRed
extends AbstractRed
@@ -149,9 +149,40 @@
ColorModel cm, SampleModel sm,
int tileGridXOff, int tileGridYOff,
Map props) {
+ init(src, bounds, cm, sm, tileGridXOff, tileGridYOff, null, props);
+ }
+
+
+ /**
+ * This is one of two basic init function (this is for single
+ * source rendereds).
+ * It is provided so subclasses can compute various values
+ * before initializing all the state in the base class.
+ * You really should call this method before returning from
+ * your subclass constructor.
+ *
+ * @param src The source for the filter
+ * @param bounds The bounds of the image
+ * @param cm The ColorModel to use. If null it defaults to
+ * ComponentColorModel/ src's ColorModel.
+ * @param sm The Sample modle to use. If this is null it will
+ * use the src's sample model if that is null it will
+ * construct a sample model that matches the ColorModel
+ * and is the size of the whole image.
+ * @param tileGridXOff The x location of tile 0,0.
+ * @param tileGridYOff The y location of tile 0,0.
+ * @param tileStore The tileStore to use (or null).
+ * @param props Any properties you want to associate with the image.
+ */
+ protected void init(CachableRed src, Rectangle bounds,
+ ColorModel cm, SampleModel sm,
+ int tileGridXOff, int tileGridYOff,
+ TileStore tiles,
+ Map props) {
super.init(src, bounds, cm, sm, tileGridXOff, tileGridYOff, props);
-
- tiles = createTileStore();
+ this.tiles = tiles;
+ if (this.tiles == null)
+ this.tiles = createTileStore();
}
/**
@@ -242,6 +273,10 @@
public TileStore getTileStore() {
return tiles;
+ }
+
+ protected void setTileStore(TileStore tiles) {
+ this.tiles = tiles;
}
protected TileStore createTileStore() {
1.4 +4 -2 xml-batik/sources/org/apache/batik/ext/awt/image/rendered/TileCacheRed.java
Index: TileCacheRed.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/ext/awt/image/rendered/TileCacheRed.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- TileCacheRed.java 17 Sep 2001 20:45:18 -0000 1.3
+++ TileCacheRed.java 26 Feb 2002 18:15:46 -0000 1.4
@@ -18,7 +18,7 @@
* generated by it's input into the TileCache.
*
* @author <a href="mailto:thomas.deweese@kodak.com">Thomas DeWeese</a>
- * @version $Id: TileCacheRed.java,v 1.3 2001/09/17 20:45:18 deweese Exp $
+ * @version $Id: TileCacheRed.java,v 1.4 2002/02/26 18:15:46 deweese Exp $
*/
public class TileCacheRed extends AbstractTiledRed {
@@ -41,7 +41,9 @@
if (tileWidth > bounds.width) tileWidth = bounds.width;
if (tileHeight > bounds.height) tileHeight = bounds.height;
SampleModel sm = cm.createCompatibleSampleModel(tileWidth, tileHeight);
- init(cr, cr.getBounds(), cm, sm, 0, 0, null);
+ init(cr, cr.getBounds(), cm, sm,
+ cr.getTileGridXOffset(), cr.getTileGridYOffset(),
+ null);
}
public void genRect(WritableRaster wr) {
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org