BLOG ARCHIVE ABOUT CONTACT Blog RSSRSS
Understanding Vector Graphics
Posted on March 21, 2007 15:22 by sukesh

During multimedia era (Windows 3.1 to Windows 95) I had conducted several talks on different elements of multimedia and vector graphics was one of them. Explanation provided below is tweaked to make sure everyone can understand easily.

What does this sample do?
Draw a circle with 100 pixel radius with a mid-point of (200,200)

Non-vector graphics scenario
So in the case of bitmap graphics (bmp/jpg etc) you draw the circle and then save the entire square area pixel-by-pixel (I'm leaving out compression related differences to not make this sample complicated) inside the file. When you zoom the image since it's increasing pixel resolution, so you see the clarity going from good => bad => worse.

Vector Graphics scenario
In the case of Vector graphics, you save (usually) formula and values required for implementing the formula. In our sample

Formula
x1 = x + r * Sin (angle)
y1 = y + r * Cos (angle)

//Sample code snippet
int centerX = 200;
int centerY = 200;
int radius = 100;

for (int i=0; i< 360;i++)  //move point from 0 to 360 degree
{
int x1 = centerX + radius * sin(i);
int y1 = centerY + radius * cos(i); 

DrawPixel(x1,y1); //drawing pixel on the screen
}

   

So going to XAML and lets see how we can implement this simple sample
This sample rotates a red circle around a circular path defined by "p_rot"

   1: <Canvas xmlns=http://schemas.microsoft.com/client/2007
2: xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
3: <Canvas.Triggers>
4: <EventTrigger RoutedEvent="Canvas.Loaded">
5: <EventTrigger.Actions>
6: <BeginStoryboard>
7: <Storyboard BeginTime="0" Duration="Forever">
8: <DoubleAnimation Storyboard.TargetName="p_rot" Storyboard.TargetProperty="Angle" From="0" To="360"
9: BeginTime="0:0:0" Duration="0:0:5" RepeatBehavior="Forever"/>
10: </Storyboard>
11: </BeginStoryboard>
12: </EventTrigger.Actions>
13: </EventTrigger>
14: </Canvas.Triggers>
15: <Canvas>
16: <UIElement.RenderTransform>
17: <TransformGroup>
18: <TransformGroup.Children>
19: <RotateTransform x:Name="p_rot" CenterX="200" CenterY="200" Angle="0"/>
20: </TransformGroup.Children>
21: </TransformGroup>
22: </UIElement.RenderTransform>
23: <Ellipse Canvas.Top="50" Canvas.Left="100" Fill="Red" Width="50" Height="50"/>
24: </Canvas>
25: </Canvas>

You can download the sample in Flash and WPF/E from the following URL

http://www.awesomeideas.net/community/Download/tabid/54/Default.aspx


Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Creating video of your cool application
Posted on March 16, 2007 10:09 by sukesh

I have seen people using a number of tools to create screen captures of thier cool application for demos, blogs posting on video sites etc...
I have been using this tool for a long time, but it's existense is unknown to many. So here are the details

Windows Media Encoder

Home Page : http://www.microsoft.com/windows/windowsmedia/forpros/encoder/default.mspx

Download Page : http://www.microsoft.com/downloads/details.aspx?FamilyID=5691ba02-e496-465a-bba9-b2f1182cdf24&DisplayLang=en

How much does it cost?

It's FREE !!!

Glimpse of the options in the wizard 1st page (loads of options more...)

 

Is this tool only for screen capturing?
No way, go ahead and explore yourself

The output file is either WMA or WMV, and you can also select target profile like desktop, pocket pc etc...
Go ahead and showcase your applications & mashups live on those video sites :)


Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5



Powered by BlogEngine.NET 1.4.5.0
[Sign in]

Author

Sukesh
Hi, I'm Sukesh
Chat with me!
who's online

Disclaimer

All opinions posted here are those of the author and are in no way intended to represent the opinions of his employer. All posts are provided "AS IS" with no warranties, and confers no rights. © Copyright 2008

Calendar

<<  January 2009  >>
MoTuWeThFrSaSu
2930311234
567891011
12131415161718
19202122232425
2627282930311
2345678

View posts in large calendar

Recent Comments

Comment RSS