Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » Chart dpi resolution
Chart dpi resolution [message #185346] Wed, 16 August 2006 15:02 Go to next message
Eclipse User
Originally posted by: jegd.ctv.es

Hi

I've been trying to use the chart engine to create a PNG representation of a chart. I've been following example 3.39 from the chart engice FAQ, and I successfully render the image file.
The thing is the resulting file has a 72dpi resolution. I've tried to change this value using the IDeviceRenderer property "DPI_RESOLUCION", setting it just before scaling the Bounds values.
The image I get looks like it's been rendered at the new resolution, but when I check the file properties, it's still a 72 dpi PNG file. Is there any way to get a 150 or 300 dpi image file,
or this is the intended behaviour?

Thanks.
Re: Chart dpi resolution [message #185525 is a reply to message #185346] Thu, 17 August 2006 08:26 Go to previous messageGo to next message
David Michonneau is currently offline David Michonneau
Messages: 1149
Registered: July 2009
Senior Member
That's strange, can you post your code?

Thanks,

David

<jegd@ctv.es> wrote in message news:ebvq38$5ta$1@utils.eclipse.org...
> Hi
>
> I've been trying to use the chart engine to create a PNG representation of
> a chart. I've been following example 3.39 from the chart engice FAQ, and I
> successfully render the image file.
> The thing is the resulting file has a 72dpi resolution. I've tried to
> change this value using the IDeviceRenderer property "DPI_RESOLUCION",
> setting it just before scaling the Bounds values.
> The image I get looks like it's been rendered at the new resolution, but
> when I check the file properties, it's still a 72 dpi PNG file. Is there
> any way to get a 150 or 300 dpi image file,
> or this is the intended behaviour?
>
> Thanks.
>
>
Re: Chart dpi resolution [message #185541 is a reply to message #185525] Thu, 17 August 2006 09:14 Go to previous messageGo to next message
Eclipse User
Originally posted by: jegd.ctv.es

Hi,

I've been using this function with the Charts created in the
PrimitiveCharts.java example. Try to generate a chart using the same
resolution, but changing the dpi value. All the PNG files generated have
the same resolution, and the same dpi, but the chart is rendered in
different ways.

Thanks.

public static void generarImagen(Chart chart, int width, int height, int
dpi) {

IDeviceRenderer idr = null;
GeneratedChartState gcs = null;
Bounds bo = null;

final PluginSettings ps = PluginSettings.instance( );

try {
idr = ps.getDevice( "dv.PNG");
} catch ( ChartException ex ) {
ex.printStackTrace( );
return;
}

idr.setProperty( IDeviceRenderer.DPI_RESOLUTION, new Integer(dpi));

idr.setProperty(IDeviceRenderer.FILE_IDENTIFIER, "chart.png");

bo = BoundsImpl.create( 0, 0, width, height);

bo.scale(72d / idr.getDisplayServer( ).getDpiResolution( ));

Generator gr = Generator.instance();

try {
gcs = gr.build( idr.getDisplayServer( ), chart, bo, null, null,
null );
gr.render( idr, gcs );
}catch ( ChartException ex ) {
ex.printStackTrace();
}

return;
}
Re: Chart dpi resolution [message #185587 is a reply to message #185541] Thu, 17 August 2006 10:32 Go to previous message
David Michonneau is currently offline David Michonneau
Messages: 1149
Registered: July 2009
Senior Member
Can you attach the outputs you get? If you increase the dpi, you should get
a PNG file with more pixels.

Thanks,

David

"Javier Gomez-Pardo Diaz" <jegd@ctv.es> wrote in message
news:5ceeed1e7dbb74e00265c7f37a3513cf$1@www.eclipse.org...
> Hi,
>
> I've been using this function with the Charts created in the
> PrimitiveCharts.java example. Try to generate a chart using the same
> resolution, but changing the dpi value. All the PNG files generated have
> the same resolution, and the same dpi, but the chart is rendered in
> different ways.
>
> Thanks.
>
> public static void generarImagen(Chart chart, int width, int height, int
> dpi) {
>
> IDeviceRenderer idr = null;
> GeneratedChartState gcs = null;
> Bounds bo = null;
>
> final PluginSettings ps = PluginSettings.instance( );
>
> try {
> idr = ps.getDevice( "dv.PNG");
> } catch ( ChartException ex ) {
> ex.printStackTrace( );
> return;
> }
>
> idr.setProperty( IDeviceRenderer.DPI_RESOLUTION, new Integer(dpi));
>
> idr.setProperty(IDeviceRenderer.FILE_IDENTIFIER, "chart.png");
>
> bo = BoundsImpl.create( 0, 0, width, height);
>
> bo.scale(72d / idr.getDisplayServer( ).getDpiResolution( ));
>
> Generator gr = Generator.instance();
>
> try {
> gcs = gr.build( idr.getDisplayServer( ), chart, bo, null, null,
> null );
> gr.render( idr, gcs );
> }catch ( ChartException ex ) {
> ex.printStackTrace();
> }
>
> return;
> }
>
>
>
Previous Topic:How to create a dependency between two XML data sets
Next Topic:Chart x-axis setting to logarithmic / linear does not work
Goto Forum:
  


Current Time: Sat Apr 19 00:44:07 EDT 2014

Powered by FUDForum. Page generated in 0.05705 seconds