fix rendering of bevels for textures with solid textures
rathnor rathnor
4 files changed,
53 insertions(+),
4 deletions(-)
M
ChangeLog
→
ChangeLog
@@ -1,6 +1,8 @@
(Format: Year/Month/Day) Changes for 0.9.10: *04/08/26: + * Fix bevel on solid colour textures (Simon) + FbTk/Texture.hh/cc FbTk/ThemeItems.hh * Make arrow in toolbar buttons scalable size (Simon) - new theme item: toolbar.button.scale: <number> The number is a scale factor, which is divided into 100 to give
M
src/FbTk/Texture.cc
→
src/FbTk/Texture.cc
@@ -22,10 +22,12 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Texture.cc,v 1.8 2004/01/11 21:04:21 fluxgen Exp $ +// $Id: Texture.cc,v 1.9 2004/08/26 16:37:48 rathnor Exp $ +#include "App.hh" #include "Texture.hh" +#include <X11/Xlib.h> #include <cstring> #include <cctype>@@ -98,6 +100,45 @@ addType(Texture::TILED);
} delete [] ts; +} + +void Texture::calcHiLoColors(int screen_num) { + Display *disp = FbTk::App::instance()->display(); + XColor xcol; + Colormap colm = DefaultColormap(disp, screen_num); + + xcol.red = (unsigned int) (m_color.red() + + (m_color.red() >> 1)); + if (xcol.red >= 0xff) xcol.red = 0xffff; + else xcol.red *= 0xff; + xcol.green = (unsigned int) (m_color.green() + + (m_color.green() >> 1)); + if (xcol.green >= 0xff) xcol.green = 0xffff; + else xcol.green *= 0xff; + xcol.blue = (unsigned int) (m_color.blue() + + (m_color.blue() >> 1)); + if (xcol.blue >= 0xff) xcol.blue = 0xffff; + else xcol.blue *= 0xff; + + if (! XAllocColor(disp, colm, &xcol)) + xcol.pixel = 0; + + m_hicolor.setPixel(xcol.pixel); + + xcol.red = + (unsigned int) ((m_color.red() >> 2) + + (m_color.red() >> 1)) * 0xff; + xcol.green = + (unsigned int) ((m_color.green() >> 2) + + (m_color.green() >> 1)) * 0xff; + xcol.blue = + (unsigned int) ((m_color.blue() >> 2) + + (m_color.blue() >> 1)) * 0xff; + + if (! XAllocColor(disp, colm, &xcol)) + xcol.pixel = 0; + + m_locolor.setPixel(xcol.pixel); } }; // end namespace FbTk
M
src/FbTk/Texture.hh
→
src/FbTk/Texture.hh
@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Texture.hh,v 1.6 2003/12/16 17:06:52 fluxgen Exp $ +// $Id: Texture.hh,v 1.7 2004/08/26 16:37:48 rathnor Exp $ #ifndef FBTK_TEXTURE_HH #define FBTK_TEXTURE_HH@@ -82,6 +82,8 @@ Color &hiColor() { return m_hicolor; }
Color &loColor() { return m_locolor; } FbPixmap &pixmap() { return m_pixmap; } + + void calcHiLoColors(int screen_num); const Color &color() const { return m_color; } const Color &colorTo() const { return m_color_to; }
M
src/FbTk/ThemeItems.hh
→
src/FbTk/ThemeItems.hh
@@ -19,7 +19,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: ThemeItems.hh,v 1.6 2004/04/26 15:04:37 rathnor Exp $ +// $Id: ThemeItems.hh,v 1.7 2004/08/26 16:37:48 rathnor Exp $ /// @file implements common theme items@@ -128,7 +128,11 @@
if (!m_value.colorTo().setFromString(colorto_name.c_str(), m_tm.screenNum())) m_value.colorTo().setFromString("white", m_tm.screenNum()); - + + + if ((m_value.type() & FbTk::Texture::SOLID) != 0 && (m_value.type() & FbTk::Texture::FLAT) == 0) + m_value.calcHiLoColors(m_tm.screenNum()); + StringUtil::removeFirstWhitespace(pixmap_name); StringUtil::removeTrailingWhitespace(pixmap_name); if (pixmap_name.empty()) {