Learn
Download
Community
Development
Home
»
Learn
»
2.3.1 Documentation
»
Texture.hpp Source File
Français
Donate
Documentation of SFML 2.3.1
Warning:
this page refers to an old version of SFML. Click here to switch to the latest version.
Main Page
Related Pages
Modules
Classes
Files
File List
SFML
include
SFML
Graphics
Texture.hpp
1
//
3
// SFML - Simple and Fast Multimedia Library
4
// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
5
//
6
// This software is provided 'as-is', without any express or implied warranty.
7
// In no event will the authors be held liable for any damages arising from the use of this software.
8
//
9
// Permission is granted to anyone to use this software for any purpose,
10
// including commercial applications, and to alter it and redistribute it freely,
11
// subject to the following restrictions:
12
//
13
// 1. The origin of this software must not be misrepresented;
14
// you must not claim that you wrote the original software.
15
// If you use this software in a product, an acknowledgment
16
// in the product documentation would be appreciated but is not required.
17
//
18
// 2. Altered source versions must be plainly marked as such,
19
// and must not be misrepresented as being the original software.
20
//
21
// 3. This notice may not be removed or altered from any source distribution.
22
//
24
25
#ifndef SFML_TEXTURE_HPP
26
#define SFML_TEXTURE_HPP
27
29
// Headers
31
#include <SFML/Graphics/Export.hpp>
32
#include <SFML/Graphics/Image.hpp>
33
#include <SFML/Window/GlResource.hpp>
34
35
36
namespace
sf
37
{
38
class
Window;
39
class
RenderTarget;
40
class
RenderTexture;
41
class
InputStream;
42
47
class
SFML_GRAPHICS_API
Texture
:
GlResource
48
{
49
public
:
50
55
enum
CoordinateType
56
{
57
Normalized
,
58
Pixels
59
};
60
61
public
:
62
69
Texture
();
70
77
Texture
(
const
Texture
& copy);
78
83
~
Texture
();
84
96
bool
create(
unsigned
int
width,
unsigned
int
height);
97
127
bool
loadFromFile(
const
std::string& filename,
const
IntRect
& area =
IntRect
());
128
159
bool
loadFromMemory(
const
void
* data, std::size_t size,
const
IntRect
& area =
IntRect
());
160
190
bool
loadFromStream(
InputStream
& stream,
const
IntRect
& area =
IntRect
());
191
214
bool
loadFromImage(
const
Image
& image,
const
IntRect
& area =
IntRect
());
215
222
Vector2u
getSize()
const
;
223
237
Image
copyToImage()
const
;
238
255
void
update(
const
Uint8* pixels);
256
277
void
update(
const
Uint8* pixels,
unsigned
int
width,
unsigned
int
height,
unsigned
int
x,
unsigned
int
y);
278
297
void
update(
const
Image
& image);
298
314
void
update(
const
Image
& image,
unsigned
int
x,
unsigned
int
y);
315
334
void
update(
const
Window
& window);
335
351
void
update(
const
Window
& window,
unsigned
int
x,
unsigned
int
y);
352
367
void
setSmooth(
bool
smooth);
368
377
bool
isSmooth()
const
;
378
401
void
setRepeated(
bool
repeated);
402
411
bool
isRepeated()
const
;
412
421
Texture
& operator =(
const
Texture
& right);
422
433
unsigned
int
getNativeHandle()
const
;
434
466
static
void
bind(
const
Texture
* texture, CoordinateType coordinateType = Normalized);
467
481
static
unsigned
int
getMaximumSize();
482
483
private
:
484
485
friend
class
RenderTexture
;
486
friend
class
RenderTarget
;
487
501
static
unsigned
int
getValidSize(
unsigned
int
size);
502
504
// Member data
506
Vector2u
m_size;
507
Vector2u
m_actualSize;
508
unsigned
int
m_texture;
509
bool
m_isSmooth;
510
bool
m_isRepeated;
511
mutable
bool
m_pixelsFlipped;
512
Uint64 m_cacheId;
513
};
514
515
}
// namespace sf
516
517
518
#endif // SFML_TEXTURE_HPP
519
sf::InputStream
Abstract class for custom file input streams.
Definition:
InputStream.hpp:41
sf
Definition:
AlResource.hpp:34
sf::GlResource
Base class for classes that require an OpenGL context.
Definition:
GlResource.hpp:40
sf::RenderTexture
Target for off-screen 2D rendering into a texture.
Definition:
RenderTexture.hpp:47
sf::Rect< int >
sf::Texture
Image living on the graphics card that can be used for drawing.
Definition:
Texture.hpp:47
sf::Window
Window that serves as a target for OpenGL rendering.
Definition:
Window/Window.hpp:57
sf::Texture::CoordinateType
CoordinateType
Types of texture coordinates that can be used for rendering.
Definition:
Texture.hpp:55
sf::RenderTarget
Base class for all render targets (window, texture, ...)
Definition:
RenderTarget.hpp:51
sf::Vector2< unsigned int >
sf::Image
Class for loading, manipulating and saving images.
Definition:
Image.hpp:46
sf::Texture::Normalized
Texture coordinates in range [0 .. 1].
Definition:
Texture.hpp:57