i was able to make it to the phoenix silverlight user group last night (2 separate trips downtown, yikes) and had a good time chatting with everyone there. i understand that there will NOT be a separate march meeting because it essentially falls very close to when scott guthrie and others will be coming to town. the group is recommending that people attend that to learn the latest and greatest about silverlight 2 right out of MIX! we had a good discussion about various things. mike palermo showed a couple of things he'd been working on including a simple game and a magnifier for photos (similar to the one michael has for video). the concept was that you have a high resolution image on the page and then he had a magnification bubble that would react to the mouse wheel event on a mouse to zoom in/out of a selected area. it looked in concept a lot of what like the Live Labs 'Seadragon' project describes as far as smooth zooming, etc.
one of the things mike did in this image magnifier is use a high-res image and basically clip it to the area being zoomed on for the mouse using transforms, etc. i asked mike if he was using another image element or using an imagebrush. i noted that i felt he should use an image brush rather than to use an existing image so that the image wasn't requested twice. this is the efficient way of doing it when working with MediaElements and VideoBrushes so that the video in the brush is in sync as well as efficiently processed. we worked up some pseudo code on the board real quick to describe what i was talking about.
well, i was slightly wrong. the imagebrush element doesn't use 'sourcename' like a videobrush. in videobrush you use the x:Name value of your mediaelement. in the imagebrush you specify the actual image location (ImageSource). i guess this somewhat surprised me so i started sniffing (thinking i made a mistake in my 'efficiency' statement. when looking at the result of something like this:
<Image Width="240" Height="121" Source="silverlightUGwithText_6.jpg" Stretch="Fill" x:Name="PhxUgLogo" Canvas.Top="102" Canvas.Left="132"/> <Ellipse Width="107" Height="107" Stroke="#FFEC1818" Canvas.Left="224" Canvas.Top="250" StrokeThickness="5"> <Ellipse.Fill> <ImageBrush ImageSource="silverlightUGwithText_6.jpg" Stretch="None"> <ImageBrush.RelativeTransform> <TransformGroup> <ScaleTransform ScaleX="1.4" ScaleY="1.4"/> </TransformGroup> </ImageBrush.RelativeTransform> </ImageBrush> </Ellipse.Fill> </Ellipse>
there are actually 2 HTTP requests to the image source. you can see them being requested. what i've learned is that silverlight maintains an internal image cache anyway so the second request (although there and happening), would see the cached image instead. so it looks like the method of using two Image elements would have the same effect...so given that i'm not sure either is 'better' than the other for doing this type of sample...what do you think? regardless it was a cool demo. thanks mike.
we talked a lot about why people are waiting for silverlight 2 and if that made sense. we also had a good discussion of 'what if i just have casual media on my home page, why silverlight instead of flash' which is a question i hear a lot. this discussion never revolves around technical issues (noted i said 'casual media' instead of high fidelity streaming, etc.) but rather around penetration of the plugin. a lot of sites don't want to bear the load of plugin download/installation. it's an interesting challenge when any new technology comes out and no different a discussion than when the .net framework first came out -- which 'app' was going to bear the installation tax in their app? good discussion.