public unsafe void PushFrame(IntPtr currentFrame) { /////////////// // Choose the best bitmap to do a background render to BitmapBunch currentBitmapBunch = this.bitmapBunch; BitmapDefinition bitmapToPrepare = currentBitmapBunch.GetNextPrepareBitmap(); bool highResolution = currentBitmapBunch.HighResolution; // Determine how much of the image to copy. int copyHeight = highResolution ? LOW_RES_HEIGHT * 2 : LOW_RES_HEIGHT; int copyWidth = highResolution ? LOW_RES_WIDTH * 2 : LOW_RES_WIDTH; // Copy! CanvasHelper.CopyBitmap(currentFrame, bitmapToPrepare, copyWidth, copyHeight, true, true, this.AutoCrop, currentBitmapBunch.ScalingAlgorithm); // Consider the newly determined crop rectangle. cropHelper.ConsiderAlternateCrop(bitmapToPrepare.Crop); bitmapToPrepare.Crop.Mimic(cropHelper.CurrentCrop); // And.... we're done. currentBitmapBunch.SetLastPreparedBitmap(bitmapToPrepare); // Refresh. this.TriggerRefresh(); }
private void CreateNewBitmapBunch(bool highResolution, ScalingAlgorithm algorithm) { var newBunch = CanvasHelper.CreateNewBitmapBunch( highResolution, algorithm, LOW_RES_WIDTH, LOW_RES_HEIGHT, this.bitmapBunch, PixelFormat.Format32bppRgb); if (newBunch != null) { this.bitmapBunch = newBunch; } }