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 cj...@apache.org on 2001/04/02 17:48:09 UTC

cvs commit: xml-batik/sources/org/apache/batik/svggen DefaultImageHandler.java SVGPaint.java SVGTexturePaint.java

cjolif      01/04/02 08:48:09

  Modified:    sources/org/apache/batik/svggen DefaultImageHandler.java
                        SVGPaint.java SVGTexturePaint.java
  Log:
  fix a throws clause
  ask extensionhandler first for translate a Paint then do regular stuff.
  
  Revision  Changes    Path
  1.7       +2 -3      xml-batik/sources/org/apache/batik/svggen/DefaultImageHandler.java
  
  Index: DefaultImageHandler.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/svggen/DefaultImageHandler.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- DefaultImageHandler.java	2001/04/02 13:36:04	1.6
  +++ DefaultImageHandler.java	2001/04/02 15:48:08	1.7
  @@ -20,7 +20,7 @@
    * attribute and sets the width and height of the element.
    *
    * @author <a href="mailto:vincent.hardy@eng.sun.com">Vincent Hardy</a>
  - * @version $Id: DefaultImageHandler.java,v 1.6 2001/04/02 13:36:04 cjolif Exp $
  + * @version $Id: DefaultImageHandler.java,v 1.7 2001/04/02 15:48:08 cjolif Exp $
    * @see             org.apache.batik.svggen.SVGGraphics2D
    */
   public class DefaultImageHandler implements ImageHandler, ErrorConstants {
  @@ -98,8 +98,7 @@
        * height attributes.
        */
       public void handleImage(RenderableImage image, Element imageElement,
  -                            SVGGeneratorContext generatorContext)
  -        throws SVGGraphics2DIOException {
  +                            SVGGeneratorContext generatorContext) {
           //
           // First, set the image width and height
           //
  
  
  
  1.4       +15 -12    xml-batik/sources/org/apache/batik/svggen/SVGPaint.java
  
  Index: SVGPaint.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/svggen/SVGPaint.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SVGPaint.java	2001/03/21 14:36:16	1.3
  +++ SVGPaint.java	2001/04/02 15:48:08	1.4
  @@ -30,10 +30,11 @@
   
   /**
    * Utility class that converts a Paint object into an
  - * SVG pattern element
  + * SVG element.
    *
  + * @author <a href="mailto:cjolif@ilog.fr">Christophe Jolif</a>
    * @author <a href="mailto:vincent.hardy@eng.sun.com">Vincent Hardy</a>
  - * @version $Id: SVGPaint.java,v 1.3 2001/03/21 14:36:16 cjolif Exp $
  + * @version $Id: SVGPaint.java,v 1.4 2001/04/02 15:48:08 cjolif Exp $
    * @see              org.apache.batik.svggen.SVGLinearGradient
    * @see              org.apache.batik.svggen.SVGTexturePaint
    */
  @@ -121,16 +122,18 @@
        * @return a descriptor of the corresponding SVG paint
        */
       public SVGPaintDescriptor toSVG(Paint paint){
  -        SVGPaintDescriptor paintDesc = null;
  -
  -        if(paint instanceof Color)
  -            paintDesc = svgColor.toSVG((Color)paint);
  -        else if(paint instanceof GradientPaint)
  -            paintDesc = svgLinearGradient.toSVG((GradientPaint)paint);
  -        else if(paint instanceof TexturePaint)
  -            paintDesc = svgTexturePaint.toSVG((TexturePaint)paint);
  -        else
  -            paintDesc = svgCustomPaint.toSVG(paint);
  +        // we first try the extension handler because we may
  +        // want to override the way a Paint is managed!
  +        SVGPaintDescriptor paintDesc = svgCustomPaint.toSVG(paint);
  +
  +        if (paint == null) {
  +            if (paint instanceof Color)
  +                paintDesc = svgColor.toSVG((Color)paint);
  +            else if (paint instanceof GradientPaint)
  +                paintDesc = svgLinearGradient.toSVG((GradientPaint)paint);
  +            else if (paint instanceof TexturePaint)
  +                paintDesc = svgTexturePaint.toSVG((TexturePaint)paint);
  +        }
   
           return paintDesc;
       }
  
  
  
  1.12      +3 -3      xml-batik/sources/org/apache/batik/svggen/SVGTexturePaint.java
  
  Index: SVGTexturePaint.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/svggen/SVGTexturePaint.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- SVGTexturePaint.java	2001/03/26 12:37:36	1.11
  +++ SVGTexturePaint.java	2001/04/02 15:48:08	1.12
  @@ -31,7 +31,7 @@
    * SVG pattern element
    *
    * @author <a href="mailto:vincent.hardy@eng.sun.com">Vincent Hardy</a>
  - * @version $Id: SVGTexturePaint.java,v 1.11 2001/03/26 12:37:36 tkormann Exp $
  + * @version $Id: SVGTexturePaint.java,v 1.12 2001/04/02 15:48:08 cjolif Exp $
    */
   public class SVGTexturePaint extends AbstractSVGConverter {
       /**
  @@ -71,7 +71,7 @@
               Element patternDef = domFactory.createElementNS(SVG_NAMESPACE_URI,
                                                               SVG_PATTERN_TAG);
               patternDef.setAttributeNS(null, SVG_PATTERN_UNITS_ATTRIBUTE,
  -                                    SVG_USER_SPACE_ON_USE_VALUE);
  +                                      SVG_USER_SPACE_ON_USE_VALUE);
   
               //
               // First, set the pattern anchor
  @@ -96,7 +96,7 @@
               // Rescale the image to fit the anchor rectangle
               //
               if (textureImage.getWidth() > 0 &&
  -               textureImage.getHeight() > 0){
  +                textureImage.getHeight() > 0){
   
                   // Rescale only if necessary
                   if(textureImage.getWidth() != anchorRect.getWidth() ||
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org