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 2003/08/13 13:01:17 UTC
cvs commit: xml-batik/sources/org/apache/batik/util SVGConstants.java
deweese 2003/08/13 04:01:17
Modified: samples/tests/spec/scripting currentScaleTranslate.svg
sources/org/apache/batik/bridge SVGImageElementBridge.java
sources/org/apache/batik/ext/awt/image/rendered
AbstractTiledRed.java
sources/org/apache/batik/swing/gvt JGVTComponent.java
sources/org/apache/batik/swing/svg JSVGComponent.java
sources/org/apache/batik/util SVGConstants.java
Log:
1) Image elements now propogate all UI event types.
2) Better prevention of non-computed tiles being put in Tile Cache
3) Swing components now use visibleRect rather than bounds for visible
area.
Revision Changes Path
1.3 +3 -3 xml-batik/samples/tests/spec/scripting/currentScaleTranslate.svg
Index: currentScaleTranslate.svg
===================================================================
RCS file: /home/cvs/xml-batik/samples/tests/spec/scripting/currentScaleTranslate.svg,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- currentScaleTranslate.svg 8 Aug 2003 11:39:33 -0000 1.2
+++ currentScaleTranslate.svg 13 Aug 2003 11:01:16 -0000 1.3
@@ -53,9 +53,9 @@
-->
<!-- ====================================================================== -->
-<!-- append child test -->
+<!-- Test of getting/setting current Scale and Translate. -->
<!-- -->
-<!-- @author tkormann@ilog.fr -->
+<!-- @author deweese@apache.org -->
<!-- @version $Id$ -->
<!-- ====================================================================== -->
1.59 +26 -8 xml-batik/sources/org/apache/batik/bridge/SVGImageElementBridge.java
Index: SVGImageElementBridge.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/SVGImageElementBridge.java,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -r1.58 -r1.59
--- SVGImageElementBridge.java 8 Aug 2003 11:38:51 -0000 1.58
+++ SVGImageElementBridge.java 13 Aug 2003 11:01:16 -0000 1.59
@@ -597,16 +597,34 @@
// to the <image> element (inside the original document).
if (ctx.isInteractive()) {
EventListener listener = new ForwardEventListener(svgElement, e);
- EventTarget target = (EventTarget)svgElement;
+ EventTarget tgt = (EventTarget)svgElement;
- target.addEventListener(SVG_EVENT_CLICK, listener, false);
- ctx.storeEventListener(target, SVG_EVENT_CLICK, listener, false);
+ tgt.addEventListener(SVG_EVENT_CLICK, listener, false);
+ ctx.storeEventListener(tgt, SVG_EVENT_CLICK, listener, false);
- target.addEventListener(SVG_EVENT_MOUSEOVER, listener, false);
- ctx.storeEventListener(target, SVG_EVENT_MOUSEOVER, listener,false);
+ tgt.addEventListener(SVG_EVENT_KEYDOWN, listener, false);
+ ctx.storeEventListener(tgt, SVG_EVENT_KEYDOWN, listener, false);
- target.addEventListener(SVG_EVENT_MOUSEOUT, listener, false);
- ctx.storeEventListener(target, SVG_EVENT_MOUSEOUT, listener, false);
+ tgt.addEventListener(SVG_EVENT_KEYPRESS, listener, false);
+ ctx.storeEventListener(tgt, SVG_EVENT_KEYPRESS, listener, false);
+
+ tgt.addEventListener(SVG_EVENT_KEYUP, listener, false);
+ ctx.storeEventListener(tgt, SVG_EVENT_KEYUP, listener, false);
+
+ tgt.addEventListener(SVG_EVENT_MOUSEDOWN, listener, false);
+ ctx.storeEventListener(tgt, SVG_EVENT_MOUSEDOWN, listener,false);
+
+ tgt.addEventListener(SVG_EVENT_MOUSEMOVE, listener, false);
+ ctx.storeEventListener(tgt, SVG_EVENT_MOUSEMOVE, listener,false);
+
+ tgt.addEventListener(SVG_EVENT_MOUSEOUT, listener, false);
+ ctx.storeEventListener(tgt, SVG_EVENT_MOUSEOUT, listener, false);
+
+ tgt.addEventListener(SVG_EVENT_MOUSEOVER, listener, false);
+ ctx.storeEventListener(tgt, SVG_EVENT_MOUSEOVER, listener,false);
+
+ tgt.addEventListener(SVG_EVENT_MOUSEUP, listener, false);
+ ctx.storeEventListener(tgt, SVG_EVENT_MOUSEUP, listener, false);
}
return result;
1.17 +4 -1 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.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- AbstractTiledRed.java 8 Aug 2003 11:39:07 -0000 1.16
+++ AbstractTiledRed.java 13 Aug 2003 11:01:16 -0000 1.17
@@ -463,6 +463,9 @@
// e.printStackTrace();
}
+ if (Thread.currentThread().isInterrupted())
+ return;
+
idx = 0;
// Fill in the ones that weren't in the cache.
for (ty=ty0; ty<=ty1; ty++) {
1.39 +22 -18 xml-batik/sources/org/apache/batik/swing/gvt/JGVTComponent.java
Index: JGVTComponent.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/swing/gvt/JGVTComponent.java,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -r1.38 -r1.39
--- JGVTComponent.java 8 Aug 2003 11:39:24 -0000 1.38
+++ JGVTComponent.java 13 Aug 2003 11:01:16 -0000 1.39
@@ -466,20 +466,24 @@
*/
public void immediateRepaint() {
if (EventQueue.isDispatchThread()) {
- Dimension dim = getSize();
+ Rectangle visRect = getVisibleRect();
if (doubleBufferedRendering)
- repaint(0, 0, dim.width, dim.height);
+ repaint(visRect.x, visRect.y,
+ visRect.width, visRect.height);
else
- paintImmediately(0, 0, dim.width, dim.height);
+ paintImmediately(visRect.x, visRect.y,
+ visRect.width, visRect.height);
} else {
try {
EventQueue.invokeAndWait(new Runnable() {
public void run() {
- Dimension dim = getSize();
+ Rectangle visRect = getVisibleRect();
if (doubleBufferedRendering)
- repaint(0, 0, dim.width, dim.height);
+ repaint(visRect.x, visRect.y,
+ visRect.width, visRect.height);
else
- paintImmediately(0, 0, dim.width, dim.height);
+ paintImmediately(visRect.x, visRect.y,
+ visRect.width,visRect.height);
}
});
} catch (Exception e) {
@@ -495,10 +499,11 @@
Graphics2D g2d = (Graphics2D)g;
- Dimension d = getSize();
+ Rectangle visRect = getVisibleRect();
g2d.setComposite(AlphaComposite.SrcOver);
g2d.setPaint(getBackground());
- g2d.fillRect(0, 0, d.width, d.height);
+ g2d.fillRect(visRect.x, visRect.y,
+ visRect.width, visRect.height);
if (image != null) {
if (paintingTransform != null) {
@@ -637,8 +642,8 @@
* Renders the GVT tree.
*/
protected void renderGVTTree() {
- Dimension d = getSize();
- if (gvtRoot == null || d.width <= 0 || d.height <= 0) {
+ Rectangle visRect = getVisibleRect();
+ if (gvtRoot == null || visRect.width <= 0 || visRect.height <= 0) {
return;
}
@@ -655,13 +660,12 @@
} catch (NoninvertibleTransformException e) {
throw new InternalError(e.getMessage());
}
- Shape s = inv.createTransformedShape
- (new Rectangle(0, 0, d.width, d.height));
+ Shape s = inv.createTransformedShape(visRect);
// Rendering thread setup.
gvtTreeRenderer = new GVTTreeRenderer(renderer, renderingTransform,
- doubleBufferedRendering,
- s, d.width, d.height);
+ doubleBufferedRendering, s,
+ visRect.width, visRect.height);
gvtTreeRenderer.setPriority(Thread.MIN_PRIORITY);
Iterator it = gvtTreeRendererListeners.iterator();
@@ -792,9 +796,9 @@
public void run() {
if (progressivePaintThread ==
thisThread) {
- Dimension dim = getSize();
- repaint(0, 0, dim.width,
- dim.height);
+ Rectangle vRect = getVisibleRect();
+ repaint(vRect.x, vRect.y,
+ vRect.width, vRect.height);
}
}
});
1.80 +20 -19 xml-batik/sources/org/apache/batik/swing/svg/JSVGComponent.java
Index: JSVGComponent.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/swing/svg/JSVGComponent.java,v
retrieving revision 1.79
retrieving revision 1.80
diff -u -r1.79 -r1.80
--- JSVGComponent.java 10 Aug 2003 18:03:16 -0000 1.79
+++ JSVGComponent.java 13 Aug 2003 11:01:17 -0000 1.80
@@ -714,8 +714,9 @@
disableInteractions = true;
initialTransform = new AffineTransform();
setRenderingTransform(initialTransform, false);
- Dimension d = getSize();
- repaint(0, 0, d.width, d.height);
+ Rectangle vRect = getVisibleRect();
+ repaint(vRect.x, vRect.y,
+ vRect.width, vRect.height);
return;
}
@@ -993,8 +994,10 @@
return;
}
- final Dimension d = getSize();
- if (gvtRoot == null || d.width <= 0 || d.height <= 0) {
+ final Rectangle visRect = getVisibleRect();
+ if ((gvtRoot == null) ||
+ (visRect.width <= 0) ||
+ (visRect.height <= 0)) {
return;
}
@@ -1006,17 +1009,15 @@
throw new InternalError(e.getMessage());
}
final Shape s =
- inv.createTransformedShape(new Rectangle(0, 0, d.width, d.height));
+ inv.createTransformedShape(visRect);
- updateManager.getUpdateRunnableQueue().invokeLater(new Runnable() {
- public void run() {
- paintingTransform = null;
- updateManager.updateRendering(renderingTransform,
- doubleBufferedRendering,
- s, d.width, d.height);
-
- }
- });
+ updateManager.getUpdateRunnableQueue().invokeLater
+ (new Runnable() { public void run() {
+ paintingTransform = null;
+ updateManager.updateRendering(renderingTransform,
+ doubleBufferedRendering, s,
+ visRect.width, visRect.height);
+ }});
}
/**
@@ -1715,10 +1716,10 @@
List l = e.getDirtyAreas();
if (l != null) {
- Dimension dim = getSize();
- List ml = mergeRectangles(l, 0, 0,
- dim.width - 1,
- dim.height - 1);
+ Rectangle visRect = getVisibleRect();
+ List ml = mergeRectangles
+ (l, visRect.x, visRect.y,
+ visRect.width - 1, visRect.height - 1);
if (ml.size() < l.size()) {
l = ml;
}
1.70 +8 -2 xml-batik/sources/org/apache/batik/util/SVGConstants.java
Index: SVGConstants.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/util/SVGConstants.java,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -r1.69 -r1.70
--- SVGConstants.java 8 Aug 2003 11:39:26 -0000 1.69
+++ SVGConstants.java 13 Aug 2003 11:01:17 -0000 1.70
@@ -868,8 +868,14 @@
// event constants
///////////////////////////////////////////////////////////////////
- String SVG_EVENT_CLICK = "click";
+ String SVG_EVENT_CLICK = "click";
+ String SVG_EVENT_KEYDOWN = "keydown";
+ String SVG_EVENT_KEYPRESS = "keypress";
+ String SVG_EVENT_KEYUP = "keyup";
+ String SVG_EVENT_MOUSEDOWN = "mousedown";
+ String SVG_EVENT_MOUSEMOVE = "mousemove";
String SVG_EVENT_MOUSEOVER = "mouseover";
String SVG_EVENT_MOUSEOUT = "mouseout";
+ String SVG_EVENT_MOUSEUP = "mouseup";
}
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org