📄 glcolortable.hpp
字号:
/* * =========================================================================== * PRODUCTION $Log: glcolortable.hpp,v $ * PRODUCTION Revision 1000.1 2004/06/01 19:49:40 gouriano * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.6 * PRODUCTION * =========================================================================== */#ifndef GUI_OPENGL___GL_COLOR_TABLE__HPP#define GUI_OPENGL___GL_COLOR_TABLE__HPP/* $Id: glcolortable.hpp,v 1000.1 2004/06/01 19:49:40 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: * Incremental and mutually contrastive color table generator. */#include <corelib/ncbistd.hpp>#include <gui/opengl/glcolor.hpp>/** @addtogroup GUI_OPENGL * * @{ */BEGIN_NCBI_SCOPEclass NCBI_GUIOPENGL_EXPORT CGlColorTable{public: CGlColorTable(); CGlColorTable(int items, float min_color = 0.0f, float max_color = 1.0f); void SetMaxItems(int items); void SetMinColor(float f); void SetMinColor(unsigned char f); void SetMaxColor(float f); void SetMaxColor(unsigned char f); CGlColor GetColor(int i) const;private: int m_MaxItems; float m_ColorStep; float m_MinColor; float m_MaxColor; float m_ColorDiff; void x_CalcColorStep();};inlinevoid CGlColorTable::SetMaxItems(int items){ m_MaxItems = max(8, items); x_CalcColorStep();}inlinevoid CGlColorTable::SetMinColor(float f){ m_MinColor = max(0.0f, f); m_MinColor = min(1.0f, m_MinColor); if (m_MaxColor < m_MinColor) { std::swap(m_MaxColor, m_MinColor); } m_ColorDiff = m_MaxColor - m_MinColor; x_CalcColorStep();}inlinevoid CGlColorTable::SetMinColor(unsigned char c){ SetMinColor(float (c) / 255.0f);}inlinevoid CGlColorTable::SetMaxColor(float f){ m_MaxColor = max(0.0f, f); m_MaxColor = min(1.0f, m_MaxColor); if (m_MaxColor < m_MinColor) { std::swap(m_MaxColor, m_MinColor); } m_ColorDiff = m_MaxColor - m_MinColor; x_CalcColorStep();}inlinevoid CGlColorTable::SetMaxColor(unsigned char c){ SetMinColor(float (c) / 255.0f);}inlinevoid CGlColorTable::x_CalcColorStep(){ m_ColorStep = m_ColorDiff / m_MaxItems * 8;}END_NCBI_SCOPE/* @} *//* * =========================================================================== * $Log: glcolortable.hpp,v $ * Revision 1000.1 2004/06/01 19:49:40 gouriano * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.6 * * Revision 1.6 2004/05/11 18:54:22 dicuccio * Added doxygne modules info * * Revision 1.5 2003/09/29 15:20:07 dicuccio * Deprecated gui/scope.hpp. Merged gui/core/types.hpp into gui/types.hpp * * Revision 1.4 2003/01/15 20:57:01 dicuccio * Must remember to recalculate color step if the bounds change * * Revision 1.3 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.2 2002/12/19 18:13:03 dicuccio * Added export specifiers for Win32. * * Revision 1.1 2002/11/22 18:06:42 dicuccio * Initial revision. * * =========================================================================== */#endif // GUI_OPENGL___GL_COLOR_TABLE__HPP
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -