tag:blogger.com,1999:blog-8422996711799977570.post6747077674169002291..comments2023-12-04T10:49:19.432+05:30Comments on Joymon's world of WPF: Understanding OpacityMask and its usageJoymonhttp://www.blogger.com/profile/12014569049635491702noreply@blogger.comBlogger12125tag:blogger.com,1999:blog-8422996711799977570.post-72100794076834389782018-06-16T21:02:19.924+05:302018-06-16T21:02:19.924+05:30I found your weblog web site on google and test a ...I found your weblog web site on google and test a couple of of your early posts. Continue to maintain up the superb operate. I just further up your RSS feed to my MSN News Reader. Seeking forward to studying more from you afterward!… <a href="https://online-casinos.us.org" rel="nofollow">best online casino</a>yaklibber924https://www.blogger.com/profile/05349925023206914461noreply@blogger.comtag:blogger.com,1999:blog-8422996711799977570.post-35573174342455144612014-02-23T19:23:33.390+05:302014-02-23T19:23:33.390+05:30Thank u so much... You saved my butt..Thank u so much... You saved my butt..Anonymoushttps://www.blogger.com/profile/09228441994193010937noreply@blogger.comtag:blogger.com,1999:blog-8422996711799977570.post-4838522723568382482012-02-17T09:16:32.838+05:302012-02-17T09:16:32.838+05:30Thanks for your kind words.
Yes it is certainly ...Thanks for your kind words. <br /><br />Yes it is certainly possible do it without an opacity mask. I suggest one use clip bounds for inclusion and exclusion of visible regions and opacity for a "fade" effect inside those regions.<br /><br />I had posted an elaborate lengthy reply a moment ago but it has disappeared since. So I'm going to keep it short. The above solution uses 5 visual tree elements inside an image to achieve what you were trying to do. However if clipping, i.e. inclusion and exclusion of visible regions, is all what you are interested in then you can do it with 2 elements. This is what you were trying to do in your post. <br /><br />As a general rule of thumb, i.e. not always, the lesser number elements in your visual tree = faster the rendering time which equates to better perf leading to happier customers :).<br /><br />Here is an example of an ellipse with only its top right quadrant being visible.<br /><br /><Ellipse HorizontalAlignment="Left" StrokeThickness="2" Fill="Black" Height="200" Width="400" Stroke="#FFE02020"><br /> <Ellipse.Clip><br /> <RectangleGeometry Rect="200,0,200,100" /><br /> </Ellipse.Clip><br /></Ellipse>Augustine Mathew [MSFT]noreply@blogger.comtag:blogger.com,1999:blog-8422996711799977570.post-56787391000663267772012-02-16T22:35:04.548+05:302012-02-16T22:35:04.548+05:30Thanks Augustine,
It gives me extra energy to post...Thanks Augustine,<br />It gives me extra energy to post more on this blog as I got a comment from [MSFT] guy..<br /><br />Is it possible without opacity mask?Joymonhttps://www.blogger.com/profile/12014569049635491702noreply@blogger.comtag:blogger.com,1999:blog-8422996711799977570.post-23882084056936540282012-02-16T14:28:52.797+05:302012-02-16T14:28:52.797+05:30Sorry I had to replace < and > to get this t...Sorry I had to replace < and > to get this thing pasted. Please consider fixing the comment section.<br /><br />Here is the snippet:<br /><br /><Image HorizontalAlignment="Left" Source="Images/Scanner.png" Stretch="Fill" Width="64"><br /> <Image.OpacityMask><br /> <DrawingBrush AlignmentX="Right" AlignmentY="Top" Stretch="None" ><br /> <DrawingBrush.Drawing><br /> <GeometryDrawing Brush="Black"><br /> <GeometryDrawing.Geometry><br /> <RectangleGeometry Rect="0,0,32,32" /><br /> </GeometryDrawing.Geometry><br /> </GeometryDrawing><br /> </DrawingBrush.Drawing><br /> </DrawingBrush><br /> </Image.OpacityMask><br /> </Image>Augustine Mathew [MSFT]noreply@blogger.comtag:blogger.com,1999:blog-8422996711799977570.post-26522643785045279782012-02-16T14:22:11.541+05:302012-02-16T14:22:11.541+05:30Hey Joy,
There is a way to do this using a single...Hey Joy,<br /><br />There is a way to do this using a single brush. Use an opacity mask with a DrawingBrush containing a rectangle with Height = 1/2 of the vertical radius of the ellipse and Width=1/2 of horizontal radius of the ellipse.<br /><br />Here is an example of a 64x64 image with only top right quadrant displayed<br /><br /><br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /><br />Thanks,<br />Augustine Mathew [MSFT]Augustine Mathew [MSFT]noreply@blogger.comtag:blogger.com,1999:blog-8422996711799977570.post-46629381200422172742010-12-25T20:21:55.617+05:302010-12-25T20:21:55.617+05:30Hi Anony,
You need to handle this type of formats ...Hi Anony,<br />You need to handle this type of formats you need to inherit the TextBox and the override the KeyDown method.<br />Stephen,<br />Happy to hear that your confusion is over :)Joymonhttps://www.blogger.com/profile/12014569049635491702noreply@blogger.comtag:blogger.com,1999:blog-8422996711799977570.post-68682093241257172342010-12-23T06:50:18.240+05:302010-12-23T06:50:18.240+05:30Great post, it helped me! But you confused me whe...Great post, it helped me! But you confused me when you said there is no way to make 3/4 of the ellipse transparent without more than one brush. Of course you can! In the LinearGradientBrush, put 0.75 and 0.25 instead of 0.5 and 0.5, and there you have it. But I understood what you meant after reading below it.Stephennoreply@blogger.comtag:blogger.com,1999:blog-8422996711799977570.post-73930058921540723462010-04-22T01:03:23.466+05:302010-04-22T01:03:23.466+05:30Hi, i need a help ...i want to know how can we mas...Hi, i need a help ...i want to know how can we mask a customized textbox with the SSN format(111-11-1111) it needs to append hyphens on its own when the user enters the numberAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-8422996711799977570.post-19861375753143709272010-04-22T01:00:19.025+05:302010-04-22T01:00:19.025+05:30dfdfAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-8422996711799977570.post-83185092382183749152009-05-14T16:12:00.000+05:302009-05-14T16:12:00.000+05:30Thanks Sameer...Thanks Sameer...Joymonhttps://www.blogger.com/profile/12014569049635491702noreply@blogger.comtag:blogger.com,1999:blog-8422996711799977570.post-66444164090554173482009-05-14T14:45:00.000+05:302009-05-14T14:45:00.000+05:30Excellent post. Liked the Q&A approach. One of...Excellent post. Liked the Q&A approach. One of the nicest posts you have made.Sameer C. Thiruthikadhttps://www.blogger.com/profile/11377589172587186337noreply@blogger.com