~ubuntu-branches/ubuntu/saucy/darktable/saucy

« back to all changes in this revision

Viewing changes to src/external/rawspeed/RawSpeed/ColorFilterArray.h

  • Committer: Bazaar Package Importer
  • Author(s): David Bremner
  • Date: 2011-08-02 21:32:31 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20110802213231-r9v63trgyk1e822j
Tags: 0.9.1-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef COLOR_FILTER_ARRAY_H
 
2
#define COLOR_FILTER_ARRAY_H
 
3
 
 
4
#include "RawDecoderException.h"
 
5
/* 
 
6
    RawSpeed - RAW file decoder.
 
7
 
 
8
    Copyright (C) 2009 Klaus Post
 
9
 
 
10
    This library is free software; you can redistribute it and/or
 
11
    modify it under the terms of the GNU Lesser General Public
 
12
    License as published by the Free Software Foundation; either
 
13
    version 2 of the License, or (at your option) any later version.
 
14
 
 
15
    This library is distributed in the hope that it will be useful,
 
16
    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
17
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
18
    Lesser General Public License for more details.
 
19
 
 
20
    You should have received a copy of the GNU Lesser General Public
 
21
    License along with this library; if not, write to the Free Software
 
22
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
23
 
 
24
    http://www.klauspost.com
 
25
*/
 
26
 
 
27
namespace RawSpeed {
 
28
 
 
29
typedef enum {
 
30
  CFA_COLOR_MIN = 0,
 
31
  CFA_RED = 0,
 
32
  CFA_GREEN = 1,
 
33
  CFA_BLUE = 2,
 
34
  CFA_GREEN2 = 3,
 
35
  CFA_CYAN = 4,
 
36
  CFA_MAGENTA = 5,
 
37
  CFA_YELLOW = 6,
 
38
  CFA_WHITE = 7,
 
39
  CFA_COLOR_MAX = 8,
 
40
  CFA_UNKNOWN = 255
 
41
} CFAColor;
 
42
 
 
43
typedef enum {
 
44
  CFA_POS_UPPERLEFT,
 
45
  CFA_POS_UPPERRIGHT,
 
46
  CFA_POS_LOWERLEFT,
 
47
  CFA_POS_LOWERRIGHT
 
48
} CFAPos;
 
49
 
 
50
class ColorFilterArray
 
51
{
 
52
public:
 
53
  ColorFilterArray(void);
 
54
  ColorFilterArray(CFAColor up_left, CFAColor up_right, CFAColor down_left, CFAColor down_right);
 
55
  virtual ~ColorFilterArray(void);
 
56
  void setCFA(CFAColor up_left, CFAColor up_right, CFAColor down_left, CFAColor down_right);
 
57
  void setColorAt(iPoint2D pos, CFAColor c);
 
58
  void setCFA(uchar8 dcrawCode);
 
59
  __inline CFAColor getColorAt(uint32 x, uint32 y) {return cfa[(x&1)+((y&1)<<1)];}
 
60
  uint32 toDcrawColor(CFAColor c);
 
61
  uint32 getDcrawFilter();
 
62
  void shiftLeft();
 
63
  void shiftDown();
 
64
  std::string asString();
 
65
  static std::string colorToString(CFAColor c);
 
66
private:
 
67
  CFAColor cfa[4];
 
68
};
 
69
 
 
70
} // namespace RawSpeed
 
71
 
 
72
#endif