Slow and steady Silverlight (41)

Source: Internet
Author: User
Tags resource xmlns silverlight

Back to the "Steady Silverlight 3.0 series Article index"

Slow Silverlight (3.0tip/trick)-GPU acceleration, out-of-browser, application library caching, merging resourcedictionary, Application extension services, Silverlight plug-in objects

Introduced

Silverlight 3.0 Tips and Tricks series

GPU acceleration-support for GPU acceleration

Out-of-browser-run outside the browser, which supports running out of browser

Application Library caching-caching DLL (Zip) in the client browser

Merging ResourceDictionary-integrating ResourceDictionary in different locations

Application extension Services-providing additional services by extending application

What's new in Silverlight plug-in objects-what's new about Silverlight plug-in objects in Silverlight 3.0

Online Demo

Http://www.cnblogs.com/webabcd/archive/2009/08/04/1538238.html

Example

1. How to achieve GPU acceleration

Gpu.xaml

<navigation:page x:class= "Silverlight30.Tip.GPU"
Xmlns= "Http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x= "Http://schemas.microsoft.com/winfx/2006/xaml"
Xmlns:d= "http://schemas.microsoft.com/expression/blend/2008"
Xmlns:mc= "http://schemas.openxmlformats.org/markup-compatibility/2006"
Mc:ignorable= "D"
xmlns:navigation= "Clr-namespace:system.windows.controls;assembly=system.windows.controls.navigation"
D:designwidth= "640" d:designheight= "480"
title= "GPU Page" >
<grid x:name= "LayoutRoot" >

<Grid.Resources>
<storyboard x:name= "ani" autoreverse= "True" repeatbehavior= "Forever" >
<doubleanimation storyboard.targetname= "St" storyboard.targetproperty= "ScaleX"
from= "1" to= "3" duration= "0:0:3"/>
<doubleanimation storyboard.targetname= "St" storyboard.targetproperty= "ScaleY"
from= "1" to= "3" duration= "0:0:3"/>
<doubleanimation storyboard.targetname= "RT" storyboard.targetproperty= "Angle"
from= "0" to= "360" duration= "0:0:3"/>
<doubleanimation storyboard.targetname= "mediaElement" storyboard.targetproperty= "Opacity"
from= "1" to= "0.3" duration= "0:0:3"/>
</Storyboard>
</Grid.Resources>

<mediaelement x:name= "MediaElement" source= "/resource/demo.mp4" "width=" height= "240"
Autoplay= "True" mediaended= "mediaelement_mediaended" rendertransformorigin= "0.5,0.5" >
<MediaElement.RenderTransform>
<TransformGroup>
<scaletransform x:name= "St" scalex= "1" scaley= "1"/>
<rotatetransform x:name= "RT" angle= "0"/>
</TransformGroup>
</MediaElement.RenderTransform>

<!--
Cachemode-cache type, for GPU acceleration, currently supports only Bitmapcache (UIElement once with CPU, the resulting bitmap is cached to the GPU and processed via the GPU)
Available for GPU acceleration are: Scale, Rotate, Opacity, rectangular clip
Cachemode.renderatscale-the magnification of the bitmap cache relative to the currently rendered UIElement. Because you need to cache as bitmaps, and for the vector graphics of Silverlight, you can set this property to avoid distortion as much as possible (of course, the higher the value is set, the heavier the burden on the GPU)
-->
<MediaElement.CacheMode>
<bitmapcache renderatscale= "1"/>
</MediaElement.CacheMode>
</MediaElement>

<image source= "/resource/logo.jpg" width= "160" "height="/>

</Grid>
</navigation:Page>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.