Version: 0.6.0
color.h
1 /******************************************************************************
2  * Project: wxGIS
3  * Purpose: color functions and classes
4  * Author: Dmitry Baryshnikov (aka Bishop), polimax@mail.ru
5  ******************************************************************************
6 * Copyright (C) 2013 Dmitry Baryshnikov
7 *
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  ****************************************************************************/
21 #pragma once
22 
23 #include "wxgis/display/display.h"
24 
25 #define ChannelType unsigned char
26 
34 class WXDLLIMPEXP_GIS_DSP wxGISColor
35 {
36 public:
37  wxGISColor();
38  wxGISColor(ChannelType red, ChannelType green, ChannelType blue, ChannelType alpha = wxALPHA_OPAQUE);
39  wxGISColor(const wxColour &Color);
40  wxGISColor(const wxGISColor &Color);
41  wxColour GetColour() const;
42  wxGISColor& operator=(const wxGISColor& Color);
43  double GetRed() const;
44  double GetBlue() const;
45  double GetGreen() const;
46  double GetAlpha() const;
47  ChannelType Red() const;
48  ChannelType Blue() const;
49  ChannelType Green() const;
50  ChannelType Alpha() const;
51  static wxGISColor MakeRandom(ChannelType low = 205);
52  void Set (ChannelType red, ChannelType green, ChannelType blue, ChannelType alpha = wxALPHA_OPAQUE);
53  virtual wxString GetAsString(long nFlags = wxC2S_NAME|wxC2S_CSS_SYNTAX) const;
54  virtual void SetFromString(const wxString &sColorTxt);
55  virtual void SetAlpha(ChannelType alpha);
56  virtual void SetRed(ChannelType red);
57  virtual void SetGreen(ChannelType green);
58  virtual void SetBlue(ChannelType blue);
59 protected:
60  virtual void SetValues(ChannelType red, ChannelType green, ChannelType blue, ChannelType alpha);
61 protected:
62  double m_dfRed;
63  double m_dfBlue;
64  double m_dfGreen;
65  double m_dfAlpha;
66  ChannelType m_nRed;
67  ChannelType m_nGreen;
68  ChannelType m_nBlue;
69  ChannelType m_nAlpha;
70 };
71 
Definition: color.h:34