Пример #1
0
        /// <summary>
        /// Draws the given frame to the video.
        /// </summary>
        /// <param name="device">The device on which the given framebuffer is created.</param>
        /// <param name="uploadedTexture">The texture which should be added to the video.</param>
        public void DrawFrame(EngineDevice device, MemoryMappedTexture <int> uploadedTexture)
        {
            try
            {
                device.EnsureNotNull(nameof(device));
                uploadedTexture.EnsureNotNull(nameof(uploadedTexture));
                if (!_hasStarted)
                {
                    throw new SeeingSharpGraphicsException($"{nameof(SeeingSharpVideoWriter)} is not started!");
                }
                if (_hasFinished)
                {
                    throw new SeeingSharpGraphicsException($"{nameof(SeeingSharpVideoWriter)} has already finished before!");
                }

                // Check for correct image size
                if (_videoSize != uploadedTexture.PixelSize)
                {
                    throw new SeeingSharpGraphicsException("Size has changed during recording!");
                }

                this.DrawFrameInternal(device, uploadedTexture);
            }
            catch (Exception ex)
            {
                _drawException = ex;
            }
        }
Пример #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="StandardTextureResource" /> class.
        /// </summary>
        internal StandardTextureResource(MemoryMappedTexture <int> inMemoryTexture)
        {
            inMemoryTexture.EnsureNotNull(nameof(inMemoryTexture));

            _inMemoryTexture = inMemoryTexture;
        }