Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

otk::Surface Class Reference

#include <surface.hh>

Collaboration diagram for otk::Surface:

Collaboration graph
[legend]
List of all members.

Public Methods

 Surface (int screen, const Point &size)
virtual ~Surface ()
int screen (void) const
virtual const Pointsize () const
virtual int width () const
virtual int height () const
virtual Pixmap pixmap () const

Protected Methods

void createObjects ()
void destroyObjects ()
void setPixmap (XImage *image)
void setPixmap (const RenderColor &color)

Private Attributes

int _screen
Point _size
Pixmap _pixmap
XftDraw * _xftdraw

Friends

class RenderControl
class TrueRenderControl
class PseudoRenderControl

Constructor & Destructor Documentation

otk::Surface::Surface int    screen,
const Point   size
 

Definition at line 18 of file surface.cc.

00019   : _screen(screen),
00020     _size(size),
00021     _pixmap(None),
00022     _xftdraw(0)
00023 {
00024 }

otk::Surface::~Surface   [virtual]
 

Definition at line 26 of file surface.cc.

References destroyObjects().

00027 {
00028   destroyObjects();
00029 }


Member Function Documentation

void otk::Surface::createObjects   [protected]
 

Definition at line 52 of file surface.cc.

References _pixmap, _size, _xftdraw, otk::ScreenInfo::colormap(), otk::ScreenInfo::depth(), otk::display, otk::ScreenInfo::rootWindow(), otk::Display::screenInfo(), otk::ScreenInfo::visual(), otk::Point::x(), and otk::Point::y().

Referenced by setPixmap().

00053 {
00054   assert(_pixmap == None); assert(!_xftdraw);
00055 
00056   const ScreenInfo *info = display->screenInfo(_screen);
00057   
00058   _pixmap = XCreatePixmap(**display, info->rootWindow(),
00059                           _size.x(), _size.y(), info->depth());
00060   assert(_pixmap != None);
00061     
00062   _xftdraw = XftDrawCreate(**display, _pixmap,
00063                            info->visual(), info->colormap());
00064   assert(_xftdraw);
00065 }

void otk::Surface::destroyObjects   [protected]
 

Definition at line 67 of file surface.cc.

References _pixmap, and _xftdraw.

Referenced by ~Surface().

00068 {
00069   if (_xftdraw) {
00070     XftDrawDestroy(_xftdraw);
00071     _xftdraw = 0;
00072   }
00073 
00074   if (_pixmap != None) {
00075     XFreePixmap(**display, _pixmap);
00076     _pixmap = None;
00077   }
00078 }

virtual int otk::Surface::height void    const [inline, virtual]
 

Definition at line 41 of file surface.hh.

References otk::Point::y().

Referenced by otk::TrueRenderControl::crossDiagonalGradient(), otk::TrueRenderControl::diagonalGradient(), otk::TrueRenderControl::drawGradientBackground(), otk::RenderControl::drawSolidBackground(), and otk::TrueRenderControl::verticalGradient().

00041 { return _size.y(); }

virtual Pixmap otk::Surface::pixmap   const [inline, virtual]
 

Definition at line 43 of file surface.hh.

Referenced by otk::RenderControl::drawSolidBackground(), and otk::Widget::render().

00043 { return _pixmap; }

int otk::Surface::screen void    const [inline]
 

Definition at line 37 of file surface.hh.

00037 { return _screen; }

void otk::Surface::setPixmap const RenderColor   color [protected]
 

Definition at line 31 of file surface.cc.

References _pixmap, _size, createObjects(), otk::RenderColor::gc(), otk::Point::x(), and otk::Point::y().

00032 {
00033   if (_pixmap == None)
00034     createObjects();
00035 
00036   XFillRectangle(**display, _pixmap, color.gc(), 0, 0,
00037                  _size.x(), _size.y());
00038 }

void otk::Surface::setPixmap XImage *    image [protected]
 

Definition at line 40 of file surface.cc.

References _pixmap, _size, createObjects(), otk::Point::x(), and otk::Point::y().

Referenced by otk::TrueRenderControl::drawGradientBackground(), and otk::RenderControl::drawSolidBackground().

00041 {
00042   assert(image->width == _size.x());
00043   assert(image->height == _size.y());
00044   
00045   if (_pixmap == None)
00046     createObjects();
00047 
00048   XPutImage(**display, _pixmap, DefaultGC(**display, _screen),
00049             image, 0, 0, 0, 0, _size.x(), _size.y());
00050 }

virtual const Point& otk::Surface::size   const [inline, virtual]
 

Definition at line 39 of file surface.hh.

00039 { return _size; }

virtual int otk::Surface::width void    const [inline, virtual]
 

Definition at line 40 of file surface.hh.

References otk::Point::x().

Referenced by otk::TrueRenderControl::crossDiagonalGradient(), otk::TrueRenderControl::diagonalGradient(), otk::TrueRenderControl::drawGradientBackground(), otk::RenderControl::drawSolidBackground(), and otk::TrueRenderControl::verticalGradient().

00040 { return _size.x(); }


Friends And Related Function Documentation

friend class PseudoRenderControl [friend]
 

Definition at line 49 of file surface.hh.

friend class RenderControl [friend]
 

Definition at line 47 of file surface.hh.

friend class TrueRenderControl [friend]
 

Definition at line 48 of file surface.hh.


Member Data Documentation

Pixmap otk::Surface::_pixmap [private]
 

Definition at line 23 of file surface.hh.

Referenced by createObjects(), destroyObjects(), and setPixmap().

int otk::Surface::_screen [private]
 

Definition at line 21 of file surface.hh.

Referenced by otk::TrueRenderControl::drawBackground(), otk::PseudoRenderControl::drawBackground(), otk::RenderControl::drawSolidBackground(), and otk::RenderControl::drawString().

Point otk::Surface::_size [private]
 

Definition at line 22 of file surface.hh.

Referenced by createObjects(), and setPixmap().

XftDraw* otk::Surface::_xftdraw [private]
 

Definition at line 24 of file surface.hh.

Referenced by createObjects(), destroyObjects(), and otk::RenderControl::drawString().


The documentation for this class was generated from the following files:
Generated on Tue Feb 4 23:00:29 2003 for Openbox by doxygen1.3-rc2