SilverlightShow: Silverlight Bug: Transforms and OpacityMask Comments http://www.silverlightshow.net/ Silverlight articles, Silverlight tutorials, Silverlight videos, Silverlight samples en-us SilverlightShow.net estoychev@completit.com (Emil Stoychev) Argotic Syndication Framework, http://www.codeplex.com/Argotic http://www.rssboard.org/rss-specification RE: Silverlight Bug: Transforms and OpacityMask http://www.silverlightshow.net/items/Silverlight-Bug-Transforms-and-OpacityMask.aspx#comment3115 <p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal 'lucida grande'; min-height: 13px; "></p> <p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal 'lucida grande'; ">I cannot make OpacityMask using code in Silverlight 3. I tried the following simple example and it does not show any error nor displays the mask at all. It is like being ignored.</p> <p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal 'lucida grande'; min-height: 13px; "></p> <p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal 'lucida grande'; ">The following code ignores the: rect1.OpacityMask = irgb; to apply the opacity mask at runtime.</p> <p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal 'lucida grande'; min-height: 13px; "></p> <p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal 'lucida grande'; min-height: 13px; "></p> <p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal 'lucida grande'; ">public MainPage() </p> <p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal 'lucida grande'; ">{</p> <p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal 'lucida grande'; ">InitializeComponent();</p> <p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal 'lucida grande'; ">Rectangle rect1 = new Rectangle(); </p> <p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal 'lucida grande'; ">rect1.Width = 300;</p> <p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal 'lucida grande'; ">rect1.Height = 300;</p> <p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal 'lucida grande'; ">rect1.Fill = new SolidColorBrush(Colors.Red); </p> <p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal 'lucida grande'; ">RadialGradientBrush irgb = new RadialGradientBrush(); </p> <p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal 'lucida grande'; ">irgb.GradientOrigin = new Point(0.5, 0.5); </p> <p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal 'lucida grande'; ">irgb.Center = new Point(0.5, 0.5);</p> <p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal 'lucida grande'; ">irgb.RadiusX = 0.5;</p> <p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal 'lucida grande'; ">irgb.RadiusY = 0.5;</p> <p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal 'lucida grande'; ">GradientStop gs1 = new GradientStop(); </p> <p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal 'lucida grande'; ">GradientStop gs2 = new GradientStop(); </p> <p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal 'lucida grande'; ">GradientStop gs3 = new GradientStop(); </p> <p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal 'lucida grande'; ">GradientStop gs4 = new GradientStop(); </p> <p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal 'lucida grande'; ">// Set the color for each stop object </p> <p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal 'lucida grande'; ">gs1.Color = Color.FromArgb(255, 255, 255, 255); </p> <p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal 'lucida grande'; ">gs2.Color = Color.FromArgb(255, 255, 255, 255); </p> <p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal 'lucida grande'; ">gs3.Color = Color.FromArgb(255, 150, 150, 150); </p> <p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal 'lucida grande'; ">gs4.Color = Color.FromArgb(255, 0, 0, 0); </p> <p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal 'lucida grande'; ">// Set the offset for each stop object </p> <p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal 'lucida grande'; ">gs1.Offset = 0.0;</p> <p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal 'lucida grande'; ">gs2.Offset = 0.25;</p> <p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal 'lucida grande'; ">gs3.Offset = 0.75;</p> <p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal 'lucida grande'; ">gs4.Offset = 1.0;</p> <p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal 'lucida grande'; ">// Add the Gradient stops to the Linear Gradient Brush </p> <p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal 'lucida grande'; ">irgb.GradientStops.Add(gs1);</p> <p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal 'lucida grande'; ">irgb.GradientStops.Add(gs2);</p> <p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal 'lucida grande'; ">irgb.GradientStops.Add(gs3);</p> <p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal 'lucida grande'; ">irgb.GradientStops.Add(gs4);</p> <p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal 'lucida grande'; ">rect1.OpacityMask = irgb;</p> <p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal 'lucida grande'; ">LayoutRoot.Children.Add(rect1);</p> <p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal 'lucida grande'; ">}</p> <p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal 'lucida grande'; min-height: 13px; "></p> ( Soprano) http://www.silverlightshow.net/items/Silverlight-Bug-Transforms-and-OpacityMask.aspx Tue, 23 Feb 2010 21:36:38 +0300 RE: Silverlight Bug: Transforms and OpacityMask http://www.silverlightshow.net/items/Silverlight-Bug-Transforms-and-OpacityMask.aspx#comment2660 <p>Hi I've just been trying to make a ticker whereby the edges of the content (usually text) fade into the surroundings. When translating the text (label, Canvas, etc.) the OpacityMask either moves or shrinks although the ScrollViewer generally is less buggy.</p> <p>I've added some commentry at the end of the OpactiyMask MSDN documentation.</p> <p>Glad I'm not alone ;)</p> <p> </p> <p>Luke</p> ( Luke Puplett) http://www.silverlightshow.net/items/Silverlight-Bug-Transforms-and-OpacityMask.aspx Wed, 11 Nov 2009 21:05:50 +0300