Monthly Archive for March, 2007

A hint of true overloading

This morning I came across some strange sort-of overload workaround that can cast your class to any type. Imagine you want to have a reference to a boolean. You have to “box” it then. It look like this:

[as]class BoxedBoolean
{
private var value: Boolean;

public function BoxedBoolean( value: Boolean )
{
this.value = value;
}
}[/as]

Now doing something like if ( boxedBoolean == true ) is not possible since boxedBoolean is type BoxedBoolean. Even though the value we want to use is a boolean value. So here is the workaround:

[as]class BoxedBoolean
{
private var value: Boolean;

public function BoxedBoolean( value: Boolean )
{
this.value = value;
}

public function toString(): Boolean
{
return value;
}
}[/as]

Do not ask me what strange nature toString() has but it works. Now the only problem with this is that if ( a == true ) works fine but if ( a ) is always true.

Here is an example

[as]var b0: BoxedBoolean = new BoxedBoolean( true );
var b1: BoxedBoolean = new BoxedBoolean( false );

trace( b0 is Boolean );
trace( b1 is Boolean );

trace( b0 );
trace( b1 );

if ( b0 == true )
trace( ‘b0 = true’ );
else
trace( ‘b0 = false’ );

if ( b1 == true )
trace( ‘b1 = true’ );
else
trace( ‘b1 = false’ );[/as]

The trace output is then

false
false
true
false
b0 = true
b1 = false

If you remove the == true you will get that both b0 and b1 are true. I do not think that there is much use for it but it is interesting what you can do. toString() can also return an integer and it works as well.

The Apollo Battlebay

Battlebay

Today the alpha release of Apollo on Adobe Labs has been announced. So finally it is time to share something I developed in my very limited spare time.

Have fun with the Battlebay. It is an application that makes heavy use of the Imageprocessing Library. I would not say that there is any sort of real user-interface but treat it as some sort of showcase application. You can easily remix pictures that have been posted on the bay and create your own content.

And while you are reading this you may have a look at popforge.de. I noticed that André got some time to put a site up there.

Matrix Extrude

Matrix Extrude

It has not as many features as a real matrix extrude but it looks smooth and organic. It is all calculated at runtime using a Sphere object of Papervision3D and then extruding some faces of it five times based on their face-normal rotated using the Matrix3D class.

Rotational Geometry

RotoGeometryTurn on your mixer. Put some Papervision3D into it. Add some Imageprocessing, basic math and then push the button. Have fun with a spicy result.

I created for this little example a new geometry object that can use any function and rotate that around a center which results in such a mesh. You know this maybe from your favorite 3D application. In this case I abuse the Curve class from my Imageprocessing library as such a function.

Update: Added two versions that use different functions.

WiiFlash API Demo

Thibault posted a new video about our WiiFlash project. He is talking about how to use it and showing some stuff of the API which is very easy to use and very lightweight.

Read the post on wiiflash.org

Adobe Photoshop online

Three days ago there was some news about an online version of Adobe Photoshop. Today I read on a German news site that they will probably use Flex. I am so excited about that news and I am looking forward to try their product. Of course I have a special interest in this because I developed my own library and now the big boys do it.

It will also be very interesting to see what they will do about some issues. If you want to edit a picture (like 6megapixel picture) it will be a big fight against stuff like the maximum execution time. Probably they will use an approach to filter an image over more than one frame. So it would be possible – just like Photoshop does – to see a progress of that thing. But even in that case such a filter would take you at least half a minute of waiting to complete. Maybe they will start working on some performance issues of the Flash player as well..?!

Anyways I can’t wait to see this in action!

Update: I am quiet sure that we will see two techniques here. One will definitly be connected to Event.ENTER_FRAME for extensive x,y-loops and a lot of getPixel()/setPixel() calls. The second method is also connected to Event.ENTER_FRAME and goes rectangle by rectangle for stuff like paletteMap(). Just speculations. We will see more in six months.