2 * Copyright (C) 2007 Pekka Lampila <pekka.lampila@iki.fi>
3 * 2008 Benjamin Otte <otte@gnome.org>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library 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 GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301 USA
25 #include "swfdec_as_internal.h"
26 #include "swfdec_blur_filter.h"
27 #include "swfdec_debug.h"
29 SWFDEC_AS_NATIVE (1102, 1, swfdec_blur_filter_get_blurX
)
31 swfdec_blur_filter_get_blurX (SwfdecAsContext
*cx
, SwfdecAsObject
*object
,
32 guint argc
, SwfdecAsValue
*argv
, SwfdecAsValue
*ret
)
34 SwfdecBlurFilter
*filter
;
36 SWFDEC_AS_CHECK (SWFDEC_TYPE_BLUR_FILTER
, &filter
, "");
38 *ret
= swfdec_as_value_from_number (cx
, filter
->x
);
41 SWFDEC_AS_NATIVE (1102, 2, swfdec_blur_filter_set_blurX
)
43 swfdec_blur_filter_set_blurX (SwfdecAsContext
*cx
, SwfdecAsObject
*object
,
44 guint argc
, SwfdecAsValue
*argv
, SwfdecAsValue
*ret
)
46 SwfdecBlurFilter
*filter
;
49 SWFDEC_AS_CHECK (SWFDEC_TYPE_BLUR_FILTER
, &filter
, "n", &d
);
51 filter
->x
= CLAMP (d
, 0, 255);
52 swfdec_blur_filter_invalidate (filter
);
55 SWFDEC_AS_NATIVE (1102, 3, swfdec_blur_filter_get_blurY
)
57 swfdec_blur_filter_get_blurY (SwfdecAsContext
*cx
, SwfdecAsObject
*object
,
58 guint argc
, SwfdecAsValue
*argv
, SwfdecAsValue
*ret
)
60 SwfdecBlurFilter
*filter
;
62 SWFDEC_AS_CHECK (SWFDEC_TYPE_BLUR_FILTER
, &filter
, "");
64 *ret
= swfdec_as_value_from_number (cx
, filter
->y
);
67 SWFDEC_AS_NATIVE (1102, 4, swfdec_blur_filter_set_blurY
)
69 swfdec_blur_filter_set_blurY (SwfdecAsContext
*cx
, SwfdecAsObject
*object
,
70 guint argc
, SwfdecAsValue
*argv
, SwfdecAsValue
*ret
)
72 SwfdecBlurFilter
*filter
;
75 SWFDEC_AS_CHECK (SWFDEC_TYPE_BLUR_FILTER
, &filter
, "n", &d
);
77 filter
->y
= CLAMP (d
, 0, 255);
78 swfdec_blur_filter_invalidate (filter
);
81 SWFDEC_AS_NATIVE (1102, 5, swfdec_blur_filter_get_quality
)
83 swfdec_blur_filter_get_quality (SwfdecAsContext
*cx
, SwfdecAsObject
*object
,
84 guint argc
, SwfdecAsValue
*argv
, SwfdecAsValue
*ret
)
86 SwfdecBlurFilter
*filter
;
88 SWFDEC_AS_CHECK (SWFDEC_TYPE_BLUR_FILTER
, &filter
, "");
90 *ret
= swfdec_as_value_from_integer (cx
, filter
->quality
);
93 SWFDEC_AS_NATIVE (1102, 6, swfdec_blur_filter_set_quality
)
95 swfdec_blur_filter_set_quality (SwfdecAsContext
*cx
, SwfdecAsObject
*object
,
96 guint argc
, SwfdecAsValue
*argv
, SwfdecAsValue
*ret
)
98 SwfdecBlurFilter
*filter
;
101 SWFDEC_AS_CHECK (SWFDEC_TYPE_BLUR_FILTER
, &filter
, "i", &i
);
103 filter
->y
= CLAMP (i
, 0, 15);
104 swfdec_blur_filter_invalidate (filter
);
108 SWFDEC_AS_NATIVE (1102, 0, swfdec_blur_filter_construct
)
110 swfdec_blur_filter_construct (SwfdecAsContext
*cx
, SwfdecAsObject
*object
,
111 guint argc
, SwfdecAsValue
*argv
, SwfdecAsValue
*ret
)
113 SwfdecBlurFilter
*filter
;
117 SWFDEC_AS_CHECK (0, NULL
, "|nni", &x
, &y
, &quality
);
119 if (!swfdec_as_context_is_constructing (cx
))
122 filter
= g_object_new (SWFDEC_TYPE_BLUR_FILTER
, "context", cx
, NULL
);
123 filter
->x
= CLAMP (x
, 0, 255);
124 filter
->y
= CLAMP (y
, 0, 255);
125 filter
->quality
= CLAMP (quality
, 0, 15);
127 swfdec_as_object_set_relay (object
, SWFDEC_AS_RELAY (filter
));
128 SWFDEC_AS_VALUE_SET_OBJECT (ret
, object
);