Export blur to XAML

Bug #572965 reported by Klaus Leth Pedersen
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
Wishlist
jazzynico

Bug Description

In Inkscape 0.47 r22583, built Nov 21 2009
I cannot export a rectangle with a blur when i view the
rectangle in Iexplore it is shown with no blur at all.

Tags: exporting xaml

Related branches

su_v (suv-lp)
tags: added: exporting xaml
Alvin Penner (apenner)
Changed in inkscape:
status: New → Confirmed
Revision history for this message
jazzynico (jazzynico) wrote :

Hum, this one is going to be a bit more difficult to solve. BlurBitmapEffect requires a blur radius, and SVG's Gaussian blur uses a standard deviation. And pure XSLT 1.0 doesn't like math...
Another problem: SVG effects are often a combination of several primitives and can't always be converted to XAML.
Since this is not a basic XAML export element, I mark this report "Wishlist".

Changed in inkscape:
importance: Undecided → Wishlist
Revision history for this message
Klaus Leth Pedersen (klp1974) wrote :

I tried to make a blured rectangle in the Expression Designer and export the XAML that just gives me a blured rectangle in a .png file and some XAML that have a reference to the picture.
I'm just wondering is it even possible to make the effect in the svg format only?

Revision history for this message
jazzynico (jazzynico) wrote :

Yes, it is possible to create a Gaussian blur effect directly in SVG, without converting to bitmap.
The main issue is that SVG and XAML don't handle effects the same way. Creating a blur in XAML is very easy, but extracting an existing SVG blur filter is more complex.
Then, we still need to convert a standard deviation to a blur radius. I've just read that r should be set to approximately to 3σ, which would makes it easier than I first thought.

I'm not sure I'll have time to implement it for 0.48. Let's target it for 0.49.

Changed in inkscape:
assignee: nobody → JazzyNico (jazzynico)
milestone: none → 0.49
Revision history for this message
Klaus Leth Pedersen (klp1974) wrote :

I'm looking forward to test it in 0.49 :-)

Revision history for this message
jazzynico (jazzynico) wrote :

Patch committed in bzr revision 9407.

It works with feGaussianBlur filter effect only. If a filter has other filter effects, it will be ignored, even if one of the effects is a Gaussian blur.

The fix can be tested with Inkscape 0.47 by replacing svg2xaml.xsl, in share/extensions, with the one located in http://bazaar.launchpad.net/~inkscape.dev/inkscape/trunk/files/head%3A/share/extensions/.

Changed in inkscape:
milestone: 0.49 → 0.48
status: Confirmed → Fix Committed
Revision history for this message
Klaus Leth Pedersen (klp1974) wrote :

I've tried to make a rectangle with a blured effect but I cannot get it to work. I have made a rectangle and made it into a path then I add a new Gaussian filter but when I view the rectangle in Iexplore there is no blur effect. The XAML has a Transform and a BlurEffect but it does not show not even in Visual Studio. Am I doing something wrong ?

Revision history for this message
jazzynico (jazzynico) wrote :

If your XAML contains the BlurEffect parts, thus it could be due to how IE or VS deals with it.
I've tested it with kaxml (last version), and the blur effect shows correctly.

Could you please apply a blur effect to a simple object with a VS or another XAML editing tool and attach the file so that I try to understand how it works in another environment? I've used BlurEffect because BlurBitmapEffect is marked deprecated in MSDN, but it could be an issue with old tools...

Revision history for this message
jazzynico (jazzynico) wrote :

I confirm IE8 gives an error message.
Works well (but not blured) if I remove the BlurEffect part of the canvas resources.

Unfortunately I'm not a Windows developer (I'm running it in a Virtual Box on Ubuntu), and thus I don't have all the development tools installed. I thought that kaxml was accurate and reliable, but it seems that it's not the case. Do you know another free tool which could help? Is IE expected to correctly open any XAML file?

Revision history for this message
jazzynico (jazzynico) wrote :

