#include <rendercontrol.hh>
Inheritance diagram for otk::RenderControl:

Public Methods | |
| virtual | ~RenderControl () |
| virtual void | drawRoot (const RenderColor &color) const |
| virtual void | drawString (Surface &sf, const Font &font, int x, int y, const RenderColor &color, const ustring &string) const |
| Draws a string onto a Surface. | |
| virtual void | drawBackground (Surface &sf, const RenderTexture &texture) const=0 |
| Draws a background onto a Surface, as specified by a RenderTexture. | |
Static Public Methods | |
| RenderControl * | getRenderControl (int screen) |
Protected Methods | |
| RenderControl (int screen) | |
| virtual void | drawSolidBackground (Surface &sf, const RenderTexture &texture) const |
Protected Attributes | |
| int | _screen |
|
|
Definition at line 49 of file rendercontrol.cc.
00050 : _screen(screen) 00051 { 00052 printf("Initializing RenderControl\n"); 00053 00054 00055 } |
|
|
Definition at line 57 of file rendercontrol.cc.
00058 {
00059 printf("Destroying RenderControl\n");
00060
00061
00062 }
|
|
||||||||||||
|
Draws a background onto a Surface, as specified by a RenderTexture.
Implemented in otk::PseudoRenderControl, and otk::TrueRenderControl. Referenced by otk::Widget::render(). |
|
|
Definition at line 64 of file rendercontrol.cc. References otk::display, otk::RenderColor::pixel(), otk::ScreenInfo::rootWindow(), and otk::Display::screenInfo().
00065 {
00066 Window root = display->screenInfo(_screen)->rootWindow();
00067 XSetWindowBackground(**display, root, color.pixel());
00068 XClearWindow(**display, root);
00069 }
|
|
||||||||||||
|
Definition at line 113 of file rendercontrol.cc. References otk::Surface::_screen, otk::RenderTexture::bevel(), otk::RenderTexture::bevelDarkColor(), otk::RenderTexture::bevelLightColor(), otk::RenderTexture::border(), otk::RenderTexture::borderColor(), otk::RenderTexture::color(), otk::RenderColor::gc(), otk::Surface::height(), otk::RenderTexture::interlaceColor(), otk::RenderTexture::interlaced(), otk::RenderTexture::parentRelative(), otk::Surface::pixmap(), otk::RenderTexture::relief(), otk::RenderColor::screen(), otk::Surface::setPixmap(), and otk::Surface::width(). Referenced by otk::TrueRenderControl::drawBackground(), and otk::PseudoRenderControl::drawBackground().
00115 {
00116 assert(_screen == sf._screen);
00117 assert(_screen == texture.color().screen());
00118
00119 if (texture.parentRelative()) return;
00120
00121 sf.setPixmap(texture.color());
00122
00123 int width = sf.width(), height = sf.height();
00124 int left = 0, top = 0, right = width - 1, bottom = height - 1;
00125
00126 if (texture.interlaced())
00127 for (int i = 0; i < height; i += 2)
00128 XDrawLine(**display, sf.pixmap(), texture.interlaceColor().gc(),
00129 0, i, width, i);
00130
00131 switch (texture.relief()) {
00132 case RenderTexture::Raised:
00133 switch (texture.bevel()) {
00134 case RenderTexture::Bevel1:
00135 XDrawLine(**display, sf.pixmap(), texture.bevelDarkColor().gc(),
00136 left, bottom, right, bottom);
00137 XDrawLine(**display, sf.pixmap(), texture.bevelDarkColor().gc(),
00138 right, bottom, right, top);
00139
00140 XDrawLine(**display, sf.pixmap(), texture.bevelLightColor().gc(),
00141 left, top, right, top);
00142 XDrawLine(**display, sf.pixmap(), texture.bevelLightColor().gc(),
00143 left, bottom, left, top);
00144 break;
00145 case RenderTexture::Bevel2:
00146 XDrawLine(**display, sf.pixmap(), texture.bevelDarkColor().gc(),
00147 left + 1, bottom - 2, right - 2, bottom - 2);
00148 XDrawLine(**display, sf.pixmap(), texture.bevelDarkColor().gc(),
00149 right - 2, bottom - 2, right - 2, top + 1);
00150
00151 XDrawLine(**display, sf.pixmap(), texture.bevelLightColor().gc(),
00152 left + 1, top + 1, right - 2, top + 1);
00153 XDrawLine(**display, sf.pixmap(), texture.bevelLightColor().gc(),
00154 left + 1, bottom - 2, left + 1, top + 1);
00155 break;
00156 default:
00157 assert(false); // unhandled RenderTexture::BevelType
00158 }
00159 break;
00160 case RenderTexture::Sunken:
00161 switch (texture.bevel()) {
00162 case RenderTexture::Bevel1:
00163 XDrawLine(**display, sf.pixmap(), texture.bevelLightColor().gc(),
00164 left, bottom, right, bottom);
00165 XDrawLine(**display, sf.pixmap(), texture.bevelLightColor().gc(),
00166 right, bottom, right, top);
00167
00168 XDrawLine(**display, sf.pixmap(), texture.bevelDarkColor().gc(),
00169 left, top, right, top);
00170 XDrawLine(**display, sf.pixmap(), texture.bevelDarkColor().gc(),
00171 left, bottom, left, top);
00172 break;
00173 case RenderTexture::Bevel2:
00174 XDrawLine(**display, sf.pixmap(), texture.bevelLightColor().gc(),
00175 left + 1, bottom - 2, right - 2, bottom - 2);
00176 XDrawLine(**display, sf.pixmap(), texture.bevelLightColor().gc(),
00177 right - 2, bottom - 2, right - 2, top + 1);
00178
00179 XDrawLine(**display, sf.pixmap(), texture.bevelDarkColor().gc(),
00180 left + 1, top + 1, right - 2, top + 1);
00181 XDrawLine(**display, sf.pixmap(), texture.bevelDarkColor().gc(),
00182 left + 1, bottom - 2, left + 1, top + 1);
00183 break;
00184 default:
00185 assert(false); // unhandled RenderTexture::BevelType
00186 }
00187 break;
00188 case RenderTexture::Flat:
00189 if (texture.border())
00190 XDrawRectangle(**display, sf.pixmap(), texture.borderColor().gc(),
00191 left, top, right, bottom);
00192 break;
00193 default:
00194 assert(false); // unhandled RenderTexture::ReliefType
00195 }
00196 }
|
|
||||||||||||||||||||||||||||
|
Draws a string onto a Surface.
Definition at line 71 of file rendercontrol.cc. References otk::Font::_offset, otk::Surface::_screen, otk::Font::_shadow, otk::Font::_tint, otk::Surface::_xftdraw, otk::Font::_xftfont, otk::RenderColor::blue(), otk::ustring::bytes(), otk::ustring::c_str(), otk::RenderColor::green(), otk::RenderColor::pixel(), otk::RenderColor::red(), and otk::ustring::utf8().
00074 {
00075 assert(sf._screen == _screen);
00076 XftDraw *d = sf._xftdraw;
00077 assert(d); // this means that the background hasn't been rendered yet!
00078
00079 if (font._shadow) {
00080 XftColor c;
00081 c.color.red = 0;
00082 c.color.green = 0;
00083 c.color.blue = 0;
00084 c.color.alpha = font._tint | font._tint << 8; // transparent shadow
00085 c.pixel = BlackPixel(**display, _screen);
00086
00087 if (string.utf8())
00088 XftDrawStringUtf8(d, &c, font._xftfont, x + font._offset,
00089 font._xftfont->ascent + y + font._offset,
00090 (FcChar8*)string.c_str(), string.bytes());
00091 else
00092 XftDrawString8(d, &c, font._xftfont, x + font._offset,
00093 font._xftfont->ascent + y + font._offset,
00094 (FcChar8*)string.c_str(), string.bytes());
00095 }
00096
00097 XftColor c;
00098 c.color.red = color.red() | color.red() << 8;
00099 c.color.green = color.green() | color.green() << 8;
00100 c.color.blue = color.blue() | color.blue() << 8;
00101 c.pixel = color.pixel();
00102 c.color.alpha = 0xff | 0xff << 8; // no transparency in Color yet
00103
00104 if (string.utf8())
00105 XftDrawStringUtf8(d, &c, font._xftfont, x, font._xftfont->ascent + y,
00106 (FcChar8*)string.c_str(), string.bytes());
00107 else
00108 XftDrawString8(d, &c, font._xftfont, x, font._xftfont->ascent + y,
00109 (FcChar8*)string.c_str(), string.bytes());
00110 return;
00111 }
|
|
|
Definition at line 29 of file rendercontrol.cc. References _, otk::display, otk::Display::screenInfo(), and otk::ScreenInfo::visual().
00030 {
00031 // get the visual on the screen and return the correct type of RenderControl
00032 int vclass = display->screenInfo(screen)->visual()->c_class;
00033 switch (vclass) {
00034 case TrueColor:
00035 return new TrueRenderControl(screen);
00036 case PseudoColor:
00037 case StaticColor:
00038 return new PseudoRenderControl(screen);
00039 case GrayScale:
00040 case StaticGray:
00041 return new PseudoRenderControl(screen);
00042 default:
00043 printf(_("RenderControl: Unsupported visual %d specified. Aborting.\n"),
00044 vclass);
00045 ::exit(1);
00046 }
00047 }
|
|
|
Definition at line 21 of file rendercontrol.hh. |
1.3-rc2