示例#1
0
        public static SKImageInfo DecodeBounds(SKStreamRewindable stream, SKColorType pref = SKColorType.Unknown)
        {
            SKImageInfo info;

            SKImageDecoder.DecodeStreamBounds(stream, out info, pref);
            return(info);
        }
示例#2
0
 public SKImageDecoder(SKStreamRewindable stream)
     : this(SkiaApi.sk_imagedecoder_factory(stream.Handle))
 {
     if (Handle == IntPtr.Zero)
     {
         throw new ArgumentException("Unable to find a decoder for the sream.", "stream");
     }
 }
示例#3
0
        public static SKBitmap Decode(SKStreamRewindable stream, SKColorType pref = SKColorType.Unknown)
        {
            var bitmap = new SKBitmap();

            if (!SKImageDecoder.DecodeStream(stream, bitmap, pref))
            {
                bitmap.Dispose();
                bitmap = null;
            }
            return(bitmap);
        }
示例#4
0
 public static bool DecodeStreamBounds(SKStreamRewindable stream, out SKImageInfo info, SKColorType pref, ref SKImageDecoderFormat format)
 {
     using (var bitmap = new SKBitmap())
     {
         if (DecodeStream(stream, bitmap, pref, SKImageDecoderMode.DecodePixels, ref format))
         {
             info = bitmap.Info;
             return(true);
         }
         info = SKImageInfo.Empty;
         return(false);
     }
 }
示例#5
0
 public static SKImageDecoderFormat GetFormat(SKStreamRewindable stream)
 {
     return(SkiaApi.sk_imagedecoder_get_stream_format(stream.Handle));
 }
示例#6
0
 public static bool DecodeStream(SKStreamRewindable stream, SKBitmap bitmap, SKColorType pref, SKImageDecoderMode mode, ref SKImageDecoderFormat format)
 {
     return(SkiaApi.sk_imagedecoder_decode_stream(stream.Handle, bitmap.Handle, pref, mode, ref format));
 }
示例#7
0
        public static bool DecodeStream(SKStreamRewindable stream, SKBitmap bitmap, SKColorType pref = SKColorType.Unknown, SKImageDecoderMode mode = SKImageDecoderMode.DecodePixels)
        {
            SKImageDecoderFormat format = SKImageDecoderFormat.Unknown;

            return(DecodeStream(stream, bitmap, pref, mode, ref format));
        }
示例#8
0
        public static bool DecodeStreamBounds(SKStreamRewindable stream, out SKImageInfo info, SKColorType pref = SKColorType.Unknown)
        {
            SKImageDecoderFormat format = SKImageDecoderFormat.Unknown;

            return(DecodeStreamBounds(stream, out info, pref, ref format));
        }