glbackground.hpp
上传用户:yhdzpy8989
上传日期:2007-06-13
资源大小:13604k
文件大小:5k
- /*
- * ===========================================================================
- * PRODUCTION $Log: glbackground.hpp,v $
- * PRODUCTION Revision 1000.2 2004/06/01 19:49:20 gouriano
- * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.4
- * PRODUCTION
- * ===========================================================================
- */
- #ifndef GUI_OPENGL___GLBACKGROUND__HPP
- #define GUI_OPENGL___GLBACKGROUND__HPP
- /* $Id: glbackground.hpp,v 1000.2 2004/06/01 19:49:20 gouriano Exp $
- * ===========================================================================
- *
- * PUBLIC DOMAIN NOTICE
- * National Center for Biotechnology Information
- *
- * This software/database is a "United States Government Work" under the
- * terms of the United States Copyright Act. It was written as part of
- * the author's official duties as a United States Government employee and
- * thus cannot be copyrighted. This software/database is freely available
- * to the public for use. The National Library of Medicine and the U.S.
- * Government have not placed any restriction on its use or reproduction.
- *
- * Although all reasonable efforts have been taken to ensure the accuracy
- * and reliability of the software and data, the NLM and the U.S.
- * Government do not and cannot warrant the performance or results that
- * may be obtained by using this software or data. The NLM and the U.S.
- * Government disclaim all warranties, express or implied, including
- * warranties of performance, merchantability or fitness for any particular
- * purpose.
- *
- * Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- * Authors: Mike DiCuccio
- *
- * File Description:
- *
- */
- #include <corelib/ncbiobj.hpp>
- #include <gui/opengl/glbackground.hpp>
- #include <gui/opengl/glcolor.hpp>
- #include <gui/opengl/glteximage.hpp>
- #include <gui/opengl/glrect.hpp>
- /** @addtogroup GUI_OPENGL
- *
- * @{
- */
- BEGIN_NCBI_SCOPE
- //
- // class CGlBackground abstracts the notion of the background for a scene.
- //
- // This class provides options for easily creating a number of simple
- // background effects. The options supported include:
- // - solid color
- // - color gradient from top->bottom or left->right with arbitrarily
- // defined light and dark colors
- class NCBI_GUIOPENGL_EXPORT CGlBackground
- {
- public:
- // enum of rvarious background effects
- enum EType {
- eSolid, // solid color
- eGradientDown, // gradient color, light->dark from top->bottom
- eGradientRight, // gradient color, light->dark from left->right
- eTexture // texture
- };
- CGlBackground();
- explicit CGlBackground(EType type);
- // set the type of background we use
- void SetType(EType type);
- // set the colors we use for the background. We have more than one color -
- // light color and dark. For the solid color background, the light color
- // is used (this is exposed as SetColor()). For the gradient colors, we
- // use two, a light and a dark. Calling SetDark() with no parameters sets
- // the dark color as a multiple of the light color.
- // There is no requirement that the light color be brighter than the dark
- // color.
- void SetColor(const CGlColor& c);
- void SetLightColor(const CGlColor& c);
- void SetDarkColor(const CGlColor& c);
- void SetDarkColor(void);
- // set the texture we use. This is only used if the background type is
- // eTexture
- void SetTexture(CTexImage& tex);
- // draw our background. This will explicitly preserve all matrices.
- void Draw(void);
- // draw our background in the specified viewport. This will explicitly
- // preserve all matrices.
- void Draw(const CGlRect<int>& vp);
- private:
- // the type of background we draw
- EType m_Type;
- // our colors
- CGlColor m_LightColor;
- CGlColor m_DarkColor;
- // our texture
- CRef<CTexImage> m_Texture;
- };
- END_NCBI_SCOPE
- /* @} */
- /*
- * ===========================================================================
- * $Log: glbackground.hpp,v $
- * Revision 1000.2 2004/06/01 19:49:20 gouriano
- * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.4
- *
- * Revision 1.4 2004/05/11 18:54:22 dicuccio
- * Added doxygne modules info
- *
- * Revision 1.3 2004/03/24 19:30:27 gorelenk
- * Added export prefix NCBI_GUIOPENGL_EXPORT to class CGlBackground .
- *
- * Revision 1.2 2004/03/22 18:50:38 dicuccio
- * Removed dtor. Added #include for CTexImage. Added Draw() variant to restrict
- * drawing to a given viewport
- *
- * Revision 1.1 2003/06/09 19:31:40 dicuccio
- * Initial revision
- *
- * ===========================================================================
- */
- #endif // GUI_OPENGL___GLBACKGROUND__HPP