diff options
| author | Dana Jansens <danakj@orodu.net> | 2003-01-20 20:20:06 +0000 |
|---|---|---|
| committer | Dana Jansens <danakj@orodu.net> | 2003-01-20 20:20:06 +0000 |
| commit | 25f0151154c90b1c72f049e200d942fb2c18ddc5 (patch) | |
| tree | 64cf6cfb2dc773b2f1f59cd8c63df16f110cf6a7 /otk/rendercontrol.cc | |
| parent | 68a6fce53badb38ba3dc387c4b5c86c02801f657 (diff) | |
drawSolidBackground seems to work :)
Diffstat (limited to 'otk/rendercontrol.cc')
| -rw-r--r-- | otk/rendercontrol.cc | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/otk/rendercontrol.cc b/otk/rendercontrol.cc index 0f84af89..189bbd6e 100644 --- a/otk/rendercontrol.cc +++ b/otk/rendercontrol.cc @@ -102,4 +102,89 @@ void RenderControl::drawString(Surface& sf, const Font &font, int x, int y, return; } +void RenderControl::drawSolidBackground(Surface& sf, + const RenderTexture& texture) const +{ + assert(_screen == sf._screen); + assert(_screen == texture.color().screen()); + + if (texture.parentRelative()) return; + + sf.setPixmap(texture.color()); + + int width = sf.width(), height = sf.height(); + int left = 0, top = 0, right = width - 1, bottom = height - 1; + + if (texture.interlaced()) + for (int i = 0; i < height; i += 2) + XDrawLine(**display, sf.pixmap(), texture.interlaceColor().gc(), + 0, i, width, i); + + switch (texture.relief()) { + case RenderTexture::Raised: + switch (texture.bevel()) { + case RenderTexture::Bevel1: + XDrawLine(**display, sf.pixmap(), texture.bevelDarkColor().gc(), + left, bottom, right, bottom); + XDrawLine(**display, sf.pixmap(), texture.bevelDarkColor().gc(), + right, bottom, right, top); + + XDrawLine(**display, sf.pixmap(), texture.bevelLightColor().gc(), + left, top, right, top); + XDrawLine(**display, sf.pixmap(), texture.bevelLightColor().gc(), + left, bottom, left, top); + break; + case RenderTexture::Bevel2: + XDrawLine(**display, sf.pixmap(), texture.bevelDarkColor().gc(), + left + 1, bottom - 2, right - 2, bottom - 2); + XDrawLine(**display, sf.pixmap(), texture.bevelDarkColor().gc(), + right - 2, bottom - 2, right - 2, top + 1); + + XDrawLine(**display, sf.pixmap(), texture.bevelLightColor().gc(), + left + 1, top + 1, right - 2, top + 1); + XDrawLine(**display, sf.pixmap(), texture.bevelLightColor().gc(), + left + 1, bottom - 2, left + 1, top + 1); + break; + default: + assert(false); // unhandled RenderTexture::BevelType + } + break; + case RenderTexture::Sunken: + switch (texture.bevel()) { + case RenderTexture::Bevel1: + XDrawLine(**display, sf.pixmap(), texture.bevelLightColor().gc(), + left, bottom, right, bottom); + XDrawLine(**display, sf.pixmap(), texture.bevelLightColor().gc(), + right, bottom, right, top); + + XDrawLine(**display, sf.pixmap(), texture.bevelDarkColor().gc(), + left, top, right, top); + XDrawLine(**display, sf.pixmap(), texture.bevelDarkColor().gc(), + left, bottom, left, top); + break; + case RenderTexture::Bevel2: + XDrawLine(**display, sf.pixmap(), texture.bevelLightColor().gc(), + left + 1, bottom - 2, right - 2, bottom - 2); + XDrawLine(**display, sf.pixmap(), texture.bevelLightColor().gc(), + right - 2, bottom - 2, right - 2, top + 1); + + XDrawLine(**display, sf.pixmap(), texture.bevelDarkColor().gc(), + left + 1, top + 1, right - 2, top + 1); + XDrawLine(**display, sf.pixmap(), texture.bevelDarkColor().gc(), + left + 1, bottom - 2, left + 1, top + 1); + break; + default: + assert(false); // unhandled RenderTexture::BevelType + } + break; + case RenderTexture::Flat: + if (texture.border()) + XDrawRectangle(**display, sf.pixmap(), texture.borderColor().gc(), + left, top, right, bottom); + break; + default: + assert(false); // unhandled RenderTexture::ReliefType + } +} + } |
