You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by Ernesto Reinaldo Barreiro <re...@isencia.com> on 2006/11/28 15:10:17 UTC
problem with RenderedDynamicImageResource (wicket 2.0)
Hi,
I have some problems in generating dynamic images (charts) and the they seem
to be related to the method
protected byte[] render()
{
while (true)
{
final BufferedImage image = new BufferedImage(width, height, type);
if (render((Graphics2D)image.getGraphics()))
{
return toImageData(image);
}
}
}
of RenderedDynamicImageResource class. The problem appears because I want to
do something like
imageResource = new RenderedDynamicImageResource(dataChart.getWidth(),
dataChart.getHeight()) {
private static final long serialVersionUID = 1L;
@Override
protected boolean render(Graphics2D graphics)
{
JFreeChart chart = getChart();
if(chart != null)
chart.draw(graphics, new Rectangle(getWidth(), getHeight()));
return true;
}
@Override
public synchronized int getWidth() {
return getDataChart().getWidth();
}
@Override
public synchronized int getHeight() {
return getDataChart().getHeight();
}
};
and the width and height used to produce the buffered image are "immutable".
A fix for this could be to re-write the method render() as
protected byte[] render()
{
while (true)
{
final BufferedImage image = new BufferedImage(getWidth(), getHeight(),
type);
if (render((Graphics2D)image.getGraphics()))
{
return toImageData(image);
}
}
}
I don't know if this change could bring other side effects? Of course, as
the method is protected I could override it to do exactly what I want but I
thought it might be better (and useful) to ask the core developers first.
I'm working with the SVN trunk (wicket 2.0).
Best regards,
Ernesto
--
View this message in context: http://www.nabble.com/problem-with-RenderedDynamicImageResource-%28wicket-2.0%29-tf2718555.html#a7579878
Sent from the Wicket - Dev mailing list archive at Nabble.com.
Re: problem with RenderedDynamicImageResource (wicket 2.0)
Posted by Ernesto Reinaldo Barreiro <re...@isencia.com>.
Dear Eelco,
Thanks for the fix! And my apologies for not reacting before in opening an
issue in your bug tracker: it was just now that I saw your replay;-)
Best regards,
Ernesto
<quot author='Eelco Hillenius'>
Nevermind. It's fixed: http://issues.apache.org/jira/browse/WICKET-130
(wicket 1.3 and 2.0).
Eelco
On 11/30/06, Eelco Hillenius <ee...@gmail.com> wrote:
> Yep, you're right. If you could open an issue for this, I'd be happy
> to apply the changes.
>
> Eelco
>
>
> On 11/28/06, Ernesto Reinaldo Barreiro <re...@isencia.com> wrote:
> >
> > Hi,
> >
> > I have some problems in generating dynamic images (charts) and the they
> seem
> > to be related to the method
> >
> > protected byte[] render()
> > {
> > while (true)
> > {
> > final BufferedImage image = new
> BufferedImage(width, height, type);
> > if (render((Graphics2D)image.getGraphics()))
> > {
> > return toImageData(image);
> > }
> > }
> > }
> >
> > of RenderedDynamicImageResource class. The problem appears because I
> want to
> > do something like
> >
> > imageResource = new
> RenderedDynamicImageResource(dataChart.getWidth(),
> > dataChart.getHeight()) {
> >
> > private static final long serialVersionUID = 1L;
> >
> > @Override
> > protected boolean render(Graphics2D graphics)
> > {
> > JFreeChart chart = getChart();
> > if(chart != null)
> > chart.draw(graphics, new
> Rectangle(getWidth(), getHeight()));
> > return true;
> > }
> >
> > @Override
> > public synchronized int getWidth() {
> > return getDataChart().getWidth();
> > }
> >
> > @Override
> > public synchronized int getHeight() {
> > return getDataChart().getHeight();
> > }
> > };
> >
> > and the width and height used to produce the buffered image are
> "immutable".
> > A fix for this could be to re-write the method render() as
> >
> > protected byte[] render()
> > {
> > while (true)
> > {
> > final BufferedImage image = new
> BufferedImage(getWidth(), getHeight(),
> > type);
> > if (render((Graphics2D)image.getGraphics()))
> > {
> > return toImageData(image);
> > }
> > }
> > }
> > I don't know if this change could bring other side effects? Of course,
> as
> > the method is protected I could override it to do exactly what I want
> but I
> > thought it might be better (and useful) to ask the core developers
> first.
> >
> > I'm working with the SVN trunk (wicket 2.0).
> >
> > Best regards,
> >
> > Ernesto
> > --
> > View this message in context:
> http://www.nabble.com/problem-with-RenderedDynamicImageResource-%28wicket-2.0%29-tf2718555.html#a7579878
> > Sent from the Wicket - Dev mailing list archive at Nabble.com.
> >
> >
>
--
View this message in context: http://www.nabble.com/problem-with-RenderedDynamicImageResource-%28wicket-2.0%29-tf2718555.html#a7637496
Sent from the Wicket - Dev mailing list archive at Nabble.com.
Re: problem with RenderedDynamicImageResource (wicket 2.0)
Posted by Eelco Hillenius <ee...@gmail.com>.
Nevermind. It's fixed: http://issues.apache.org/jira/browse/WICKET-130
(wicket 1.3 and 2.0).
Eelco
On 11/30/06, Eelco Hillenius <ee...@gmail.com> wrote:
> Yep, you're right. If you could open an issue for this, I'd be happy
> to apply the changes.
>
> Eelco
>
>
> On 11/28/06, Ernesto Reinaldo Barreiro <re...@isencia.com> wrote:
> >
> > Hi,
> >
> > I have some problems in generating dynamic images (charts) and the they seem
> > to be related to the method
> >
> > protected byte[] render()
> > {
> > while (true)
> > {
> > final BufferedImage image = new BufferedImage(width, height, type);
> > if (render((Graphics2D)image.getGraphics()))
> > {
> > return toImageData(image);
> > }
> > }
> > }
> >
> > of RenderedDynamicImageResource class. The problem appears because I want to
> > do something like
> >
> > imageResource = new RenderedDynamicImageResource(dataChart.getWidth(),
> > dataChart.getHeight()) {
> >
> > private static final long serialVersionUID = 1L;
> >
> > @Override
> > protected boolean render(Graphics2D graphics)
> > {
> > JFreeChart chart = getChart();
> > if(chart != null)
> > chart.draw(graphics, new Rectangle(getWidth(), getHeight()));
> > return true;
> > }
> >
> > @Override
> > public synchronized int getWidth() {
> > return getDataChart().getWidth();
> > }
> >
> > @Override
> > public synchronized int getHeight() {
> > return getDataChart().getHeight();
> > }
> > };
> >
> > and the width and height used to produce the buffered image are "immutable".
> > A fix for this could be to re-write the method render() as
> >
> > protected byte[] render()
> > {
> > while (true)
> > {
> > final BufferedImage image = new BufferedImage(getWidth(), getHeight(),
> > type);
> > if (render((Graphics2D)image.getGraphics()))
> > {
> > return toImageData(image);
> > }
> > }
> > }
> > I don't know if this change could bring other side effects? Of course, as
> > the method is protected I could override it to do exactly what I want but I
> > thought it might be better (and useful) to ask the core developers first.
> >
> > I'm working with the SVN trunk (wicket 2.0).
> >
> > Best regards,
> >
> > Ernesto
> > --
> > View this message in context: http://www.nabble.com/problem-with-RenderedDynamicImageResource-%28wicket-2.0%29-tf2718555.html#a7579878
> > Sent from the Wicket - Dev mailing list archive at Nabble.com.
> >
> >
>
Re: problem with RenderedDynamicImageResource (wicket 2.0)
Posted by Eelco Hillenius <ee...@gmail.com>.
Yep, you're right. If you could open an issue for this, I'd be happy
to apply the changes.
Eelco
On 11/28/06, Ernesto Reinaldo Barreiro <re...@isencia.com> wrote:
>
> Hi,
>
> I have some problems in generating dynamic images (charts) and the they seem
> to be related to the method
>
> protected byte[] render()
> {
> while (true)
> {
> final BufferedImage image = new BufferedImage(width, height, type);
> if (render((Graphics2D)image.getGraphics()))
> {
> return toImageData(image);
> }
> }
> }
>
> of RenderedDynamicImageResource class. The problem appears because I want to
> do something like
>
> imageResource = new RenderedDynamicImageResource(dataChart.getWidth(),
> dataChart.getHeight()) {
>
> private static final long serialVersionUID = 1L;
>
> @Override
> protected boolean render(Graphics2D graphics)
> {
> JFreeChart chart = getChart();
> if(chart != null)
> chart.draw(graphics, new Rectangle(getWidth(), getHeight()));
> return true;
> }
>
> @Override
> public synchronized int getWidth() {
> return getDataChart().getWidth();
> }
>
> @Override
> public synchronized int getHeight() {
> return getDataChart().getHeight();
> }
> };
>
> and the width and height used to produce the buffered image are "immutable".
> A fix for this could be to re-write the method render() as
>
> protected byte[] render()
> {
> while (true)
> {
> final BufferedImage image = new BufferedImage(getWidth(), getHeight(),
> type);
> if (render((Graphics2D)image.getGraphics()))
> {
> return toImageData(image);
> }
> }
> }
> I don't know if this change could bring other side effects? Of course, as
> the method is protected I could override it to do exactly what I want but I
> thought it might be better (and useful) to ask the core developers first.
>
> I'm working with the SVN trunk (wicket 2.0).
>
> Best regards,
>
> Ernesto
> --
> View this message in context: http://www.nabble.com/problem-with-RenderedDynamicImageResource-%28wicket-2.0%29-tf2718555.html#a7579878
> Sent from the Wicket - Dev mailing list archive at Nabble.com.
>
>