scantools
1.0.4
Graphics manipulation with a view towards scanned documents
|
The resolution class stores a resolution and converts between units. More...
#include <resolution.h>
Public Types | |
enum | unit { dpcm , dpi , dpm } |
List of supported units. More... | |
Public Member Functions | |
resolution () | |
Constructs a zero resolution. | |
resolution (qreal l, unit u) | |
Constructs resolution of given value and unit. More... | |
qreal | get (unit u) const |
Get numerical value for resolution. More... | |
void | set (qreal l, unit u) |
Sets resolution in given unit. More... | |
bool | isNonPositive () const |
Check if resolution is zero or less. More... | |
bool | isZero () const |
Fuzzy check if resolution is zero. More... | |
bool | isValid () const |
Check if resolution is valid. More... | |
operator QString () const | |
Convert to string. More... | |
bool | operator== (const resolution other) const |
Check for equality. More... | |
Static Public Attributes | |
static const int | minResDPI = 10 |
Minimal resolution handled by scantools. More... | |
static const int | maxResDPI = 10000 |
Maximal resolution handled by scantools. More... | |
Friends | |
resolution | qMax (const resolution res1, const resolution res2) |
Find the maximum of two resolutions. More... | |
Related Functions | |
(Note that these are not member functions.) | |
length | operator/ (qreal numerator, const resolution denominator) |
Divide a scalar ("number of dots") by a resolution to obtain a length. More... | |
resolution | operator/ (qreal numerator, const length denominator) |
Divide a scalar by a length to obtain a resolution. More... | |
The resolution class stores a resolution and converts between units.
This is a trivial class that helps with resolution storage and conversions. Resolutiones are stored intenally in 1/100 dot/cm, which allows conversions between units without rounding error.
The class "resolution" is known to the QMetaType systen and can be used as a custom type in QVariant.
Definition at line 39 of file resolution.h.
enum resolution::unit |
List of supported units.
Enumerator | |
---|---|
dpcm | Pixel per Centimeter. |
dpi | Pixel per Inch. |
dpm | Pixel per Millimeter. |
Definition at line 53 of file resolution.h.
|
inline |
Constructs resolution of given value and unit.
l | Length |
u | Unit |
Definition at line 69 of file resolution.h.
qreal resolution::get | ( | unit | u | ) | const |
Get numerical value for resolution.
u | Unit |
|
inline |
Check if resolution is zero or less.
Definition at line 92 of file resolution.h.
|
inline |
Check if resolution is valid.
Definition at line 108 of file resolution.h.
|
inline |
Fuzzy check if resolution is zero.
Definition at line 100 of file resolution.h.
|
inline |
Convert to string.
Definition at line 116 of file resolution.h.
|
inline |
Check for equality.
other | Other resolution |
Definition at line 126 of file resolution.h.
void resolution::set | ( | qreal | l, |
unit | u | ||
) |
Sets resolution in given unit.
l | Length |
u | Unit |
|
related |
Divide a scalar by a length to obtain a resolution.
numerator | Scalar ("Number of dots") |
denominator | length |
Definition at line 179 of file resolution.h.
|
related |
Divide a scalar ("number of dots") by a resolution to obtain a length.
numerator | Scalar ("Number of dots") |
denominator | Resolution |
Definition at line 164 of file resolution.h.
|
friend |
Find the maximum of two resolutions.
Maximum of two resolutions.
res1 | First resolution |
res2 | Second resolution |
Definition at line 185 of file resolution.h.
|
static |
Maximal resolution handled by scantools.
All classes, functions and methods of this library require that all numbers describing graphical resolution are smaller than or equal to maxRes, which is specified in dots per inch.
Definition at line 145 of file resolution.h.
|
static |
Minimal resolution handled by scantools.
All classes, functions and methods of this library require that all numbers describing graphical resolution are larger than or equal to minRes, which is specified in dots per inch.
Definition at line 137 of file resolution.h.