Package org.apache.batik.gvt

Examples of org.apache.batik.gvt.ShapeNode


                    // FIXX: This really isn't right we need to
                    // Add the proxy children.
                    if (rect.contains(gnBounds))
                        ret.add(curr);
                } if (gn instanceof ShapeNode) {
                    ShapeNode sn = (ShapeNode)gn;
                    Shape sensitive = sn.getSensitiveArea();
                    if (sensitive != null) {
                        sensitive = at.createTransformedShape(sensitive);
                        if (sensitive.intersects(rect))
                            ret.add(curr);
                    }
View Full Code Here


        // Check GN more closely
        if (!(gn instanceof ShapeNode))
            return true;

        ShapeNode sn = (ShapeNode)gn;
        Shape sensitive = sn.getSensitiveArea();
        if (sensitive == null) return false;

        sensitive = at.createTransformedShape(sensitive);
        if (sensitive.intersects(rect))
            return true;
View Full Code Here

     * @param ctx the bridge context to use
     * @param e the element that describes the graphics node to build
     * @return a graphics node that represents the specified element
     */
    public GraphicsNode createGraphicsNode(BridgeContext ctx, Element e) {
        ShapeNode shapeNode = (ShapeNode)super.createGraphicsNode(ctx, e);
        // delegates to subclasses the shape construction
        buildShape(ctx, e, shapeNode);
        // 'shape-rendering' and 'color-rendering'
        Map shapeHints = CSSUtilities.convertShapeRendering(e);
        Map colorHints = CSSUtilities.convertColorRendering(e);
        if (shapeHints != null || colorHints != null) {
            RenderingHints hints;
            if (shapeHints == null) {
                hints = new RenderingHints(colorHints);
            } else if (colorHints == null) {
                hints = new RenderingHints(shapeHints);
            } else {
                hints = new RenderingHints(shapeHints);
                hints.putAll(colorHints);
            }
            shapeNode.setRenderingHints(hints);
        }
        return shapeNode;
    }
View Full Code Here

    /**
     * Creates a <tt>ShapeNode</tt>.
     */
    protected GraphicsNode instantiateGraphicsNode() {
        return new ShapeNode();
    }
View Full Code Here

     * @param node the graphics node to build
     */
    public void buildGraphicsNode(BridgeContext ctx,
                                  Element e,
                                  GraphicsNode node) {
        ShapeNode shapeNode = (ShapeNode)node;
        shapeNode.setShapePainter(createShapePainter(ctx, e, shapeNode));
        super.buildGraphicsNode(ctx, e, node);
    }
View Full Code Here

        AffineTransform scaleTransform = AffineTransform.getScaleInstance(scale, -scale);

        // create a shape node that represents the d attribute
        String d = glyphElement.getAttributeNS(null, SVG_D_ATTRIBUTE);
        if (d.length() != 0) {
            ShapeNode shapeNode = new ShapeNode();
            AWTPathProducer app = new AWTPathProducer();
            app.setWindingRule(CSSUtilities.convertFillRule(glyphElement));
            try {
                PathParser pathParser = new PathParser();
                pathParser.setPathHandler(app);
                pathParser.parse(new StringReader(d));
            } catch (ParseException ex) {
                throw new BridgeException(glyphElement, ERR_ATTRIBUTE_VALUE_MALFORMED,
                                          new Object [] {SVG_D_ATTRIBUTE});
            } finally {

                // transform the shape into the correct coord system
                Shape shape = app.getShape();
                Shape transformedShape = scaleTransform.createTransformedShape(shape);
                shapeNode.setShape(transformedShape);

                // set up the painter for the d part of the glyph
                ShapePainter painter = PaintServer.convertFillAndStroke(
                                      textElement, shapeNode, ctx);
                shapeNode.setShapePainter(painter);

                glyphContentNode.add(shapeNode);
            }
        }
View Full Code Here

            GeneralPath path = new GeneralPath(clipNode.getOutline(rc));
            path.setWindingRule(wr);
            Shape outline = Tx.createTransformedShape(path);

            // apply the 'clip-path' of the current clipPath's child
            ShapeNode outlineNode = new ShapeNode();
            outlineNode.setShape(outline);
            ClipRable clip = CSSUtilities.convertClipPath(child,
                                                          outlineNode,
                                                          ctx);
            if (clip != null) {
                Area area = new Area(outline);
                area.subtract(new Area(clip.getClipPath()));
                outline = area;
            }
            clipPath.add(new Area(outline));
        }
        if (!hasChildren) {
            return null; // empty clipPath
        }

        // construct the shape node that represents the clipPath
        ShapeNode clipPathNode = new ShapeNode();
        clipPathNode.setShape(clipPath);

        // apply the 'clip-path' of the clipPath element (already in user space)
        ClipRable clipElementClipPath =
            CSSUtilities.convertClipPath(clipElement, clipPathNode, ctx);
        if (clipElementClipPath != null) {
View Full Code Here

     * @param ctx the bridge context to use
     * @param e the element that describes the graphics node to build
     * @return a graphics node that represents the specified element
     */
    public GraphicsNode createGraphicsNode(BridgeContext ctx, Element e) {
        ShapeNode shapeNode = (ShapeNode)super.createGraphicsNode(ctx, e);
  if (shapeNode == null) {
      return null;
  }
        // delegates to subclasses the shape construction
        buildShape(ctx, e, shapeNode);

        // 'shape-rendering' and 'color-rendering'
        RenderingHints hints = CSSUtilities.convertShapeRendering(e, null);
        hints = CSSUtilities.convertColorRendering(e, hints);
        if (hints != null) {
            shapeNode.setRenderingHints(hints);
        }
        return shapeNode;
    }
View Full Code Here

    /**
     * Creates a <tt>ShapeNode</tt>.
     */
    protected GraphicsNode instantiateGraphicsNode() {
        return new ShapeNode();
    }
View Full Code Here

     * @param node the graphics node to build
     */
    public void buildGraphicsNode(BridgeContext ctx,
                                  Element e,
                                  GraphicsNode node) {
        ShapeNode shapeNode = (ShapeNode)node;
        shapeNode.setShapePainter(createShapePainter(ctx, e, shapeNode));
        super.buildGraphicsNode(ctx, e, node);
    }
View Full Code Here

TOP

Related Classes of org.apache.batik.gvt.ShapeNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.