summaryrefslogtreecommitdiff
path: root/core/multimedia/opieplayer/libflash/cxform.cc
Unidiff
Diffstat (limited to 'core/multimedia/opieplayer/libflash/cxform.cc') (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/libflash/cxform.cc79
1 files changed, 79 insertions, 0 deletions
diff --git a/core/multimedia/opieplayer/libflash/cxform.cc b/core/multimedia/opieplayer/libflash/cxform.cc
new file mode 100644
index 0000000..b448f5d
--- a/dev/null
+++ b/core/multimedia/opieplayer/libflash/cxform.cc
@@ -0,0 +1,79 @@
1/////////////////////////////////////////////////////////////
2// Flash Plugin and Player
3// Copyright (C) 1998,1999 Olivier Debon
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 2
8// of the License, or (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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18//
19///////////////////////////////////////////////////////////////
20// Author : Olivier Debon <odebon@club-internet.fr>
21//
22
23#include "swf.h"
24
25#ifdef RCSID
26static char *rcsid = "$Id";
27#endif
28
29long
30Cxform::getRed(long v) {
31 long val;
32
33 val = (long)(ra*v+rb);
34 if (val > 255) val = 255;
35 else if (val < 0) val = 0;
36 return val;
37}
38
39long
40Cxform::getGreen(long v) {
41 long val;
42
43 val = (long)(ga*v+gb);
44 if (val > 255) val = 255;
45 else if (val < 0) val = 0;
46 return val;
47}
48
49long
50Cxform::getBlue(long v) {
51 long val;
52
53 val = (long)(ba*v+bb);
54 if (val > 255) val = 255;
55 else if (val < 0) val = 0;
56 return val;
57}
58
59long
60Cxform::getAlpha(long v) {
61 long val;
62
63 val = (long)(aa*v+ab);
64 if (val > 255) val = 255;
65 else if (val < 0) val = 0;
66 return val;
67}
68
69Color
70Cxform::getColor(Color color) {
71 Color newColor;
72
73 newColor.red = getRed(color.red);
74 newColor.green = getGreen(color.green);
75 newColor.blue = getBlue(color.blue);
76 newColor.alpha = getAlpha(color.alpha);
77
78 return newColor;
79}