libSDL2pp
C++ bindings/wrapper for SDL2
Loading...
Searching...
No Matches
Public Member Functions | Friends | List of all members
SDL2pp::Surface::LockHandle Class Reference

SDL2pp::Surface lock. More...

#include <SDL2pp/Surface.hh>

Public Member Functions

 LockHandle ()
 Create no-op lock.
 
 ~LockHandle ()
 Destructor.
 
 LockHandle (LockHandle &&other) noexcept
 Move constructor.
 
LockHandleoperator= (LockHandle &&other) noexcept
 Move assignment operator.
 
 LockHandle (const LockHandle &other)=delete
 Deleted copy constructor.
 
LockHandleoperator= (const LockHandle &other)=delete
 Deleted assignment operator.
 
void * GetPixels () const
 Get pointer to raw pixel data of locked region.
 
int GetPitch () const
 Get pitch of locked pixel data.
 
const SDL_PixelFormat & GetFormat () const
 Get pixel format of the surface.
 

Friends

class Surface
 

Detailed Description

SDL2pp::Surface lock.

For direct pixel access, SDL surface may need to be locked. This class represents the lock and controls its lifetime as the lock is released as soon as LockHandle is destroyed.

Constructor & Destructor Documentation

◆ LockHandle() [1/3]

SDL2pp::Surface::LockHandle::LockHandle ( )

Create no-op lock.

This may be initialized with real lock later via move assignment

◆ ~LockHandle()

SDL2pp::Surface::LockHandle::~LockHandle ( )

Destructor.

Releases the lock

See also
http://wiki.libsdl.org/SDL_UnlockSurface

◆ LockHandle() [2/3]

SDL2pp::Surface::LockHandle::LockHandle ( Surface::LockHandle &&  other)
noexcept

Move constructor.

Parameters
[in]otherSDL2pp::Surface::LockHandle to move data from

◆ LockHandle() [3/3]

SDL2pp::Surface::LockHandle::LockHandle ( const LockHandle other)
delete

Deleted copy constructor.

This class is not copyable

Member Function Documentation

◆ GetFormat()

const SDL_PixelFormat & SDL2pp::Surface::LockHandle::GetFormat ( ) const

Get pixel format of the surface.

Returns
Format of the pixels stored in the surface

◆ GetPitch()

int SDL2pp::Surface::LockHandle::GetPitch ( ) const

Get pitch of locked pixel data.

Returns
Number of bytes in a row of pixel data, including padding between lines

◆ GetPixels()

void * SDL2pp::Surface::LockHandle::GetPixels ( ) const

Get pointer to raw pixel data of locked region.

Returns
Pointer to raw pixel data of locked region

◆ operator=() [1/2]

LockHandle & SDL2pp::Surface::LockHandle::operator= ( const LockHandle other)
delete

Deleted assignment operator.

This class is not copyable

◆ operator=() [2/2]

Surface::LockHandle & SDL2pp::Surface::LockHandle::operator= ( Surface::LockHandle &&  other)
noexcept

Move assignment operator.

Parameters
[in]otherSDL2pp::Surface::LockHandle to move data from
Returns
Reference to self

The documentation for this class was generated from the following files: