SkiaSharp.SKCodec.GetPixels C# (CSharp) Method

GetPixels() public method

public GetPixels ( SKImageInfo info, IntPtr pixels, int rowBytes, SKCodecOptions options, IntPtr colorTable, int &colorTableCount ) : SKCodecResult
info SKImageInfo
pixels System.IntPtr
rowBytes int
options SKCodecOptions
colorTable System.IntPtr
colorTableCount int
return SKCodecResult
		public unsafe SKCodecResult GetPixels (SKImageInfo info, IntPtr pixels, int rowBytes, SKCodecOptions options, IntPtr colorTable, ref int colorTableCount)
		{
			if (pixels == IntPtr.Zero)
				throw new ArgumentNullException (nameof (pixels));

			var nativeOptions = new SKCodecOptionsInternal {
				fZeroInitialized = options.ZeroInitialized,
				fSubset = null
			};
			if (options.HasSubset) {
				var subset = options.Subset.Value;
				nativeOptions.fSubset = ⊂
			}
			return SkiaApi.sk_codec_get_pixels (Handle, ref info, pixels, (IntPtr)rowBytes, ref nativeOptions, colorTable, ref colorTableCount);
		}

Same methods

SKCodec::GetPixels ( SKImageInfo info, IntPtr pixels ) : SKCodecResult
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, 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