#108 - added missing static method "FromBitmap"

This commit is contained in:
Alexander Marek 2016-07-21 15:54:00 +02:00
Родитель 990ae04023
Коммит 4c8abe8281
4 изменённых файлов: 23 добавлений и 6 удалений

Просмотреть файл

@ -71,9 +71,17 @@ namespace SkiaSharp
public SKData Encode (SKImageEncodeFormat format, int quality)
{
return GetObject<SKData> (SkiaApi.sk_image_encode_specific (Handle, format, quality));
}
}
public static SKImage FromBitmap(SKBitmap bitmap)
{
if (bitmap == null)
throw new ArgumentNullException("bitmap");
public int Width => SkiaApi.sk_image_get_width (Handle);
var handle = SkiaApi.sk_image_new_from_bitmap(bitmap.Handle);
return GetObject<SKImage>(handle);
}
public int Width => SkiaApi.sk_image_get_width (Handle);
public int Height => SkiaApi.sk_image_get_height (Handle);
public uint UniqueId => SkiaApi.sk_image_get_unique_id (Handle);
}

Просмотреть файл

@ -297,7 +297,9 @@ namespace SkiaSharp
public extern static sk_data_t sk_image_encode(sk_image_t t);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static sk_data_t sk_image_encode_specific(sk_image_t t, SKImageEncodeFormat format, int quality);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static sk_image_t sk_image_new_from_bitmap(sk_bitmap_t b);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static void sk_image_unref(sk_image_t t);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static int sk_image_get_width(sk_image_t t);

Просмотреть файл

@ -1,13 +1,17 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
VisualStudioVersion = 14.0.24720.0
# Visual Studio 14
VisualStudioVersion = 14.0.25123.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Binding", "Binding\Binding.shproj", "{9C502B9A-25D4-473F-89BD-5A13DDE16354}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SkiaSharp.Generic", "SkiaSharp.Generic\SkiaSharp.Generic.csproj", "{E81CA656-224A-4121-ADD9-1771E06E8A8F}"
EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
Binding\Binding.projitems*{e81ca656-224a-4121-add9-1771e06e8a8f}*SharedItemsImports = 4
Binding\Binding.projitems*{9c502b9a-25d4-473f-89bd-5a13dde16354}*SharedItemsImports = 13
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
@ -18,4 +22,7 @@ Global
{E81CA656-224A-4121-ADD9-1771E06E8A8F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E81CA656-224A-4121-ADD9-1771E06E8A8F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

2
skia

@ -1 +1 @@
Subproject commit 2e4ace6235c0515c65931e5c08b212f83e3081e4
Subproject commit c6d9330044f00ec5895e4b94ec845b395d9795c5