osgEarth 2.1.1
|
Public Member Functions | |
RoundedFrame () | |
virtual void | draw (const ControlContext &cx, DrawableList &drawables) |
RoundedFrame::RoundedFrame | ( | ) |
Definition at line 1045 of file Controls.cpp.
{
//nop
}
void RoundedFrame::draw | ( | const ControlContext & | cx, |
DrawableList & | drawables | ||
) | [virtual] |
Reimplemented from osgEarth::Util::Controls::Frame.
Definition at line 1051 of file Controls.cpp.
{ if ( Geometry::hasBufferOperation() ) { if ( !getImage() || getImage()->s() != _renderSize.x() || getImage()->t() != _renderSize.y() ) { // create a rounded rectangle by buffering a rectangle. "buffer" value affects how rounded // the corners are. float buffer = Geometry::hasBufferOperation() ? 10.0f : 0.0f; osg::ref_ptr<Geometry> geom = new Polygon(); geom->push_back( osg::Vec3d( buffer, buffer, 0 ) ); geom->push_back( osg::Vec3d( _renderSize.x()-1-buffer, buffer, 0 ) ); geom->push_back( osg::Vec3d( _renderSize.x()-1-buffer, _renderSize.y()-1-buffer, 0 ) ); geom->push_back( osg::Vec3d( buffer, _renderSize.y()-1-buffer, 0 ) ); BufferParameters bp; bp._capStyle = BufferParameters::CAP_ROUND; geom->buffer( buffer-1.0f, geom, bp ); GeometryRasterizer ras( (int)_renderSize.x(), (int)_renderSize.y() ); ras.draw( geom.get(), backColor().value() ); osg::Image* image = ras.finalize(); const_cast<RoundedFrame*>(this)->setImage( image ); } ImageControl::draw( cx, out ); } else { // fallback: draw a non-rounded frame. Frame::draw( cx, out ); } }