C# Class SFML.Graphics.Texture

Image living on the graphics card that can be used for drawing
Inheritance: SFML.System.ObjectBase
Afficher le fichier Open project: SFML/SFML.Net Class Usage Examples

Méthodes publiques

Méthode Description
Bind ( Texture texture ) : void

Bind a texture for rendering

CopyToImage ( ) : Image

Copy a texture's pixels to an image

GenerateMipmap ( ) : bool

Generate a mipmap using the current texture data

Mipmaps are pre-computed chains of optimized textures. Each level of texture in a mipmap is generated by halving each of the previous level's dimensions. This is done until the final level has the size of 1x1. The textures generated in this process may make use of more advanced filters which might improve the visual quality of textures when they are applied to objects much smaller than they are. This is known as minification. Because fewer texels (texture elements) have to be sampled from when heavily minified, usage of mipmaps can also improve rendering performance in certain scenarios.

Mipmap generation relies on the necessary OpenGL extension being available. If it is unavailable or generation fails due to another reason, this function will return false. Mipmap data is only valid from the time it is generated until the next time the base level image is modified, at which point this function will have to be called again to regenerate it.

Texture ( Image image ) : System

Construct the texture from an image

Texture ( Image image, IntRect area ) : System

Construct the texture from an image

Texture ( Stream stream ) : System

Construct the texture from a file in a stream

Texture ( Stream stream, IntRect area ) : System

Construct the texture from a file in a stream

Texture ( Texture copy ) : System

Construct the texture from another texture

Texture ( byte bytes ) : System

Construct the texture from a file in memory

Texture ( string filename ) : System

Construct the texture from a file

Texture ( string filename, IntRect area ) : System

Construct the texture from a file

Texture ( uint width, uint height ) : System

Construct the texture

ToString ( ) : string

Provide a string describing the object

Update ( Image image ) : void

Update a texture from an image

Update ( Image image, uint x, uint y ) : void

Update a texture from an image

Update ( RenderWindow window ) : void

Update a texture from the contents of a render-window

Update ( RenderWindow window, uint x, uint y ) : void

Update a texture from the contents of a render-window

Update ( SFML window ) : void

Update a texture from the contents of a window

Update ( SFML window, uint x, uint y ) : void

Update a texture from the contents of a window

Update ( byte pixels ) : void

Update a texture from an array of pixels

Update ( byte pixels, uint width, uint height, uint x, uint y ) : void

Update a texture from an array of pixels

Méthodes protégées

Méthode Description
Destroy ( bool disposing ) : void

Handle the destruction of the object

Private Methods

Méthode Description
Texture ( IntPtr cPointer ) : System

Internal constructor

sfTexture_bind ( IntPtr texture ) : void
sfTexture_copy ( IntPtr texture ) : IntPtr
sfTexture_copyToImage ( IntPtr texture ) : IntPtr
sfTexture_create ( uint width, uint height ) : IntPtr
sfTexture_createFromFile ( string filename, IntRect &area ) : IntPtr
sfTexture_createFromImage ( IntPtr image, IntRect &area ) : IntPtr
sfTexture_createFromMemory ( IntPtr data, ulong size, IntRect &area ) : IntPtr
sfTexture_createFromStream ( IntPtr stream, IntRect &area ) : IntPtr
sfTexture_destroy ( IntPtr texture ) : void
sfTexture_generateMipmap ( IntPtr texture ) : bool
sfTexture_getMaximumSize ( ) : uint
sfTexture_getNativeHandle ( IntPtr shader ) : uint
sfTexture_getSize ( IntPtr texture ) : Vector2u
sfTexture_getTexCoords ( IntPtr texture, IntRect rectangle ) : FloatRect
sfTexture_isRepeated ( IntPtr texture ) : bool
sfTexture_isSmooth ( IntPtr texture ) : bool
sfTexture_isSrgb ( IntPtr texture ) : bool
sfTexture_setRepeated ( IntPtr texture, bool repeated ) : void
sfTexture_setSmooth ( IntPtr texture, bool smooth ) : void
sfTexture_setSrgb ( IntPtr texture, bool sRgb ) : void
sfTexture_updateFromImage ( IntPtr texture, IntPtr image, uint x, uint y ) : void
sfTexture_updateFromPixels ( IntPtr texture, byte pixels, uint width, uint height, uint x, uint y ) : void
sfTexture_updateFromRenderWindow ( IntPtr texture, IntPtr renderWindow, uint x, uint y ) : void
sfTexture_updateFromWindow ( IntPtr texture, IntPtr window, uint x, uint y ) : void

