Skip to content
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

Wish: implement rasterizer compatible with Flash (SWF) #68

Open
Oldes opened this issue Mar 15, 2020 · 7 comments
Open

Wish: implement rasterizer compatible with Flash (SWF) #68

Oldes opened this issue Mar 15, 2020 · 7 comments

Comments

@Oldes
Copy link

Oldes commented Mar 15, 2020

I believe it would be really cool to be able use data from Adobe's Animate (used to be Macromedia Flash) SWF file format to render vector animations on CPU using Blend2D.

I don't request Blend2D to be able parse SWFs. That is something I'm able to do myself. Problem is that SWF was using two fill styles per edge. Here is what is in the SWF specification:

FillStyle0 and FillStyle1

The Adobe Flash authoring tool supports two fill styles per edge, one for each side of the edge: FillStyle0 and FillStyle1. For shapes that don’t self-intersect or overlap, FillStyle0 should be used. For overlapping shapes the situation is more complex.

For example, if a shape consists of two overlapping squares, and only FillStyle0 is defined, Flash Player renders a ‘hole’ where the paths overlap. This area can be filled using FillStyle1. In this situation, the rule is that for any directed vector, FillStyle0 is the color to the left of the vector, and FillStyle1 is the color to the right of the vector (as shown in the following diagram).

image

Here is PDF with full SWF specification (last freely available) if needed:
https://www.adobe.com/content/dam/acom/en/devnet/pdf/swf-file-format-spec.pdf

Not a big priority for me as I'm busy in other directions right now, but this is something what I always wanted to be handled by AGG, so see it in Blend2D would be really nice!

Thanks a lot and keep going. Blend2D is great!

@jackwlee01
Copy link

This would be a fantastic enhancement that I would get a lot of use out of.

@Oldes
Copy link
Author

Oldes commented Feb 13, 2021

Yes.. especially now when the official Adobe's Flash player is dead.

@jackwlee01
Copy link

I have been researching for my own SWF parser and encountered the quirk you raised. I found some good info on a solution:

http://wahlers.com.br/claus/blog/hacking-swf-1-shapes-in-flash/

This lead me to the author's excellent AS3 library, which I am now using for reference purposes.

https://github.com/claus/as3swf

@Oldes
Copy link
Author

Oldes commented Feb 13, 2021

As the link to MS blog from the first mentioned link was covered with dust and took me some time to find it in past... here is its working version:

https://docs.microsoft.com/en-us/archive/blogs/mswanson/converting-flash-shapes-to-wpf

@jackwlee01
Copy link

Thanks for tracking down that article!

@kobalicek
Copy link
Member

I think the feature is interesting, but I don't know whether this would ever be part of Blend2D. The primary reason is that there is a lot of missing features that other libraries have - and these are the priority (masking, layers, pixel and convolution effects, path effects and dashing, better text support, 64-bit and floating point pixel formats, etc...). Once these are all implemented we can discuss new candidates.

I don't wanna kill new ideas, however, my time is limited, so I will spend it on features that I think are more necessary.

@Oldes
Copy link
Author

Oldes commented Feb 14, 2021

No problem.. use your valuable time as you think its the most useful. One can still convert swf shapes to classic shapes as described in the links above, meantime.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants