Flash vs Silverlight: 3D Image Space Flash vs Silverlight: Random Expand Rotator
Sep 09

With the advantage of rendering speed, Flash and Silverlight can provide a richer experience in drawing and image filtering. Moreover, by using the Timer Event, real time replay of drawing bring us into another generation of art.

Recently, I got quite many application requests. I think a implementation list will be made to give you a better idea what will happen in the next few days.

Vote for this sample

Flash is Better? (205 votes)
Silverlight is Better! (208 votes)

Comparison

Flash implementation: 1 hour 10 minutes  
Silverlight implementation: 1 hour 30 minutes 
What’s the difference?

  • Line Drawing: moveTo, LineTo [AS3] vs System.Windows.Shapes.Line [C#]

Source codes

Flash

Silverlight

Line: moveTo, LineTo [AS3] vs System.Windows.Shapes.Line [C#]

I think drawing in AS3 is pretty straight forward and easy. It’s because all of the drawing libraries can be found inside the graphics object.

// AS3
// draw a square
var shape:Shape = new Shape();
shape.graphics.lineStyle(LINE_WIDTH, 0x000000);
shape.graphics.moveTo(0, 0);
shape.graphics.lineTo(0, 100);
// you can change the lineStyle anytime
shape.graphics.lineStyle(LINE_WIDTH, 0x000000);
shape.graphics.lineTo(100, 100);
shape.graphics.lineTo(100, 0);
shape.graphics.lineTo(0, 0);
addChild(shape);

How about in C#? Silverlight has a wide range of line drawing libraries. Though it’s powerful, but I really find it hard to learn. By a series of trial and error, I have come up a solution to draw a square using code. I think much more time is needed to explore the whole mystery of the Line Class.

Other than that, Silverlight has a readily available control (InkPresenter) for drawing lines. However, if you really want to produce the “ink” effect similar to the above sample, you may only do it by yourself.

// C#
// draw a square
PolyLineSegment polyLineSegment = new PolyLineSegment();
polyLineSegment.Points.Add(new Point(0, 100));
polyLineSegment.Points.Add(new Point(100, 100));
polyLineSegment.Points.Add(new Point(100, 0));
polyLineSegment.Points.Add(new Point(0, 0));

PathFigure pathFigure = new PathFigure();
pathFigure.StartPoint = new Point(0, 0);
pathFigure.Segments.Add(polyLineSegment);

PathGeometry pathGeometry = new PathGeometry();
pathGeometry.Figures.Add(pathFigure);

Path path = new Path();
path.Stroke = new SolidColorBrush(Colors.Black);
path.StrokeThickness = 10;
path.Data = pathGeometry;

// add to the stage
LayoutRoot.Children.Add(path);

Random Posts

10 Responses to “Flash vs Silverlight: Simple Drawing”

  1. Mike Brown Says:

    Hello,
    This is an interesting comparison of the two platforms. However Silverlight (and WPF) really shines in markup. You can recreate the path geometry with this simple line of markup

    You might have to change the layout for this because I wrote it for WPF. But it’s not far off from what you’d write for Silverlight. I think you’re hiding a major convenience that silverlight provides by not including the markup components of the platform.

  2. Mike Brown Says:

    Hmm…looks like your engine ate my markup

  3. admin Says:

    HI Brown, I agree that Silverlight has a huge advantange in using the mark up as well. Actually, I want to demonstrate how things are done (in code) in both of the technology.

    Anyway, I also think that it’s also important to show the best side of them, I will review this problem. Thanks for you suggestion.

  4. From Flash to Silverlight… - Rudi Grobler Says:

    [...] Flash vs Silverlight- Simple Drawing [...]

  5. Paul Gregoire Says:

    Size-wise Flash is still better but the language behind Silverlight is more robust. Using this post as a gauge of which was better I would say Flash since the Silverlight demo wouldn’t start for me, it simply added a black dot on the far right when I clicked.

  6. Fallon Massey Says:

    The flash api is more NORMAL, if you’ve ever used any drawing api.

    Whhile SL’s api is wierd, I’ll take it because C# is ohhhh so sweet, and we’re able to reuse code on both the server and client.

  7. unruledboy Says:

    excellent, I like it, though the “ink” seems not so “inky” with my mouse :)

  8. bm Says:

    Flash version works on Linux, Silverlight version doesn’t.

    Flash wins!

  9. monica Says:

    I like Silverlight… the only thing is having to download, run, install silverlight if it’s not already on the client machine and then having to restart the browser. That’s the only thing I wish could be fixed to make it over the top over Flash

  10. Italiak1 Says:

    Thank you for valuable information.

Leave a Reply