320 likes | 442 Views
What's N ew in S ilverlight 3 : GRAPHICS. Andy Beaulieu MCT, MCSD.NET WPF + Silverlight Insiders MVP Client App Dev www.andybeaulieu.com | www.spritehand.com. About Me. Andy Beaulieu Based in Syracuse, NY MCT, MCSD.NET Microsoft MVP Client App Dev WPF & Silverlight Insiders
E N D
What's New inSilverlight 3:GRAPHICS Andy Beaulieu MCT, MCSD.NET WPF + Silverlight Insiders MVP Client App Dev www.andybeaulieu.com | www.spritehand.com
About Me • Andy Beaulieu • Based in Syracuse, NY • MCT, MCSD.NET • Microsoft MVP Client App Dev • WPF & Silverlight Insiders • Full-time Developer, Part-time Trainer • .NET Community: • Speaker at User Groups, Code Camps, Conferences • User Group Leader - www.cnydevelopers.net • INETA Volunteer • Blog and Creations: • www.andybeaulieu.com • www.spritehand.com
Agenda • Perspective 3D • Effects (aka Pixel Shaders) • GPU Acceleration (Cached Composition) • Bitmap API • Animation Easing • H264 Video Support
About Silverlight 3 • IN BETA 1 • NO GO-LIVE License • Released at MIX Conference on 3/18/2009 • http://silverlight.net/getstarted/silverlight3/default.aspx • Release Date? • Unknown • NO MULTI-TARGETING SUPPORT • Use a VirtualPC, Separate Box, or Hacks Available
FOR 2D GRAPHICS OR VIDEO GPU ACCELERATION VIDEO SUPPORT Is silverlight 3 the holy grail?
FOR BUSINESS DEVELOPERS TEXT RENDERING .NET RIA SERVICES Is silverlight 3 the holy grail?
MAJOR ISSUES? PRINTING SUPPORT BROWSER PENETRATION BROWSER REACH Is silverlight 3 the holy grail?
Perspective 3D • PlaneProjection • Allows 2D Content to be rotated in 3D space RotationX
Perspective 3D • PlaneProjection: Property Element Syntax • Common Properties • Rotation X, RotationY, RotationZ • GlobalOffsetX, GlobalOffsetY, GlobalOffsetZ
Effects (aka Pixel Shaders) • Modify Displayed Pixels of any UI Element • Two Effects Available Out-of-the-Box in SL3: • Blur • DropShadow • Currently done in SOFTWARE (slow) • Maybe someday in Hardware
Effects (aka Pixel Shaders) • We can Create our own CUSTOM Pixel Shader Effects! • Created using High Level Shader Language (HLSL) • HLSL + Shaders exist in DirectX and WPF • Lots of samples of HLSL around web • Shazzam! • Nice real-time editing tool • http://www.shazzam-tool.com/
DEMO: CUSTOM EFFECTS (pixel shaders)AND perspective 3d (MIX demo)
GPU Acceleration • Final Draw done using GPU • GPU Can be Video Card or On-board (90% of PCs) • Blending, Transforms, or Rectangular Clipping also done by GPU • BIG performance boost
GPU Acceleration, cont’d • Supported on both Mac and PC • Mac uses OpenGL • PC uses DirectX • Some Browsers on Mac (ie Safari) only allow OpenGL in Full Screen Mode!
GPU Acceleration • How to Enable (PART 1): • Must enable at the PLUG-IN LEVEL:
Bitmap Caching • Useful for speeding up graphics that DO NOT change (do not rotate, animate, etc.) • Video Card will handle drawing of UI Element • Example: scrolling backgrounds, background elements, etc. • Requires GPU Acceleration is turned on • How to Enable Bitmap Caching: • Add CacheMode="BitmapCache“ attribute to each UI Element that you want Bitmap Cached
GPU Acceleration • Debugging GPU Acceleration • How can we tell what is being cached successfully? • Set the EnableCacheVisualization property to “true” in the plug-in initialization • Any NON-Cached surface will be tinted a color. • BE CAREFUL OF SURFACE SIZE. • On older machines, a surface > 2048 pixels in height or width will disable caching.
Bitmap API • Allows you to create Bitmap’s in Silverlight • Useful for: • Paint Programs • Emulators • Fractal Generators • Can also take “snapshot” of Silverlight UI into Bitmap • Perhaps load to server for inclusion in a Report?
Bitmap API • LIMITATIONS IN SILVERLIGHT 3 BETA • Cannot access Pixels after calling Render() • Due to Security constraints • (imagine a malicious Silverlight App reading images off your Bank website and sending them up to a server) • Hopefully fixed by Release Time!
Bitmap API, cont’d • How to use
Animation Easing • Makes it easy to add lifelike manner to animations • Easily add basic physics to StoryBoard animation • Saves you creating StoryBoard key frames by hand
H.264 Video Support • H.264 == MPEG-4 • Many consider this “The Internet Video Standard” • Good Quality @ Lower Bit Rates • Can use Expression Encoder 2 to encode to MPEG-4 • Need Encoder Service Pack 1, from MS Download!
QUESTIONS? www.andybeaulieu.com | www.spritehand.com