Diffstat (limited to 'noncore/styles/theme/ogfxeffect.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/styles/theme/ogfxeffect.h | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/noncore/styles/theme/ogfxeffect.h b/noncore/styles/theme/ogfxeffect.h new file mode 100644 index 0000000..45a8482 --- a/dev/null +++ b/noncore/styles/theme/ogfxeffect.h | |||
@@ -0,0 +1,78 @@ | |||
1 | /* This file is part of the KDE libraries | ||
2 | Copyright (C) 1998, 1999 Christian Tibirna <ctibirna@total.net> | ||
3 | (C) 1998, 1999 Daniel M. Duley <mosfet@kde.org> | ||
4 | (C) 1998, 1999 Dirk A. Mueller <mueller@kde.org> | ||
5 | |||
6 | */ | ||
7 | |||
8 | // $Id$ | ||
9 | |||
10 | #ifndef __OGFX_EFFECT_H | ||
11 | #define __OGFX_EFFECT_H | ||
12 | |||
13 | #include <qpixmap.h> | ||
14 | #include <qimage.h> | ||
15 | |||
16 | /** | ||
17 | * This class includes various pixmap-based graphical effects. | ||
18 | * | ||
19 | * Everything is | ||
20 | * static, so there is no need to create an instance of this class. You can | ||
21 | * just call the static methods. They are encapsulated here merely to provide | ||
22 | * a common namespace. | ||
23 | */ | ||
24 | class OGfxEffect | ||
25 | { | ||
26 | public: | ||
27 | enum GradientType { VerticalGradient, HorizontalGradient, | ||
28 | DiagonalGradient, CrossDiagonalGradient, | ||
29 | PyramidGradient, RectangleGradient, | ||
30 | PipeCrossGradient, EllipticGradient }; | ||
31 | enum RGBComponent { Red, Green, Blue }; | ||
32 | |||
33 | enum Lighting {NorthLite, NWLite, WestLite, SWLite, | ||
34 | SouthLite, SELite, EastLite, NELite}; | ||
35 | |||
36 | /** | ||
37 | * Create a gradient from color a to color b of the specified type. | ||
38 | * | ||
39 | * @param pixmap The pixmap to process. | ||
40 | * @param ca Color a. | ||
41 | * @param cb Color b. | ||
42 | * @param type The type of gradient. | ||
43 | * @param ncols The number of colors to use when not running on a | ||
44 | * truecolor display. The gradient will be dithered to this number of | ||
45 | * colors. Pass 0 to prevent dithering. | ||
46 | * @return Returns the generated pixmap, for convenience. | ||
47 | */ | ||
48 | static QPixmap& gradient(QPixmap& pixmap, const QColor &ca, const QColor &cb, | ||
49 | GradientType type, int ncols=3); | ||
50 | |||
51 | |||
52 | /** | ||
53 | * Blend the provided pixmap into a background of the indicated color | ||
54 | * | ||
55 | * @param pixmap The pixmap to process. | ||
56 | * @param initial_intensity this parameter takes values from -1 to 1: | ||
57 | * @li If positive, it tells how much to fade the image in its | ||
58 | * less affected spot. | ||
59 | * @li If negative, it tells roughly indicates how much of the image | ||
60 | * remains unaffected | ||
61 | * @param bgnd Indicates the color of the background to blend in. | ||
62 | * @param eff Lets you choose what kind of blending you like. | ||
63 | * @param anti_dir Blend in the opposite direction (makes no much sense | ||
64 | * with concentric blending effects). | ||
65 | * @return Returns the @ref pixmap(), provided for convenience. | ||
66 | */ | ||
67 | static QPixmap& blend(QPixmap& pixmap, float initial_intensity, | ||
68 | const QColor &bgnd, GradientType eff, | ||
69 | bool anti_dir=false, int ncols=3); | ||
70 | |||
71 | |||
72 | static QImage& blend(QImage &image, float initial_intensity, | ||
73 | const QColor &bgnd, GradientType eff, | ||
74 | bool anti_dir); | ||
75 | }; | ||
76 | |||
77 | |||
78 | #endif | ||