Skip to content

Commit

Permalink
update dll and fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
IOL0ol1 committed Dec 4, 2022
1 parent 556270b commit 20468cc
Show file tree
Hide file tree
Showing 40 changed files with 805 additions and 206 deletions.
1 change: 0 additions & 1 deletion OpenSlideSharp.Common.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

<!--- Package information, Version -->
<PropertyGroup>
<PackageVersion>1.0.1.4</PackageVersion>
<Authors>IOL0ol1</Authors>
<Copyright>Copyright © 2021-2022</Copyright>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
Expand Down
13 changes: 10 additions & 3 deletions OpenSlideSharp.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30406.217
# Visual Studio Version 17
VisualStudioVersion = 17.4.33110.190
MinimumVisualStudioVersion = 15.0.26124.0
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{6EE7C68C-65D9-4290-81AE-09BA58C857CD}"
EndProject
Expand All @@ -25,7 +25,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSlideSharp.BitmapExtens
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSlideSharp.BruTile", "src\OpenSlideSharp.BruTile\OpenSlideSharp.BruTile.csproj", "{9DA7F592-F964-45CB-9E2E-F8028AE3C956}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SlideViewer", "example\SlideViewer\SlideViewer.csproj", "{11D9A92F-2314-407B-A392-18B2290E4972}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SlideViewer", "example\SlideViewer\SlideViewer.csproj", "{11D9A92F-2314-407B-A392-18B2290E4972}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSlideSharp.OpencvExtensions", "src\OpenSlideSharp.OpencvExtensions\OpenSlideSharp.OpencvExtensions.csproj", "{4322CA50-F9C6-4619-8A8F-9D99E5906CCB}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -69,6 +71,10 @@ Global
{11D9A92F-2314-407B-A392-18B2290E4972}.Debug|Any CPU.Build.0 = Debug|Any CPU
{11D9A92F-2314-407B-A392-18B2290E4972}.Release|Any CPU.ActiveCfg = Release|Any CPU
{11D9A92F-2314-407B-A392-18B2290E4972}.Release|Any CPU.Build.0 = Release|Any CPU
{4322CA50-F9C6-4619-8A8F-9D99E5906CCB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4322CA50-F9C6-4619-8A8F-9D99E5906CCB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4322CA50-F9C6-4619-8A8F-9D99E5906CCB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4322CA50-F9C6-4619-8A8F-9D99E5906CCB}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -83,6 +89,7 @@ Global
{695DED59-4106-424A-9831-2227F0B35BAE} = {6EE7C68C-65D9-4290-81AE-09BA58C857CD}
{9DA7F592-F964-45CB-9E2E-F8028AE3C956} = {6EE7C68C-65D9-4290-81AE-09BA58C857CD}
{11D9A92F-2314-407B-A392-18B2290E4972} = {C3C9459E-1461-4480-B551-AAED7BDAD940}
{4322CA50-F9C6-4619-8A8F-9D99E5906CCB} = {6EE7C68C-65D9-4290-81AE-09BA58C857CD}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {6D55D41F-7887-4787-BD15-17389C769282}
Expand Down
4 changes: 2 additions & 2 deletions build/DownloadAndCopy.ps1
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@


