| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef PRINTING_UNITS_H_ | 5 #ifndef PRINTING_UNITS_H_ |
| 6 #define PRINTING_UNITS_H_ | 6 #define PRINTING_UNITS_H_ |
| 7 | 7 |
| 8 #include "printing/printing_export.h" |
| 9 |
| 8 namespace printing { | 10 namespace printing { |
| 9 | 11 |
| 10 // Length of a thousanth of inches in 0.01mm unit. | 12 // Length of a thousanth of inches in 0.01mm unit. |
| 11 const int kHundrethsMMPerInch = 2540; | 13 const int kHundrethsMMPerInch = 2540; |
| 12 | 14 |
| 13 // Length of an inch in CSS's 1pt unit. | 15 // Length of an inch in CSS's 1pt unit. |
| 14 // http://dev.w3.org/csswg/css3-values/#absolute-length-units-cm-mm.-in-pt-pc | 16 // http://dev.w3.org/csswg/css3-values/#absolute-length-units-cm-mm.-in-pt-pc |
| 15 const int kPointsPerInch = 72; | 17 const int kPointsPerInch = 72; |
| 16 | 18 |
| 17 // Length of an inch in CSS's 1px unit. | 19 // Length of an inch in CSS's 1px unit. |
| 18 // http://dev.w3.org/csswg/css3-values/#the-px-unit | 20 // http://dev.w3.org/csswg/css3-values/#the-px-unit |
| 19 const int kPixelsPerInch = 96; | 21 const int kPixelsPerInch = 96; |
| 20 | 22 |
| 21 // Converts from one unit system to another using integer arithmetics. | 23 // Converts from one unit system to another using integer arithmetics. |
| 22 int ConvertUnit(int value, int old_unit, int new_unit); | 24 PRINTING_EXPORT int ConvertUnit(int value, int old_unit, int new_unit); |
| 23 | 25 |
| 24 // Converts from one unit system to another using doubles. | 26 // Converts from one unit system to another using doubles. |
| 25 double ConvertUnitDouble(double value, double old_unit, double new_unit); | 27 PRINTING_EXPORT double ConvertUnitDouble(double value, double old_unit, |
| 28 double new_unit); |
| 26 | 29 |
| 27 // Converts from 0.001 inch unit to 0.00001 meter. | 30 // Converts from 0.001 inch unit to 0.00001 meter. |
| 28 int ConvertMilliInchToHundredThousanthMeter(int milli_inch); | 31 PRINTING_EXPORT int ConvertMilliInchToHundredThousanthMeter(int milli_inch); |
| 29 | 32 |
| 30 // Converts from 0.00001 meter unit to 0.001 inch. | 33 // Converts from 0.00001 meter unit to 0.001 inch. |
| 31 int ConvertHundredThousanthMeterToMilliInch(int cmm); | 34 PRINTING_EXPORT int ConvertHundredThousanthMeterToMilliInch(int cmm); |
| 32 | 35 |
| 33 // Converts from 1 pixel to 1 point using integers. | 36 // Converts from 1 pixel to 1 point using integers. |
| 34 int ConvertPixelsToPoint(int pixels); | 37 PRINTING_EXPORT int ConvertPixelsToPoint(int pixels); |
| 35 | 38 |
| 36 // Converts from 1 pixel to 1 point using doubles. | 39 // Converts from 1 pixel to 1 point using doubles. |
| 37 double ConvertPixelsToPointDouble(double pixels); | 40 PRINTING_EXPORT double ConvertPixelsToPointDouble(double pixels); |
| 38 | 41 |
| 39 // Converts from 1 point to 1 pixel using doubles. | 42 // Converts from 1 point to 1 pixel using doubles. |
| 40 double ConvertPointsToPixelDouble(double points); | 43 double ConvertPointsToPixelDouble(double points); |
| 41 | 44 |
| 42 // Splits the horizontal width equally into segments with an interstice | 45 // Splits the horizontal width equally into segments with an interstice |
| 43 // between each segment. Returns the width of a segment. | 46 // between each segment. Returns the width of a segment. |
| 44 double GetHeaderFooterSegmentWidth(double page_width); | 47 PRINTING_EXPORT double GetHeaderFooterSegmentWidth(double page_width); |
| 45 | 48 |
| 46 } // namespace printing | 49 } // namespace printing |
| 47 | 50 |
| 48 #endif // PRINTING_UNITS_H_ | 51 #endif // PRINTING_UNITS_H_ |
| OLD | NEW |