You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Vijay Kumar V <vi...@gmail.com> on 2005/03/01 05:58:33 UTC

ThumbNail image generation

Hi,

I just want to create two images from SVG content.

One image with normal size and the other one in a thumbnail size.
Is there any such method in batik which i could use to achieve the
above??

Thanks in advance,
Vijay

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


Re: ThumbNail -- What is wrong?

Posted by Danilo Costa <da...@gmail.com>.
Hi Thomas

I forgot to mention that our svg is dynamic! We've noticed that if we
set the document state to ALMAYS_STATIC :

 setDocumentState(JSVGCanvas.ALWAYS_STATIC)

the thumbnail is updated properly. But if it is set to be ALWAYS_DYNAMIC

  setDocumentState(JSVGCanvas.ALWAYS_DYNAMIC) 

it doesn't work when we use the zoom or pan in the svg (the way I've
mentioned before).



On Thu, 17 Mar 2005 10:25:25 -0300, Danilo Costa <da...@gmail.com> wrote:
> ---------- Forwarded message ----------
> From: Thomas DeWeese <Th...@kodak.com>
> Date: Thu, 17 Mar 2005 05:58:55 -0500
> Subject: Re: ThumbNail -- What is wrong?
> To: batik-users@xmlgraphics.apache.org
> 
> Danilo Costa wrote:
> > In SVGPanel I've added listeners
> 
>     So you haven't really modified the behavior of the Canvas
> in any way, just added a few new listeners?
> 
>     Is it possible your listeners are throwing an exception?
> The thumbnail knows to update it's self when it receives
> those events.  At this point I think you will be best served
> adding lots of System.err.println to ThumbnailDialog to see
> where it is failing.
> 
> > The MainFrame class (that extends a JFrame)  calls the SVGPanel and
> > the ThumbnailDialog:
> >  ....................
> >   JInternalFrame frameTemp = mainDesktop.getSelectedFrame();
> 
>     So this has been bothering me a little.  I've never used
> the thumbnail dialog in an internal frame before.  I can't
> imagine why this would matter but it appears to be one of the
> few differences between what squiggle (which works) does and
> what your app (which doesn't work) does.
> 
>    You might try creating a normal JFrame.
> 
> > Should I implement those listeners in The MainFrame ?
> > Just the way squiggle does?
> 
>     I don't think the listeners are likely to be the problem.
> Unless they are disrupting the event dispatch.
> 
> > Should I do something else I am not doing when I've implented
> > those listeners?
> 
>     No, I just wanted to make sure you weren't mucking with
> say the way zoom or pan works.
> 
> > I've noticed that if I change de size of the JInternalFrame, the size
> > of the svg also changes and the thumbnailDialog is updated! But it
> > still doesnt work if I perform some zoom.
> 
>     This means that at least some of the listeners are working.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
> 
> --
> "...YOU CANNOT KNOW THE MEANING OF YOUR LIFE UNTIL YOU ARE CONNECTED
> WITH THE POWER THAT CREATED YOU..."
> Shri Mataji Nirmala Devi
> 


-- 
"...YOU CANNOT KNOW THE MEANING OF YOUR LIFE UNTIL YOU ARE CONNECTED
WITH THE POWER THAT CREATED YOU..."
Shri Mataji Nirmala Devi

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


Re: ThumbNail -- What is wrong?

Posted by Thomas DeWeese <Th...@Kodak.com>.
Danilo Costa wrote:
> In SVGPanel I've added listeners 

    So you haven't really modified the behavior of the Canvas
in any way, just added a few new listeners?

    Is it possible your listeners are throwing an exception?
The thumbnail knows to update it's self when it receives
those events.  At this point I think you will be best served
adding lots of System.err.println to ThumbnailDialog to see
where it is failing.

> The MainFrame class (that extends a JFrame)  calls the SVGPanel and
> the ThumbnailDialog:
>  ....................
>   JInternalFrame frameTemp = mainDesktop.getSelectedFrame();

    So this has been bothering me a little.  I've never used
the thumbnail dialog in an internal frame before.  I can't
imagine why this would matter but it appears to be one of the
few differences between what squiggle (which works) does and
what your app (which doesn't work) does.

   You might try creating a normal JFrame.

> Should I implement those listeners in The MainFrame ?
> Just the way squiggle does? 

    I don't think the listeners are likely to be the problem.
Unless they are disrupting the event dispatch.

> Should I do something else I am not doing when I've implented 
> those listeners?

    No, I just wanted to make sure you weren't mucking with
say the way zoom or pan works.

> I've noticed that if I change de size of the JInternalFrame, the size
> of the svg also changes and the thumbnailDialog is updated! But it
> still doesnt work if I perform some zoom.

    This means that at least some of the listeners are working.

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


Re: ThumbNail -- What is wrong?

Posted by Danilo Costa <da...@gmail.com>.
Hi Thomas, I will give you more details

My Class SVGPanel that extends JSVGCanvas is placed in a JInternalFrame.

In SVGPanel I've added listeners 

        this.addSVGLoadEventDispatcherListener
        this.addSVGLoadEventDispatcherListener 
        this.addGVTTreeBuilderListener
        this.addGVTTreeBuilderListener

just to know when the load phase strats , or when the rendering
processes sotps ...

The MainFrame class (that extends a JFrame)  calls the SVGPanel and
the ThumbnailDialog:
 ....................
  JInternalFrame frameTemp = mainDesktop.getSelectedFrame();
  JRootPane panTemp = (JRootPane) frameTemp.getComponent(0);
  SVGPanel svgTemp = (SVGPanel) panTemp.getContentPane().getComponent(0);
  tb = new ThumbnailDialog (this, svgTemp);
..................

Should I implement those listeners in The MainFrame ?
Just the way squiggle does? 

Should I do something else I am not doing when I've implented those listeners?

I've noticed that if I change de size of the JInternalFrame, the size
of the svg also changes and the thumbnailDialog is updated! But it
still doesnt work if I perform some zoom.


Thanks for trying help me!

On Wed, 16 Mar 2005 08:08:50 -0500, Thomas DeWeese
<Th...@kodak.com> wrote:
> Hi Danilo,
> 
>     Thanks, this is much clearer what you are seeing unfortunately
> I can't imagine what is causing it.
> 
> > <Th...@kodak.com> wrote:
> >
> >>Danilo Costa wrote:
> >>
> >>>I am trying to use ThumbNailDialog.
> 
> >>    Can you describe the behavior in greater detail?
> 
> Danilo Costa wrote:
> 
> >  I move the rectangle (the visible area) over the thumbnail once, and
> > the main canvas (that one with the SVG) is updated the way it should
> > be. So I do it again, I move, or better, I try to move that rectangle
> > over thumbnail again, and it doesnt work , the rectangle stay in the
> > same place.
> 
>     My suggestion would be to add print statements to the ThumbnailDialog
> AreaOfInterestListener class to see if the mouseXXX methods are being
> called as they should be.  My first suspcion is that 'in' is always
> turning out to be false, but I don't see why.
> 
>     You mentioned that you actually had a subclass of the JSVGCanvas,
> can you outline what behavior you are changing in your subclass?
> This is most likely the cause of the problem.
> 
> >  Sorry, I think the word I should use is updated!
> >  I interact over the main SVG canvas and the thumbnail is not updated
> > with the new changes, such as pan and zoom, the thumbnail doesnt show
> > any change.
> 
>     This makes it sound like either synchronize methods might not be
> getting called.  They depend on the GVT Rendering events being sent.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
> 
> 


-- 
"...YOU CANNOT KNOW THE MEANING OF YOUR LIFE UNTIL YOU ARE CONNECTED
WITH THE POWER THAT CREATED YOU..."
Shri Mataji Nirmala Devi

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


Re: ThumbNail -- What is wrong?

Posted by Thomas DeWeese <Th...@Kodak.com>.
Hi Danilo,

    Thanks, this is much clearer what you are seeing unfortunately
I can't imagine what is causing it.

> <Th...@kodak.com> wrote:
> 
>>Danilo Costa wrote:
>>
>>>I am trying to use ThumbNailDialog. 

>>    Can you describe the behavior in greater detail?

Danilo Costa wrote:

>  I move the rectangle (the visible area) over the thumbnail once, and
> the main canvas (that one with the SVG) is updated the way it should
> be. So I do it again, I move, or better, I try to move that rectangle
> over thumbnail again, and it doesnt work , the rectangle stay in the
> same place.

    My suggestion would be to add print statements to the ThumbnailDialog
AreaOfInterestListener class to see if the mouseXXX methods are being
called as they should be.  My first suspcion is that 'in' is always
turning out to be false, but I don't see why.

    You mentioned that you actually had a subclass of the JSVGCanvas,
can you outline what behavior you are changing in your subclass?
This is most likely the cause of the problem.

>  Sorry, I think the word I should use is updated!
>  I interact over the main SVG canvas and the thumbnail is not updated
> with the new changes, such as pan and zoom, the thumbnail doesnt show
> any change.

    This makes it sound like either synchronize methods might not be
getting called.  They depend on the GVT Rendering events being sent.


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


Re: ThumbNail -- What is wrong?

Posted by Danilo Costa <da...@gmail.com>.
Ok . .here we go.


On Mon, 14 Mar 2005 19:46:08 -0500, Thomas DeWeese
<Th...@kodak.com> wrote:
> Danilo Costa wrote:
> > I am trying to use ThumbNailDialog. I've created a new instance of
> > it passing the main frame of my application and the JSVGCanvas
> > (Actually an extended class). Well it works, but 2 or 3 interections
> > after it the thumbnail stops to work.
> 
>     Can you describe the behavior in greater detail?

 I move the rectangle (the visible area) over the thumbnail once, and
the main canvas (that one with the SVG) is updated the way it should
be. So I do it again, I move, or better, I try to move that rectangle
over thumbnail again, and it doesnt work , the rectangle stay in the
same place.
> 
> > Another  strange thing is that the thumbnail is not actualized
> > when I change de zoom or the position of the SVG in the main canvas.
> 
>     I don't follow you.  What does 'actualized' mean?

 Sorry, I think the word I should use is updated!
 I interact over the main SVG canvas and the thumbnail is not updated
with the new changes, such as pan and zoom, the thumbnail doesnt show
any change.


> 
>     I understand that English may not be your first language but
> I can't really understand what is going wrong so I can't help.
> 
> ---------------------------------------------------------------------

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


Re: ThumbNail -- What is wrong?

Posted by Thomas DeWeese <Th...@Kodak.com>.
Danilo Costa wrote:
> I am trying to use ThumbNailDialog. I've created a new instance of
> it passing the main frame of my application and the JSVGCanvas
> (Actually an extended class). Well it works, but 2 or 3 interections
> after it the thumbnail stops to work. 

    Can you describe the behavior in greater detail?

> Another  strange thing is that the thumbnail is not actualized 
> when I change de zoom or the position of the SVG in the main canvas.

    I don't follow you.  What does 'actualized' mean?

    I understand that English may not be your first language but
I can't really understand what is going wrong so I can't help.

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


ThumbNail -- What is wrong?

Posted by Danilo Costa <da...@gmail.com>.
Hi, I am trying to use ThumbNailDialog. I've created a new instance of
it passing the main frame of my application and the JSVGCanvas
(Actually an extended class). Well it works, but 2 or 3 interections
after it the thumbnail stops to work. Another  strange thing is that
the thumbnail is not actualized when I change de zoom or the position
of the SVG in the main canvas.
Here is the piece of code responsable for the thumbnail:

miniMap.addActionListener (new ActionListener ()
   		{
            public void actionPerformed (ActionEvent e) 
            {              	
                JInternalFrame frameTemp = mainDesktop.getSelectedFrame();
                JRootPane panTemp = (JRootPane) frameTemp.getComponent(0);
				SVGPanel svgTemp = (SVGPanel) panTemp.getContentPane().getComponent(0);
                tb = new ThumbnailDialog (thisframe, svgTemp.getSvgCanvas());
                tb.setInteractionEnabled(true);

                tb.pack();

                tb.setVisible(true);

            };
   		});

Some one can help me?

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


Re: ThumbNail image generation

Posted by Thomas DeWeese <Th...@Kodak.com>.
Hi Vijay,

Vijay Kumar V wrote:

> I just want to create two images from SVG content.
> 
> One image with normal size and the other one in a thumbnail size.
> Is there any such method in batik which i could use to achieve the
> above??

    Sure, if you can get any BufferedImage from the SVG (there
are lots of examples out there, take a look at the
batik.transcoder.SVGAbstractTranscoder) you just need to change
the user->device space (viewBox) transform.  There are a number of
utility methods in the batik.bridge.ViewBox class, such as
"ViewBox.getPreserveAspectRatioTransform(root, width, height)"

The viewing transform can then be set on the CanvasGraphicsNode
which is usually the first child of the RootGraphicsNode.

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