Page Index Toggle Pages: 1 [2]  Send TopicPrint
Hot Topic (More than 10 Replies) Version 3.3 beta (Read 20956 times)
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Version 3.3 beta
Reply #15 - Jun 17th, 2015 at 8:49am
Print Post  
This build should render correctly the border elements that were missing before:
https://mindfusion.eu/_beta/wpfdiag_vsx.zip

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Centron
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 24
Joined: Feb 11th, 2015
Re: Version 3.3 beta
Reply #16 - Jul 14th, 2015 at 2:48pm
Print Post  
Stoyo wrote on Jun 8th, 2015 at 9:09am:
This build should load stencils correctly when using DE culture:
https://mindfusion.eu/_temp/vsx_fix.zip

Our developer will investigate the missing details - they might be coming from conditional visibility of primitives, which Visio uses to customize shapes via attributes you toggle in context menu. We also do not support themes at this time, any reference to theme attributes will be replaced with cached value instead, but it's not always available.


Hello,

is there an expected date/version for when the import will be improved? I have a large number of visio masters that are not imported correctly at all, including in your reference application. Sample masters here: http://www.filedropper.com/hp-desktop-monitors

thanks and best regards
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Version 3.3 beta
Reply #17 - Jul 17th, 2015 at 12:57pm
Print Post  
Hi,

This stencil contains some embedded EMF images which cannot be rendered by WPF out of the box. You can convert them to WPF ImageSource using code below, and you will also need to add System.Drawing.dll as reference to your project.

Code
Select All
private static ImageSource CreateImage(Stream stream)
{
	var image = new System.Drawing.Imaging.Metafile(stream);

	const int size = 256;
	using (var bitmap = new System.Drawing.Bitmap(size, size, System.Drawing.Imaging.PixelFormat.Format32bppArgb))
	{
		using (var graphics = System.Drawing.Graphics.FromImage(bitmap))
		{
			graphics.DrawImage(image, 0, 0, size, size);

			using (var memoryStream = new MemoryStream())
			{
				bitmap.Save(memoryStream, System.Drawing.Imaging.ImageFormat.Png);

				var result = new BitmapImage();
				result.BeginInit();
				result.StreamSource = memoryStream;
				result.CreateOptions = BitmapCreateOptions.IgnoreColorProfile;
				result.CacheOption = BitmapCacheOption.OnLoad;
				result.EndInit();

				return result;
			}
		}
	}
}

var stencil = VisioStencil.LoadFromXml(fileName, CreateImage); 



This build also extends support for cross-shape formula references necessary to render correct heights for the monitor shapes:
https://mindfusion.eu/_beta/vsx_meta.zip

Quote:
is there an expected date/version for when the import will be improved? I have a large number of visio masters that are not imported correctly at all


While the stencil XML format itself is documented, there are many Visio API functions and objects referenced from shape formulas that are not and we must implement by guesswork. So you will have to send us the stencil files that don't work for our developers to investigate and we'll try to improve.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Centron
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 24
Joined: Feb 11th, 2015
Re: Version 3.3 beta
Reply #18 - Jul 21st, 2015 at 7:16am
Print Post  
Thanks for the reply. Unfortunately, the solution doesn't work yet. I'm getting a generic GDI error when creating the image. It happens with all vsx files, including the one I shared previously. Is that a problem on my end?

http://i.imgur.com/Oj6wAWF.png

Perhaps these SO threads might help?

http://stackoverflow.com/questions/336387/image-save-throws-a-gdi-exception-beca...

http://stackoverflow.com/questions/1053052/a-generic-error-occurred-in-gdi-jpeg-...
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Version 3.3 beta
Reply #19 - Jul 21st, 2015 at 8:47am
Print Post  
VisioStencil handles exceptions thrown by this callback and will try to decode the stream in formats supported by WPF if it catches any exception. You are probably seeing it because you have the 'stop when thrown' option enabled in exceptions dialog, but if you continue execution the stencil should still load.

You could probe for EMF headers first instead of directly calling constructor, this works for the monitors.vsx without exceptions:

Code
Select All
var reader = new BinaryReader(stream);
var headerWord1 = reader.ReadInt16();
var headerWord2 = reader.ReadInt16();
var headerWord3 = reader.ReadInt16();
stream.Seek(0, SeekOrigin.Begin);

if (headerWord1 != 1 && headerWord1 != 2)
	return null;
if (headerWord2 != 0)
	return null;
if (headerWord3 != 108)
	return null;

var image = new System.Drawing.Imaging.Metafile(stream);
... 



If you see missing images from other stencils, they might be stored in another metafile format (e.g. WMF, EMF+) so you might have to add some checks for them too.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Centron
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 24
Joined: Feb 11th, 2015
Re: Version 3.3 beta
Reply #20 - Jul 21st, 2015 at 9:40am
Print Post  
Thanks, the additional code catches the exceptions. However, the nodes still don't load correctly for me:

http://imgur.com/Gdj1Om7
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Version 3.3 beta
Reply #21 - Jul 21st, 2015 at 10:24am
Print Post  
Are you using the last build?

Quote:
This build also extends support for cross-shape formula references necessary to render correct heights for the monitor shapes:
https://mindfusion.eu/_beta/vsx_meta.zip
  
Back to top
 
IP Logged
 
Centron
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 24
Joined: Feb 11th, 2015
Re: Version 3.3 beta
Reply #22 - Jul 21st, 2015 at 11:13am
Print Post  
Stoyo wrote on Jul 21st, 2015 at 10:24am:
Are you using the last build?

Quote:
This build also extends support for cross-shape formula references necessary to render correct heights for the monitor shapes:
https://mindfusion.eu/_beta/vsx_meta.zip


My bad, I did not include those libs, only the code. Yes it works and looks great, thanks a lot!
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1 [2] 
Send TopicPrint