|
| 1 | +//! `flash.filters.GlowFilter` builtin/prototype |
| 2 | +
|
| 3 | +use crate::avm2::activation::Activation; |
| 4 | +use crate::avm2::class::{Class, ClassAttributes}; |
| 5 | +use crate::avm2::method::Method; |
| 6 | +use crate::avm2::names::{Namespace, QName}; |
| 7 | +use crate::avm2::value::Value; |
| 8 | +use crate::avm2::{Error, Object}; |
| 9 | +use gc_arena::{GcCell, MutationContext}; |
| 10 | + |
| 11 | +/// Implements `flash.filters.GlowFilter`'s class constructor. |
| 12 | +pub fn class_init<'gc>( |
| 13 | + _activation: &mut Activation<'_, 'gc, '_>, |
| 14 | + _this: Option<Object<'gc>>, |
| 15 | + _args: &[Value<'gc>], |
| 16 | +) -> Result<Value<'gc>, Error> { |
| 17 | + Ok(Value::Undefined) |
| 18 | +} |
| 19 | + |
| 20 | +/// Implements `flash.filters.GlowFilter`'s instance constructor. |
| 21 | +pub fn instance_init<'gc>( |
| 22 | + _activation: &mut Activation<'_, 'gc, '_>, |
| 23 | + _this: Option<Object<'gc>>, |
| 24 | + _args: &[Value<'gc>], |
| 25 | +) -> Result<Value<'gc>, Error> { |
| 26 | + Ok(Value::Undefined) |
| 27 | +} |
| 28 | + |
| 29 | +pub fn create_class<'gc>(mc: MutationContext<'gc, '_>) -> GcCell<'gc, Class<'gc>> { |
| 30 | + let class = Class::new( |
| 31 | + QName::new(Namespace::package("flash.filters"), "GlowFilter"), |
| 32 | + Some(QName::new(Namespace::package("flash.filters"), "BitmapFilter").into()), |
| 33 | + Method::from_builtin(instance_init, "<GlowFilter instance initializer>", mc), |
| 34 | + Method::from_builtin(class_init, "<GlowFilter class initializer>", mc), |
| 35 | + mc, |
| 36 | + ); |
| 37 | + |
| 38 | + let mut write = class.write(mc); |
| 39 | + write.set_attributes(ClassAttributes::FINAL | ClassAttributes::SEALED); |
| 40 | + |
| 41 | + class |
| 42 | +} |
0 commit comments