Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/silverlight/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何在Image.OpacityMask中组合垂直线和水平线ArgRadientBrush_C#_Silverlight_Windows Phone 7_Windows Phone 8 - Fatal编程技术网

C# 如何在Image.OpacityMask中组合垂直线和水平线ArgRadientBrush

C# 如何在Image.OpacityMask中组合垂直线和水平线ArgRadientBrush,c#,silverlight,windows-phone-7,windows-phone-8,C#,Silverlight,Windows Phone 7,Windows Phone 8,我有形象。 我想使图像边缘模糊。 我可以在Image.opacity上添加仅一个LinearGradientBrush,并仅生成水平或垂直模糊边缘: <Image Height="300" Width="450" Name="oldImg" Source="/untitled.jpg"> <Image.OpacityMask> <LinearGradientBrush StartPoint="0,0" EndPoint="0,1"> <Gra

我有形象。 我想使图像边缘模糊。 我可以在Image.opacity上添加仅一个LinearGradientBrush,并仅生成水平或垂直模糊边缘:

<Image Height="300" Width="450" Name="oldImg" Source="/untitled.jpg">
 <Image.OpacityMask>
  <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
   <GradientStop Offset="0" Color="Transparent"></GradientStop>
   <GradientStop Offset=".3" Color="Black"></GradientStop>
   <GradientStop Offset=".7" Color="Black"></GradientStop>
   <GradientStop Offset="1" Color="Transparent"></GradientStop>
  </LinearGradientBrush>
 </Image.OpacityMask>
</Image>


如何组合垂直线和水平线ArgRadientBrush?

一种方法是在图像顶部堆叠两个矩形

<Grid>
<Image Height="300" Width="450" Name="oldImg" Source="/untitled.jpg"></Image>
 <Rectangle >
  <Rectangle.Fill>
    <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
     <GradientStop Offset="0" Color="White"></GradientStop>
     <GradientStop Offset=".3" Color="Transparent"></GradientStop>
     <GradientStop Offset=".7" Color="Transparent"></GradientStop>
     <GradientStop Offset="1" Color="White"></GradientStop>
    </LinearGradientBrush>
  </Rectangle.Fill>
  </Rectangle>
 <Rectangle>
  <Rectangle.Fill>
    <LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
     <GradientStop Offset="0" Color="White"></GradientStop>
     <GradientStop Offset=".3" Color="Transparent"></GradientStop>
     <GradientStop Offset=".7" Color="Transparent"></GradientStop>
     <GradientStop Offset="1" Color="White"></GradientStop>
    </LinearGradientBrush>
  </Rectangle.Fill>
  </Rectangle>
</Grid>


我不认为您可以在填充/遮罩中应用多个笔刷。

谢谢。但我认为这并不能解决我的问题。可能使用LinearGradientBrush是一个糟糕的解决方案,您可以提供其他解决方案吗?我的问题更大,因为我有两个图像控件(看起来像层)。我想在顶部图像上模糊边缘,这样我可以看到第二个图像(边缘模糊的地方)