public bool ReadPixels(SKPixmap pixmap) { return(ReadPixels(pixmap.Info, pixmap.GetPixels(), pixmap.RowBytes, 0, 0, SKTransferFunctionBehavior.Respect)); }
public bool ReadPixels(SKPixmap pixmap, int srcX, int srcY) { return(ReadPixels(pixmap, srcX, srcY, SKImageCachingHint.Allow)); }
public bool ScalePixels(SKPixmap dst, SKFilterQuality quality) { return(ScalePixels(dst, quality, SKImageCachingHint.Allow)); }
protected override SKData OnEncode(SKPixmap pixmap) { return(onEncode?.Invoke(pixmap) ?? null); }
public static SKImage FromPixels(SKPixmap pixmap, SKImageRasterReleaseDelegate releaseProc) { return(FromPixels(pixmap, releaseProc, null)); }
public bool InstallPixels(SKPixmap pixmap) { return(SkiaApi.sk_bitmap_install_pixels_with_pixmap(Handle, pixmap.Handle)); }
public static bool Resize(SKPixmap dst, SKPixmap src, SKBitmapResizeMethod method) { return(SkiaApi.sk_bitmapscaler_resize(dst.Handle, src.Handle, method)); }
public bool ReadPixels(SKPixmap pixmap, int srcX, int srcY, SKImageCachingHint cachingHint) { if (pixmap == null) throw new ArgumentNullException(nameof(pixmap)); }
public static SKImage FromPixels(SKImageInfo info, IntPtr pixels, int rowBytes) { using (var pixmap = new SKPixmap(info, pixels, rowBytes)) { return(FromPixels(pixmap, null, null)); } }
public bool Encode(SKWStream dst, SKEncodedImageFormat format, int quality) { using (var pixmap = new SKPixmap()) { return(PeekPixels(pixmap) && pixmap.Encode(dst, format, quality)); } }
protected abstract SKData OnEncode(SKPixmap pixmap);
public bool CopyTo(SKBitmap destination, SKColorType colorType) { // TODO: instead of working on `destination` directly, we should // create a temporary bitmap and then inject the data if (destination == null) { throw new ArgumentNullException(nameof(destination)); } if (!CanCopyTo(colorType)) { return(false); } SKPixmap srcPM = PeekPixels(); if (srcPM == null) { return(false); } SKImageInfo dstInfo = srcPM.Info.WithColorType(colorType); switch (colorType) { case SKColorType.Rgb565: // CopyTo() is not strict on alpha type. Here we set the src to opaque to allow // the call to ReadPixels() to succeed and preserve this lenient behavior. if (srcPM.AlphaType != SKAlphaType.Opaque) { srcPM = srcPM.WithAlphaType(SKAlphaType.Opaque); } dstInfo.AlphaType = SKAlphaType.Opaque; break; case SKColorType.RgbaF16: // The caller does not have an opportunity to pass a dst color space. // Assume that they want linear sRGB. dstInfo.ColorSpace = SKColorSpace.CreateSrgbLinear(); if (srcPM.ColorSpace == null) { // We can't do a sane conversion to F16 without a dst color space. // Guess sRGB in this case. srcPM = srcPM.WithColorSpace(SKColorSpace.CreateSrgb()); } break; } destination.Reset(); // TODO: is this needed? if (!destination.TryAllocPixels(dstInfo, colorType == SKColorType.Index8 ? ColorTable : null)) { return(false); } SKPixmap dstPM = destination.PeekPixels(); if (dstPM == null) { return(false); } // We can't do a sane conversion from F16 without a src color space. Guess sRGB in this case. if (srcPM.ColorType == SKColorType.RgbaF16 && dstPM.ColorSpace == null) { dstPM = dstPM.WithColorSpace(SKColorSpace.CreateSrgb()); } // ReadPixels does not yet support color spaces with parametric transfer functions. This // works around that restriction when the color spaces are equal. if (colorType != SKColorType.RgbaF16 && srcPM.ColorType != SKColorType.RgbaF16 && dstPM.ColorSpace == srcPM.ColorSpace) { dstPM = dstPM.WithColorSpace(null); srcPM = srcPM.WithColorSpace(null); } if (!srcPM.ReadPixels(dstPM)) { return(false); } return(true); }
public bool ReadPixels(SKPixmap pixmap) => ReadPixels(pixmap.Info, pixmap.GetPixels(), pixmap.RowBytes, 0, 0);
public bool ReadPixels(SKPixmap pixmap, int srcX, int srcY) => ReadPixels(pixmap.Info, pixmap.GetPixels(), pixmap.RowBytes, srcX, srcY);
public static SKSurface Create(SKPixmap pixmap, SKSurfaceProps props) => Create(pixmap, new SKSurfaceProperties(props));
public bool ReadPixels(SKPixmap pixmap) => ReadPixels(pixmap, 0, 0, SKImageCachingHint.Allow);
public static SKSurface Create(SKPixmap pixmap) => Create(pixmap, null);
public bool ReadPixels(SKPixmap pixmap, int srcX, int srcY) => ReadPixels(pixmap, srcX, srcY, SKImageCachingHint.Allow);
public bool Encode(SKWStream dst, SKEncodedImageFormat format, int quality) { return(SKPixmap.Encode(dst, this, format, quality)); }
public static SKImage FromPixels(SKPixmap pixmap) { return(FromPixels(pixmap, null, null)); }
public bool ReadPixels(SKPixmap pixmap, int srcX, int srcY) { return(ReadPixels(pixmap.Info, pixmap.GetPixels(), pixmap.RowBytes, srcX, srcY)); }
public bool ReadPixels(SKPixmap pixmap) { return(ReadPixels(pixmap.Info, pixmap.GetPixels(), pixmap.RowBytes, 0, 0)); }