[SKImage] Allow for images to be encoded in more formats

This commit is contained in:
Miguel de Icaza 2016-03-05 23:24:43 -05:00
Родитель 523f29de86
Коммит d72364f2fe
6 изменённых файлов: 43 добавлений и 4 удалений

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

@ -10,6 +10,18 @@ using System;
namespace SkiaSharp
{
public enum SKImageEncodeFormat {
Unknown,
Bmp,
Gif,
Ico,
Jpeg,
Png,
Wbmp,
Webp,
Ktx,
}
public class SKImage : SKObject
{
protected override void Dispose (bool disposing)
@ -62,6 +74,11 @@ namespace SkiaSharp
return new SKData (SkiaApi.sk_image_encode (Handle));
}
public SKData Encode (SKImageEncodeFormat format, int quality)
{
return new SKData (SkiaApi.sk_image_encode_specific (Handle, format, quality));
}
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);

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

@ -255,6 +255,8 @@ namespace SkiaSharp
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
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)]
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);

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

@ -131,9 +131,6 @@
<MemberSignature Language="C#" Value="public static SkiaSharp.SKData FromMallocMemory (byte[] bytes);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig class SkiaSharp.SKData FromMallocMemory(unsigned int8[] bytes) cil managed" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>SkiaSharp.SKData</ReturnType>
</ReturnValue>

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

@ -60,6 +60,28 @@
</remarks>
</Docs>
</Member>
<Member MemberName="Encode">
<MemberSignature Language="C#" Value="public SkiaSharp.SKData Encode (SkiaSharp.SKImageEncodeFormat format, int quality);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance class SkiaSharp.SKData Encode(valuetype SkiaSharp.SKImageEncodeFormat format, int32 quality) cil managed" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>SkiaSharp.SKData</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="format" Type="SkiaSharp.SKImageEncodeFormat" />
<Parameter Name="quality" Type="System.Int32" />
</Parameters>
<Docs>
<param name="format">To be added.</param>
<param name="quality">To be added.</param>
<summary>To be added.</summary>
<returns>To be added.</returns>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="FromData">
<MemberSignature Language="C#" Value="public static SkiaSharp.SKImage FromData (SkiaSharp.SKData data);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig class SkiaSharp.SKImage FromData(class SkiaSharp.SKData data) cil managed" />

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

@ -66,6 +66,7 @@
<Type Name="SKImageDecoderFormat" Kind="Enumeration" />
<Type Name="SKImageDecoderMode" Kind="Enumeration" />
<Type Name="SKImageDecoderResult" Kind="Enumeration" />
<Type Name="SKImageEncodeFormat" Kind="Enumeration" />
<Type Name="SKImageFilter" Kind="Class" />
<Type Name="SKImageFilter+CropRect" Kind="Class" />
<Type Name="SKImageInfo" Kind="Structure" />

2
skia

@ -1 +1 @@
Subproject commit b013c01c28c3210ca5cea134cfbc819c1efa5c0d
Subproject commit 135c8ca428342a2abfcd43f2d300f1f2e9ab03f4