Home » Archived » BIRT » Chart dpi resolution
Chart dpi resolution [message #185346] |
Wed, 16 August 2006 19:02 |
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 #185541 is a reply to message #185525] |
Thu, 17 August 2006 13:14 |
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 14:32 |
David Michonneau Messages: 1145 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;
> }
>
>
>
|
|
|
Goto Forum:
Current Time: Wed Apr 24 18:45:19 GMT 2024
Powered by FUDForum. Page generated in 0.03620 seconds
|