SkiaSharp.SKCodec.GetPixels C# (CSharp) Method

GetPixels() public method

public GetPixels ( SKImageInfo info, IntPtr pixels ) : SKCodecResult
info SKImageInfo
pixels System.IntPtr
return SKCodecResult
		public SKCodecResult GetPixels (SKImageInfo info, IntPtr pixels)
		{
			int colorTableCount = 0;
			return GetPixels (info, pixels, info.RowBytes, SKCodecOptions.Default, IntPtr.Zero, ref colorTableCount);
		}

Same methods

SKCodec::GetPixels ( SKImageInfo info, IntPtr pixels, IntPtr colorTable, int &colorTableCount ) : SKCodecResult
SKCodec::GetPixels ( SKImageInfo info, IntPtr pixels, SKCodecOptions options, IntPtr colorTable, int &colorTableCount ) : SKCodecResult
SKCodec::GetPixels ( SKImageInfo info, IntPtr pixels, SKCodecOptions options, SKColorTable colorTable, int &colorTableCount ) : SKCodecResult
SKCodec::GetPixels ( SKImageInfo info, IntPtr pixels, SKColorTable colorTable, int &colorTableCount ) : SKCodecResult
SKCodec::GetPixels ( SKImageInfo info, IntPtr pixels, int rowBytes, SKCodecOptions options, IntPtr colorTable, int &colorTableCount ) : SKCodecResult
SKCodec::GetPixels ( SKImageInfo info, IntPtr pixels, int rowBytes, SKCodecOptions options, SKColorTable colorTable, int &colorTableCount ) : SKCodecResult
SKCodec::GetPixels ( SKImageInfo info, byte &pixels ) : SKCodecResult
SKCodec::GetPixels ( byte &pixels ) : SKCodecResult

Usage Example

示例#1
0
        public static SKBitmap Decode(SKCodec codec, SKImageInfo bitmapInfo)
        {
            if (codec == null)
            {
                throw new ArgumentNullException(nameof(codec));
            }

            // construct a color table for the decode if necessary
            SKColorTable colorTable = null;
            int          colorCount = 0;

            if (bitmapInfo.ColorType == SKColorType.Index8)
            {
                colorTable = new SKColorTable();
            }

            // read the pixels and color table
            var    bitmap = new SKBitmap(bitmapInfo, colorTable);
            IntPtr length;
            var    result = codec.GetPixels(bitmapInfo, bitmap.GetPixels(out length), colorTable, ref colorCount);

            if (result != SKCodecResult.Success && result != SKCodecResult.IncompleteInput)
            {
                bitmap.Dispose();
                bitmap = null;
            }
            return(bitmap);
        }
All Usage Examples Of SkiaSharp.SKCodec::GetPixels