>Are  you using the bridge module for that?
 
    I am not extend the svg tag so I am not entend the bridge module.
 
>I  need more details on what your filter looks like to answer that question.
    I have not a good idea about how to a graphics-node look like being selected.
    So, I change the fill color by feSpecularLighting.
    As the lower source, I create a filter and add the SpecularLightingRable8Bit object.
 
 
    public static Filter createFilter(
                               GraphicsNode filteredNode) {
 
        // get filter chain region
        Rectangle2D filterRegion = filteredNode.getGeometryBounds();
 
        // make the initial source as a RenderableImage
        Filter sourceGraphic = filteredNode.getGraphicsNodeRable();
 
        // build a FilterChainRable8Bit
        FilterChainRable filterChain
            = new FilterChainRable8Bit(sourceGraphic, filterRegion);
 
        // 'filterRes' attribute - default is implementation specific
        filterChain.setFilterResolutionX(-1);
        filterChain.setFilterResolutionY(-1);
 
        // create a map for filter nodes to advertise themselves as named source
        Map filterNodeMap = new HashMap(11);
        filterNodeMap.put(SVG_SOURCE_GRAPHIC_VALUE, sourceGraphic);
 
        Filter in = createFilterItem(
                                          filterRegion,
                                          filteredNode,
                                          sourceGraphic,
                                          filterNodeMap
                                          );
 
        if (in == sourceGraphic) {
            return null; // no filter primitives found, disable the filter.
        } else {
            filterChain.setSource(in);
            return filterChain;
        }
    }
 
  public static Filter createFilterItem(  Rectangle2D filterRegion,
                                          GraphicsNode filteredNode,
                                          Filter in,
                                          Map filterMap){
        // 'surfaceScale' attribute - default is 1
        float surfaceScale =1;
 
        // 'specularConstant' attribute - default is 1
        float specularConstant =1;
 
        // 'specularExponent' attribute - default is 1
        float specularExponent = 1;
 
        // extract the light definition from the filterElement's children list
        //Light light = extractLight(filterElement, ctx);
        Light light = new PointLight(0, 0, 0, java.awt.Color.blue);
 
        // 'kernelUnitLength' attribute
        //double [] kernelUnitLength = convertKernelUnitLength(filterElement);
        double [] kernelUnitLength = null;
 
        // The default region is the union of the input sources
        // regions unless 'in' is 'SourceGraphic' in which case the
        // default region is the filterChain's region
        Filter sourceGraphics = (Filter)filterMap.get(SVG_SOURCE_GRAPHIC_VALUE);
        Rectangle2D defaultRegion;
        defaultRegion = filterRegion;
        Rectangle2D primitiveRegion = defaultRegion;
 
        Filter filter = new  SpecularLightingRable8Bit(in,
                                                       primitiveRegion,
                                                       light,
                                                       specularConstant,
                                                       specularExponent,
                                                       surfaceScale,
                                                       kernelUnitLength);
 
        return filter;
    }
----- Original Message -----
Sent: Thursday, March 07, 2002 3:59 PM
Subject: RE: How to modify the GraphicsNode of GVT in apache batik?

    In my program,  There are Steps:
        1. parse the svg file to the SvgSaxDocument,
        2. build SvgSaxDocument to the tree of GraphicsNode 
 
Are  you using the bridge module for that?
 
         3. transcoder the tree of GraphicsNode to JPEGImage and send to user.
        4. find out the GraphicsNode selected by user on the tree generated in Step2.
        5. modify these selected GraphicsNode and redo the Step 3.
 
    my questions is:
        1. How to modify a GraphicsNode to show ideally that it had been selected?
  
Well, I think you need the notion of layer on top of the GVT tree. The layer can contain some
shapes that represents the outline of the selected element. Then, when you rasterize, create
a jpeg image that shows both layers (the svg one and yours with the selected elements).
 
        2. If I can easyly change the fill color of a GraphicsNode? 
 
use the setShapePainter method on ShapeNode (as the SVGShapeElementBridge does).
 
        3. Now, I had maken a Filter Object by copying and modifying the code of  some FilterBridges.
            That filter can modify the fill color like SpecularLight Filter.
            Then I call the setFilter() mothed, if there are not a filter ever, all is right.
            But if there are a filter ever, all get bad. Example, if there are a feOffset Filter to shift image ever,
            after I set my filter, the image can not be shift.
 
I  need more details on what your filter looks like to answer that question.
I have not a good idea about how to a graphics-node look like being selected.
So, I chang the fill color by feSpecularLight.
 
    I am sorry, the upper questions must be very mess.
 
Thierry.
 

Reply via email to