-
-
Notifications
You must be signed in to change notification settings - Fork 831
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement flash.filters.BevelFilter avm1 built-in #1215
Conversation
let highlight_color = args | ||
.get(2) | ||
.unwrap_or(&0xFFFFFF.into()) | ||
.coerce_to_i32(activation)?; | ||
|
||
let highlight_color_clamped = if highlight_color.is_negative() { | ||
0x1000000 - (highlight_color.abs() % 0x1000000) | ||
} else { | ||
highlight_color % (0x1000000) | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this can just be coerce_to_u32
and then color & 0xffffff
|
||
let angle = args | ||
.get(1) | ||
.unwrap_or(&44.9999999772279.into()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if the almost-45 default means the angle is actually stored as radians (in an f32?), and the getters/setters convert to/from degrees, or similar? Not sure, something to keep in mind and maybe test more thoroughly someday.
let shadow_color_clamped = if shadow_color.is_negative() { | ||
0x1000000 - (shadow_color.abs() % 0x1000000) | ||
} else { | ||
shadow_color % (0x1000000) | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto
bevel_filter.set_distance(activation.context.gc_context, distance); | ||
bevel_filter.set_angle(activation.context.gc_context, clamped_angle); | ||
bevel_filter.set_highlight_color(activation.context.gc_context, highlight_color_clamped); | ||
bevel_filter.set_highlight_alpha(activation.context.gc_context, highlight_alpha); | ||
bevel_filter.set_shadow_color(activation.context.gc_context, shadow_color_clamped); | ||
bevel_filter.set_shadow_alpha(activation.context.gc_context, shadow_alpha); | ||
bevel_filter.set_blur_x(activation.context.gc_context, blur_x); | ||
bevel_filter.set_blur_y(activation.context.gc_context, blur_y); | ||
bevel_filter.set_strength(activation.context.gc_context, strength); | ||
bevel_filter.set_quality(activation.context.gc_context, quality); | ||
bevel_filter.set_type(activation.context.gc_context, type_); | ||
bevel_filter.set_knockout(activation.context.gc_context, knockout); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If these setters are going to clamp the values, do we have to do it above too? Seems like we're doing it twice
Thank you! |
Implements flash.filters.BevelFilter (#292)
This also fixes the issue with
clone()
for filter objects mentioned in my previous pr (#1041)