diff options
author | rathnor <rathnor> | 2004-08-26 16:37:48 (GMT) |
---|---|---|
committer | rathnor <rathnor> | 2004-08-26 16:37:48 (GMT) |
commit | 0f83e449727a16c178b47262f170e879a22c0981 (patch) | |
tree | d167b77a07b99c931402d699ad6b1f2c90bed757 /src/FbTk/Texture.cc | |
parent | 346a6598a62350c5d234e3177de9e6c6c1963475 (diff) | |
download | fluxbox-0f83e449727a16c178b47262f170e879a22c0981.zip fluxbox-0f83e449727a16c178b47262f170e879a22c0981.tar.bz2 |
fix rendering of bevels for textures with solid textures
Diffstat (limited to 'src/FbTk/Texture.cc')
-rw-r--r-- | src/FbTk/Texture.cc | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/src/FbTk/Texture.cc b/src/FbTk/Texture.cc index 41314ce..dbf9cf5 100644 --- a/src/FbTk/Texture.cc +++ b/src/FbTk/Texture.cc | |||
@@ -22,10 +22,12 @@ | |||
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
23 | // DEALINGS IN THE SOFTWARE. | 23 | // DEALINGS IN THE SOFTWARE. |
24 | 24 | ||
25 | // $Id: Texture.cc,v 1.8 2004/01/11 21:04:21 fluxgen Exp $ | 25 | // $Id: Texture.cc,v 1.9 2004/08/26 16:37:48 rathnor Exp $ |
26 | 26 | ||
27 | #include "App.hh" | ||
27 | #include "Texture.hh" | 28 | #include "Texture.hh" |
28 | 29 | ||
30 | #include <X11/Xlib.h> | ||
29 | #include <cstring> | 31 | #include <cstring> |
30 | #include <cctype> | 32 | #include <cctype> |
31 | 33 | ||
@@ -100,4 +102,43 @@ void Texture::setFromString(const char * const texture_str) { | |||
100 | delete [] ts; | 102 | delete [] ts; |
101 | } | 103 | } |
102 | 104 | ||
105 | void Texture::calcHiLoColors(int screen_num) { | ||
106 | Display *disp = FbTk::App::instance()->display(); | ||
107 | XColor xcol; | ||
108 | Colormap colm = DefaultColormap(disp, screen_num); | ||
109 | |||
110 | xcol.red = (unsigned int) (m_color.red() + | ||
111 | (m_color.red() >> 1)); | ||
112 | if (xcol.red >= 0xff) xcol.red = 0xffff; | ||
113 | else xcol.red *= 0xff; | ||
114 | xcol.green = (unsigned int) (m_color.green() + | ||
115 | (m_color.green() >> 1)); | ||
116 | if (xcol.green >= 0xff) xcol.green = 0xffff; | ||
117 | else xcol.green *= 0xff; | ||
118 | xcol.blue = (unsigned int) (m_color.blue() + | ||
119 | (m_color.blue() >> 1)); | ||
120 | if (xcol.blue >= 0xff) xcol.blue = 0xffff; | ||
121 | else xcol.blue *= 0xff; | ||
122 | |||
123 | if (! XAllocColor(disp, colm, &xcol)) | ||
124 | xcol.pixel = 0; | ||
125 | |||
126 | m_hicolor.setPixel(xcol.pixel); | ||
127 | |||
128 | xcol.red = | ||
129 | (unsigned int) ((m_color.red() >> 2) + | ||
130 | (m_color.red() >> 1)) * 0xff; | ||
131 | xcol.green = | ||
132 | (unsigned int) ((m_color.green() >> 2) + | ||
133 | (m_color.green() >> 1)) * 0xff; | ||
134 | xcol.blue = | ||
135 | (unsigned int) ((m_color.blue() >> 2) + | ||
136 | (m_color.blue() >> 1)) * 0xff; | ||
137 | |||
138 | if (! XAllocColor(disp, colm, &xcol)) | ||
139 | xcol.pixel = 0; | ||
140 | |||
141 | m_locolor.setPixel(xcol.pixel); | ||
142 | } | ||
143 | |||
103 | }; // end namespace FbTk | 144 | }; // end namespace FbTk |