urgent: the problem with resizing svg figure [message #85919] |
Sat, 16 December 2006 08:57 |
Eclipse User |
|
|
|
Originally posted by: dzhpingbo.sohu.com
I can show svg figures properly by using the code below, but it comes out
problem when resizing the figure.You can see the the problem in the attached
picture.The "activity" figure only show half when decrease the size of
figure, and there comes out big space between figure and label when increase
the size of figure.
To my surprise, the presenter.svg which I download from cvs repository of
gmf, has no problem I mentioned above when resizing the figure.
So I wonder is there something special with the presenter.svg file, because
I run the activity.svg and present.svg with the same code list below.
looking forward to your answers, because my project requires me to show the
figures properly and it comes to the end of the project soon.
public static IPath path = new Path(TRANSLATE_PATH_ARGUMENT).append("icons"
+ IPath.SEPARATOR + "Activity.svg");;
protected NodeFigure createNodePlate() {
/*return new DefaultSizeNodeFigure(getMapMode().DPtoLP(40), getMapMode()
.DPtoLP(40));*/
URL presenterURL = null;
presenterURL = FileLocator.find(NewpmbeDiagramEditorPlugin
.getInstance().getBundle(), path, null);
RenderedImage rndImg = RenderedImageFactory.getInstance(presenterURL);
final ScalableImageFigure sif = new ScalableImageFigure(rndImg, false,
true, true);
NodeFigure figure = new WrapperNodeFigure(sif) {
protected ConnectionAnchor createDefaultAnchor() {
return new SlidableImageAnchor(this, sif);
}
protected ConnectionAnchor createAnchor(PrecisionPoint p) {
if (p == null)
// If the old terminal for the connection anchor cannot be resolved (by
SlidableAnchor) a null
// PrecisionPoint will passed in - this is handled here
return createDefaultAnchor();
return new SlidableImageAnchor(this, sif, p);
}
};
return figure;
}
|
|
|
Re: urgent: the problem with resizing svg figure [message #85937 is a reply to message #85919] |
Sat, 16 December 2006 11:41 |
Eclipse User |
|
|
|
Originally posted by: dzhpingbo.sohu.com
I know it relevents to viewbox, list below. But how can I know the width and
height of the svg file? which tool should I use to figure out the width and
height of the svg file?
<svg xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;"
xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
width="35.81445" height="91.60449" viewBox="0 0 35.81445 91.60449"
overflow="visible" enable-background="new 0 0 35.81445 91.60449"
xml:space="preserve">
and I had alter activity.svg file by adding viewBox="150 0 70.81445
200.60449" just as presenter.svg file does, it come out properly before
resizing the figure, but it still can only show part of the figure when
resizing the figure, what is wrong with my svg file?
"dzh" <dzhpingbo@sohu.com> д
|
|
|
|
Re: urgent: the problem with resizing svg figure [message #85999 is a reply to message #85969] |
Sun, 17 December 2006 02:22 |
Eclipse User |
|
|
|
Originally posted by: dzhpingbo.sohu.com
Thank you for your answers:)
I know it relevents to viewbox now, because I delete viewBox="0 0 35.81445
91.60449" from presenter.svg, then it come out the problem the same as my
svg file, and be normal if I added viewBox="0 0 35.81445 91.60449".
But how can I know the width and height of the svg file? which tool should I
use to figure out the width and
height of the svg file?
presenter.svg:
<svg xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;"
xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
width="35.81445" height="91.60449" viewBox="0 0 35.81445 91.60449"
overflow="visible" enable-background="new 0 0 35.81445 91.60449"
xml:space="preserve">
I had tried to alter activity.svg file by adding width="70.81445 " and
height=" 200.60449" viewBox="150 0 70.81445 200.60449" just as presenter.svg
file does, it come out properly(the figure is just on the center of the box
and can fully be seen) before
resizing the figure, but it still can only show part of the figure when
resizing the figure,how can I know the width and height of the svg file?
which tool should I use to figure out the width and height of the svg file?
=========
"Alex Shatalin" <vano@borland.com> д
|
|
|
Re: urgent: the problem with resizing svg figure [message #86060 is a reply to message #85999] |
Sun, 17 December 2006 20:11 |
Alex Boyko Messages: 200 Registered: July 2009 |
Senior Member |
|
|
Hi,
From the way you construct the ScalableImageFigure I understand that you'd
like to preserve the original SVG image aspect ratio, correct?
final ScalableImageFigure sif = new ScalableImageFigure(rndImg, false,
true, true);
You can try not to respect them and construct the image figure as
following:
final ScalableImageFigure sif = new ScalableImageFigure(rndImg, false,
false, true);
This will render the SVG image to occupy the entire bounds of the figure.
If you really want your image to have aspect ratio of the oeriginal image
try use latest GMF from HEAD or R1_maintanance. There used to be a bug
with the aspect ratio of the images - the original aspect ratio wasn't
respected properly. It sounds like you're experiencing this bug - after
resizing the image it becomes cut off. (Bug:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=163123)
Hope this helps.
Cheers,
Alex
|
|
|
Re: urgent: the problem with resizing svg figure [message #86105 is a reply to message #86060] |
Mon, 18 December 2006 07:10 |
dzh Messages: 10 Registered: July 2009 |
Junior Member |
|
|
Thank you so much:) according to your help, I succed in showing the figure
properly:)
"Alex Boyko" <aboyko@ca.ibm.com>
??????:202da8233689efe4278f6394e9261abd$1@www.eclipse.org...
> Hi,
>
> From the way you construct the ScalableImageFigure I understand that you'd
> like to preserve the original SVG image aspect ratio, correct?
> final ScalableImageFigure sif = new ScalableImageFigure(rndImg, false,
> true, true);
>
>
> You can try not to respect them and construct the image figure as
> following:
>
> final ScalableImageFigure sif = new ScalableImageFigure(rndImg, false,
> false, true);
>
> This will render the SVG image to occupy the entire bounds of the figure.
>
> If you really want your image to have aspect ratio of the oeriginal image
> try use latest GMF from HEAD or R1_maintanance. There used to be a bug
> with the aspect ratio of the images - the original aspect ratio wasn't
> respected properly. It sounds like you're experiencing this bug - after
> resizing the image it becomes cut off. (Bug:
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=163123)
> Hope this helps.
>
> Cheers,
> Alex
>
>
>
|
|
|
|
Powered by
FUDForum. Page generated in 0.03868 seconds