Locks a Texture for access to its pixels.
|
constexpr | TextureLock ()=default |
| Creates an empty lock.
|
|
constexpr | TextureLock (TextureLock &&other) |
| Move constructor.
|
|
| TextureLock (TextureRef texture, OptionalRef< const SDL_Rect > rect) |
| Lock a portion of the texture for write-only pixel access.
|
|
| ~TextureLock () |
| Destructor.
|
|
void | Unlock () |
| Unlock a texture, uploading the changes to video memory, if needed.
|
|
void | reset () |
| Same as Unlock(), just for uniformity.
|
|
constexpr | LockBase ()=default |
| Default ctor.
|
|
| LockBase (const LockBase &other)=delete |
|
| LockBase (LockBase &&other) |
| Move ctor.
|
|
constexpr | ~LockBase () |
| Dtor.
|
|
LockBase & | operator= (LockBase other) |
| Move assignment.
|
|
RESOURCE | release () |
| Returns reference and reset this.
|
|
constexpr | operator bool () const |
| Check if not null.
|
|
constexpr bool | operator== (const ResourcePtrBase &other) const |
| Comparison.
|
|
constexpr bool | operator== (std::nullptr_t) const |
| Comparison.
|
|
constexpr bool | operator== (std::nullopt_t) const |
| Comparison.
|
|
constexpr reference | operator* () const |
| Gets reference.
|
|
constexpr const reference * | operator-> () const |
| Gets addressable reference.
|
|
constexpr reference * | operator-> () |
| Gets addressable reference.
|
|
reference | get () const |
| Get reference.
|
|
|
using | deleter = DELETER |
| The deleter type.
|
|
using | reference = RESOURCE |
| The reference resource type.
|
|
using | value_type = typename reference::value_type |
| The raw resource type.
|
|
constexpr | LockBase (SurfaceRef &&resource) |
| Constructs initializing member.
|
|
constexpr | ResourceOwnerBase (base::value_type value={}, DELETER deleter={}) |
| Constructs from raw type.
|
|
void | free () |
| Frees resource.
|
|
constexpr | ResourcePtrBase (value_type value={}) |
| Constructs from raw type.
|
|
reference & | get () |
| Get reference.
|
|
◆ TextureLock()
As an optimization, the pixels made available for editing don't necessarily contain the old texture data. This is a write-only operation, and if you need to keep a copy of the texture data you should do that at the application level.
You must use TextureLock.Unlock() to unlock the pixels and apply any changes.
- Parameters
-
texture | the texture to lock for access, which was created with TEXTUREACCESS_STREAMING . |
rect | an Rect structure representing the area to lock for access; nullptr to lock the entire texture. |
- Exceptions
-
- Thread safety:
- This function should only be called on the main thread.
- Since
- This function is available since SDL 3.2.0.
- See also
- TextureLock.Unlock
◆ ~TextureLock()
SDL::TextureLock::~TextureLock |
( |
| ) |
|
|
inline |
◆ Unlock()
void SDL::TextureLock::Unlock |
( |
| ) |
|
|
inline |
Warning: Please note that TextureRef.Lock() is intended to be write-only; it will not guarantee the previous contents of the texture will be provided. You must fully initialize any area of a texture that you lock before unlocking it, as the pixels might otherwise be uninitialized memory.
Which is to say: locking and immediately unlocking a texture can result in corrupted textures, depending on the renderer in use.
- Thread safety:
- This function should only be called on the main thread.
- Since
- This function is available since SDL 3.2.0.
- See also
- TextureRef.Lock
The documentation for this class was generated from the following file: