cpp-sdl2
C++ header-only SDL2 wrapper
sdl::Surface::Lock Class Reference

Represent a lock to safely access surface content. More...

#include <surface.hpp>

Public Member Functions

Pixel at (Vec2i const &pos) const
 Get pixel at given coordinates inside surface. More...
 
Pixel at (size_t x, size_t y) const
 Get pixel at specified location inside surface. More...
 
Pixel operator[] (Vec2i const &pos) const
 Get pixel at specified location via operator[]. More...
 
void * raw_array () const
 Get access to the raw array of pixels. More...
 
 ~Lock ()
 Free the lock. More...
 

Private Member Functions

constexpr Lock (SDL_Surface &surface_)
 Private constructor for lock object. More...
 

Private Attributes

SDL_Surface * surface_
 Raw pointer to the surface. More...
 

Friends

class Surface
 

Detailed Description

Represent a lock to safely access surface content.

Definition at line 25 of file surface.hpp.

Constructor & Destructor Documentation

◆ ~Lock()

sdl::Surface::Lock::~Lock ( )
inline

Free the lock.

Definition at line 48 of file surface.hpp.

References surface_.

◆ Lock()

constexpr sdl::Surface::Lock::Lock ( SDL_Surface &  surface_)
inlineprivate

Private constructor for lock object.

Definition at line 52 of file surface.hpp.

Member Function Documentation

◆ at() [1/2]

Pixel sdl::Surface::Lock::at ( Vec2i const &  pos) const
inline

Get pixel at given coordinates inside surface.

Definition at line 31 of file surface.hpp.

References at().

Referenced by at(), and operator[]().

◆ at() [2/2]

Pixel sdl::Surface::Lock::at ( size_t  x,
size_t  y 
) const
inline

Get pixel at specified location inside surface.

Definition at line 33 of file surface.hpp.

References surface_.

◆ operator[]()

Pixel sdl::Surface::Lock::operator[] ( Vec2i const &  pos) const
inline

Get pixel at specified location via operator[].

Definition at line 42 of file surface.hpp.

References at().

◆ raw_array()

void* sdl::Surface::Lock::raw_array ( ) const
inline

Get access to the raw array of pixels.

Definition at line 45 of file surface.hpp.

References surface_.

Friends And Related Function Documentation

◆ Surface

friend class Surface
friend

Definition at line 27 of file surface.hpp.

Referenced by sdl::Surface::Surface().

Member Data Documentation

◆ surface_


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