[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog server/Makefile.am server/strea...
From: |
Chad Musick |
Subject: |
[Gnash-commit] gnash ChangeLog server/Makefile.am server/strea... |
Date: |
Sun, 26 Aug 2007 15:14:13 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Chad Musick <cmusick> 07/08/26 15:14:13
Modified files:
. : ChangeLog
server : Makefile.am stream.h stream.cpp
server/swf : PlaceObject2Tag.cpp
Added files:
server : BevelFilter.h BevelFilter.cpp BitmapFilter.h
BlurFilter.cpp BlurFilter.h
ColorMatrixFilter.cpp ColorMatrixFilter.h
ConvolutionFilter.cpp ConvolutionFilter.h
DropShadowFilter.cpp DropShadowFilter.h
GlowFilter.h GlowFilter.cpp
GradientBevelFilter.cpp GradientBevelFilter.h
GradientGlowFilter.cpp GradientGlowFilter.h
server/parser : filter_factory.h filter_factory.cpp
Log message:
Splits the filters file into a separate class and files for each filter,
since they are first class objects in ActionScript, so they need a bit
more interface exposed.
Changes to stream to make get_short_fixed() work correctly, as well as
adding some unsigned versions of fixed routines and full float version.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4105&r2=1.4106
http://cvs.savannah.gnu.org/viewcvs/gnash/server/Makefile.am?cvsroot=gnash&r1=1.122&r2=1.123
http://cvs.savannah.gnu.org/viewcvs/gnash/server/stream.h?cvsroot=gnash&r1=1.24&r2=1.25
http://cvs.savannah.gnu.org/viewcvs/gnash/server/stream.cpp?cvsroot=gnash&r1=1.24&r2=1.25
http://cvs.savannah.gnu.org/viewcvs/gnash/server/BevelFilter.h?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/server/BevelFilter.cpp?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/server/BitmapFilter.h?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/server/BlurFilter.cpp?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/server/BlurFilter.h?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/server/ColorMatrixFilter.cpp?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/server/ColorMatrixFilter.h?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/server/ConvolutionFilter.cpp?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/server/ConvolutionFilter.h?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/server/DropShadowFilter.cpp?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/server/DropShadowFilter.h?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/server/GlowFilter.h?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/server/GlowFilter.cpp?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/server/GradientBevelFilter.cpp?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/server/GradientBevelFilter.h?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/server/GradientGlowFilter.cpp?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/server/GradientGlowFilter.h?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/filter_factory.h?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/filter_factory.cpp?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/server/swf/PlaceObject2Tag.cpp?cvsroot=gnash&r1=1.19&r2=1.20
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.4105
retrieving revision 1.4106
diff -u -b -r1.4105 -r1.4106
--- ChangeLog 26 Aug 2007 10:23:47 -0000 1.4105
+++ ChangeLog 26 Aug 2007 15:14:09 -0000 1.4106
@@ -1,3 +1,21 @@
+2007-08-26 Chad Musick <address@hidden>
+
+ * server/Makefile.am: Add new files, remove obsolete ones.
+ * server/BevelFilter.h,.cpp: A Bevel display object filter
+ * server/BitmapFilter.h: Base class for other filters
+ * server/BlurFilter.h,.cpp: A Blur display object filter
+ * server/ColorMatrixFilter.h,.cpp: A color matrix display filter
+ * server/ConvolutionFilter.h,.cpp: A convolution display filter
+ * server/DropShadowFilter.h,.cpp: A drop shadow display filter
+ * server/GlowFilter.h,.cpp: A glow display filter
+ * server/GradientBevelFilter.h,.cpp: A gradient bevel filter
+ * server/GradientGlowFilter.h,.cpp: A gradient glow filter
+ * server/filters.h,.cpp: Removed (split to other files)
+ * server/stream.h,stream.cpp: Added read_float, read_short_ufixed,
+ fixed calculation of value in read_short_fixed, added read_ufixed
+ * server/parser/filter_factory.h,.cpp: parsing code of filters
+ * server/swf/PlaceObject2Tag.cpp: Changed to use new filters
+
2007-08-26 Sandro Santilli <address@hidden>
* configure.ac: keep mit-shm enabled by default (use --disable-mit-shm
Index: server/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/server/Makefile.am,v
retrieving revision 1.122
retrieving revision 1.123
diff -u -b -r1.122 -r1.123
--- server/Makefile.am 24 Aug 2007 05:57:09 -0000 1.122
+++ server/Makefile.am 26 Aug 2007 15:14:10 -0000 1.123
@@ -18,7 +18,7 @@
#
#
-# $Id: Makefile.am,v 1.122 2007/08/24 05:57:09 cmusick Exp $
+# $Id: Makefile.am,v 1.123 2007/08/26 15:14:10 cmusick Exp $
AUTOMAKE_OPTIONS =
@@ -65,7 +65,15 @@
cxform.cpp \
DynamicShape.cpp \
edit_text_character.cpp \
- filters.cpp \
+ BlurFilter.cpp \
+ GlowFilter.cpp \
+ DropShadowFilter.cpp \
+ ConvolutionFilter.cpp \
+ ColorMatrixFilter.cpp \
+ GradientGlowFilter.cpp \
+ BevelFilter.cpp \
+ GradientBevelFilter.cpp \
+ parser/filter_factory.cpp \
generic_character.cpp \
matrix.cpp \
movie_instance.cpp \
@@ -129,7 +137,16 @@
event_id.h \
execute_tag.h \
fill_style.h \
- filters.h \
+ BitmapFilter.h \
+ BlurFilter.h \
+ BevelFilter.h \
+ GradientBevelFilter.h \
+ GlowFilter.h \
+ GradientGlowFilter.h \
+ DropShadowFilter.h \
+ ConvolutionFilter.h \
+ ColorMatrixFilter.h \
+ parser/filter_factory.h \
font.h \
fontlib.h \
generic_character.h \
Index: server/stream.h
===================================================================
RCS file: /sources/gnash/gnash/server/stream.h,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -b -r1.24 -r1.25
--- server/stream.h 24 Aug 2007 05:45:51 -0000 1.24
+++ server/stream.h 26 Aug 2007 15:14:12 -0000 1.25
@@ -51,8 +51,23 @@
/// number of bits to read.
int read_sint(unsigned short bitcount);
+ /// \brief
+ /// Reads a little-endian decimal point value in the
+ /// format that the first half is before the decimal
+ /// point and the second half is after the decimal.
+ /// _fixed is 32 bits, short_fixed is 16. The _sfixed
+ /// versions read a signed fixed value.
float read_fixed();
- float read_short_fixed();
+ float read_ufixed();
+ float read_short_ufixed();
+ float read_short_sfixed();
+
+ /// \brief
+ /// Read floating point values, not in the fixed format.
+ float read_float();
+
+ /// \brief
+ /// Correct for any unused bits from a uint read.
void align();
unsigned read(char *buf, unsigned count);
Index: server/stream.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/stream.cpp,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -b -r1.24 -r1.25
--- server/stream.cpp 24 Aug 2007 05:45:51 -0000 1.24
+++ server/stream.cpp 26 Aug 2007 15:14:12 -0000 1.25
@@ -116,14 +116,43 @@
float stream::read_fixed()
{
+#if 0 /* Chad */
m_unused_bits = 0;
int32_t val = m_input->read_le32();
return (float) val / 65536.0f;
+#else
+ align();
+ return static_cast<float> (static_cast<double>
(static_cast<long int> (m_input->read_le32())) / 65536.0f);
+#endif /* Chad */
}
- float stream::read_short_fixed()
+
+ // float is not large enough to hold a 32 bit value without doing the
wrong thing with the sign.
+ // So we upgrade to double for the calculation and then resize when we
know it's small enough.
+ float stream::read_ufixed()
{
- m_unused_bits = 0;
- return (float) m_input->read_le16();
+ align();
+ return static_cast<float> (static_cast<double>
(static_cast<unsigned long int> (m_input->read_le32())) / 65536.0f);
+ }
+
+ // Read a short fixed value, unsigned.
+ float stream::read_short_ufixed()
+ {
+ align();
+ return static_cast<float> (static_cast<uint16_t>
(m_input->read_le16())) / 256.0f;
+ }
+
+ // Read a short fixed value, signed.
+ float stream::read_short_sfixed()
+ {
+ align();
+ return static_cast<float> (static_cast<int16_t>
(m_input->read_le16())) / 256.0f;
+ }
+
+ // Read a signed float value.
+ float stream::read_float()
+ {
+ align();
+ return static_cast<float> (m_input->read_le32());
}
void stream::align() { m_unused_bits = 0; m_current_byte = 0; }
Index: server/swf/PlaceObject2Tag.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/swf/PlaceObject2Tag.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -b -r1.19 -r1.20
--- server/swf/PlaceObject2Tag.cpp 24 Aug 2007 10:46:11 -0000 1.19
+++ server/swf/PlaceObject2Tag.cpp 26 Aug 2007 15:14:13 -0000 1.20
@@ -17,7 +17,7 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
-/* $Id: PlaceObject2Tag.cpp,v 1.19 2007/08/24 10:46:11 strk Exp $ */
+/* $Id: PlaceObject2Tag.cpp,v 1.20 2007/08/26 15:14:13 cmusick Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -29,7 +29,7 @@
#include "swf_event.h"
#include "log.h"
#include "stream.h"
-#include "filters.h"
+#include "filter_factory.h"
namespace gnash {
namespace SWF {
@@ -268,8 +268,8 @@
if (has_filters)
{
- effect_filters::effect_filters_vec v; // TODO: Something should be
done with the filters...
- effect_filters::filter_factory::read(in, movie_version, true, &v);
+ Filters v; // TODO: Attach the filters to the display object.
+ filter_factory::read(in, movie_version, true, &v);
}
if (has_blend_mode)
Index: server/BevelFilter.h
===================================================================
RCS file: server/BevelFilter.h
diff -N server/BevelFilter.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ server/BevelFilter.h 26 Aug 2007 15:14:10 -0000 1.1
@@ -0,0 +1,85 @@
+//
+// Copyright (C) 2007 Free Software Foundation, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+/* $Id: BevelFilter.h,v 1.1 2007/08/26 15:14:10 cmusick Exp $ */
+
+#ifndef GNASH_BEVELFILTER_H
+#define GNASH_BEVELFILTER_H
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "BitmapFilter.h"
+
+namespace gnash {
+
+// A bevel effect filter.
+class BevelFilter : public BitmapFilter
+{
+public:
+ typedef enum
+ {
+ OUTER_BEVEL = 1,
+ INNER_BEVEL = 2,
+ FULL_BEVEL = 3
+ } bevel_type;
+
+ // Fill from a stream. See parser/filter_factory.cpp for the
implementations.
+ virtual bool read(stream* in);
+
+ virtual ~BevelFilter() { return; }
+
+ // Clone this object and return a copy of it. (AS accessible function.)
+ // Guaranteed to return an object which can be cast to BlurFilter
+ Filter const clone();
+
+ BevelFilter() :
+ m_distance(0.0f), m_angle(0.0f), m_highlightColor(0),
+ m_highlightAlpha(0), m_shadowColor(0), m_shadowAlpha(0),
+ m_blurX(0.0f), m_blurY(0.0f), m_strength(0.0f), m_quality(0),
+ m_type(FULL_BEVEL), m_knockout(false)
+ { return; }
+
+ BevelFilter(float distance, float angle, uint32_t hcolor,
+ uint8_t halpha, uint32_t scolor, uint8_t salpha,
+ float blurX, float blurY, float strength,
+ uint8_t quality, bevel_type type, bool knockout) :
+ m_distance(distance), m_angle(angle), m_highlightColor(hcolor),
+ m_highlightAlpha(halpha), m_shadowColor(scolor), m_shadowAlpha(salpha),
+ m_blurX(blurX), m_blurY(blurY), m_strength(strength),
+ m_quality(quality), m_type(type), m_knockout(knockout)
+ { return; }
+
+private:
+ float m_distance; // Distance of the filter in pixels.
+ float m_angle; // Angle of the filter.
+ uint32_t m_highlightColor; // Color of the highlight.
+ uint8_t m_highlightAlpha; // Alpha of the highlight.
+ uint32_t m_shadowColor; // RGB color.
+ uint8_t m_shadowAlpha; // Alpha strength, as a percentage(?)
+ float m_blurX; // horizontal blur
+ float m_blurY; // vertical blur
+ float m_strength; // How strong is the filter.
+ uint8_t m_quality; // How many times to apply the filter.
+ bevel_type m_type; // The type of filter. (Rendered as string in AS)
+ bool m_knockout; // If true, render only the filter effect.
+};
+
+} // Namespace gnash
+
+#endif // GNASH_BEVELFILTER_H
Index: server/BevelFilter.cpp
===================================================================
RCS file: server/BevelFilter.cpp
diff -N server/BevelFilter.cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ server/BevelFilter.cpp 26 Aug 2007 15:14:10 -0000 1.1
@@ -0,0 +1,37 @@
+//
+// Copyright (C) 2007 Free Software Foundation, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+/* $Id: BevelFilter.cpp,v 1.1 2007/08/26 15:14:10 cmusick Exp $ */
+
+#include "BevelFilter.h"
+
+namespace gnash {
+
+// See parser/filter_factory.cpp for the implementation. Purposefully not here.
+//bool BevelFilter::read(stream* in);
+
+Filter const
+BevelFilter::clone()
+{
+ Filter p(new BevelFilter(m_distance, m_angle, m_highlightColor,
+ m_highlightAlpha, m_shadowColor, m_shadowAlpha,
+ m_blurX, m_blurY, m_strength, m_quality, m_type, m_knockout));
+ return p;
+}
+
+} // Namespace gnash
+
Index: server/BitmapFilter.h
===================================================================
RCS file: server/BitmapFilter.h
diff -N server/BitmapFilter.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ server/BitmapFilter.h 26 Aug 2007 15:14:10 -0000 1.1
@@ -0,0 +1,51 @@
+//
+// Copyright (C) 2007 Free Software Foundation, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+/* $Id: BitmapFilter.h,v 1.1 2007/08/26 15:14:10 cmusick Exp $ */
+
+#ifndef GNASH_BITMAPFILTER_H
+#define GNASH_BITMAPFILTER_H
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "as_object.h"
+
+namespace gnash {
+
+class stream;
+class BitmapFilter;
+
+typedef boost::intrusive_ptr<BitmapFilter> Filter;
+
+// The common base class for AS display filters.
+class BitmapFilter : public as_object
+{
+public:
+ // Fill from a stream. See parser/filter_factory.cpp for the
implementations.
+ virtual bool read(stream* in) = 0;
+
+ virtual ~BitmapFilter() { return; }
+
+ // Clone this object and return a copy of it. (AS accessible function.)
+ Filter const clone();
+};
+
+} // Namespace gnash
+
+#endif // GNASH_BITMAPFILTER_H
Index: server/BlurFilter.cpp
===================================================================
RCS file: server/BlurFilter.cpp
diff -N server/BlurFilter.cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ server/BlurFilter.cpp 26 Aug 2007 15:14:11 -0000 1.1
@@ -0,0 +1,35 @@
+//
+// Copyright (C) 2007 Free Software Foundation, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+/* $Id: BlurFilter.cpp,v 1.1 2007/08/26 15:14:11 cmusick Exp $ */
+
+#include "BlurFilter.h"
+
+namespace gnash {
+
+// See parser/filter_factory.cpp for the implementation. Purposefully not here.
+//bool BlurFilter::read(stream* in);
+
+Filter const
+BlurFilter::clone()
+{
+ Filter p(new BlurFilter(m_blurX, m_blurY, m_quality));
+ return p;
+}
+
+} // Namespace gnash
+
Index: server/BlurFilter.h
===================================================================
RCS file: server/BlurFilter.h
diff -N server/BlurFilter.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ server/BlurFilter.h 26 Aug 2007 15:14:11 -0000 1.1
@@ -0,0 +1,60 @@
+//
+// Copyright (C) 2007 Free Software Foundation, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+/* $Id: BlurFilter.h,v 1.1 2007/08/26 15:14:11 cmusick Exp $ */
+
+#ifndef GNASH_BLURFILTER_H
+#define GNASH_BLURFILTER_H
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "BitmapFilter.h"
+
+namespace gnash {
+
+// A blur effect filter.
+class BlurFilter : public BitmapFilter
+{
+public:
+ // Fill from a stream. See parser/filter_factory.cpp for the
implementations.
+ virtual bool read(stream* in);
+
+ virtual ~BlurFilter() { return; }
+
+ // Clone this object and return a copy of it. (AS accessible function.)
+ // Guaranteed to return an object which can be cast to BlurFilter
+ Filter const clone();
+
+ BlurFilter() :
+ m_blurX(0.0f), m_blurY(0.0f), m_quality(0)
+ { return; }
+
+ BlurFilter(float blurX, float blurY, uint8_t quality) :
+ m_blurX(blurX), m_blurY(blurY), m_quality(quality)
+ { return; }
+
+private:
+ float m_blurX; // How much horizontal blur.
+ float m_blurY; // How much vertical blur.
+ uint8_t m_quality; // How many passes to take.
+};
+
+} // Namespace gnash
+
+#endif // GNASH_BLURFILTER_H
Index: server/ColorMatrixFilter.cpp
===================================================================
RCS file: server/ColorMatrixFilter.cpp
diff -N server/ColorMatrixFilter.cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ server/ColorMatrixFilter.cpp 26 Aug 2007 15:14:11 -0000 1.1
@@ -0,0 +1,35 @@
+//
+// Copyright (C) 2007 Free Software Foundation, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+/* $Id: ColorMatrixFilter.cpp,v 1.1 2007/08/26 15:14:11 cmusick Exp $ */
+
+#include "ColorMatrixFilter.h"
+
+namespace gnash {
+
+// See parser/filter_factory.cpp for the implementation. Purposefully not here.
+//bool ConvolutionFilter::read(stream* in);
+
+Filter const
+ColorMatrixFilter::clone()
+{
+ Filter p(new ColorMatrixFilter(m_matrix));
+ return p;
+}
+
+} // Namespace gnash
+
Index: server/ColorMatrixFilter.h
===================================================================
RCS file: server/ColorMatrixFilter.h
diff -N server/ColorMatrixFilter.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ server/ColorMatrixFilter.h 26 Aug 2007 15:14:11 -0000 1.1
@@ -0,0 +1,59 @@
+//
+// Copyright (C) 2007 Free Software Foundation, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+/* $Id: ColorMatrixFilter.h,v 1.1 2007/08/26 15:14:11 cmusick Exp $ */
+
+#ifndef GNASH_COLORMATRIXFILTER_H
+#define GNASH_COLORMATRIXFILTER_H
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "array.h"
+#include "BitmapFilter.h"
+
+namespace gnash {
+
+// A color matrix effect filter.
+class ColorMatrixFilter : public BitmapFilter
+{
+public:
+ // Fill from a stream. See parser/filter_factory.cpp for the
implementations.
+ virtual bool read(stream* in);
+
+ virtual ~ColorMatrixFilter() { return; }
+
+ // Clone this object and return a copy of it. (AS accessible function.)
+ // Guaranteed to return an object which can be cast to ColorMatrixFilter
+ Filter const clone();
+
+ ColorMatrixFilter() :
+ m_matrix()
+ { return; }
+
+ ColorMatrixFilter(as_array_object a_matrix) :
+ m_matrix(a_matrix)
+ { return; }
+
+private:
+ as_array_object m_matrix; // The color matrix
+};
+
+} // Namespace gnash
+
+#endif // GNASH_CONVOLUTIONFILTER_H
Index: server/ConvolutionFilter.cpp
===================================================================
RCS file: server/ConvolutionFilter.cpp
diff -N server/ConvolutionFilter.cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ server/ConvolutionFilter.cpp 26 Aug 2007 15:14:11 -0000 1.1
@@ -0,0 +1,36 @@
+//
+// Copyright (C) 2007 Free Software Foundation, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+/* $Id: ConvolutionFilter.cpp,v 1.1 2007/08/26 15:14:11 cmusick Exp $ */
+
+#include "ConvolutionFilter.h"
+
+namespace gnash {
+
+// See parser/filter_factory.cpp for the implementation. Purposefully not here.
+//bool ConvolutionFilter::read(stream* in);
+
+Filter const
+ConvolutionFilter::clone()
+{
+ Filter p(new ConvolutionFilter(m_matrixX, m_matrixY, m_matrix,
+ m_divisor, m_bias, m_preserveAlpha, m_clamp, m_color, m_alpha));
+ return p;
+}
+
+} // Namespace gnash
+
Index: server/ConvolutionFilter.h
===================================================================
RCS file: server/ConvolutionFilter.h
diff -N server/ConvolutionFilter.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ server/ConvolutionFilter.h 26 Aug 2007 15:14:11 -0000 1.1
@@ -0,0 +1,72 @@
+//
+// Copyright (C) 2007 Free Software Foundation, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+/* $Id: ConvolutionFilter.h,v 1.1 2007/08/26 15:14:11 cmusick Exp $ */
+
+#ifndef GNASH_CONVOLUTIONFILTER_H
+#define GNASH_CONVOLUTIONFILTER_H
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "array.h"
+#include "BitmapFilter.h"
+
+namespace gnash {
+
+// A convolution effect filter.
+class ConvolutionFilter : public BitmapFilter
+{
+public:
+ // Fill from a stream. See parser/filter_factory.cpp for the
implementations.
+ virtual bool read(stream* in);
+
+ virtual ~ConvolutionFilter() { return; }
+
+ // Clone this object and return a copy of it. (AS accessible function.)
+ // Guaranteed to return an object which can be cast to BlurFilter
+ Filter const clone();
+
+ ConvolutionFilter() :
+ m_matrixX(), m_matrixY(), m_matrix(), m_divisor(), m_bias(),
+ m_preserveAlpha(false), m_clamp(false), m_color(), m_alpha()
+ { return; }
+
+ ConvolutionFilter(uint8_t matrixX, uint8_t matrixY, as_array_object
a_matrix,
+ float divisor, float bias, bool preserveAlpha, bool clamp, uint32_t
color,
+ uint8_t alpha) :
+ m_matrixX(matrixX), m_matrixY(matrixY), m_matrix(a_matrix),
+ m_divisor(divisor), m_bias(bias), m_preserveAlpha(preserveAlpha),
+ m_clamp(clamp), m_color(color), m_alpha(alpha)
+ { return; }
+
+private:
+ uint8_t m_matrixX; // Number of columns
+ uint8_t m_matrixY; // Number of rows
+ as_array_object m_matrix; // The convolution matrix
+ float m_divisor;
+ float m_bias;
+ bool m_preserveAlpha; // If true, don't convolute the alpha channel
+ bool m_clamp; // Whether or not to clamp
+ uint32_t m_color; // For off-image pixels
+ uint8_t m_alpha; // For off-image pixels
+};
+
+} // Namespace gnash
+
+#endif // GNASH_CONVOLUTIONFILTER_H
Index: server/DropShadowFilter.cpp
===================================================================
RCS file: server/DropShadowFilter.cpp
diff -N server/DropShadowFilter.cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ server/DropShadowFilter.cpp 26 Aug 2007 15:14:11 -0000 1.1
@@ -0,0 +1,37 @@
+//
+// Copyright (C) 2007 Free Software Foundation, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+/* $Id: DropShadowFilter.cpp,v 1.1 2007/08/26 15:14:11 cmusick Exp $ */
+
+#include "DropShadowFilter.h"
+
+namespace gnash {
+
+// See parser/filter_factory.cpp for the implementation. Purposefully not here.
+//bool DropShadowFilter::read(stream* in);
+
+Filter const
+DropShadowFilter::clone()
+{
+ Filter p(new DropShadowFilter(m_distance, m_angle, m_color, m_alpha,
+ m_blurX, m_blurY, m_strength, m_quality, m_inner, m_knockout,
+ m_hideObject));
+ return p;
+}
+
+} // Namespace gnash
+
Index: server/DropShadowFilter.h
===================================================================
RCS file: server/DropShadowFilter.h
diff -N server/DropShadowFilter.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ server/DropShadowFilter.h 26 Aug 2007 15:14:11 -0000 1.1
@@ -0,0 +1,75 @@
+//
+// Copyright (C) 2007 Free Software Foundation, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+/* $Id: DropShadowFilter.h,v 1.1 2007/08/26 15:14:11 cmusick Exp $ */
+
+#ifndef GNASH_DROPSHADOWFILTER_H
+#define GNASH_DROPSHADOWFILTER_H
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "BitmapFilter.h"
+
+namespace gnash {
+
+// A drop shadow effect filter.
+class DropShadowFilter : public BitmapFilter
+{
+public:
+ // Fill from a stream. See parser/filter_factory.cpp for the
implementations.
+ virtual bool read(stream* in);
+
+ virtual ~DropShadowFilter() { return; }
+
+ // Clone this object and return a copy of it. (AS accessible function.)
+ // Guaranteed to return an object which can be cast to BlurFilter
+ Filter const clone();
+
+ DropShadowFilter() :
+ m_distance(0.0f), m_angle(0.0f), m_color(0), m_alpha(0),
+ m_blurX(0.0f), m_blurY(0.0f), m_strength(0.0f), m_quality(0),
+ m_inner(false), m_knockout(false), m_hideObject(false)
+ { return; }
+
+ DropShadowFilter(float distance, float angle, uint32_t color,
+ uint8_t alpha, float blurX, float blurY, float strength,
+ uint8_t quality, bool inner, bool knockout, bool hideObject) :
+ m_distance(distance), m_angle(angle), m_color(color),
+ m_alpha(alpha), m_blurX(blurX), m_blurY(blurY), m_strength(strength),
+ m_quality(quality), m_inner(inner), m_knockout(knockout),
+ m_hideObject(hideObject)
+ { return; }
+
+private:
+ float m_distance; // Distance of the filter in pixels.
+ float m_angle; // Angle of the filter.
+ uint32_t m_color; // RGB color.
+ uint8_t m_alpha; // Alpha strength, as a percentage(?)
+ float m_blurX; // horizontal blur
+ float m_blurY; // vertical blur
+ float m_strength; // How strong is the filter.
+ uint8_t m_quality; // How many times to apply the filter.
+ bool m_inner; // Is this an inner shadow?
+ bool m_knockout; // If true, render only the filter effect.
+ bool m_hideObject; // Does this hide the object?
+};
+
+} // Namespace gnash
+
+#endif // GNASH_DROPSHADOWFILTER_H
Index: server/GlowFilter.h
===================================================================
RCS file: server/GlowFilter.h
diff -N server/GlowFilter.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ server/GlowFilter.h 26 Aug 2007 15:14:12 -0000 1.1
@@ -0,0 +1,71 @@
+//
+// Copyright (C) 2007 Free Software Foundation, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+/* $Id: GlowFilter.h,v 1.1 2007/08/26 15:14:12 cmusick Exp $ */
+
+#ifndef GNASH_GLOWFILTER_H
+#define GNASH_GLOWFILTER_H
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "BitmapFilter.h"
+
+namespace gnash {
+
+// A glow effect filter.
+class GlowFilter : public BitmapFilter
+{
+public:
+ // Fill from a stream. See parser/filter_factory.cpp for the
implementations.
+ virtual bool read(stream* in);
+
+ virtual ~GlowFilter() { return; }
+
+ // Clone this object and return a copy of it. (AS accessible function.)
+ // Guaranteed to return an object which can be cast to BlurFilter
+ Filter const clone();
+
+ GlowFilter() :
+ m_color(0), m_alpha(0),
+ m_blurX(0.0f), m_blurY(0.0f), m_strength(0.0f), m_quality(0),
+ m_inner(false), m_knockout(false)
+ { return; }
+
+ GlowFilter(uint32_t color,
+ uint8_t alpha, float blurX, float blurY, float strength,
+ uint8_t quality, bool inner, bool knockout) :
+ m_color(color),
+ m_alpha(alpha), m_blurX(blurX), m_blurY(blurY), m_strength(strength),
+ m_quality(quality), m_inner(inner), m_knockout(knockout)
+ { return; }
+
+private:
+ uint32_t m_color; // RGB color.
+ uint8_t m_alpha; // Alpha strength, as a percentage(?)
+ float m_blurX; // horizontal blur
+ float m_blurY; // vertical blur
+ float m_strength; // How strong is the filter.
+ uint8_t m_quality; // How many times to apply the filter.
+ bool m_inner; // Is this an inner shadow?
+ bool m_knockout; // If true, render only the filter effect.
+};
+
+} // Namespace gnash
+
+#endif // GNASH_GLOWFILTER_H
Index: server/GlowFilter.cpp
===================================================================
RCS file: server/GlowFilter.cpp
diff -N server/GlowFilter.cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ server/GlowFilter.cpp 26 Aug 2007 15:14:12 -0000 1.1
@@ -0,0 +1,36 @@
+//
+// Copyright (C) 2007 Free Software Foundation, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+/* $Id: GlowFilter.cpp,v 1.1 2007/08/26 15:14:12 cmusick Exp $ */
+
+#include "GlowFilter.h"
+
+namespace gnash {
+
+// See parser/filter_factory.cpp for the implementation. Purposefully not here.
+//bool DropShadowFilter::read(stream* in);
+
+Filter const
+GlowFilter::clone()
+{
+ Filter p(new GlowFilter(m_color, m_alpha,
+ m_blurX, m_blurY, m_strength, m_quality, m_inner, m_knockout));
+ return p;
+}
+
+} // Namespace gnash
+
Index: server/GradientBevelFilter.cpp
===================================================================
RCS file: server/GradientBevelFilter.cpp
diff -N server/GradientBevelFilter.cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ server/GradientBevelFilter.cpp 26 Aug 2007 15:14:12 -0000 1.1
@@ -0,0 +1,36 @@
+//
+// Copyright (C) 2007 Free Software Foundation, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+/* $Id: GradientBevelFilter.cpp,v 1.1 2007/08/26 15:14:12 cmusick Exp $ */
+
+#include "GradientBevelFilter.h"
+
+namespace gnash {
+
+// See parser/filter_factory.cpp for the implementation. Purposefully not here.
+//bool GradientBevelFilter::read(stream* in);
+
+Filter const
+GradientBevelFilter::clone()
+{
+ Filter p(new GradientBevelFilter(m_distance, m_angle, m_colors, m_alphas,
+ m_blurX, m_blurY, m_strength, m_quality, m_type, m_knockout));
+ return p;
+}
+
+} // Namespace gnash
+
Index: server/GradientBevelFilter.h
===================================================================
RCS file: server/GradientBevelFilter.h
diff -N server/GradientBevelFilter.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ server/GradientBevelFilter.h 26 Aug 2007 15:14:12 -0000 1.1
@@ -0,0 +1,82 @@
+//
+// Copyright (C) 2007 Free Software Foundation, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+/* $Id: GradientBevelFilter.h,v 1.1 2007/08/26 15:14:12 cmusick Exp $ */
+
+#ifndef GNASH_GRADIENTBEVELFILTER_H
+#define GNASH_GRADIENTBEVELFILTER_H
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "array.h"
+#include "BitmapFilter.h"
+
+namespace gnash {
+
+// A gradient bevel effect filter.
+class GradientBevelFilter : public BitmapFilter
+{
+public:
+ typedef enum
+ {
+ INNER_BEVEL = 2,
+ OUTER_BEVEL = 1,
+ FULL_BEVEL = 3
+ } glow_types;
+
+ // Fill from a stream. See parser/filter_factory.cpp for the
implementations.
+ virtual bool read(stream* in);
+
+ virtual ~GradientBevelFilter() { return; }
+
+ // Clone this object and return a copy of it. (AS accessible function.)
+ // Guaranteed to return an object which can be cast to BlurFilter
+ Filter const clone();
+
+ GradientBevelFilter() :
+ m_distance(0.0f), m_angle(0.0f), m_colors(), m_alphas(),
+ m_blurX(0.0f), m_blurY(0.0f), m_strength(0.0f), m_quality(0),
+ m_type(INNER_BEVEL), m_knockout(false)
+ { return; }
+
+ GradientBevelFilter(float distance, float angle, as_array_object colors,
+ as_array_object alphas, float blurX, float blurY, float strength,
+ uint8_t quality, glow_types type, bool knockout) :
+ m_distance(distance), m_angle(angle), m_colors(colors),
+ m_alphas(alphas), m_blurX(blurX), m_blurY(blurY), m_strength(strength),
+ m_quality(quality), m_type(type), m_knockout(knockout)
+ { return; }
+
+private:
+ float m_distance; // Distance of the filter in pixels.
+ float m_angle; // Angle of the filter.
+ as_array_object m_colors; // Colors of the gradients.
+ as_array_object m_alphas; // Alphas of the gradients.
+ as_array_object m_ratios; // Ratios of the gradients.
+ float m_blurX; // horizontal blur
+ float m_blurY; // vertical blur
+ float m_strength; // How strong is the filter.
+ uint8_t m_quality; // How many times to apply the filter.
+ glow_types m_type; // What type of effect.
+ bool m_knockout; // If true, render only the filter effect.
+};
+
+} // Namespace gnash
+
+#endif // GNASH_GRADIENTBEVELFILTER_H
Index: server/GradientGlowFilter.cpp
===================================================================
RCS file: server/GradientGlowFilter.cpp
diff -N server/GradientGlowFilter.cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ server/GradientGlowFilter.cpp 26 Aug 2007 15:14:12 -0000 1.1
@@ -0,0 +1,36 @@
+//
+// Copyright (C) 2007 Free Software Foundation, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+/* $Id: GradientGlowFilter.cpp,v 1.1 2007/08/26 15:14:12 cmusick Exp $ */
+
+#include "GradientGlowFilter.h"
+
+namespace gnash {
+
+// See parser/filter_factory.cpp for the implementation. Purposefully not here.
+//bool GradientGlowFilter::read(stream* in);
+
+Filter const
+GradientGlowFilter::clone()
+{
+ Filter p(new GradientGlowFilter(m_distance, m_angle, m_colors, m_alphas,
+ m_blurX, m_blurY, m_strength, m_quality, m_type, m_knockout));
+ return p;
+}
+
+} // Namespace gnash
+
Index: server/GradientGlowFilter.h
===================================================================
RCS file: server/GradientGlowFilter.h
diff -N server/GradientGlowFilter.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ server/GradientGlowFilter.h 26 Aug 2007 15:14:12 -0000 1.1
@@ -0,0 +1,82 @@
+//
+// Copyright (C) 2007 Free Software Foundation, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+/* $Id: GradientGlowFilter.h,v 1.1 2007/08/26 15:14:12 cmusick Exp $ */
+
+#ifndef GNASH_GRADIENTGLOWFILTER_H
+#define GNASH_GRADIENTGLOWFILTER_H
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "array.h"
+#include "BitmapFilter.h"
+
+namespace gnash {
+
+// A gradient glow effect filter.
+class GradientGlowFilter : public BitmapFilter
+{
+public:
+ typedef enum
+ {
+ INNER_GLOW = 2,
+ OUTER_GLOW = 1,
+ FULL_GLOW = 3
+ } glow_types;
+
+ // Fill from a stream. See parser/filter_factory.cpp for the
implementations.
+ virtual bool read(stream* in);
+
+ virtual ~GradientGlowFilter() { return; }
+
+ // Clone this object and return a copy of it. (AS accessible function.)
+ // Guaranteed to return an object which can be cast to BlurFilter
+ Filter const clone();
+
+ GradientGlowFilter() :
+ m_distance(0.0f), m_angle(0.0f), m_colors(), m_alphas(),
+ m_blurX(0.0f), m_blurY(0.0f), m_strength(0.0f), m_quality(0),
+ m_type(INNER_GLOW), m_knockout(false)
+ { return; }
+
+ GradientGlowFilter(float distance, float angle, as_array_object colors,
+ as_array_object alphas, float blurX, float blurY, float strength,
+ uint8_t quality, glow_types type, bool knockout) :
+ m_distance(distance), m_angle(angle), m_colors(colors),
+ m_alphas(alphas), m_blurX(blurX), m_blurY(blurY), m_strength(strength),
+ m_quality(quality), m_type(type), m_knockout(knockout)
+ { return; }
+
+private:
+ float m_distance; // Distance of the filter in pixels.
+ float m_angle; // Angle of the filter.
+ as_array_object m_colors; // Colors of the gradients.
+ as_array_object m_alphas; // Alphas of the gradients.
+ as_array_object m_ratios; // Ratios of the gradients.
+ float m_blurX; // horizontal blur
+ float m_blurY; // vertical blur
+ float m_strength; // How strong is the filter.
+ uint8_t m_quality; // How many times to apply the filter.
+ glow_types m_type; // What type of effect.
+ bool m_knockout; // If true, render only the filter effect.
+};
+
+} // Namespace gnash
+
+#endif // GNASH_GRADIENTGLOWFILTER_H
Index: server/parser/filter_factory.h
===================================================================
RCS file: server/parser/filter_factory.h
diff -N server/parser/filter_factory.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ server/parser/filter_factory.h 26 Aug 2007 15:14:13 -0000 1.1
@@ -0,0 +1,49 @@
+//
+// Copyright (C) 2007 Free Software Foundation, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+/* $Id: filter_factory.h,v 1.1 2007/08/26 15:14:13 cmusick Exp $ */
+
+#ifndef GNASH_FILTER_FACTORY_H
+#define GNASH_FILTER_FACTORY_H
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <vector>
+#include "BitmapFilter.h"
+
+namespace gnash {
+
+class stream;
+
+typedef std::vector<Filter> Filters;
+
+class filter_factory
+{
+public:
+ /// \brief Read one, possibly multiple filters from the stream,
+ /// and push them into the vector store. Returns the number read.
+ /// If read_multiple is true, the first byte of the stream is
+ /// expected to contain the number of filters to be read.
+ static int const read(stream* in, int movie_version, bool read_multiple,
+ Filters* store);
+};
+
+} // Namespace gnash
+
+#endif // GNASH_FILTER_FACTORY_H
Index: server/parser/filter_factory.cpp
===================================================================
RCS file: server/parser/filter_factory.cpp
diff -N server/parser/filter_factory.cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ server/parser/filter_factory.cpp 26 Aug 2007 15:14:13 -0000 1.1
@@ -0,0 +1,301 @@
+//
+// Copyright (C) 2007 Free Software Foundation, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+/* $Id: filter_factory.cpp,v 1.1 2007/08/26 15:14:13 cmusick Exp $ */
+
+#include "filter_factory.h"
+#include "BitmapFilter.h"
+#include "BlurFilter.h"
+#include "DropShadowFilter.h"
+#include "GlowFilter.h"
+#include "BevelFilter.h"
+#include "GradientGlowFilter.h"
+#include "ConvolutionFilter.h"
+#include "ColorMatrixFilter.h"
+#include "GradientBevelFilter.h"
+
+#include "log.h"
+#include "stream.h"
+
+namespace gnash {
+
+typedef enum
+{
+ DROP_SHADOW = 0,
+ BLUR = 1,
+ GLOW = 2,
+ BEVEL = 3,
+ GRADIENT_GLOW = 4,
+ CONVOLUTION = 5,
+ COLOR_MATRIX = 6,
+ GRADIENT_BEVEL = 7
+} filter_types;
+
+int const filter_factory::read(stream* in, int /* movie_version */,
+ bool read_multiple, Filters* store)
+{
+ int count = 1;
+
+ if (read_multiple)
+ {
+ in->ensureBytes(1);
+ count = static_cast<int> (in->read_u8());
+ }
+
+ for (int i = 0; i < count; ++i)
+ {
+ BitmapFilter *the_filter = NULL;
+
+ filter_types filter_type = static_cast<filter_types> (in->read_u8());
+
+ switch (filter_type)
+ {
+ case DROP_SHADOW:
+ the_filter = new DropShadowFilter;
+ break;
+ case BLUR:
+ the_filter = new BlurFilter;
+ break;
+ case GLOW:
+ the_filter = new GlowFilter;
+ break;
+ case BEVEL:
+ the_filter = new BevelFilter;
+ break;
+ case GRADIENT_GLOW:
+ the_filter = new GradientGlowFilter;
+ break;
+ case CONVOLUTION:
+ the_filter = new ConvolutionFilter;
+ break;
+ case COLOR_MATRIX:
+ the_filter = new ColorMatrixFilter;
+ break;
+ case GRADIENT_BEVEL:
+ the_filter = new GradientBevelFilter;
+ break;
+ default:
+ IF_VERBOSE_MALFORMED_SWF(
+ log_swferror(_("Invalid filter type %d."), filter_type);
+ );
+ return i; // We're already broken, no need to cause more pain.
+ }
+
+ // Protect against exceptions and such by storing before we read.
+ Filter p(the_filter);
+ if (!p->read(in))
+ {
+ IF_VERBOSE_MALFORMED_SWF(
+ log_swferror(_("Filter %d could not read."), filter_type);
+ );
+ return i; // We're already broken.
+ }
+ store->push_back(p);
+ }
+
+ return count;
+}
+
+bool DropShadowFilter::read(stream* in)
+{
+ m_color = in->read_u8() << 16 + in->read_u8() << 8 + in->read_u8();
+ m_alpha = in->read_u8();
+
+ m_blurX = in->read_fixed();
+ m_blurY = in->read_fixed();
+
+ m_angle = in->read_fixed();
+ m_distance = in->read_fixed();
+
+ m_strength = in->read_short_sfixed();
+
+ m_inner = in->read_uint(1) ? true : false;
+ m_knockout = in->read_uint(1) ? true : false;
+ m_hideObject = in->read_uint(1) ? true : false;
+
+ static_cast<void> (in->read_uint(5)); // Throw these away on purpose.
+
+ return true;
+}
+
+bool BlurFilter::read(stream* in)
+{
+ m_blurX = in->read_ufixed();
+ m_blurY = in->read_ufixed();
+
+ m_quality = static_cast<uint8_t> (in->read_uint(5));
+
+ static_cast<void> (in->read_uint(3)); // Throw these away.
+
+ return true;
+}
+
+bool GlowFilter::read(stream* in)
+{
+ m_color = in->read_u8() << 16 + in->read_u8() << 8 + in->read_u8();
+ m_alpha = in->read_u8();
+
+ m_blurX = in->read_fixed();
+ m_blurY = in->read_fixed();
+
+ m_strength = in->read_short_sfixed();
+
+ m_inner = in->read_uint(1) ? true : false;
+ m_knockout = in->read_uint(1) ? true : false;
+
+ static_cast<void> (in->read_uint(6)); // Throw these away.
+
+ return true;
+}
+
+bool BevelFilter::read(stream* in)
+{
+ // TODO: It is possible that the order of these two should be reversed.
+ // highlight might come first. Find out for sure and then fix and remove
+ // this comment.
+ m_shadowColor = in->read_u8() << 16 + in->read_u8() << 8 + in->read_u8();
+ m_shadowAlpha = in->read_u8();
+
+ m_highlightColor = in->read_u8() << 16 + in->read_u8() << 8 +
in->read_u8();
+ m_highlightAlpha = in->read_u8();
+
+ m_blurX = in->read_fixed();
+ m_blurY = in->read_fixed();
+
+ m_angle = in->read_fixed();
+ m_distance = in->read_fixed();
+
+ m_strength = in->read_short_sfixed();
+
+ bool inner_shadow = in->read_uint(1) ? true : false;
+ m_knockout = in->read_uint(1) ? true : false;
+ static_cast<void> (in->read_uint(1));
+ bool on_top = in->read_uint(1) ? true : false;
+
+ // Set the bevel type. top and inner is full, top is outer, inner is inner
+ m_type = on_top ? (inner_shadow ? FULL_BEVEL : OUTER_BEVEL) : INNER_BEVEL;
+
+ static_cast<void> (in->read_uint(4)); // Throw these away.
+
+ return true;
+}
+
+bool GradientGlowFilter::read(stream* in)
+{
+ bool count = in->read_u8(); // How many colorings.
+
+ for (int i = 0; i < count; ++i)
+ {
+ m_colors.push(as_value(in->read_u8() << 16 + in->read_u8() << 8 +
in->read_u8()));
+ m_alphas.push(as_value(in->read_u8()));
+ }
+
+ for (int i = 0; i < count; ++i)
+ {
+ m_ratios.push(as_value(in->read_u8()));
+ }
+
+ m_blurX = in->read_fixed();
+ m_blurY = in->read_fixed();
+
+ m_angle = in->read_fixed();
+ m_distance = in->read_fixed();
+
+ m_strength = in->read_short_sfixed();
+
+ bool inner = in->read_uint(1) ? true : false;
+ m_knockout = in->read_uint(1) ? true : false;
+ static_cast<void> (in->read_uint(1));
+ bool outer = in->read_uint(1) ? true : false;
+
+ m_type = outer ? (inner ? FULL_GLOW : OUTER_GLOW) : INNER_GLOW;
+
+ m_quality = static_cast<uint8_t> (in->read_uint(4));
+
+ return true;
+}
+
+bool ConvolutionFilter::read(stream* in)
+{
+ m_matrixX = in->read_u8();
+ m_matrixY = in->read_u8();
+
+ m_divisor = in->read_float();
+ m_bias = in->read_float();
+
+ for (int i = 0; i < m_matrixX * m_matrixY; ++i)
+ {
+ m_matrix.push(as_value(in->read_float()));
+ }
+
+ m_color = in->read_u8() << 16 + in->read_u8() << 8 + in->read_u8();
+ m_alpha = in->read_u8();
+
+ static_cast<void> (in->read_uint(6)); // Throw away.
+
+ m_clamp = in->read_uint(1) ? true : false;
+ m_preserveAlpha = in->read_uint(1) ? true : false;
+
+ return true;
+}
+
+bool ColorMatrixFilter::read(stream* in)
+{
+ for (int i = 0; i < 20; ++i)
+ {
+ m_matrix.push(in->read_float());
+ }
+
+ return true;
+}
+
+bool GradientBevelFilter::read(stream* in)
+{
+ bool count = in->read_u8(); // How many colorings.
+
+ for (int i = 0; i < count; ++i)
+ {
+ m_colors.push(as_value(in->read_u8() << 16 + in->read_u8() << 8 +
in->read_u8()));
+ m_alphas.push(as_value(in->read_u8()));
+ }
+
+ for (int i = 0; i < count; ++i)
+ {
+ m_ratios.push(as_value(in->read_u8()));
+ }
+
+ m_blurX = in->read_fixed();
+ m_blurY = in->read_fixed();
+
+ m_angle = in->read_fixed();
+ m_distance = in->read_fixed();
+
+ m_strength = in->read_short_sfixed();
+
+ bool inner = in->read_uint(1) ? true : false;
+ m_knockout = in->read_uint(1) ? true : false;
+ static_cast<void> (in->read_uint(1));
+ bool outer = in->read_uint(1) ? true : false;
+
+ m_type = outer ? (inner ? FULL_BEVEL : OUTER_BEVEL) : INNER_BEVEL;
+
+ m_quality = static_cast<uint8_t> (in->read_uint(4));
+
+ return true;
+}
+
+} // gnash namespace
- [Gnash-commit] gnash ChangeLog server/Makefile.am server/strea...,
Chad Musick <=