You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@royale.apache.org by Greg Dove <gr...@gmail.com> on 2019/12/11 20:09:25 UTC

SWF Graphics api emulation (Re-post from Flex dev list)

This was posted to Flex dev list by mistake.
Please ignore this if you already read it in the other list.

Combined content of what I posted in other thread:

Just some early advice that I expect to have a very close emulation of the
flash graphics API available by early January at the latest. I had a client
express a need for this, and I have quite a lot of progress already.
I know we have various graphics support already in Graphics and MXRoyale,
but the emphasis for this will be on the closest match to swf that I can
reasonably achieve. I'm reasonably familiar with this stuff from things I
have done in the past (although much of that was 10-12 years ago now).

There are some things that, while technically possible may not be
'practical' to emulate based on how heavy the code would be to achieve that
in JS. One of these is the miter joint implementation in flash which is not
currently available in a similar way in svg. Unfortunately it seems that
will not be available in svg 2.0 even though it was intended to be.
Also some browser/OS combinations seem to not handle certain gradients very
well. In general windows is better than mac for these, and Safari on Mac
seems to be the most problematic so far. I did not focus a lot on mobile,
but things were working quite good in a 2013 Galaxy Tablet, for example.

Anyhow I just wanted to let others know I was working on this.

This is player level emulation of [1], supporting (as much as possible)
direct use of legacy flash player-level (i.e. no graphics lib) drawing
code. So it is more the flash.display.* stuff that relates to drawing, and
it's not going to be the right solution for everyone (even the client that
wants it, I will try to move them to svg, but for now this is a good
option, and I think it will help others. I also think I can get some
'flash' people interested in the project who never used Flex in the past).

I'm also making sure it emulates the various quirks in the flash drawing
api, which sometimes can be relied upon (negative widths, negative corner
radii etc)
I have the gradient and solid colors working, Currently no bitmapData, but
I plan to add that.

Here's how I am testing across machines [2]. If you want to test arbitrary
code, you can go into the console and simply type in 'graphics' and
'Matrix' commands from javascript, it will run them in both flash and
javascript at the same time. I have it to the point where (partly because
Adobe Animate timeline as3 is a bit more loosely typed) I can paste between
the js console and Adobe Animate and it works in both, which has been
helpful for testing various things.
Don't try this on a mobile device, I really only built it for desktop
without any thought for mobile, you need a FHD+ monitor for the side by
side view to be practical. If you see any issues please let me know.

As mentioned, in terms of timing, I hope to add this to Royale in January.


1.
https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/Graphics.html

2. http://interactionscript.com/royale/swf-graphics/index.html

Re: SWF Graphics api emulation (Re-post from Flex dev list)

Posted by Carlos Rovira <ca...@apache.org>.
Hi Greg,

awesome work! Can wait to play with it! I think it will be a great addition
that can make old flash devs get around Royale to play with it and maybe
adopt it! :)

Great work! :)

Carlos


El mié., 11 dic. 2019 a las 21:09, Greg Dove (<gr...@gmail.com>)
escribió:

> This was posted to Flex dev list by mistake.
> Please ignore this if you already read it in the other list.
>
> Combined content of what I posted in other thread:
>
> Just some early advice that I expect to have a very close emulation of the
> flash graphics API available by early January at the latest. I had a client
> express a need for this, and I have quite a lot of progress already.
> I know we have various graphics support already in Graphics and MXRoyale,
> but the emphasis for this will be on the closest match to swf that I can
> reasonably achieve. I'm reasonably familiar with this stuff from things I
> have done in the past (although much of that was 10-12 years ago now).
>
> There are some things that, while technically possible may not be
> 'practical' to emulate based on how heavy the code would be to achieve that
> in JS. One of these is the miter joint implementation in flash which is not
> currently available in a similar way in svg. Unfortunately it seems that
> will not be available in svg 2.0 even though it was intended to be.
> Also some browser/OS combinations seem to not handle certain gradients very
> well. In general windows is better than mac for these, and Safari on Mac
> seems to be the most problematic so far. I did not focus a lot on mobile,
> but things were working quite good in a 2013 Galaxy Tablet, for example.
>
> Anyhow I just wanted to let others know I was working on this.
>
> This is player level emulation of [1], supporting (as much as possible)
> direct use of legacy flash player-level (i.e. no graphics lib) drawing
> code. So it is more the flash.display.* stuff that relates to drawing, and
> it's not going to be the right solution for everyone (even the client that
> wants it, I will try to move them to svg, but for now this is a good
> option, and I think it will help others. I also think I can get some
> 'flash' people interested in the project who never used Flex in the past).
>
> I'm also making sure it emulates the various quirks in the flash drawing
> api, which sometimes can be relied upon (negative widths, negative corner
> radii etc)
> I have the gradient and solid colors working, Currently no bitmapData, but
> I plan to add that.
>
> Here's how I am testing across machines [2]. If you want to test arbitrary
> code, you can go into the console and simply type in 'graphics' and
> 'Matrix' commands from javascript, it will run them in both flash and
> javascript at the same time. I have it to the point where (partly because
> Adobe Animate timeline as3 is a bit more loosely typed) I can paste between
> the js console and Adobe Animate and it works in both, which has been
> helpful for testing various things.
> Don't try this on a mobile device, I really only built it for desktop
> without any thought for mobile, you need a FHD+ monitor for the side by
> side view to be practical. If you see any issues please let me know.
>
> As mentioned, in terms of timing, I hope to add this to Royale in January.
>
>
> 1.
>
> https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/Graphics.html
>
> 2. http://interactionscript.com/royale/swf-graphics/index.html
>


-- 
Carlos Rovira
http://about.me/carlosrovira