01: package net.sourceforge.squirrel_sql.plugins.graph;
02:
03: import net.sourceforge.squirrel_sql.plugins.graph.xmlbeans.FormatXmlBean;
04:
05: import java.awt.*;
06:
07: public class PixelCalculater {
08: public static final double CM_BY_INCH = 1 / 2.54;
09:
10: private FormatXmlBean _format;
11: private double _sldValue = 1;
12:
13: public PixelCalculater(FormatXmlBean format, double sldValue) {
14: _format = format;
15: _sldValue = sldValue;
16: }
17:
18: public PixelCalculater(FormatXmlBean format) {
19: _format = format;
20: }
21:
22: // public int getPixelWidth()
23: // {
24: // int pixelByCm = (int) (Toolkit.getDefaultToolkit().getScreenResolution() * CM_BY_INCH + 0.5);
25: // return (int)(_format.getWidth() * pixelByCm + 0.5);
26: // }
27: //
28: // public int getPixelHeight()
29: // {
30: // int pixelByCm = (int) (Toolkit.getDefaultToolkit().getScreenResolution() * CM_BY_INCH + 0.5);
31: // return (int)(_format.getHeight() * pixelByCm + 0.5);
32: // }
33:
34: public int getPixelWidth() {
35: int pixelByCm = (int) (Toolkit.getDefaultToolkit()
36: .getScreenResolution()
37: * CM_BY_INCH + 0.5);
38: return (int) (_format.getWidth() * pixelByCm * _sldValue + 0.5);
39: }
40:
41: public int getPixelHeight() {
42: int pixelByCm = (int) (Toolkit.getDefaultToolkit()
43: .getScreenResolution()
44: * CM_BY_INCH + 0.5);
45: return (int) (_format.getHeight() * pixelByCm * _sldValue + 0.5);
46: }
47: }
|