public Texture2D Texture() { if (txOutput == null) { txOutput = Texture2D.FromStream(Game1.graphics.GraphicsDevice, SourceStream()); } #if LOG_DEBUG SDV_Logger.DumpObject("txOutput", txOutput); #endif return(txOutput); }
public MemoryStream SourceStream() { SKImage image = SKImage.FromBitmap(SourceImage); SKData encoded = image.Encode(); var memoryStream = new MemoryStream(); encoded.AsStream().CopyTo(memoryStream); memoryStream.Seek(0, SeekOrigin.Begin); #if LOG_DEBUG SDV_Logger.LogInfo("SourceStream", $"Stream length: {memoryStream.Length}"); #endif return(memoryStream); }