SkiaSharp.SKCodec.Create C# (CSharp) Method

Create() public static method

public static Create ( SKStream stream ) : SKCodec
stream SKStream
return SKCodec
		public static SKCodec Create (SKStream stream)
		{
			if (stream == null)
				throw new ArgumentNullException (nameof (stream));
			var codec = GetObject<SKCodec> (SkiaApi.sk_codec_new_from_stream (stream.Handle));
			stream.RevokeOwnership (codec);
			return codec;
		}

Same methods

SKCodec::Create ( SKData data ) : SKCodec

Usage Example

示例#1
0
 public static SKImage FromEncodedData(string filename)
 {
     if (filename == null)
     {
         throw new ArgumentNullException(nameof(filename));
     }
     using (var stream = SKBitmap.OpenStream(filename))
         using (var codec = SKCodec.Create(stream))
             using (var bitmap = SKBitmap.Decode(codec, codec.Info)) {
                 if (bitmap == null)
                 {
                     return(null);
                 }
                 return(FromBitmap(bitmap));
             }
 }
All Usage Examples Of SkiaSharp.SKCodec::Create