SFML.Graphics.Texture.CopyToImage C# (CSharp) Method

CopyToImage() public method

Copy a texture's pixels to an image
public CopyToImage ( ) : Image
return Image
        public Image CopyToImage()
        {
            return new Image(sfTexture_copyToImage(CPointer));
        }

Usage Example

Exemplo n.º 1
0
        /// <summary>
        /// Draw the surface directly to the game window.  This will refresh the view,
        /// and Display the surface, as well as clear it if AutoClear is true.
        /// </summary>
        /// <param name="game">The Game to render to.</param>
        public void DrawToWindow(Game game)
        {
            RefreshView();

            Display();

            Drawable drawable = RenderShaders();

            game.Window.Draw(drawable, _states);

            if (_saveNextFrame)
            {
                _saveNextFrame = false;

                var texture = new SFML.Graphics.Texture(game.Window.Size.X, game.Window.Size.Y);
                texture.Update(game.Window);
                var capture = texture.CopyToImage();
                capture.SaveToFile(_saveNameFramePath);
            }

            if (AutoClear)
            {
                Clear(FillColor);
            }
        }
All Usage Examples Of SFML.Graphics.Texture::CopyToImage