private void RenderImageThatMasksText(VideoInterpreter.VideoCapture frame, IBoundingBox invalidatedRegion) { frame.CopyToWriteableBitmap(BackgroundOverlayImage, invalidatedRegion); BackgroundOverlay.Width = frame.Width; BackgroundOverlay.Height = frame.Height; foreach (var textLoc in TextLocations) { CopyBitmapToWriteableBitmap(_backgroundBitmap, BackgroundOverlayImage, textLoc.TreeNode); } }
public void WriteBackgroundAndRender(Tree tree) { VideoInterpreter.VideoCapture capture = tree["videocapture"] as VideoInterpreter.VideoCapture; IBoundingBox invalidatedpixels = tree["invalidated"] as IBoundingBox; //Todo: this is not working properly - returning null when there is a change... List <Tree> contentRegionBoxes = GetContentRegionBoxes(tree); if (invalidatedpixels != null) { _backgroundBitmap.Width = tree.Width; _backgroundBitmap.Height = tree.Height; WriteBackgroundPixels(_backgroundBitmap, contentRegionBoxes, tree); Dispatcher.BeginInvoke(_update, capture, tree, contentRegionBoxes, tree); } else { WriteBackgroundPixels(_backgroundBitmap, contentRegionBoxes, tree); Dispatcher.BeginInvoke(_update, capture, tree, contentRegionBoxes, null); } }
private void UIThreadUpdate(VideoInterpreter.VideoCapture frame, Tree root, List <Tree> textNodes, IBoundingBox invalidated) { SetTextBoxes(textNodes, root); RenderImageThatMasksText(frame, invalidated); }