/// <inheritdoc/> public bool TryWrite(Lazy <Stream> stream, CodecFormat format, SpanBitmap bmp) { var fmt = _GetFormatFromExtension(format); if (fmt == null) { return(false); } using var dst = bmp.Info.ToAndroidFactory().CreateCompatibleBitmap(); bmp.CopyTo(dst); dst.Compress(fmt, 100, stream.Value); return(true); }
public static void Inference <TResult>(this IInferenceContext <PointerBitmap, TResult> context, TResult result, SpanBitmap image, RECT?imageRect = null) where TResult : class { if (image.PixelFormat == Pixel.BGR24.Format) { context.Inference(result, image.OfType <Pixel.BGR24>(), imageRect); return; } // convert image to BGR24 MemoryBitmap tmp = default; image.CopyTo(ref tmp, Pixel.BGR24.Format); tmp.AsSpanBitmap().PinReadablePointer ( ptrBmp => context.Inference(result, ptrBmp, imageRect) ); }
public void Update(SpanBitmap <float> newDepth) { newDepth.CopyTo(ref _Depth); _SpriteAsset = null; }