HydrogenAudio

Hosted Forums => foobar2000 => Development - (fb2k) => Topic started by: paulski on 2003-06-29 13:02:22

Title: Using Macromedia Flash ocx in a component
Post by: paulski on 2003-06-29 13:02:22
Hi all

I've been looking into making use of the Macromedia Flash activeX control for use as a UI front end component (also as a visualisation engine in foobar 0.7 ;) ).
However, I cannot seem to achieve this from the 2 options I've looked into:
1) Use MFC for creating an activeX wrapper for Flash within the component: Can't get it to integrate with SDK :( - too many conflicts.
2) Write boilerplate COM code for activeX container (without using MFC): don't have a clue where to start :(

As you can see, I'm stumped.

Is this even feasible??

Please help.

Paulski
Title: Using Macromedia Flash ocx in a component
Post by: danZ on 2003-06-29 15:06:01
Quote
Hi all

I've been looking into making use of the Macromedia Flash activeX control for use as a UI front end component (also as a visualisation engine in foobar 0.7  ).
However, I cannot seem to achieve this from the 2 options I've looked into:
1) Use MFC for creating an activeX wrapper for Flash within the component: Can't get it to integrate with SDK  - too many conflicts.
2) Write boilerplate COM code for activeX container (without using MFC): don't have a clue where to start

As you can see, I'm stumped.

Is this even feasible??

Please help.

Paulski

Why kinds of conflicts are you having with MFC?  I know of at least 2 components written in MFC so it is certainly possible.  You could also try WTL which is much lighter then MFC but has some wrappers for making COM "hosting" quick and easy.  I'd recommend WTL since basically all you need is a simple window that embeds the Flash OCX.

Try this article for starters.

Hosting ActiveX in WTL (http://www.codeproject.com/wtl/WTL4MFC6.asp)
Title: Using Macromedia Flash ocx in a component
Post by: paulski on 2003-06-29 15:31:56
I'll look into it. Thanx.
Do you know which components already use MFC?
Title: Using Macromedia Flash ocx in a component
Post by: danZ on 2003-07-01 15:24:08
Quote
I'll look into it. Thanx.
Do you know which components already use MFC?

I wrote one a long time ago, foo_ledz.  Also, foo_ufts, foo_bookmark, and foo_chug (http://www.loodi.com/foo_chug.zip) which had the source code included I believe.
Title: Using Macromedia Flash ocx in a component
Post by: paulski on 2003-07-01 18:53:04
Great thnx. I've managed to get flash inserted working using pure ATL code for sending events to Flash but hit problems when I wanted to integrate sink maps for receiving events. I might save some time with MFC though so I'll check out your code.
Title: Using Macromedia Flash ocx in a component
Post by: paulski on 2003-07-09 10:15:54
OK, I've got it the Flash plugin working nicely in 0.667. You simply design your UI in macromedia flash and use FSCommands to tell foobar what to do when you interact with it.

I'm using the neptune winamp3 skin as a test swf and it looks great, except for one thing: anti-aliased edges. The skin is non-rectangular with an alpha shadow. In my plugin code, I am using colour keying (a windows 2000 / XP feature) to make the background transparent. However, the Flash ocx pre-blends the skin with the background of my dialog container instead of with the desktop so you end up with an ugly "halo" around the shape.

Any ideas on how to resolve this? If not, I will have to design my skins with aliased edges

Paulski
Title: Using Macromedia Flash ocx in a component
Post by: danZ on 2003-07-09 14:18:49
IIRC, in Director/Shockwave you can control the anti-aliasing properties of each sprite individually.  I'd be suprised if you can't do the same thing in Flash thus allowing you to turn off anti-aliasing for the background graphic while leaving it on for text, and other layers.

When will you be posting a beta?
Title: Using Macromedia Flash ocx in a component
Post by: paulski on 2003-07-09 19:58:01
The anti-aliasing within the movie works perfectly. It's only when I have a transparent, non rectangular outline of the movie that I have the problem (look at the neptune skin of the winamp 3 site to see what I mean). This is because the movie needs to be blended with the pixels of the desktop in order to get a nice anti-aliased outline of the movie.

I want to see if I can resolve this issue (with your help) before I release the plugin, but it will be soon nonetheless.

Paulski
Title: Using Macromedia Flash ocx in a component
Post by: danZ on 2003-07-09 22:24:42
Quote
The anti-aliasing within the movie works perfectly. It's only when I have a transparent, non rectangular outline of the movie that I have the problem (look at the neptune skin of the winamp 3 site to see what I mean). This is because the movie needs to be blended with the pixels of the desktop in order to get a nice anti-aliased outline of the movie.

I want to see if I can resolve this issue (with your help) before I release the plugin, but it will be soon nonetheless.

Paulski

Yeah, I understand.  The movie is being anti-aliased with your (transparent) window background color and then drawn on the desktop.

The problem is that the ocx composites with your own window and then XP draws your window on the desktop.  I think you have to turn off antialiasing of the background in the flash movie so it won't blend with your background color.

You'll have to live with an aliased edge wrt the other windows on the desktop.

If you want to try it (never done it myself) the layered window api on XP has an UpdateLayeredWindow function that is a more robust (and complictated) way of doing the layered windows.  It involves a blend function and a bunch of other stuff and you use it in place of the simple SetLayeredWindowAttributes() function which handles simple color key and alpha blend.  In other words, you'd have to write the anti-aliasing blitter your self in the blend function.

I vote for an aliased edge - easy
Title: Using Macromedia Flash ocx in a component
Post by: paulski on 2003-07-09 23:06:14
I tried the UpdateLayeredWindow (instead of set...Attributes) approach but got no joy - I've only seen it used with memory based bitmaps. If I could somehow get the device context of the ocx instance however, I could redirect drawing also to a memory based DC and voila (maybe) .
Well, the aliased edge solution is just as good as any version of windows media player. So it can't be that bad right? 
Title: Using Macromedia Flash ocx in a component
Post by: danZ on 2003-07-09 23:14:35
Quote
I tried the UpdateLayeredWindow (instead of set...Attributes) approach but got no joy - I've only seen it used with memory based bitmaps. If I could somehow get the device context of the ocx instance however, I could redirect drawing also to a memory based DC and voila (maybe) .
Well, the aliased edge solution is just as good as any version of windows media player. So it can't be that bad right? 

I wouldn't postpone getting out there for some testing based only on the anti-aliasing issue.

You can always add that later when/if you figure out how to do it.

I'm eager to see the first pass.
Title: Using Macromedia Flash ocx in a component
Post by: paulski on 2003-07-14 15:10:45
I think you have a valid point Danz. I'll submit something within the next few days (I need to finish the volume control in the sample Macromedia movie before then).

By the way, I've seen that a company called FlashAnts (www.flashants.com) offer a program to create windowless, anti-aliased edge Flash projectors using the Flash ocx. This means that it most certainly is possible to do. I still haven't got a clue as to how though.

Paulski