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 Stephen Turner <st...@ilc.com> on 2004/01/25 21:43:13 UTC

blink rendering

I'm working on an application that renders graphics that regularly blink 
in many areas within the svg document. We are using batik to render the 
graphics and have noticed that the cpu % exponentially grows as the more 
blinks occur on the screen (as expected). The circles, rectangles, 
polygons, etc all blink at the same time. Is there a way to optimize 
things that blink on the screen when there are really only two images 
that should rotate.... assuming nothing else changes on the screen? I've 
looked at DynamicImageRenderer. Is this the right place to start? Any 
help would be appreciated.

Thanks,
Stephen


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


Re: blink rendering

Posted by Stephen Turner <st...@ilc.com>.
Thomas DeWeese wrote:

> Hi Stephen,
>
>    Well you can render the two images to BufferedImages and manually
> manage the display (i.e. don't use the JSVGCanvas at all).  This would
> of course lose the ability to easily pan/zoom etc.  If you want to go
> this route the slideshow application is does almost exactly this.
>
>    Your approach of having two JSVGCanvas's also seems like it might
> work, however you will probably need to subclass them to add
> 'better' ways to control visibility - so for example using
> Chimera's suggestion of toggling visibility will cause the canvas to 
> rerender each time (you have probably actually doubled the work).
>
>    But if you were to subclass the Canvas you could have a boolean
> that you check in paintComponent if it is 'visible' then you
> call the baseclass paintComponent, otherwise you do nothing (perhaps
> calling JComponent.paintComponent).
>
>    You could then have a 'blink' canvas that sits over a normal
> canvas.  The tricky part then would be to synchronize
> events/rendering transforms (assuming you need to).
>
>
> Stephen Turner wrote:
>
>> Chimera wrote:
>>
>>>> I'm working on an application that renders graphics that regularly 
>>>> blink
>>>> in many areas within the svg document. We are using batik to render 
>>>> the
>>>> graphics and have noticed that the cpu % exponentially grows as the 
>>>> more
>>>> blinks occur on the screen (as expected). The circles, rectangles,
>>>> polygons, etc all blink at the same time. Is there a way to optimize
>>>> things that blink on the screen when there are really only two images
>>>> that should rotate.... assuming nothing else changes on the screen? 
>>>> I've
>>>> looked at DynamicImageRenderer. Is this the right place to start? Any
>>>> help would be appreciated.
>>>>   
>>>
>>>
>>>
>>> Is it possible to have all of those items on a 'layer' that toggles
>>> visibility on and off?  Just an idea.
>>>
>>>
>>> Chimera
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
>>> For additional commands, e-mail: batik-users-help@xml.apache.org
>>>
>>>
>>>  
>>>
>> I tried that and the cpu still runs high. I basically loaded 2 svg 
>> canvases on top of each other and toggled them every 500 ms. Any 
>> other ideas?
>>
>> Stephen
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
>> For additional commands, e-mail: batik-users-help@xml.apache.org
>>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org
>
>
We ended up taking a snapshot BufferedImage of the on and off images and 
rotating them in and out. The cpu is much better now.

Thanks,
Stephen


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


Re: blink rendering

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

    Well you can render the two images to BufferedImages and manually
manage the display (i.e. don't use the JSVGCanvas at all).  This would
of course lose the ability to easily pan/zoom etc.  If you want to go
this route the slideshow application is does almost exactly this.

    Your approach of having two JSVGCanvas's also seems like it might
work, however you will probably need to subclass them to add
'better' ways to control visibility - so for example using
Chimera's suggestion of toggling visibility will cause the canvas to 
rerender each time (you have probably actually doubled the work).

    But if you were to subclass the Canvas you could have a boolean
that you check in paintComponent if it is 'visible' then you
call the baseclass paintComponent, otherwise you do nothing (perhaps
calling JComponent.paintComponent).

    You could then have a 'blink' canvas that sits over a normal
canvas.  The tricky part then would be to synchronize
events/rendering transforms (assuming you need to).


Stephen Turner wrote:
> Chimera wrote:
> 
>>> I'm working on an application that renders graphics that regularly blink
>>> in many areas within the svg document. We are using batik to render the
>>> graphics and have noticed that the cpu % exponentially grows as the more
>>> blinks occur on the screen (as expected). The circles, rectangles,
>>> polygons, etc all blink at the same time. Is there a way to optimize
>>> things that blink on the screen when there are really only two images
>>> that should rotate.... assuming nothing else changes on the screen? I've
>>> looked at DynamicImageRenderer. Is this the right place to start? Any
>>> help would be appreciated.
>>>   
>>
>>
>> Is it possible to have all of those items on a 'layer' that toggles
>> visibility on and off?  Just an idea.
>>
>>
>> Chimera
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
>> For additional commands, e-mail: batik-users-help@xml.apache.org
>>
>>
>>  
>>
> I tried that and the cpu still runs high. I basically loaded 2 svg 
> canvases on top of each other and toggled them every 500 ms. Any other 
> ideas?
> 
> Stephen
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org
> 




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


Re: blink rendering

Posted by Stephen Turner <st...@ilc.com>.
Chimera wrote:

>>I'm working on an application that renders graphics that regularly blink
>>in many areas within the svg document. We are using batik to render the
>>graphics and have noticed that the cpu % exponentially grows as the more
>>blinks occur on the screen (as expected). The circles, rectangles,
>>polygons, etc all blink at the same time. Is there a way to optimize
>>things that blink on the screen when there are really only two images
>>that should rotate.... assuming nothing else changes on the screen? I've
>>looked at DynamicImageRenderer. Is this the right place to start? Any
>>help would be appreciated.
>>    
>>
>
>Is it possible to have all of those items on a 'layer' that toggles
>visibility on and off?  Just an idea.
>
>
>Chimera
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
>For additional commands, e-mail: batik-users-help@xml.apache.org
>
>
>  
>
I tried that and the cpu still runs high. I basically loaded 2 svg 
canvases on top of each other and toggled them every 500 ms. Any other 
ideas?

Stephen


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


Re: blink rendering

Posted by Chimera <ch...@Ennersea.net>.
> I'm working on an application that renders graphics that regularly blink
> in many areas within the svg document. We are using batik to render the
> graphics and have noticed that the cpu % exponentially grows as the more
> blinks occur on the screen (as expected). The circles, rectangles,
> polygons, etc all blink at the same time. Is there a way to optimize
> things that blink on the screen when there are really only two images
> that should rotate.... assuming nothing else changes on the screen? I've
> looked at DynamicImageRenderer. Is this the right place to start? Any
> help would be appreciated.

Is it possible to have all of those items on a 'layer' that toggles
visibility on and off?  Just an idea.


Chimera


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