param(
[string]$x86="https://github.com/openslide/openslide-winbuild/releases/download/v20171122/openslide-win32-20171122.zip",
[string]$x64="https://github.com/openslide/openslide-winbuild/releases/download/v20171122/openslide-win64-20171122.zip",
[string]$x86="https://github.com/openslide/openslide-winbuild/releases/download/v20221111/openslide-win32-20221111.zip",
[string]$x64="https://github.com/openslide/openslide-winbuild/releases/download/v20221111/openslide-win64-20221111.zip",
[string]$x86Output="..\openslide\x86\",
[string]$x64Output="..\openslide\x64\")

Expand Down
5 changes: 2 additions & 3 deletions example/MultiSlideServer/Cache/DeepZoomGeneratorCache.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;

using Microsoft.Extensions.Caching.Memory;
using Microsoft.Extensions.Caching.Memory;
using Microsoft.Extensions.Options;
using System;

namespace MultiSlideServer.Cache
{
Expand Down
8 changes: 3 additions & 5 deletions example/MultiSlideServer/Controllers/HomeController.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
using System.Linq;
using System.Text;

using Microsoft.AspNetCore.Mvc;

using Microsoft.AspNetCore.Mvc;
using MultiSlideServer.Cache;
using System.Linq;
using System.Text;

namespace MultiSlideServer.Controllers
{
Expand Down
3 changes: 1 addition & 2 deletions example/MultiSlideServer/ImageProvider.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using Microsoft.Extensions.Options;
using MultiSlideServer.Cache;
using OpenSlideSharp;
using System;
using System.Collections.Generic;

namespace MultiSlideServer
Expand Down Expand Up @@ -53,6 +52,6 @@ public RetainableDeepZoomGenerator RetainDeepZoomGenerator(string name, string p
dz.Dispose();
return dz;
}

}
}
9 changes: 3 additions & 6 deletions example/MultiSlideServer/Startup.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
using System;
using System.Threading.Tasks;

using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Primitives;

using MultiSlideServer.Cache;

using OpenSlideSharp;
using OpenSlideSharp.BitmapExtensions;
using System;
namespace MultiSlideServer
{
public class Startup
Expand Down
2 changes: 1 addition & 1 deletion example/SingleSlideServer/ImageOption.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
{
public class ImageOption
{
public string Path { get; set; }
public string Path { get; set; }
}
}
4 changes: 2 additions & 2 deletions example/SingleSlideServer/ImageProvider.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;
using Microsoft.Extensions.Options;
using Microsoft.Extensions.Options;
using OpenSlideSharp;
using System;

namespace SingleSlideServer
{
Expand Down
6 changes: 2 additions & 4 deletions example/SingleSlideServer/Startup.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
using System.Threading.Tasks;

using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Primitives;

using OpenSlideSharp;
using OpenSlideSharp.BitmapExtensions;

namespace SingleSlideServer
{
Expand Down
18 changes: 11 additions & 7 deletions example/SlideViewer/App.xaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
<Application x:Class="SlideLibrary.Demo.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
StartupUri="MainWindow.xaml">
<Application
x:Class="SlideLibrary.Demo.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
StartupUri="MainWindow.xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<materialDesign:BundledTheme BaseTheme="Inherit" PrimaryColor="Blue"
SecondaryColor="Blue" ColorAdjustment="{materialDesign:ColorAdjustment}" />
<materialDesign:BundledTheme
BaseTheme="Inherit"
ColorAdjustment="{materialDesign:ColorAdjustment}"
PrimaryColor="Blue"
SecondaryColor="Blue" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" />
</ResourceDictionary.MergedDictionaries>
<Style BasedOn="{StaticResource MaterialDesignWindow}" TargetType="Window" />
Expand Down
16 changes: 8 additions & 8 deletions example/SlideViewer/Behaviors/PreviewBehavior.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
using System;
using Mapsui;
using Mapsui.Geometries;
using Mapsui.Layers;
using Mapsui.Providers;
using Mapsui.Styles;
using Mapsui.UI.Wpf;
using Microsoft.Xaml.Behaviors;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
Expand All @@ -7,13 +14,6 @@
using System.Runtime.InteropServices;
using System.Windows;
using System.Windows.Threading;
using Mapsui;
using Mapsui.Geometries;
using Mapsui.Layers;
using Mapsui.Providers;
using Mapsui.Styles;
using Mapsui.UI.Wpf;
using Microsoft.Xaml.Behaviors;
using Bitmap = System.Drawing.Bitmap;
using Point = Mapsui.Geometries.Point;

Expand Down
14 changes: 10 additions & 4 deletions example/SlideViewer/Behaviors/ViewportBehavior.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
using System;
using System.Windows;

using Mapsui.UI.Wpf;
using Mapsui.UI.Wpf;

/* 项目“SlideViewer (netcoreapp3.1)”的未合并的更改
在此之前:
using Microsoft.Xaml.Behaviors;
在此之后:
using Microsoft.Xaml.Behaviors;
using System;
using System.Windows;
*/
using Microsoft.Xaml.Behaviors;
using System.Windows;

namespace SlideLibrary.Demo
{
Expand Down
14 changes: 10 additions & 4 deletions example/SlideViewer/Converters/PointConverter.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
using System;
using System.Collections.Generic;

/* 项目“SlideViewer (netcoreapp3.1)”的未合并的更改
在此之前:
using System;
在此之后:
using Mapsui.Geometries;
using System;
*/
using Mapsui.Geometries;
using System;
using System.Globalization;
using System.Windows.Data;

using Mapsui.Geometries;

namespace SlideLibrary.Demo
{
public class PointConverter : IValueConverter
Expand Down
12 changes: 4 additions & 8 deletions example/SlideViewer/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using System;
using Mapsui.Fetcher;
using Microsoft.Win32;
using OpenSlideSharp.BruTile;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
Expand All @@ -9,13 +12,6 @@
using System.Runtime.CompilerServices;
using System.Windows;
using System.Windows.Media;

using Mapsui.Fetcher;

using Microsoft.Win32;

using OpenSlideSharp.BruTile;

using Point = Mapsui.Geometries.Point;

namespace SlideLibrary.Demo
Expand Down
11 changes: 4 additions & 7 deletions example/SlideViewer/Mapsui/SlideSliceLayer.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;

using BruTile;

using BruTile;
using Mapsui;
using Mapsui.Fetcher;
using Mapsui.Geometries;
using Mapsui.Layers;
using Mapsui.Providers;
using Mapsui.Styles;

using OpenSlideSharp.BruTile;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace SlideLibrary.Demo
{
Expand Down
11 changes: 4 additions & 7 deletions example/SlideViewer/Mapsui/SlideTileLayer.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;

using BruTile;

using BruTile;
using Mapsui.Fetcher;
using Mapsui.Layers;
using Mapsui.Providers;
using Mapsui.Rendering;

using OpenSlideSharp.BruTile;
using System;
using System.Collections.Generic;
using System.Linq;

namespace SlideLibrary.Demo
{
Expand Down
11 changes: 6 additions & 5 deletions example/SlideViewer/SlideViewer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BruTile" Version="4.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="Mapsui.Wpf" Version="3.0.2" />
<PackageReference Include="MaterialDesignThemes" Version="4.2.1" />
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.39" />
<PackageReference Include="BruTile" Version="[4.0.0,5)" />
<PackageReference Include="Newtonsoft.Json" Version="[13.0.1,)" />
<PackageReference Include="Mapsui.Wpf" Version="[3.0.2,4)" />
<PackageReference Include="MaterialDesignThemes" Version="[4.2.1,5)" />
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="[1.1.39,2)" />
<PackageReference Include="OpenCvSharp4.Windows" Version="[4.6.0.20220608,)" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Runtime.InteropServices;

namespace OpenSlideSharp
namespace OpenSlideSharp.BitmapExtensions
{
/// <summary>
///
Expand Down
4 changes: 2 additions & 2 deletions src/OpenSlideSharp.BitmapExtensions/BitmapExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using System.IO;
using System.Linq;

namespace OpenSlideSharp
namespace OpenSlideSharp.BitmapExtensions
{
/// <summary>
///
Expand Down Expand Up @@ -38,7 +38,7 @@ public static MemoryStream ToStream(this Image bitmap, ImageFormat format = null
if (bitmap == null) throw new NullReferenceException();
var ms = new MemoryStream();
EncoderParameters parameters = quality.HasValue ? new EncoderParameters() { Param = new[] { new EncoderParameter(Encoder.Quality, quality.Value) } } : null;
bitmap.Save(ms, (format??ImageFormat.Jpeg).FindCodec(), parameters);
bitmap.Save(ms, (format ?? ImageFormat.Jpeg).FindCodec(), parameters);
ms.Seek(0, SeekOrigin.Begin);
return ms;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Runtime.InteropServices;
using static OpenSlideSharp.DeepZoomGenerator;

namespace OpenSlideSharp
namespace OpenSlideSharp.BitmapExtensions
{
/// <summary>
///
Expand Down Expand Up @@ -42,7 +41,7 @@ public static byte[] GetTileAsJpeg(this DeepZoomGenerator generator, int level,
/// <returns></returns>
public static MemoryStream GetTileAsJpegStream(this DeepZoomGenerator generator, int level, int col, int row, out TileInfo tileInfo, int? quality = null)
{
return GetTileImage(generator, level, col, row, out tileInfo, quality).ToStream(ImageFormat.Jpeg, quality);
return GetTileImage(generator, level, col, row, out tileInfo).ToStream(ImageFormat.Jpeg, quality);

}

Expand Down Expand Up @@ -76,7 +75,7 @@ public static byte[] GetTileAsPng(this DeepZoomGenerator generator, int level, i
/// <returns></returns>
public static MemoryStream GetTileAsPngStream(this DeepZoomGenerator generator, int level, int col, int row, out TileInfo tileInfo, int? quality = null)
{
return GetTileImage(generator, level, col, row, out tileInfo, quality).ToStream(ImageFormat.Png, quality);
return GetTileImage(generator, level, col, row, out tileInfo).ToStream(ImageFormat.Png, quality);
}

/// <summary>
Expand All @@ -87,9 +86,8 @@ public static MemoryStream GetTileAsPngStream(this DeepZoomGenerator generator,
/// <param name="col"></param>
/// <param name="row"></param>
/// <param name="tileInfo"></param>
/// <param name="quality"></param>
/// <returns></returns>
public unsafe static Bitmap GetTileImage(this DeepZoomGenerator generator, int level, int col, int row, out TileInfo tileInfo, int? quality = null)
public unsafe static Bitmap GetTileImage(this DeepZoomGenerator generator, int level, int col, int row, out TileInfo tileInfo)
{
if (generator == null)
throw new NullReferenceException();
Expand Down
Loading

0 comments on commit 20468cc

Please sign in to comment.