public Hash traps = null;
- // Vector Support /////////////////////////////////////////////////////////////////////
-
- /** The SVG path for this node */
- public String path = null;
-
- /** The affine multiplied by the CTM *before* this element and its children are processed */
- public SVG.Affine transform = null;
-
-
// Instance Data: IndexOf ////////////////////////////////////////////////////////////
/** The indexof() Function; created lazily */
/** loads the image described by string str, possibly blocking for a network load */
static ImageDecoder getImage(String str, final Function callback) {
- boolean ispng = false;
if (str.indexOf(':') == -1) {
String s = str;
byte[] b = Resources.getResource(Resources.resolve(s + ".png", null));
- if (b == null) return null;
- return PNG.decode(new ByteArrayInputStream(b), str);
+ if (b != null) return PNG.decode(new ByteArrayInputStream(b), str);
+ b = Resources.getResource(Resources.resolve(s + ".jpeg", null));
+ if (b != null) return Platform.decodeJPEG(new ByteArrayInputStream(b), str);
+ return null;
} else {
Thread thread = Thread.currentThread();
mythread.setPriority(Thread.MIN_PRIORITY);
mythread.done.release();
try {
- // FIXME use mime types here, not extensions
- if (str.endsWith(".jpeg") || str.endsWith(".jpg"))
- str = "http://xmlrpc.xwt.org/jpeg2png/" + str.substring(str.indexOf("//") + 2);
-
HTTP http = new HTTP(str);
final HTTP.HTTPInputStream in = http.GET();
final int contentLength = in.getContentLength();
return ret;
}
};
-
+
if (str.endsWith(".gif")) return GIF.decode(is, str);
- else return PNG.decode(is, str);
+ else if (str.endsWith(".jpeg") || str.endsWith(".jpg")) return Platform.decodeJPEG(is, str);
+ else return PNG.decode(is, str);
} catch (IOException e) {
if (Log.on) Log.log(Box.class, "error while trying to load an image from " + str);
if (Log.on) Log.log(Box.class, "unable to load image " + s + " at " +
Context.enter().interpreterSourceFile + ":" + Context.enter().interpreterLine);
return;
- }
+ }
if (sizetoimage) syncSizeToImage();
dirty();
}
// Rendering Pipeline /////////////////////////////////////////////////////////////////////
/** Renders self and children within the specified region. All rendering operations are clipped to xIn,yIn,wIn,hIn */
- void render(int xIn, int yIn, int wIn, int hIn, DoubleBuffer buf) { render(xIn, yIn, wIn, hIn, buf, null); }
- void render(int xIn, int yIn, int wIn, int hIn, DoubleBuffer buf, SVG.Affine ctm) {
+ void render(int xIn, int yIn, int wIn, int hIn, DoubleBuffer buf) {
if (surface.abort || invisible) return;
// intersect the x,y,w,h rendering window with ourselves; quit if it's empty
else renderStretchedImage(x, y, w, h, buf);
}
- // FIXME: this should go at the top of this method
- SVG.Affine ctm_;
- if (transform != null) {
- if (ctm == null) ctm = SVG.Affine.identity();
- ctm_ = ctm.copy();
- ctm_.multiply(transform);
- } else {
- ctm_ = ctm;
- }
-
- if (path != null) {
- SVG.VP vp = SVG.VP.fromString(path);
- if (ctm_ != null) vp.multiply(ctm_);
- vp.sort();
- vp.fill(buf, null, 0xFFFF0000, null);
- vp.stroke(buf, 100, textcolor, false);
- }
-
if (text != null && !text.equals("")) renderText(x, y, w, h, buf);
// now subtract the pad region from the clip region before proceeding
int h2 = min(y + h, pos(1) + size(1) - pad(1)) - y2;
for(Box b = getChild(0); b != null; b = b.nextSibling())
- b.render(x2, y2, w2, h2, buf, ctm_);
+ b.render(x2, y2, w2, h2, buf);
}
private void renderBorder(int x, int y, int w, int h, DoubleBuffer buf) {
} else {
Box newnode = (Box)value;
+
+ // check if box being moved is currently target of a redirect
+ for(Box cur = newnode.getParent(); cur != null; cur = cur.getParent())
+ if (cur.redirect == newnode) {
+ if (Log.on) Log.log(this, "attempt to move a box that is the target of a redirect at "+
+ Context.enter().interpreterSourceFile + ":" + Context.enter().interpreterLine);
+ return;
+ }
+
+ // check for recursive ancestor violation
for(Box cur = this; cur != null; cur = cur.getParent())
if (cur == newnode) {
if (Log.on) Log.log(this, "attempt to make a node a parent of its own ancestor at " +