*/
abstract protected void loadImage() throws FopImageException;
+
/**
* If true, image data are inverted
*/
* @exception FopImageException an error occured during property retriaval
*/
public int getWidth() throws FopImageException {
- if (this.m_width == 0)
- this.loadImage();
+ synchronized(this) {
+ if (this.m_width == 0)
+ this.loadImage();
+ }
return this.m_width;
}
* @exception FopImageException an error occured during property retriaval
*/
public int getHeight() throws FopImageException {
- if (this.m_height == 0)
- this.loadImage();
+ synchronized(this) {
+ if (this.m_height == 0)
+ this.loadImage();
+ }
return this.m_height;
}
* @exception FopImageException an error occured during property retriaval
*/
public ColorSpace getColorSpace() throws FopImageException {
- if (this.m_colorSpace == null)
- this.loadImage();
+ synchronized(this) {
+ if (this.m_colorSpace == null)
+ this.loadImage();
+ }
return this.m_colorSpace;
}
* @exception FopImageException an error occured during property retriaval
*/
public int getBitsPerPixel() throws FopImageException {
- if (this.m_bitsPerPixel == 0)
- this.loadImage();
+ synchronized(this) {
+ if (this.m_bitsPerPixel == 0)
+ this.loadImage();
+ }
return this.m_bitsPerPixel;
}
* @exception FopImageException an error occured during loading
*/
public byte[] getBitmaps() throws FopImageException {
- if (this.m_bitmaps == null)
- this.loadImage();
+ synchronized(this) {
+ if (this.m_bitmaps == null)
+ this.loadImage();
+ }
return this.m_bitmaps;
}
* @exception FopImageException an error occured during loading
*/
public int getBitmapsSize() throws FopImageException {
- if (this.m_bitmapsSize == 0)
- this.loadImage();
+ synchronized(this) {
+ if (this.m_bitmapsSize == 0)
+ this.loadImage();
+ }
return this.m_bitmapsSize;
}
* Using the bitsPerPixel var as our flag since many imges will
* have a null m_compressionType even after being loaded
*/
- if (this.m_bitsPerPixel == 0)
- this.loadImage();
+ synchronized(this) {
+ if (this.m_bitsPerPixel == 0)
+ this.loadImage();
+ }
return m_compressionType;
}
* Free all ressource.
*/
public void close() {
+ //org.apache.fop.messaging.MessageHandler.debug(getClass().getName()+".close(): "+this.m_href);
/*
* For the moment, only release the bitmaps (image areas
* can share the same FopImage object)
* Thus, even if it had been called, other properties
* are still available.
*/
- // this.m_width = 0;
- // this.m_height = 0;
- // this.m_href = null;
- // this.m_colorSpace = null;
- // this.m_bitsPerPixel = 0;
- this.m_bitmaps = null;
- this.m_bitmapsSize = 0;
- // this.m_isTransparent = false;
- // this.m_transparentColor = null;
+ synchronized(this) {
+ // this.m_width = 0;
+ // this.m_height = 0;
+ // this.m_href = null;
+ // this.m_colorSpace = null;
+ // this.m_bitsPerPixel = 0;
+ this.m_bitmaps = null;
+ this.m_bitmapsSize = 0;
+ // this.m_isTransparent = false;
+ // this.m_transparentColor = null;
+ }
}
}
/*
* $Id$
- * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
+ * Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/
import java.net.URL;
import java.net.MalformedURLException;
import java.lang.reflect.Constructor;
-import java.util.HashMap;
+import java.util.Map;
/**
* create FopImage objects (with a configuration file - not yet implemented).
*/
public class FopImageFactory {
- private static HashMap m_urlMap = new HashMap();
+ private static Map m_urlMap = new java.util.HashMap();
/**
* create an FopImage objects.
+ e_context.getMessage());
} catch (Exception e) {
// maybe relative
- URL context_url = null;
- String base = Configuration.getStringValue("baseDir");
+ URL baseURL = Configuration.getBaseURL();
- if (base == null) {
+ if (baseURL == null) {
throw new FopImageException("Error with image URL: "
+ e.getMessage()
- + " and no base directory is specified");
+ + " and no base URL is specified");
}
try {
- absoluteURL = new URL(Configuration.getStringValue("baseDir")
- + absoluteURL.getFile());
+ absoluteURL = new URL(baseURL, absoluteURL.getFile());
} catch (MalformedURLException e_context) {
// pb context url
throw new FopImageException("Invalid Image URL - error on relative URL : "