📄 glcolor.hpp
字号:
/* * =========================================================================== * PRODUCTION $Log: glcolor.hpp,v $ * PRODUCTION Revision 1000.2 2004/06/01 19:49:38 gouriano * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.16 * PRODUCTION * =========================================================================== */#ifndef GUI_OPENGL___GL_COLOR__HPP#define GUI_OPENGL___GL_COLOR__HPP/* $Id: glcolor.hpp,v 1000.2 2004/06/01 19:49:38 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: * CGlColor - provides explicit control and conversion for FLTK <-> OpenGL * colors */#include <corelib/ncbistd.hpp>#include <gui/utils/rgba_color.hpp>#include <gui/opengl.h>#include <FL/fl_draw.H>/** @addtogroup GUI_OPENGL * * @{ */BEGIN_NCBI_SCOPEclass NCBI_GUIOPENGL_EXPORT CGlColor : public CRgbaColor{public: /// default ctor CGlColor(); /// construct around an FLTK color CGlColor(Fl_Color); /// construct from a color array CGlColor(const float* color, size_t size); /// construct from floating point values CGlColor(float r, float g, float b); CGlColor(float r, float g, float b, float a); /// construct from unsigned char vales. These are normalized internally /// to the range 0-1 CGlColor(unsigned char r, unsigned char g, unsigned char b); CGlColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a); /// construct around a string in the form "r g b" explicit CGlColor(const string& s); /// virtual dtor virtual ~CGlColor(); /// set from an FLTK color void SetFltkColor(Fl_Color c); /// return the appropriate Fl_Color Fl_Color GetFltkColor(void) const; /// return a color array const GLfloat* GetGlColor(void) const; /// make this color the current color void Select();};inline void glColorC(const CGlColor& Color){ glColor4fv(Color.GetGlColor());}inline const GLfloat* CGlColor::GetGlColor(void) const{ return GetColorArray();}inline void CGlColor::Select(){ glColor4fv(GetColorArray());}END_NCBI_SCOPE/* @} *//* * =========================================================================== * $Log: glcolor.hpp,v $ * Revision 1000.2 2004/06/01 19:49:38 gouriano * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.16 * * Revision 1.16 2004/05/11 18:54:22 dicuccio * Added doxygne modules info * * Revision 1.15 2004/01/27 18:28:54 dicuccio * Added comments. Moved inline functions out of class body. * * Revision 1.14 2003/10/29 22:25:01 yazhuk * Made some functions inline, added glColorC() function * * Revision 1.13 2003/09/29 15:20:07 dicuccio * Deprecated gui/scope.hpp. Merged gui/core/types.hpp into gui/types.hpp * * Revision 1.12 2003/09/04 14:00:26 dicuccio * Introduce IDocument and IView as abstract base classes. Use IDocument instead * of CDocument. * * Revision 1.11 2003/08/25 18:02:20 rsmith * Colors to and from strings. * * Revision 1.10 2003/06/18 18:16:00 meric * Moved inline interface to glcolor.cpp * * Revision 1.9 2003/06/18 16:43:10 meric * Move most of functionality to gui/utils in class CRgbaColor * * Revision 1.8 2003/05/15 12:19:15 dicuccio * Fixed compiler warning about signed <-> unsigned comparison * * Revision 1.7 2003/05/14 21:21:43 meric * modify PrintTo() to optionally skip output of alpha value (not by default) * * Revision 1.6 2003/05/14 14:56:27 meric * modified CGlColor's operator<<() to use a const object reference * * Revision 1.5 2003/05/13 19:22:58 dicuccio * Added constructor, stream output (Peter Meric) * * Revision 1.4 2003/01/13 13:11:42 dicuccio * Namespace clean-up. Retired namespace gui -> converted to namespace ncbi. * Moved all FLUID-generated code into namespace ncbi. * * Revision 1.3 2002/12/19 18:13:03 dicuccio * Added export specifiers for Win32. * * Revision 1.2 2002/11/22 18:56:16 dicuccio * Added support for alpha channel - color is now a 4-position item. Also, added * direct accessor for glColor?v(). * * Revision 1.1 2002/11/22 18:06:42 dicuccio * Initial revision. * * =========================================================================== */#endif // GUI_OPENGL___GL_COLOR__HPP
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -