Gnash  0.8.11dev
SetBackgroundColorTag.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 GNASH_SWF_SETBACKGROUNDCOLOR_TAG_H
20 #define GNASH_SWF_SETBACKGROUNDCOLOR_TAG_H
21 
22 #include "ControlTag.h"
23 #include "TypesParser.h"
24 #include "SWF.h"
25 #include "MovieClip.h"
26 #include "movie_definition.h"
27 #include "log.h"
28 #include "RGBA.h"
29 
30 // Forward declarations
31 namespace gnash {
32  class SWFStream;
33  class movie_definition;
34 }
35 
36 namespace gnash {
37 namespace SWF {
38 
40 //
42 {
43 
44 private:
45 
48  rgba m_color;
49 
51  //
56  void read(SWFStream& in)
57  {
58  // may throw ParserException
59  m_color = readRGB(in);
60 
62  log_parse(_(" SetBackgroundColor: %s"), m_color);
63  );
64  }
65 
66 
67 public:
68 
72  //
77  {
78  read(in);
79  }
80 
81  void executeState(MovieClip* m, DisplayList& /*dlist*/) const {
82  m->set_background_color(m_color);
83  }
84 
86  static void loader(SWFStream& in, TagType tag, movie_definition& m,
87  const RunResources& /*r*/)
88  {
89  assert(tag == SWF::SETBACKGROUNDCOLOR); // 9
90 
91  // this one may throw, we'll let caller catch it
92  boost::intrusive_ptr<ControlTag> t(new SetBackgroundColorTag(in));
93  m.addControlTag(t); // takes ownership
94  }
95 };
96 
97 
98 
99 
100 } // namespace gnash::SWF
101 } // namespace gnash
102 
103 
104 #endif // GNASH_SWF_SETBACKGROUNDCOLOR_TAG_H
105 
106 
107 // Local Variables:
108 // mode: C++
109 // indent-tabs-mode: t
110 // End:
Client program's interface to the definition of a movie or sprite.
Definition: movie_definition.h:95
A MovieClip is a container for DisplayObjects.
Definition: MovieClip.h:83
TagType
SWF tag types. Symbolic names copied from Ming.
Definition: SWF.h:30
void set_background_color(const rgba &color)
Definition: MovieClip.cpp:1581
SetBackgroundColorTag(SWFStream &in)
Construct a SetBackgroundColorTag by reading it from the given SWF stream.
Definition: SetBackgroundColorTag.h:76
Definition: SWF.h:41
rgba readRGB(SWFStream &in)
Read an RGB rgba from input stream.
Definition: TypesParser.cpp:103
#define IF_VERBOSE_PARSE(x)
Definition: log.h:364
Control tags are swf tags that control the operation of the movie.
Definition: ControlTag.h:43
Definition: GnashKey.h:166
#define _(String)
Definition: log.h:44
Class to group together per-run and external resources for Gnash.
Definition: RunResources.h:43
Definition: GnashKey.h:159
SWF Tag SetBackgroundColor (9)
Definition: SetBackgroundColorTag.h:41
void executeState(MovieClip *m, DisplayList &) const
Execute "state" or "DisplayList" tags.
Definition: SetBackgroundColorTag.h:81
virtual void addControlTag(boost::intrusive_ptr< SWF::ControlTag >)
Add an ControlTag to this movie_definition's playlist.
Definition: movie_definition.h:273
A list of on-stage DisplayObjects, ordered by depth.
Definition: DisplayList.h:64
Definition: GnashKey.h:331
SWF stream wrapper class.
Definition: SWFStream.h:58
static void loader(SWFStream &in, TagType tag, movie_definition &m, const RunResources &)
Set background color tag loader (SWF::SETBACKGROUNDCOLOR)
Definition: SetBackgroundColorTag.h:86
A basic RGBA type.
Definition: RGBA.h:35