1.11
Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
Surface Class Reference

#include <surface.h>

Public Types

using ReleaseFunction = std::function< void(void *)>
 

Public Member Functions

 Surface (const detail::FrameBuffer &fb)
 
 Surface (const Size &size={}, PixelFormat format=PixelFormat::argb8888)
 
 Surface (const Surface &)=delete
 
 Surface (Surface &&rhs)
 
 Surface (void *data, const ReleaseFunction &release, const Size &size, PixelFormat format, DefaultDim stride)
 
 ~Surface ()
 
EGT_NODISCARD Color color_at (const Point &point) const
 
void color_at (const Point &point, const Color &color)
 
void * data ()
 
const void * data () const
 
bool empty () const
 
void flood (const Point &point, const Color &color)
 
void flush (bool claimed_by_cpu=false) const
 
PixelFormat format () const
 
DefaultDim height () const
 
EGT_NODISCARD const detail::InternalSurface & impl () const
 
void mark_dirty ()
 
 operator bool () const noexcept
 
Surfaceoperator= (const Surface &)=delete
 
Surfaceoperator= (Surface &&rhs)
 
const Sizesize () const
 
DefaultDim stride () const
 
void sync_for_cpu () const
 Claim the surface for being used by the CPU.
 
DefaultDim width () const
 
void write_to_png (const std::string &name) const
 
void zero ()
 

Static Public Member Functions

static DefaultDim stride (PixelFormat format, DefaultDim width)
 

Protected Attributes

void * m_data {nullptr}
 
PixelFormat m_format {PixelFormat::invalid}
 
std::unique_ptr< detail::InternalSurface > m_impl
 
ReleaseFunction m_release
 
Size m_size
 
DefaultDim m_stride {0}
 

Member Typedef Documentation

◆ ReleaseFunction

using ReleaseFunction = std::function<void(void*)>

Constructor & Destructor Documentation

◆ Surface() [1/5]

Surface ( const Size size = {},
PixelFormat  format = PixelFormat::argb8888 
)

◆ Surface() [2/5]

Surface ( void *  data,
const ReleaseFunction release,
const Size size,
PixelFormat  format,
DefaultDim  stride 
)

◆ Surface() [3/5]

Surface ( const detail::FrameBuffer &  fb)

◆ ~Surface()

~Surface ( )

◆ Surface() [4/5]

Surface ( const Surface )
delete

◆ Surface() [5/5]

Surface ( Surface &&  rhs)

Member Function Documentation

◆ color_at() [1/2]

EGT_NODISCARD Color color_at ( const Point point) const

◆ color_at() [2/2]

void color_at ( const Point point,
const Color color 
)

◆ data() [1/2]

void * data ( )
inline

◆ data() [2/2]

const void * data ( ) const
inline

◆ empty()

bool empty ( ) const
inline

◆ flood()

void flood ( const Point point,
const Color color 
)

◆ flush()

void flush ( bool  claimed_by_cpu = false) const

◆ format()

PixelFormat format ( ) const
inline

◆ height()

DefaultDim height ( ) const
inline

◆ impl()

EGT_NODISCARD const detail::InternalSurface & impl ( ) const
inline

◆ mark_dirty()

void mark_dirty ( )

◆ operator bool()

operator bool ( ) const
inlineexplicitnoexcept

◆ operator=() [1/2]

Surface & operator= ( const Surface )
delete

◆ operator=() [2/2]

Surface & operator= ( Surface &&  rhs)

◆ size()

const Size & size ( ) const
inline

◆ stride() [1/2]

DefaultDim stride ( ) const
inline

◆ stride() [2/2]

static DefaultDim stride ( PixelFormat  format,
DefaultDim  width 
)
static

◆ sync_for_cpu()

void sync_for_cpu ( ) const

Claim the surface for being used by the CPU.

Wait for all GPU operations, if any, to complete.

◆ width()

DefaultDim width ( ) const
inline

◆ write_to_png()

void write_to_png ( const std::string &  name) const

◆ zero()

void zero ( )

Member Data Documentation

◆ m_data

void* m_data {nullptr}
protected

◆ m_format

PixelFormat m_format {PixelFormat::invalid}
protected

◆ m_impl

std::unique_ptr<detail::InternalSurface> m_impl
protected

◆ m_release

ReleaseFunction m_release
protected

◆ m_size

Size m_size
protected

◆ m_stride

DefaultDim m_stride {0}
protected