34 SDL_FreeSurface(
surf);
40 if(
surf &&
surf->format->format != SDL_PIXELFORMAT_ARGB8888) {
57 throw std::invalid_argument(
"Creating surface with negative dimensions");
60 surface_ = SDL_CreateRGBSurfaceWithFormat(0,
w,
h, 32, SDL_PIXELFORMAT_ARGB8888);
70 : surface_(std::exchange(
s.surface_,
nullptr))
93 surface_ = std::exchange(
s.surface_,
nullptr);
100 return surface(SDL_ConvertSurfaceFormat(
surface_, SDL_PIXELFORMAT_ARGB8888, 0));
111 stream <<
"<null surface>";
112 }
else if(!
surf->format) {
113 stream <<
"<invalid surface>";
115 stream <<
"{ " <<
surf->w <<
'x' <<
surf->h <<
'@'
116 << unsigned(
surf->format->BitsPerPixel) <<
"bpp"
117 << (
surf->format->palette ?
" indexed" :
"")
118 <<
" clip_rect=[" <<
surf->clip_rect
119 <<
"] refcount=" <<
surf->refcount
surface clone() const
Creates a new, duplicate surface in memory using the 'neutral' pixel format.
SDL_Surface * get() const
std::size_t area() const
Total area of the surface in square pixels.
surface & operator=(const surface &s)
Contains the SDL_Rect helper code.
std::ostream & operator<<(std::ostream &stream, const surface &surf)
static map_location::direction s