No problem with Okino XAML viewer.

Revision history for this message
Klaus Leth Pedersen (klp1974) wrote :

I've tried both with KAXAML and Okino Viewer and they both display my blured rectangle but I have to refactor the output from Inkscape to display a blured rectangle. A part of the output from Inkscape looks like this
  <Canvas.Resources>
      <BlurEffect
         x:Key="filter3591"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         KernelType="Gaussian"
         Radius="3"/>
   </Canvas.Resources>
   <Canvas Name="layer1">
      <Path
         Name="rect2816"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         Data="m 188.571 99.505 l 200 0 l 0 115.714 l -200 0 l 0 -115.714 z"
         Fill="#FFFF6600"/>
   </Canvas>

Then I refactor the BlurEffect tag.

<Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Data="m 150.000 99.505 l 200 0 l 0 115.714 l -200 0 l 0 -115.714 z" Fill="#FFFF6600">
      <Path.Effect>
         <BlurEffect x:Name="GaussBlurEffect" Radius="13"/>
      </Path.Effect>
   </Path>

Now it displays correct in KAXAML and the Okino viewer but not in browsers. I have a teory that it needs to be compiled into a usercontrol to display it in a browser I will look into that later. Thanks for the kaxaml tool it is a nice tool.

Revision history for this message
jazzynico (jazzynico) wrote :

It's my fault, I tested the patch on rectangle shapes only, and forgot to apply it to the other shapes and paths...
Should be fixed now.
(in http://bazaar.launchpad.net/~inkscape.dev/inkscape/trunk/files/head%3A/share/extensions/, revision 9413).

Thanks for your help!

Revision history for this message
Klaus Leth Pedersen (klp1974) wrote :

I have tested revision 9413 on windows XP SP2 and now my rectangle path is displayed with a blur effect. The exported XAML is still displayed with out the blur in IExplore and Firefox.
I tested a little further and I made a Silverlight project in Visual Studio and added the XAML. I opened the XAML in Expression Blend the only problem was the KernelType="Gaussian" that had to be removed before Blend could read the XAML. Then I made the XAML into a UserControl and now I can display a blured rectangle on a webpage. I would like to know why XAML with a blured rectangle needs to be compiled before you can view it in a browser. The conclusion must be that the output from Inkscape is alright except from the KernelType attribute.

Revision history for this message
jazzynico (jazzynico) wrote :

Yes, the KernelType attribute is not listed in the BlurEffect properties (http://msdn.microsoft.com/en-us/library/system.windows.media.effects.blureffect_properties%28v=VS.95%29.aspx). It was an attribute of the deprecated BlurBitmapEffect...

Attribute removed in bzr revision 9415.
The development phase is about to be frozen, and thus this is probably the very last fix for 0.48.

Revision history for this message
Alvin Penner (apenner) wrote :

Hi,
    Thanks for all the work on XAML. I am having some problems with the attached file, which has a rectangle with blur. I cannot load it into IE8 on Windows XP.

Revision history for this message
Alvin Penner (apenner) wrote :

The error message is attached here. It appears to be a security violation of some sort. Any ideas on how to get around this?
I'm running IE8 with .NET Framework 3.5 and MSXML 6.0

Revision history for this message
Klaus Leth Pedersen (klp1974) wrote :

Hi,
You are welcome, its nice to help making Inkscape an even greater tool. I am facing the excact same security problem on both XP and Vista and IE8 and Firefox. I have not found a solution to display blured objects in the browser and the best explanation is that the silverlight to display blured objects is implemented via unmanaged code http://social.msdn.microsoft.com/forums/en-US/wpf/thread/0b0fe818-e7c6-4a65-9954-1fcaaaa11417/
I am stil open for a solution ;-)

If you just want to view your XAML you could try the free KAXAML viewer its a great tool (Thanks again JazzyNico). If you bulit your XAML into a website I dont think you will see the problem.

jazzynico (jazzynico)
Changed in inkscape:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.