File indexing completed on 2024-12-22 04:13:05

0001 /*
0002  *  SPDX-FileCopyrightText: 2019 Agata Cacko <cacko.azh@gmail.com>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 #ifndef KIS_SPIN_BOX_SPLINE_UNITS_CONVERTER_H
0008 #define KIS_SPIN_BOX_SPLINE_UNITS_CONVERTER_H
0009 
0010 #include <kritaui_export.h>
0011 
0012 
0013 
0014 /**
0015  * KisSpinBoxSplineUnitConverter is a class that converts points
0016  *  from ranges(0, 1) to ranges (min, max).
0017  * In case of reverted ranges (min > max),
0018  *  smaller values from range (0, 1) correspond
0019  *  to bigger values from range (min, max)
0020  *  and the other way around.
0021  * Example:
0022  *  3 from (0, 10) is 0.3 from (0, 1)
0023  *  3 from (10, 0) is 0.7 from (0, 1)
0024  */
0025 class KRITAUI_EXPORT KisSpinBoxSplineUnitConverter
0026 {
0027 
0028 public:
0029     double io2sp(int x, int min, int max);
0030     int sp2io(double x, int min, int max);
0031 
0032 };
0033 
0034 
0035 
0036 #endif // KIS_SPIN_BOX_SPLINE_UNITS_CONVERTER_H