@@ -1826,7 +1826,7 @@ public void flush() {
18261826 // allow creating a Graphics from MemoryImageSource
18271827 // so pixels would never be there.
18281828 if (pix != null )
1829- 秘g .drawImagePriv (this , 0 , 0 , null );
1829+ 秘g .drawImageFromRaster (this , 0 , 0 , null );
18301830 /**
18311831 * @j2sNative if (pix) pix.img = this;
18321832 *
@@ -1972,23 +1972,49 @@ public void flush() {
19721972 * @param force initially false just to get the pre-constructed canvas if it exists
19731973 * @return
19741974 */
1975+
1976+ public final static int GET_IMAGE_ALLOW_NULL = 0 ;
1977+ public final static int GET_IMAGE_FOR_RASTER = 1 ;
1978+ public final static int GET_IMAGE_FOR_ICON = 2 ;
1979+
19751980
1976- public DOMNode 秘getImageNode (boolean force ) {
1981+ /**
1982+ *
1983+ * Return or create a DOMNode canvas or image tag or null
1984+ *
1985+ * @param mode GET_IMAGE_ALLOW_NULL(0) || GET_IMAGE_FOR_RASTER(1) ||
1986+ * GET_IMAGE_FOR_ICON(2)
1987+ * @return if allowing null, return the canvas if we have raster data (always
1988+ * null?) or the canvas or imgNode if not; if getting an image for a
1989+ * raster, we already know this is a raster image, so create its image;
1990+ * if getting an image for an icon, return the canvas or imgNode if this
1991+ * is not a raster image, or create its image
1992+ */
1993+ public DOMNode 秘getImageNode (int mode ) {
19771994 // If we have raster data and are not forcing, return the canvas if it exists.
1978- // If we we have no raster data and are not forcing, force the issue anyway
1995+ // If we we have no raster data and are not forcing, force the issue anyway
19791996 // and return the canvas or image node.
19801997 // If we are forcing, or force the creation of a canvas
1981- if (!force )
1998+ switch (mode ) {
1999+ default :
2000+ case GET_IMAGE_ALLOW_NULL :
19822001 return (DOMNode ) (秘hasRasterData || 秘canvas != null ? 秘canvas
19832002 : 秘imgNode != null ? 秘imgNode : JSGraphicsCompositor .createImageNode (this ));
1984- // we are forcing
1985- 秘getPixelsFromRaster ();
1986- 秘g = null ;
1987- 秘getImageGraphic ();
1988- DOMNode canvas = 秘g .getCanvas ();
1989- 秘g = null ;
1990- 秘canvas = null ;
1991- return canvas ;
2003+ case GET_IMAGE_FOR_ICON :
2004+ if (!秘hasRasterData )
2005+ return (DOMNode ) (秘canvas != null ? 秘canvas
2006+ : 秘imgNode != null ? 秘imgNode : JSGraphicsCompositor .createImageNode (this ));
2007+ //$fall-through$
2008+ case GET_IMAGE_FOR_RASTER :
2009+ // we are forcing
2010+ 秘getPixelsFromRaster ();
2011+ 秘g = null ;
2012+ 秘getImageGraphic ();
2013+ DOMNode canvas = 秘g .getCanvas ();
2014+ 秘g = null ;
2015+ 秘canvas = null ;
2016+ return canvas ;
2017+ }
19922018 }
19932019
19942020 /**
0 commit comments