コード例 #1
0
ファイル: SKBitmap.cs プロジェクト: roceh/SkiaSharp
        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
ファイル: SKBitmap.cs プロジェクト: roceh/SkiaSharp
        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));
        }