[ 
https://issues.apache.org/jira/browse/BATIK-1071?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

DongSoo,Lee updated BATIK-1071:
-------------------------------

    Description: 
In case of converting ".svg" to ".png",
it occurs not to be applied the hints about scaling of ".png" using 
PNGTranscoder.
For instance of the codes occurring bugs, here it is.
(Some not important codes are omitted..)

==================================================
PNGTranscoder tr = new PNGTranscoder();
tr.addTranscodingHint(PNGTranscoder.KEY_WIDTH, new Float(w) );
tr.addTranscodingHint(PNGTranscoder.KEY_HEIGHT, new Float(h) );
tr.addTranscodingHint(PNGTranscoder.KEY_AOI, new 
Rectangle(0,0,svgRealWidth,svgRealHeight ) );

TranscoderInput trIn = new TranscoderInput(svgDoc);
TranscoderOutput trOut = new TranscoderOutput(new FileOutputStream("xx.png", 
true) );

tr.transcode(trIn, trOut);
==================================================

After running these codes, you will be able to get the terrible image(.png).
The png image will be a part of the original svg image.

So I checked the classes "PNGTranscoder", "ImageTranscoder", 
"SVGAbstractTranscoder"  among the involved classes.
And then, I found the wrong point from them.

==================================================
On "SVGAbstractTranscoder" class
especially line 289 "this.root = gvtRoot;
 => If the instance of CanvasGraphicsNode is not null,  the instance of 
CanvasGraphicsNode obviously has the transforming information which referred 
the 'Px' variable(especially "AffineTransform")
      And then, the "AffineTransform" instance is initialized.(the line 284)
 => But on the line 289, 'this.root' is assigned 'gvtRoot' that doesn't have 
the transforming information which referred the 'Px'(the instance of 
'AffineTransform').
      So, the child class "ImageTranscoder" can't get the transforming 
information(especially scale). Because the variable "curTxf" is already 
initialized by the parent class.(Refer to the line 103 
"renderer.setTransform(curTxf );")

So, as a result, I think the line 289 codes on "SVGAbstractTranscoder" need to 
be changed like the below codes..
 => this.root = cgn;

And the line 103 codes on "ImageTranscoder" also need to be changed like the 
below codes
 => renderer.setTransform(this.root.getTransform() );
==================================================

I hope this bug reporting will be useful to improve Apache Batik project.
If there are some wrong in my reporting, plz let me know..

  was:
In case of converting ".svg" to ".png",
it occurs not to be applied the hints about scaling of ".png" using 
PNGTranscoder.
For instance of the codes occurring bugs, here it is.
(Some not important codes is omitted..)

==================================================
PNGTranscoder tr = new PNGTranscoder();
tr.addTranscodingHint(PNGTranscoder.KEY_WIDTH, new Float(w) );
tr.addTranscodingHint(PNGTranscoder.KEY_HEIGHT, new Float(h) );
tr.addTranscodingHint(PNGTranscoder.KEY_AOI, new 
Rectangle(0,0,svgRealWidth,svgRealHeight ) );

TranscoderInput trIn = new TranscoderInput(svgDoc);
TranscoderOutput trOut = new TranscoderOutput(new FileOutputStream("xx.png", 
true) );

tr.transcode(trIn, trOut);
==================================================

After running these codes, you will be able to get the terrible image(.png).
The png image will be a part of the original svg image.

So I checked the classes "PNGTranscoder", "ImageTranscoder", 
"SVGAbstractTranscoder"  among the involved classes.
And then, I found the wrong point from them.

==================================================
On "SVGAbstractTranscoder" class
especially line 289 "this.root = gvtRoot;
 => If the instance of CanvasGraphicsNode is not null,  the instance of 
CanvasGraphicsNode obviously has the transforming information which referred 
the 'Px' variable(especially "AffineTransform")
      And then, the "AffineTransform" instance is initialized.(the line 284)
 => But on the line 289, 'this.root' is assigned 'gvtRoot' that doesn't have 
the transforming information which referred the 'Px'(the instance of 
'AffineTransform').
      So, the child class "ImageTranscoder" can't get the transforming 
information(especially scale). Because the variable "curTxf" is already 
initialized by the parent class.(Refer to the line 103 
"renderer.setTransform(curTxf );")

So, as a result, I think the line 289 codes on "SVGAbstractTranscoder" need to 
be changed like the below codes..
 => this.root = cgn;

And the line 103 codes on "ImageTranscoder" also need to be changed like the 
below codes
 => renderer.setTransform(this.root.getTransform() );
==================================================

I hope this bug reporting will be useful to improve Apache Batik project.
If there are some wrong in my reporting, plz let me know..


> Not being adjusted the hint about scaling of .svg using "PNGTranscoder" for 
> converting .svg to .png
> ---------------------------------------------------------------------------------------------------
>
>                 Key: BATIK-1071
>                 URL: https://issues.apache.org/jira/browse/BATIK-1071
>             Project: Batik
>          Issue Type: Bug
>          Components: SVG Rasterizer
>    Affects Versions: 1.7
>         Environment: Not important
>            Reporter: DongSoo,Lee
>            Priority: Minor
>              Labels: Transcoder, png, scale
>             Fix For: 1.7
>
>
> In case of converting ".svg" to ".png",
> it occurs not to be applied the hints about scaling of ".png" using 
> PNGTranscoder.
> For instance of the codes occurring bugs, here it is.
> (Some not important codes are omitted..)
> ==================================================
> PNGTranscoder tr = new PNGTranscoder();
> tr.addTranscodingHint(PNGTranscoder.KEY_WIDTH, new Float(w) );
> tr.addTranscodingHint(PNGTranscoder.KEY_HEIGHT, new Float(h) );
> tr.addTranscodingHint(PNGTranscoder.KEY_AOI, new 
> Rectangle(0,0,svgRealWidth,svgRealHeight ) );
> TranscoderInput trIn = new TranscoderInput(svgDoc);
> TranscoderOutput trOut = new TranscoderOutput(new FileOutputStream("xx.png", 
> true) );
> tr.transcode(trIn, trOut);
> ==================================================
> After running these codes, you will be able to get the terrible image(.png).
> The png image will be a part of the original svg image.
> So I checked the classes "PNGTranscoder", "ImageTranscoder", 
> "SVGAbstractTranscoder"  among the involved classes.
> And then, I found the wrong point from them.
> ==================================================
> On "SVGAbstractTranscoder" class
> especially line 289 "this.root = gvtRoot;
>  => If the instance of CanvasGraphicsNode is not null,  the instance of 
> CanvasGraphicsNode obviously has the transforming information which referred 
> the 'Px' variable(especially "AffineTransform")
>       And then, the "AffineTransform" instance is initialized.(the line 284)
>  => But on the line 289, 'this.root' is assigned 'gvtRoot' that doesn't have 
> the transforming information which referred the 'Px'(the instance of 
> 'AffineTransform').
>       So, the child class "ImageTranscoder" can't get the transforming 
> information(especially scale). Because the variable "curTxf" is already 
> initialized by the parent class.(Refer to the line 103 
> "renderer.setTransform(curTxf );")
> So, as a result, I think the line 289 codes on "SVGAbstractTranscoder" need 
> to be changed like the below codes..
>  => this.root = cgn;
> And the line 103 codes on "ImageTranscoder" also need to be changed like the 
> below codes
>  => renderer.setTransform(this.root.getTransform() );
> ==================================================
> I hope this bug reporting will be useful to improve Apache Batik project.
> If there are some wrong in my reporting, plz let me know..



--
This message was sent by Atlassian JIRA
(v6.2#6252)

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-h...@xmlgraphics.apache.org

Reply via email to