WebKit Roll 139323:139374.
[chromium-blink-merge.git] / printing / units.h
blob8f028324301ab7f02915bd8a54af4258318aae5a
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef PRINTING_UNITS_H_
6 #define PRINTING_UNITS_H_
8 #include "printing/printing_export.h"
10 namespace printing {
12 // Length of a thousanth of inches in 0.01mm unit.
13 const int kHundrethsMMPerInch = 2540;
15 // Length of an inch in CSS's 1pt unit.
16 // http://dev.w3.org/csswg/css3-values/#absolute-length-units-cm-mm.-in-pt-pc
17 const int kPointsPerInch = 72;
19 // Length of an inch in CSS's 1px unit.
20 // http://dev.w3.org/csswg/css3-values/#the-px-unit
21 const int kPixelsPerInch = 96;
23 // Converts from one unit system to another using integer arithmetics.
24 PRINTING_EXPORT int ConvertUnit(int value, int old_unit, int new_unit);
26 // Converts from one unit system to another using doubles.
27 PRINTING_EXPORT double ConvertUnitDouble(double value, double old_unit,
28 double new_unit);
30 // Converts from 0.001 inch unit to 0.00001 meter.
31 PRINTING_EXPORT int ConvertMilliInchToHundredThousanthMeter(int milli_inch);
33 // Converts from 0.00001 meter unit to 0.001 inch.
34 PRINTING_EXPORT int ConvertHundredThousanthMeterToMilliInch(int cmm);
36 // Converts from 1 pixel to 1 point using integers.
37 PRINTING_EXPORT int ConvertPixelsToPoint(int pixels);
39 // Converts from 1 pixel to 1 point using doubles.
40 PRINTING_EXPORT double ConvertPixelsToPointDouble(double pixels);
42 // Converts from 1 point to 1 pixel using doubles.
43 double ConvertPointsToPixelDouble(double points);
45 } // namespace printing
47 #endif // PRINTING_UNITS_H_