Method Details

Bind() public static méthode

Bind a texture for rendering
public static Bind ( Texture texture ) : void
texture Texture Shader to bind (can be null to use no texture)
Résultat void

CopyToImage() public méthode

Copy a texture's pixels to an image
public CopyToImage ( ) : Image
Résultat Image

Destroy() protected méthode

Handle the destruction of the object
protected Destroy ( bool disposing ) : void
disposing bool Is the GC disposing the object, or is it an explicit call ?
Résultat void

GenerateMipmap() public méthode

Generate a mipmap using the current texture data

Mipmaps are pre-computed chains of optimized textures. Each level of texture in a mipmap is generated by halving each of the previous level's dimensions. This is done until the final level has the size of 1x1. The textures generated in this process may make use of more advanced filters which might improve the visual quality of textures when they are applied to objects much smaller than they are. This is known as minification. Because fewer texels (texture elements) have to be sampled from when heavily minified, usage of mipmaps can also improve rendering performance in certain scenarios.

Mipmap generation relies on the necessary OpenGL extension being available. If it is unavailable or generation fails due to another reason, this function will return false. Mipmap data is only valid from the time it is generated until the next time the base level image is modified, at which point this function will have to be called again to regenerate it.

public GenerateMipmap ( ) : bool
Résultat bool

Texture() public méthode

Construct the texture from an image
public Texture ( Image image ) : System
image Image Image to load to the texture
Résultat System

Texture() public méthode

Construct the texture from an image
public Texture ( Image image, IntRect area ) : System
image Image Image to load to the texture
area IntRect Area of the image to load
Résultat System

Texture() public méthode

Construct the texture from a file in a stream
public Texture ( Stream stream ) : System
stream Stream Stream containing the file contents
Résultat System

Texture() public méthode

Construct the texture from a file in a stream
public Texture ( Stream stream, IntRect area ) : System
stream Stream Stream containing the file contents
area IntRect Area of the image to load
Résultat System

Texture() public méthode

Construct the texture from another texture
public Texture ( Texture copy ) : System
copy Texture Texture to copy
Résultat System

Texture() public méthode

Construct the texture from a file in memory
public Texture ( byte bytes ) : System
bytes byte Byte array containing the file contents
Résultat System

Texture() public méthode

Construct the texture from a file
public Texture ( string filename ) : System
filename string Path of the image file to load
Résultat System

Texture() public méthode

Construct the texture from a file
public Texture ( string filename, IntRect area ) : System
filename string Path of the image file to load
area IntRect Area of the image to load
Résultat System

Texture() public méthode

Construct the texture
public Texture ( uint width, uint height ) : System
width uint Texture width
height uint Texture height
Résultat System

ToString() public méthode

Provide a string describing the object
public ToString ( ) : string
Résultat string

Update() public méthode

Update a texture from an image
public Update ( Image image ) : void
image Image Image to copy to the texture
Résultat void

Update() public méthode

Update a texture from an image
public Update ( Image image, uint x, uint y ) : void
image Image Image to copy to the texture
x uint X offset in the texture where to copy the source pixels
y uint Y offset in the texture where to copy the source pixels
Résultat void

Update() public méthode

Update a texture from the contents of a render-window
public Update ( RenderWindow window ) : void
window RenderWindow Render-window to copy to the texture
Résultat void

Update() public méthode

Update a texture from the contents of a render-window
public Update ( RenderWindow window, uint x, uint y ) : void
window RenderWindow Render-window to copy to the texture
x uint X offset in the texture where to copy the source pixels
y uint Y offset in the texture where to copy the source pixels
Résultat void

Update() public méthode

Update a texture from the contents of a window
public Update ( SFML window ) : void
window SFML Window to copy to the texture
Résultat void

Update() public méthode

Update a texture from the contents of a window
public Update ( SFML window, uint x, uint y ) : void
window SFML Window to copy to the texture
x uint X offset in the texture where to copy the source pixels
y uint Y offset in the texture where to copy the source pixels
Résultat void

Update() public méthode

Update a texture from an array of pixels
public Update ( byte pixels ) : void
pixels byte Array of pixels to copy to the texture
Résultat void

Update() public méthode

Update a texture from an array of pixels
public Update ( byte pixels, uint width, uint height, uint x, uint y ) : void
pixels byte Array of pixels to copy to the texture
width uint Width of the pixel region contained in pixels
height uint Height of the pixel region contained in pixels
x uint X offset in the texture where to copy the source pixels
y uint Y offset in the texture where to copy the source pixels
Résultat void