diff options
-rw-r--r-- | demos/csharp/api/ghostnet.cs | 14 | ||||
-rw-r--r-- | demos/csharp/windows/ghostnet_wpf_example/ghostnet_simple_viewer.csproj | 32 |
2 files changed, 44 insertions, 2 deletions
diff --git a/demos/csharp/api/ghostnet.cs b/demos/csharp/api/ghostnet.cs index 3ea7028ed..f033941f2 100644 --- a/demos/csharp/api/ghostnet.cs +++ b/demos/csharp/api/ghostnet.cs | |||
@@ -86,37 +86,46 @@ public class gsEventArgs : EventArgs | |||
86 | } | 86 | } |
87 | } | 87 | } |
88 | 88 | ||
89 | /* Ghostscript display device callback delegates. */ | 89 | /* Ghostscript display device callback delegates. Make sure that |
90 | these are using Cdecl calling convention, which means gsdll | ||
91 | is doing the stack cleanup after the call */ | ||
90 | 92 | ||
91 | /* New device has been opened */ | 93 | /* New device has been opened */ |
92 | /* This is the first event from this device. */ | 94 | /* This is the first event from this device. */ |
95 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] | ||
93 | public delegate int display_open_del(IntPtr handle, IntPtr device); | 96 | public delegate int display_open_del(IntPtr handle, IntPtr device); |
94 | 97 | ||
95 | /* Device is about to be closed. */ | 98 | /* Device is about to be closed. */ |
96 | /* Device will not be closed until this function returns. */ | 99 | /* Device will not be closed until this function returns. */ |
100 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] | ||
97 | public delegate int display_preclose_del(IntPtr handle, IntPtr device); | 101 | public delegate int display_preclose_del(IntPtr handle, IntPtr device); |
98 | 102 | ||
99 | /* Device has been closed. */ | 103 | /* Device has been closed. */ |
100 | /* This is the last event from this device. */ | 104 | /* This is the last event from this device. */ |
105 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] | ||
101 | public delegate int display_close_del(IntPtr handle, IntPtr device); | 106 | public delegate int display_close_del(IntPtr handle, IntPtr device); |
102 | 107 | ||
103 | /* Device is about to be resized. */ | 108 | /* Device is about to be resized. */ |
104 | /* Resize will only occur if this function returns 0. */ | 109 | /* Resize will only occur if this function returns 0. */ |
105 | /* raster is byte count of a row. */ | 110 | /* raster is byte count of a row. */ |
111 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] | ||
106 | public delegate int display_presize_del(IntPtr handle, IntPtr device, | 112 | public delegate int display_presize_del(IntPtr handle, IntPtr device, |
107 | int width, int height, int raster, uint format); | 113 | int width, int height, int raster, uint format); |
108 | 114 | ||
109 | /* Device has been resized. */ | 115 | /* Device has been resized. */ |
110 | /* New pointer to raster returned in pimage */ | 116 | /* New pointer to raster returned in pimage */ |
117 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] | ||
111 | public delegate int display_size_del(IntPtr handle, IntPtr device, | 118 | public delegate int display_size_del(IntPtr handle, IntPtr device, |
112 | int width, int height, int raster, uint format, | 119 | int width, int height, int raster, uint format, |
113 | IntPtr pimage); | 120 | IntPtr pimage); |
114 | 121 | ||
115 | /* flushpage */ | 122 | /* flushpage */ |
123 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] | ||
116 | public delegate int display_sync_del(IntPtr handle, IntPtr device); | 124 | public delegate int display_sync_del(IntPtr handle, IntPtr device); |
117 | 125 | ||
118 | /* showpage */ | 126 | /* showpage */ |
119 | /* If you want to pause on showpage, then don't return immediately */ | 127 | /* If you want to pause on showpage, then don't return immediately */ |
128 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] | ||
120 | public delegate int display_page_del(IntPtr handle, IntPtr device, int copies, int flush); | 129 | public delegate int display_page_del(IntPtr handle, IntPtr device, int copies, int flush); |
121 | 130 | ||
122 | 131 | ||
@@ -125,6 +134,7 @@ public class gsEventArgs : EventArgs | |||
125 | * progressive update of the display. | 134 | * progressive update of the display. |
126 | * This function pointer may be set to NULL if not required. | 135 | * This function pointer may be set to NULL if not required. |
127 | */ | 136 | */ |
137 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] | ||
128 | public delegate int display_update_del(IntPtr handle, IntPtr device, int x, int y, | 138 | public delegate int display_update_del(IntPtr handle, IntPtr device, int x, int y, |
129 | int w, int h); | 139 | int w, int h); |
130 | 140 | ||
@@ -135,10 +145,12 @@ public class gsEventArgs : EventArgs | |||
135 | * image buffer. The first row will be placed at the address | 145 | * image buffer. The first row will be placed at the address |
136 | * returned by display_memalloc. | 146 | * returned by display_memalloc. |
137 | */ | 147 | */ |
148 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] | ||
138 | public delegate int display_memalloc_del(IntPtr handle, IntPtr device, ulong size); | 149 | public delegate int display_memalloc_del(IntPtr handle, IntPtr device, ulong size); |
139 | 150 | ||
140 | /* Free memory for bitmap */ | 151 | /* Free memory for bitmap */ |
141 | /* If this is NULL, the Ghostscript memory device will free the bitmap */ | 152 | /* If this is NULL, the Ghostscript memory device will free the bitmap */ |
153 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] | ||
142 | public delegate int display_memfree_del(IntPtr handle, IntPtr device, IntPtr mem); | 154 | public delegate int display_memfree_del(IntPtr handle, IntPtr device, IntPtr mem); |
143 | 155 | ||
144 | private int display_size(IntPtr handle, IntPtr device, | 156 | private int display_size(IntPtr handle, IntPtr device, |
diff --git a/demos/csharp/windows/ghostnet_wpf_example/ghostnet_simple_viewer.csproj b/demos/csharp/windows/ghostnet_wpf_example/ghostnet_simple_viewer.csproj index 6ea52f155..a7daf8f6f 100644 --- a/demos/csharp/windows/ghostnet_wpf_example/ghostnet_simple_viewer.csproj +++ b/demos/csharp/windows/ghostnet_wpf_example/ghostnet_simple_viewer.csproj | |||
@@ -14,6 +14,21 @@ | |||
14 | <WarningLevel>4</WarningLevel> | 14 | <WarningLevel>4</WarningLevel> |
15 | <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> | 15 | <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> |
16 | <Deterministic>true</Deterministic> | 16 | <Deterministic>true</Deterministic> |
17 | <PublishUrl>publish\</PublishUrl> | ||
18 | <Install>true</Install> | ||
19 | <InstallFrom>Disk</InstallFrom> | ||
20 | <UpdateEnabled>false</UpdateEnabled> | ||
21 | <UpdateMode>Foreground</UpdateMode> | ||
22 | <UpdateInterval>7</UpdateInterval> | ||
23 | <UpdateIntervalUnits>Days</UpdateIntervalUnits> | ||
24 | <UpdatePeriodically>false</UpdatePeriodically> | ||
25 | <UpdateRequired>false</UpdateRequired> | ||
26 | <MapFileExtensions>true</MapFileExtensions> | ||
27 | <ApplicationRevision>0</ApplicationRevision> | ||
28 | <ApplicationVersion>1.0.0.%2a</ApplicationVersion> | ||
29 | <IsWebBootstrapper>false</IsWebBootstrapper> | ||
30 | <UseApplicationTrust>false</UseApplicationTrust> | ||
31 | <BootstrapperEnabled>true</BootstrapperEnabled> | ||
17 | </PropertyGroup> | 32 | </PropertyGroup> |
18 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | 33 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> |
19 | <PlatformTarget>AnyCPU</PlatformTarget> | 34 | <PlatformTarget>AnyCPU</PlatformTarget> |
@@ -57,7 +72,7 @@ | |||
57 | <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'"> | 72 | <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'"> |
58 | <DebugSymbols>true</DebugSymbols> | 73 | <DebugSymbols>true</DebugSymbols> |
59 | <OutputPath>bin\x86\Debug\</OutputPath> | 74 | <OutputPath>bin\x86\Debug\</OutputPath> |
60 | <DefineConstants>DEBUG;TRACE</DefineConstants> | 75 | <DefineConstants>TRACE;DEBUG;GHOSTPDL</DefineConstants> |
61 | <DebugType>full</DebugType> | 76 | <DebugType>full</DebugType> |
62 | <PlatformTarget>x86</PlatformTarget> | 77 | <PlatformTarget>x86</PlatformTarget> |
63 | <LangVersion>7.3</LangVersion> | 78 | <LangVersion>7.3</LangVersion> |
@@ -74,6 +89,9 @@ | |||
74 | <ErrorReport>prompt</ErrorReport> | 89 | <ErrorReport>prompt</ErrorReport> |
75 | <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> | 90 | <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> |
76 | </PropertyGroup> | 91 | </PropertyGroup> |
92 | <PropertyGroup> | ||
93 | <RunPostBuildEvent>Always</RunPostBuildEvent> | ||
94 | </PropertyGroup> | ||
77 | <ItemGroup> | 95 | <ItemGroup> |
78 | <Reference Include="ReachFramework" /> | 96 | <Reference Include="ReachFramework" /> |
79 | <Reference Include="System" /> | 97 | <Reference Include="System" /> |
@@ -179,6 +197,18 @@ | |||
179 | <ItemGroup> | 197 | <ItemGroup> |
180 | <None Include="App.config" /> | 198 | <None Include="App.config" /> |
181 | </ItemGroup> | 199 | </ItemGroup> |
200 | <ItemGroup> | ||
201 | <BootstrapperPackage Include=".NETFramework,Version=v4.7.2"> | ||
202 | <Visible>False</Visible> | ||
203 | <ProductName>Microsoft .NET Framework 4.7.2 %28x86 and x64%29</ProductName> | ||
204 | <Install>true</Install> | ||
205 | </BootstrapperPackage> | ||
206 | <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1"> | ||
207 | <Visible>False</Visible> | ||
208 | <ProductName>.NET Framework 3.5 SP1</ProductName> | ||
209 | <Install>false</Install> | ||
210 | </BootstrapperPackage> | ||
211 | </ItemGroup> | ||
182 | <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | 212 | <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> |
183 | <PropertyGroup> | 213 | <PropertyGroup> |
184 | <PostBuildEvent>if $(ConfigurationName) == Debug ( | 214 | <PostBuildEvent>if $(ConfigurationName) == Debug ( |