File indexing completed on 2024-04-28 05:46:50
0001 /***************************************************************************** 0002 * Copyright 2009 - 2010 Craig Drummond <craig.p.drummond@gmail.com> * 0003 * Copyright 2013 - 2015 Yichao Yu <yyc1992@gmail.com> * 0004 * * 0005 * This program is free software; you can redistribute it and/or modify * 0006 * it under the terms of the GNU Lesser General Public License as * 0007 * published by the Free Software Foundation; either version 2.1 of the * 0008 * License, or (at your option) version 3, or any later version accepted * 0009 * by the membership of KDE e.V. (or its successor approved by the * 0010 * membership of KDE e.V.), which shall act as a proxy defined in * 0011 * Section 6 of version 3 of the license. * 0012 * * 0013 * This program is distributed in the hope that it will be useful, * 0014 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 0016 * Lesser General Public License for more details. * 0017 * * 0018 * You should have received a copy of the GNU Lesser General Public * 0019 * License along with this library. If not, * 0020 * see <http://www.gnu.org/licenses/>. * 0021 *****************************************************************************/ 0022 0023 #ifndef QTC_UTILS_SHADE_H 0024 #define QTC_UTILS_SHADE_H 0025 0026 #include "utils.h" 0027 #include "options.h" 0028 0029 #define QTC_NUM_STD_SHADES (6) 0030 /* 3d effect - i.e. buttons, etc */ 0031 static const double qtc_intern_shades[2][11][QTC_NUM_STD_SHADES] = { 0032 { 0033 /* HSV & HSL */ 0034 {1.05, 1.04, 0.90, 0.800, 0.830, 0.82}, 0035 {1.06, 1.04, 0.90, 0.790, 0.831, 0.78}, 0036 {1.07, 1.04, 0.90, 0.785, 0.832, 0.75}, 0037 {1.08, 1.05, 0.90, 0.782, 0.833, 0.72}, 0038 {1.09, 1.05, 0.90, 0.782, 0.834, 0.70}, 0039 {1.10, 1.06, 0.90, 0.782, 0.836, 0.68}, 0040 {1.12, 1.06, 0.90, 0.782, 0.838, 0.63}, 0041 {1.16, 1.07, 0.90, 0.782, 0.840, 0.62}, /* default */ 0042 {1.18, 1.07, 0.90, 0.783, 0.842, 0.60}, 0043 {1.20, 1.08, 0.90, 0.784, 0.844, 0.58}, 0044 {1.22, 1.08, 0.90, 0.786, 0.848, 0.55} 0045 }, { /* SIMPLE */ 0046 {1.07, 1.03, 0.91, 0.780, 0.834, 0.75}, 0047 {1.08, 1.03, 0.91, 0.781, 0.835, 0.74}, 0048 {1.09, 1.03, 0.91, 0.782, 0.836, 0.73}, 0049 {1.10, 1.04, 0.91, 0.783, 0.837, 0.72}, 0050 {1.11, 1.04, 0.91, 0.784, 0.838, 0.71}, 0051 {1.12, 1.05, 0.91, 0.785, 0.840, 0.70}, 0052 {1.13, 1.05, 0.91, 0.786, 0.842, 0.69}, 0053 {1.14, 1.06, 0.91, 0.787, 0.844, 0.68}, /* default */ 0054 {1.16, 1.06, 0.91, 0.788, 0.846, 0.66}, 0055 {1.18, 1.07, 0.91, 0.789, 0.848, 0.64}, 0056 {1.20, 1.07, 0.91, 0.790, 0.850, 0.62} 0057 } 0058 }; 0059 0060 #define QTC_STD_BORDER (5) 0061 0062 QTC_ALWAYS_INLINE static inline double 0063 qtcShadeGetIntern(int c, int s, bool darker, Shading shading) 0064 { 0065 if (c > 10 || c < 0 || s >= QTC_NUM_STD_SHADES || s < 0) { 0066 return 1.0; 0067 } 0068 double shade = qtc_intern_shades[Shading::Simple == shading ? 1 : 0][c][s]; 0069 if (darker && s == QTC_STD_BORDER) 0070 return shade - 0.1; 0071 return shade; 0072 } 0073 0074 #endif