Add a border or outline to Text or Bitmap at runtime

I’ve been trying to figure out how to add an outline to dynamic text and found out that there’s little usable concrete examples out there.

I hobbled together some classes that find the outline of an object and used that to draw pixels in those places. I then attempted to outline that outline to create a simple border weight like effect. Here’s the demo.

The main issue for a text outline is that the text has to be rasterized first; it’s not as easy to apply as a drop shadow filter effect.

The other issues are that the border grows in rather than out, the edge is aliased and the outline is cut off if the bitmap is not large enough ahead of time.

I think a better approach would be to create a pixel bender filter that can be applied to display object. Or instead of getting the points around an object get the text path (like in FXG Path) and then apply a stroke to it.

<s:Path data="M 1,2 L 3,4">
    <s:stroke>
        <s:SolidColorStroke weight="2" />
    </s:stroke>
</s:Path>

If possible the class would extend Label and add a stroke property or extend Path and add a text property (when you set the text the path would be created). Examples:

<s:Path text="Test Text">
    <s:stroke>
        <s:SolidColorStroke weight="2" />
    </s:stroke>
</s:Path>
<s:Path bitmapData="{image1}">
    <s:stroke>
        <s:SolidColorStroke weight="2" />
    </s:stroke>
</s:Path>
<s:Label text="Test Text">
    <s:stroke>
        <s:SolidColorStroke weight="2" />
    </s:stroke>
</s:Path>
Posted in AIR, Flash, Flex, FXG | Leave a comment

Performance difference between debug and release builds

Check out the difference in speed between a release swf and the debug swf in the example project.

debug build outline time: ~250ms
release build outline time: ~50ms

In the above tests I set the font size to 200 and clicked the outline button.

It’s almost 5x faster! I know it’s supposed to be faster but I didn’t have numbers before. It’s supposed to be faster if you’re running in the release build of the Flash Player as well. I might test that next.

Flash Player Content Debugger 11.2.202.228
Macbook AIR 1.7GHz i5

 

Posted in AIR, Flash, Flash Catalyst, Flex, Technology | Leave a comment

The reason HTML5 has so much momentum

In a comment in the last post I was reminded of the way web developers think about HTML5. It has gained so much momentum and attention that it’s rocked the boat all throughout the industry. How could this happen?

It isn’t because it’s a technical ground breaking feat…  it’s because HTML5 is a movement. It’s a symbol to look to and an ideal to rally around. It’s hope for worn out web developers.

That’s why there’s so much energy behind it. That’s why there’s so much momentum.

But as it is it won’t solve the problems.* As it is you’ll still have the same problems and I’ll tell you why. It is not fixing the real issues. And like weeds in a garden they’ll keep coming back until you grab the problems by the root and yank them out for good! I describe those problems here. Read it now.

You need a single community created, community unified HTML5 rendering plugin. HTML5 Player. That balances the power. Not one browser or company can control. Remember IE6? You couldn’t do anything about it. If you had an HTML5 plugin it could grow leaps and bounds. If there’s a bug you can fix it immediately. Not let it linger for years. It’s not dependent on Microsoft to fix.

Aren’t there problems with plugins? A plug-in and plug in container software is just like any other software. That is it’s as secure and stable as it’s made to be…  Remember, JavaScript was a plugin at one time and people said the same things. You wouldn’t have the web as it is without it. Remember, desktop software has it’s rendering and behavior guaranteed. You know desktop developers pity web developers. It’s not supposed to be this way!

Aren’t there problems with search engines reading plug-in content? Why would there be? You’re just passing the HTML to the HTML5 plug in / renderer. Besides that’s the search engines job not yours. With that one standard open source renderer you can ensure you’re content and design and features and behavior  is rendered the same and behaves the same across browsers. (you know what… whatever… do what you want).

*Update – I want to make it clear that I’m describing the problem as I see it. I want to mention that there has been a lot of work by a lot of people, companies and communities with solutions that abstract these issues (as mentioned by Flexodus in the comments).

I believe in fixing problems like these at their root. On the other hand if these issues are solved for you they are no longer issues. It’s like the situation where a sailor couldn’t travel down a river because of the dangerous rocks. If you raise the water level high enough the rocks on the river bed are no longer an issue.

If you’ve found solutions that work please comment.

Posted in Flash, HTML, HTML5 | 3 Comments

Song – Night Time

This is a song I put together from 2005. Entitled Night Time (since that was when I made it).

Night Time

Posted in Music | Leave a comment

Guardian / Alter

alter

This is from 2005. I titled it guardian at the time because it related to a story I was working. It’s similar in idea to an Alter (see s-CRY-ed).

Posted in Art | Leave a comment