Gnash  0.8.11dev
SWFCxForm.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012
3 // Free Software Foundation, Inc.
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 
19 #ifndef GNASHCXFORM_H
20 #define GNASHCXFORM_H
21 
22 #include "dsodefs.h" // for DSOEXPORT
23 
24 #include <iosfwd>
25 #include <cstdint>
26 
27 namespace gnash {
28  class rgba;
29 }
30 
31 namespace gnash {
32 
35 {
36 public:
37 
40  :
41  ra(256),
42  ga(256),
43  ba(256),
44  aa(256),
45  rb(0),
46  gb(0),
47  bb(0),
48  ab(0)
49  {
50  }
51 
52  std::int16_t ra; // RedMultTerm, 8.8 fixed point
53  std::int16_t ga; // GreenMultTerm 8.8 fixed point
54  std::int16_t ba; // BlueMultTerm 8.8 fixed point
55  std::int16_t aa; // AlphaMultTerm 8.8 fixed point
56  std::int16_t rb; // RedAddTerm, 16 bit integer(no fraction)
57  std::int16_t gb; // GreenAddTerm 16 bit integer(no fraction)
58  std::int16_t bb; // BlueAddTerm 16 bit integer(no fraction)
59  std::int16_t ab; // AlphaAddTerm 16 bit integer(no fraction)
60 
62  //
66  void concatenate(const SWFCxForm& c);
67 
69  rgba transform(const rgba& in) const;
70 
72  void transform(std::uint8_t& r, std::uint8_t& g, std::uint8_t& b,
73  std::uint8_t& a) const;
74 
75 };
76 
77 inline bool
78 operator==(const SWFCxForm& a, const SWFCxForm& b)
79 {
80  return a.ra == b.ra &&
81  a.rb == b.rb &&
82  a.ga == b.ga &&
83  a.gb == b.gb &&
84  a.ba == b.ba &&
85  a.bb == b.bb &&
86  a.aa == b.aa &&
87  a.ab == b.ab;
88 }
89 
90 inline bool
91 operator!=(const SWFCxForm& a, const SWFCxForm& b)
92 {
93  return !(a == b);
94 }
95 
97 //
101 inline bool
103 {
104  return (255 * cx.aa >> 8) + cx.ab == 0;
105 }
106 
107 std::ostream& operator<<(std::ostream& os, const SWFCxForm& cx);
108 
109 } // namespace gnash
110 
111 #endif
112 
113 
114 // Local Variables:
115 // mode: C++
116 // indent-tabs-mode: t
117 // End:
Definition: GnashKey.h:147
std::int16_t gb
Definition: SWFCxForm.h:57
std::int16_t ab
Definition: SWFCxForm.h:59
bool operator==(const event_id &a, const event_id &b)
Return whether two event_ids are equal.
Definition: event_id.h:163
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:40
std::int16_t bb
Definition: SWFCxForm.h:58
std::int16_t ba
Definition: SWFCxForm.h:54
Definition: GnashKey.h:149
Color transformation record.
Definition: SWFCxForm.h:34
SWFCxForm()
Construct an identity CxForm.
Definition: SWFCxForm.h:39
Definition: GnashKey.h:164
bool operator!=(const SWFCxForm &a, const SWFCxForm &b)
Definition: SWFCxForm.h:91
std::ostream & operator<<(std::ostream &o, const URL &u)
Definition: URL.cpp:447
std::int16_t ra
Definition: SWFCxForm.h:52
Definition: GnashKey.h:148
std::int16_t aa
Definition: SWFCxForm.h:55
#define DSOEXPORT
Definition: dsodefs.h:55
std::int16_t rb
Definition: SWFCxForm.h:56
Definition: GnashKey.h:153
std::int16_t ga
Definition: SWFCxForm.h:53
bool invisible(const SWFCxForm &cx)
Returns true when the SWFCxForm leads to alpha == 0.
Definition: SWFCxForm.h:102
A basic RGBA type.
Definition: RGBA.h:35