Skip to content

Commit

Permalink
v3.5 beta 3
Browse files Browse the repository at this point in the history
  • Loading branch information
simonegli committed Mar 16, 2013
1 parent 7b8f122 commit be65bae
Show file tree
Hide file tree
Showing 57 changed files with 5,066 additions and 1,202 deletions.
15 changes: 12 additions & 3 deletions XamlImageConverter.Exe/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@ public class Program {
if (a.Count == 0 || new[] { "-h", "help", "-help", "?", "/?", "-?" }.Any(s => a.Any(at => s == at.Trim().ToLower()))) {
Console.WriteLine("XamlImageConverter 3.5 by Chris Cavanagh & Simon Egli");
Console.WriteLine("Creates snapshots, gif animations or html image maps from XAML, SVG & PSD images\n\r");
Console.Error.WriteLine("XamlImageConverter [-x] [-w] [-s [running time]] [-r] [-v]");
Console.Error.WriteLine("XamlImageConverter [-x] [-w] [-1] [-s [running time]] [-r] [-v]");
Console.Error.WriteLine(" [-l librarypath] [-p projectpath] configFile { configFile }");
Console.Error.WriteLine("A configFile is a xaml batch file, describing an image conversion job.");
Console.Error.WriteLine("Documentation for creating a configFile can be found at");
Console.Error.WriteLine(" http:https://xamlimageconverter.codeplex.com.");
Console.Error.WriteLine(" -1 option: Use only one cpu core.");
Console.Error.WriteLine(" -w option: Wait for key at end.");
Console.Error.WriteLine(" -s option: Run as server for the HttpHandler.");
Console.Error.WriteLine(" (To support 3D xaml, that doesn't render under IIS).");
Expand All @@ -55,6 +56,12 @@ public class Program {
a.Remove("-w");
waitForKey = true;
}
bool manycore = true;
if (a.Contains("-1")) {
a.Remove("-1");
manycore = false;
}


bool server = false;
bool test = false;
Expand Down Expand Up @@ -104,7 +111,7 @@ public class Program {
List<string> files = new List<string>();
foreach (var f in a) {
var appRoot = projectPath;
var file = f;
var file = f;
if (appRoot.EndsWith("\\")) appRoot = appRoot.Substring(0, appRoot.Length - 1);
file = file.Replace("~", appRoot)
.Replace("/", "\\");
Expand All @@ -130,19 +137,21 @@ public class Program {
compiler.LibraryPath = libraryPath;
compiler.ProjectPath = projectPath;
compiler.RebuildAll = rebuildAll;
compiler.Parallel = manycore;
if (log) compiler.Loggers.Add(new FileLogger());
compiler.UseService = true;
compiler.Compile(files);
//cserver.Compile(compiler);
});
}
cserver.Start();
cserver.Start();

} else {
var compiler = new Compiler();
compiler.LibraryPath = libraryPath;
compiler.ProjectPath = projectPath;
compiler.RebuildAll = rebuildAll;
compiler.Parallel = manycore;
compiler.SeparateAppDomain = useAppDomain;
if (log) compiler.Loggers.Add(new FileLogger());
compiler.Compile(files);
Expand Down
20 changes: 3 additions & 17 deletions XamlImageConverter.Exe/XamlImageConverter.Exe.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -116,26 +116,9 @@
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="img\test\page_header.pdf" />
<None Include="src\Planet.psd" />
</ItemGroup>
<ItemGroup>
<Content Include="img\ImageMaps\Readme.aspx">
<SubType>ASPXCodeBehind</SubType>
</Content>
<Content Include="img\test\animated-loader-filmstrip.jpg" />
<Content Include="img\test\animated-loader.gif" />
<Content Include="img\test\copyright_bar.png" />
<Content Include="img\test\copyright_bar_element.png" />
<Content Include="img\test\main_content_bkgd.png" />
<Content Include="img\test\main_content_bkgd_lft.png" />
<Content Include="img\test\main_content_bkgd_rt.png" />
<Content Include="img\test\page_header_ctr.png" />
<Content Include="img\test\page_header_lft.png" />
<Content Include="img\test\page_header_rt.png" />
<Content Include="Readme.aspx">
<SubType>ASPXCodeBehind</SubType>
</Content>
<Content Include="src\blog-banner.jpg" />
<Content Include="src\generic-lines.png" />
<Content Include="src\jquery.js" />
Expand Down Expand Up @@ -191,6 +174,9 @@
<SubType>Designer</SubType>
</Page>
</ItemGroup>
<ItemGroup>
<Folder Include="img\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Expand Down
14 changes: 7 additions & 7 deletions XamlImageConverter.Exe/src/MakeImages.xic.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@

<xic:Snapshot Right="0" Top="0" Width="30" Height="164" File="page_header.pdf" />

<xic:Snapshot Left="0" Top="0" Width="30" Height="164" File="page_header.ps" />
<xic:Snapshot Left="14" Top="0" Width="748" Height="164" File="page_header.ps" />
<xic:Snapshot Left="0" Top="0" Width="30" Height="164" File="page_header.xps" />
<xic:Snapshot Left="14" Top="0" Width="748" Height="164" File="page_header.xps" />

<xic:Snapshot Right="0" Top="0" Width="30" Height="164" File="page_header.ps" />
<xic:Snapshot Right="0" Top="0" Width="30" Height="164" File="page_header.xps" />

<xic:Snapshot Left="0" Top="0" Width="30" Height="164" File="page_header.eps" />
<xic:Snapshot Left="0" Top="0" Width="30" Height="164" File="page_header.xps" />


</xic:Group>
Expand Down Expand Up @@ -100,15 +100,15 @@
<xic:Snapshot File="usa.map.xaml" />

<xic:Map Image="usa.map.png" File="usa.map.html" ID="usa">
<Areas Elements="WA;OR;CA;AK;ID;NV;AZ;UT;MT;WY;CO;NM;TX;OK;KS;NE;SD;ND;MN;IA;MO;AR;LA;WI;IL;TN;MS;MI;IN;KY;AL;FL;GA;SC;NC;VA;WV;OH;PA;MD;NJ;NY;CT;MA;VT;NH;ME;RI;DE" onclick="alert('State %ID% clicked...');" />
<Areas Elements="WA;OR;CA;AK;ID;NV;AZ;UT;MT;WY;CO;NM;TX;OK;KS;NE;SD;ND;MN;IA;MO;AR;LA;WI;IL;TN;MS;MI;IN;KY;AL;FL;GA;SC;NC;VA;WV;OH;PA;MD;NJ;NY;CT;MA;VT;NH;ME;RI;DE,HI" onclick="alert('State %ID% clicked...');" />
</xic:Map>
<xic:ImageMap Image="usa.map.png" File="Readme.aspx" ID="usa">
<HotSpots Elements="WA;OR;CA;AK;ID;NV;AZ;UT;MT;WY;CO;NM;TX;OK;KS;NE;SD;ND;MN;IA;MO;AR;LA;WI;IL;TN;MS;MI;IN;KY;AL;FL;GA;SC;NC;VA;WV;OH;PA;MD;NJ;NY;CT;MA;VT;NH;ME;RI;DE" PostBackValue="%ID%" />
<HotSpots Elements="WA;OR;CA;AK;ID;NV;AZ;UT;MT;WY;CO;NM;TX;OK;KS;NE;SD;ND;MN;IA;MO;AR;LA;WI;IL;TN;MS;MI;IN;KY;AL;FL;GA;SC;NC;VA;WV;OH;PA;MD;NJ;NY;CT;MA;VT;NH;ME;RI;DE,HI" PostBackValue="%ID%" />
</xic:ImageMap>

</xic:Scene>

<xic:Scene OutputPath="~/img" Theme="Aero">
<xic:Scene OutputPath="~/img" Theme="Luna">
<xic:Xaml>
<Canvas Width="500" Height="500">
<Canvas.Background>
Expand Down
11 changes: 4 additions & 7 deletions XamlImageConverter.ItemWizard/ItemWizard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -232,16 +232,13 @@ public class ItemWizard: IWizard {
var IsWeb = File.Exists(conf);
if (!IsWeb) return;

var binlazy = Path.Combine(dest, "Bin\\Lazy");
if (!Directory.Exists(binlazy)) {
var bin = Path.Combine(dest, "Bin");
var binlazy = bin + "\\Lazy";
if (!Directory.Exists(bin)) {
Directory.CreateDirectory(binlazy);
Files.Copy(Path.Combine(src, "XamlImageConverter.dll"), binlazy);
Files.Copy(Path.Combine(src, "XamlImageConverter.pdb"), binlazy);
Files.Copy(Path.Combine(src, "Lazy\\gxps"), binlazy);
Files.Copy(Path.Combine(src, "Lazy\\ImageMagick"), binlazy);
Files.Copy(Path.Combine(src, "Lazy\\psd2xaml"), binlazy);
Files.Copy(Path.Combine(src, "Lazy\\html2xaml"), binlazy);
//Files.Copy(Path.Combine(src, "Lazy\\XamlImageConverter.xsd"), binlazy);
Files.Copy(Path.Combine(src, "Lazy"), bin);
var cache = Path.Combine(dest, "Images\\Cache");
if (!Directory.Exists(cache)) Directory.CreateDirectory(cache);
}
Expand Down
93 changes: 47 additions & 46 deletions XamlImageConverter.Test.Web/Web.config
Original file line number Diff line number Diff line change
@@ -1,56 +1,57 @@
<?xml version="1.0"?>
<configuration>
<configSections>
<section name="XamlImageConverter" type="XamlImageConverter.Configuration, XamlImageConverter.Web, Version=3.5.0.0, Culture=neutral, PublicKeyToken=60c2ec984bc1bb45"/>
</configSections>
<XamlImageConverter log="true" cache="~/Images/Cache" separateDomain="false" />
<appSettings/>
<connectionStrings/>
<!--
<configSections>
<section name="XamlImageConverter" type="XamlImageConverter.Configuration, XamlImageConverter.Web, Version=3.5.0.0, Culture=neutral, PublicKeyToken=60c2ec984bc1bb45"/>
</configSections>
<XamlImageConverter log="true" cache="~/Images/Cache" separateDomain="false"/>
<appSettings/>
<connectionStrings/>
<!--
For a description of web.config changes for .NET 4.5 see http:https://go.microsoft.com/fwlink/?LinkId=235367.
The following attributes can be set on the <httpRuntime> tag.
<system.Web>
<httpRuntime targetFramework="4.5" />
</system.Web>
-->
<system.web>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
-->
<compilation debug="true" targetFramework="4.5">
<assemblies>
<add assembly="XamlImageConverter.Web, Version=3.5.0.0, Culture=neutral, PublicKeyToken=60c2ec984bc1bb45"/>
</assemblies>
</compilation>
<pages controlRenderingCompatibilityVersion="4.0">
<controls>
<add tagPrefix="xic" namespace="Silversite.Web.UI" assembly="XamlImageConverter.Web, Version=3.5.0.0, Culture=neutral, PublicKeyToken=60c2ec984bc1bb45"/>
</controls>
</pages>
<!--
The <authentication> section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authentication mode="Windows"/>
<customErrors mode="Off"/>
</system.web>
<!--
The system.webServer section is required for running ASP.NET AJAX under Internet
Information Services 7.0. It is not necessary for previous version of IIS.
-->
<system.webServer>
<handlers>
<add name="XamlImageConverterXaml" verb="*" path="*.xaml" preCondition="integratedMode" type="Silversite.Web.XamlImageHandler, XamlImageConverter.Web, Version=3.5.0.0, Culture=neutral, PublicKeyToken=60c2ec984bc1bb45"/>
<add name="XamlImageConverterPsd" verb="*" path="*.svg" preCondition="integratedMode" type="Silversite.Web.XamlImageHandler, XamlImageConverter.Web, Version=3.5.0.0, Culture=neutral, PublicKeyToken=60c2ec984bc1bb45"/>
<add name="XamlImageConverterSvg" verb="*" path="*.svgz" preCondition="integratedMode" type="Silversite.Web.XamlImageHandler, XamlImageConverter.Web, Version=3.5.0.0, Culture=neutral, PublicKeyToken=60c2ec984bc1bb45"/>
<add name="XamlImageConverterSvgz" verb="*" path="*.psd" preCondition="integratedMode" type="Silversite.Web.XamlImageHandler, XamlImageConverter.Web, Version=3.5.0.0, Culture=neutral, PublicKeyToken=60c2ec984bc1bb45"/>
<add name="XamlImageConverterDynamic" verb="*" path="xic.axd" preCondition="integratedMode" type="Silversite.Web.XamlImageHandler, XamlImageConverter.Web, Version=3.5.0.0, Culture=neutral, PublicKeyToken=60c2ec984bc1bb45"/>
</handlers>
<validation validateIntegratedModeConfiguration="false"/>
</system.webServer>
<system.web>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
-->
<compilation debug="true" targetFramework="4.5">
<assemblies>
<add assembly="XamlImageConverter.Web, Version=3.5.0.0, Culture=neutral, PublicKeyToken=60c2ec984bc1bb45"/>
</assemblies>
</compilation>
<pages controlRenderingCompatibilityVersion="4.0">
<controls>
<add tagPrefix="xic" namespace="Silversite.Web.UI" assembly="XamlImageConverter.Web, Version=3.5.0.0, Culture=neutral, PublicKeyToken=60c2ec984bc1bb45"/>
</controls>
</pages>
<!--
The <authentication> section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authentication mode="Windows"/>
<customErrors mode="Off"/>
<httpRuntime requestValidationMode="2.0" />
</system.web>
<!--
The system.webServer section is required for running ASP.NET AJAX under Internet
Information Services 7.0. It is not necessary for previous version of IIS.
-->
<system.webServer>
<handlers>
<add name="XamlImageConverterXaml" verb="*" path="*.xaml" preCondition="integratedMode" type="Silversite.Web.XamlImageHandler, XamlImageConverter.Web, Version=3.5.0.0, Culture=neutral, PublicKeyToken=60c2ec984bc1bb45"/>
<add name="XamlImageConverterPsd" verb="*" path="*.svg" preCondition="integratedMode" type="Silversite.Web.XamlImageHandler, XamlImageConverter.Web, Version=3.5.0.0, Culture=neutral, PublicKeyToken=60c2ec984bc1bb45"/>
<add name="XamlImageConverterSvg" verb="*" path="*.svgz" preCondition="integratedMode" type="Silversite.Web.XamlImageHandler, XamlImageConverter.Web, Version=3.5.0.0, Culture=neutral, PublicKeyToken=60c2ec984bc1bb45"/>
<add name="XamlImageConverterSvgz" verb="*" path="*.psd" preCondition="integratedMode" type="Silversite.Web.XamlImageHandler, XamlImageConverter.Web, Version=3.5.0.0, Culture=neutral, PublicKeyToken=60c2ec984bc1bb45"/>
<add name="XamlImageConverterDynamic" verb="*" path="xic.axd" preCondition="integratedMode" type="Silversite.Web.XamlImageHandler, XamlImageConverter.Web, Version=3.5.0.0, Culture=neutral, PublicKeyToken=60c2ec984bc1bb45"/>
</handlers>
<validation validateIntegratedModeConfiguration="false" />
</system.webServer>
</configuration>
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
<xic:Snapshot File="full.png" />
<xic:Snapshot File="full.eps" />
<xic:Snapshot File="full.pdf" />
<xic:Snapshot Element="rotatingTest" File="arrow.xps" />

</xic:Scene>

Expand Down
Binary file not shown.
55 changes: 33 additions & 22 deletions XamlImageConverter.Test.Web/XamlImageConverter.Demo/Readme.aspx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<%@ Page Language="C#" %>
<%@ Page Language="C#" ValidateRequest="false" %>
<%@ Import Namespace="System.Xml.Linq" %>
<%@ Import Namespace="Silversite.Web.UI" %>

Expand All @@ -18,20 +18,33 @@
<body>
<form id="form1" runat="server">
<div>

<h3>A direct conversion of xaml =&gt; png</h3>
<pre><code>&lt;img src="Homepage.xaml?png" runat="server" /&gt;</code></pre>
<img src="Homepage.xaml?png" runat="server" />
<hr />

<h3>A conversion of multiple images with a batch script file, and of an animated gif.</h3>
<h3>A PDF of the above xaml</h3>
<pre><code>&lt;a href="Homepage.xaml?pdf"&gt;Homepage PDF&lt;/a&gt;</code></pre>
<a href="Homepage.xaml?pdf">Homepage PDF</a>
<hr />

<h3>Rendering of multiple images with a batch script file, and of an animated gif.</h3>
<pre><code>&lt;img src="CreateImages.xic.xaml?Image=Images/Homepage/animated-loader.gif" runat="server" /&gt;</code></pre>
<img src="CreateImages.xic.xaml?Image=Images/Homepage/animated-loader.gif" runat="server" />
<hr />

<h3>A html image map created from a svg source</h3>
<p>This map was generated from <a href="http:https://en.wikipedia.org/wiki/Image:Map_of_USA_with_state_names.svg">"Map of USA with state names.svg"</a>.
Note that in the current version the font is not resolved correctly.</p>
Note that in the current version the SVG font is not resolved correctly.</p>
<pre><code>&lt;asp:ImageMap ID="usamap" runat="server" ImageUrl="CreateImages.xic.xaml?Image=Images/Usa.Map.png" CssClass="map" /&gt;</code></pre>
and in CreateImages.xic.xaml:
<pre><code>&lt;xic:Snapshot Image="Usa.Map.png" &gt;
&lt;xic:ImageMap ID="usamap" Image="Usa.Map.png" File="Readme.aspx" &gt;
&lt;HotSpots Elements="WA,OR,CA,AK,ID,NV,AZ,UT,MT,WY,CO,NM,TX,OK,KS,NE,SD,ND,MN,IA,MO,AR,LA,WI,IL,TN,MS,MI,IN,KY,AL,FL,GA,SC,NC,VA,WV,OH,PA,MD,NJ,NY,CT,MA,VT,NH,ME,RI,DE,HI" HotSpotMode="PostBack" PostBackValue="%ID%"/&gt;
&lt;/xic:ImageMap&gt
</code></pre>

<asp:ImageMap ID="usamap" runat="server" ImageUrl="CreateImages.xic.xaml?Image=Images/Usa.Map.png" CssClass="map">
<asp:PolygonHotSpot HotSpotMode="PostBack" PostBackValue="WA" Coordinates="86,28,86,30,85,31,86,32,85,34,84,35,83,34,84,32,82,31,82,33,81,33,80,31,79,29,81,29,82,30,83,28,86,28" />
<asp:PolygonHotSpot HotSpotMode="PostBack" PostBackValue="WA" Coordinates="93,24,102,27,111,29,130,34,152,40,168,43,167,47,163,60,159,81,156,97,155,106,142,103,127,99,112,100,112,98,106,100,102,100,100,98,98,99,94,99,92,97,87,95,86,95,82,94,80,96,74,95,69,91,69,91,69,83,67,79,63,79,63,76,60,76,58,74,57,75,54,72,55,70,57,69,59,65,56,64,57,61,61,60,58,57,57,50,57,47,57,40,56,37,58,27,60,28,62,31,65,33,68,35,72,37,75,38,78,39,82,40,84,40,84,38,85,37,87,35,87,36,88,38,86,39,85,41,87,42,88,44,89,46,90,46,90,45,89,44,89,40,90,39,89,37,89,35,91,32,90,29,87,24,88,24,89,23,93,24" />
Expand Down Expand Up @@ -120,42 +133,40 @@
</asp:ImageMap>
<hr />

<h3>A PDF of the above homepage</h3>
<pre><code>&lt;asp:HyperLink runat="server" NavigateUrl="Homepage.xaml?pdf"&gt;Homepage PDF&lt;/asp:HyperLink&gt;</code></pre>
<asp:HyperLink runat="server" NavigateUrl="Homepage.xaml?pdf">Homepage PDF</asp:HyperLink>
<hr />

<h3>Conversion of 3D content doesn't work under IIS (only on IIS6).</h3>
<h3>Rendering of 3D content doesn't work under IIS (only on IIS6 & IISExpress, because IIS does not run in a user session and can't access video drivers).</h3>
<pre><code>&lt;img src="Kaxaml.xaml?gif&Storyboard=rotate&Frames=50&Loop=0" runat="server" /&gt;</code></pre>
<img src="Kaxaml.xaml?gif&Storyboard=rotate&Frames=50&Loop=0" runat="server" />

<h3>Conversion of 3D content doesn't work under IIS, so here is a precompiled version.</h3>
<h3>Rendering of 3D content doesn't work under IIS, so here is a precompiled version.</h3>
<pre><code>&lt;img src="Kaxaml.gif" runat="server" /&gt;</code></pre>
<img src="Kaxaml.gif" runat="server" />

<h3>Direct xaml in ASP.NET.</h3>

<pre><code>
&lt;asp:TextBox ID="buttontext" runat="server"&gt;I'm a button&lt;/asp:TextBox&gt;&lt;asp:Button ID="Button1" runat="server" OnClick="Update" Text="Update" /&gt;
&lt;xic:XamlImage ID="dynamicbutton" runat="server" ImageUrl="Images/XamlImage.png"&gt;
&lt;Button&gt;I'm a Button&lt;/Button&gt;
&lt;/xic:XamlImage&gt;
&lt;script runat="server"&gt;
protected void Update(object sender, EventArgs e) {
var dynamicbutton = (XamlImage)Page.FindControl("dynamicbutton");
dynamicbutton.Xaml = string.Format("&lt;Button&gt;{0}&lt;/Button&gt;", buttontext.Text);
}
&lt;/script&gt;
<pre><code>&lt;asp:TextBox ID="buttontext" runat="server"Width="700" Height="100" TextMode="MultiLine"&gt;&lt;Button&gt;I'm a button&lt;/Button&gt;&lt;/asp:TextBox&gt;
&lt;asp:Button runat="server" OnClick="Update" Text="Update" /&gt;
&lt;xic:XamlImage ID="dynamicbutton" runat="server" Image="Images/XamlImage.png" &gt;
&lt;Button&gt;I'm a Button&lt;/Button&gt;
&lt;/xic:XamlImage&gt;
&lt;script runat="server"&gt;
protected void Update(object sender, EventArgs e) {
var dynamicbutton = (XamlImage)Page.FindControl("dynamicbutton");
dynamicbutton.Content = buttontext.Text;
}
&lt;/script&gt;
</code></pre>

<asp:TextBox ID="buttontext" runat="server">I'm a button</asp:TextBox><asp:Button ID="Button1" runat="server" OnClick="Update" Text="Update" />
<asp:TextBox ID="buttontext" runat="server" Width="700" Height="100" TextMode="MultiLine">&lt;Button&gt;I'm a button&lt;/Button&gt;</asp:TextBox><br />
You can also insert xaml tags here.<br />
<asp:Button runat="server" OnClick="Update" Text="Update" /><br />
<xic:XamlImage ID="dynamicbutton" runat="server" ImageUrl="Images/XamlImage.png" >
<Button>I'm a Button</Button>
</xic:XamlImage>
<script runat="server">
protected void Update(object sender, EventArgs e) {
var dynamicbutton = (XamlImage)Page.FindControl("dynamicbutton");
dynamicbutton.Xaml = string.Format("<Button>{0}</Button>", buttontext.Text);
dynamicbutton.Content = buttontext.Text;
}
</script>

Expand Down
Loading

0 comments on commit be65bae

Please sign in to comment.