SDL3pp
A slim C++ wrapper for SDL3
Loading...
Searching...
No Matches
SDL3pp_surface.h
1#ifndef SDL3PP_SURFACE_H_
2#define SDL3PP_SURFACE_H_
3
4#include <SDL3/SDL_surface.h>
5#include "SDL3pp_blendmode.h"
6#include "SDL3pp_error.h"
7#include "SDL3pp_iostream.h"
8#include "SDL3pp_optionalRef.h"
9#include "SDL3pp_pixels.h"
10#include "SDL3pp_properties.h"
11#include "SDL3pp_rect.h"
12#include "SDL3pp_spanRef.h"
13#include "SDL3pp_strings.h"
14#include "SDL3pp_version.h"
15
16namespace SDL {
17
42// Forward decl
43struct Surface;
44
46using SurfaceRaw = SDL_Surface*;
47
48// Forward decl
49struct SurfaceRef;
50
53{
55
58 : value(value)
59 {
60 }
61
63 constexpr SurfaceParam(std::nullptr_t = nullptr)
64 : value(nullptr)
65 {
66 }
67
69 constexpr explicit operator bool() const { return !!value; }
70
72 constexpr auto operator<=>(const SurfaceParam& other) const = default;
73
75 constexpr operator SurfaceRaw() const { return value; }
76
78 constexpr auto operator->() { return value; }
79};
80
83{
85
88 : value(value)
89 {
90 }
91
95 {
96 }
97
99 constexpr SurfaceConstParam(std::nullptr_t = nullptr)
100 : value(nullptr)
101 {
102 }
103
105 constexpr explicit operator bool() const { return !!value; }
106
108 constexpr auto operator<=>(const SurfaceConstParam& other) const = default;
109
111 constexpr operator const SurfaceRaw() const { return value; }
112
114 constexpr auto operator->() { return value; }
115};
116
117// Forward decl
118struct SurfaceLock;
119
128
130 SDL_SURFACE_PREALLOCATED;
131
133 SDL_SURFACE_LOCK_NEEDED;
134
136 SDL_SURFACE_LOCKED;
137
139constexpr SurfaceFlags SURFACE_SIMD_ALIGNED = SDL_SURFACE_SIMD_ALIGNED;
140
146constexpr bool MustLock(SurfaceConstParam S) { return SDL_MUSTLOCK((S.value)); }
147
153using ScaleMode = SDL_ScaleMode;
154
155#if SDL_VERSION_ATLEAST(3, 2, 10)
156
157constexpr ScaleMode SCALEMODE_INVALID = SDL_SCALEMODE_INVALID;
158
159#endif // SDL_VERSION_ATLEAST(3, 2, 10)
160
162 SDL_SCALEMODE_NEAREST;
163
165 SDL_SCALEMODE_LINEAR;
166
167#if SDL_VERSION_ATLEAST(3, 4, 0)
168
173constexpr ScaleMode SCALEMODE_PIXELART = SDL_SCALEMODE_PIXELART;
174
175#endif // SDL_VERSION_ATLEAST(3, 4, 0)
176
182using FlipMode = SDL_FlipMode;
183
184constexpr FlipMode FLIP_NONE = SDL_FLIP_NONE;
185
186constexpr FlipMode FLIP_HORIZONTAL = SDL_FLIP_HORIZONTAL;
187
188constexpr FlipMode FLIP_VERTICAL = SDL_FLIP_VERTICAL;
189
190#if SDL_VERSION_ATLEAST(3, 4, 0)
191
194 SDL_FLIP_HORIZONTAL_AND_VERTICAL;
195
196#endif // SDL_VERSION_ATLEAST(3, 4, 0)
197
227{
228 SurfaceRaw m_resource = nullptr;
229
230public:
232 constexpr Surface(std::nullptr_t = nullptr) noexcept
233 : m_resource(0)
234 {
235 }
236
244 constexpr explicit Surface(const SurfaceRaw resource) noexcept
245 : m_resource(resource)
246 {
247 }
248
250 constexpr Surface(const Surface& other)
251 : m_resource(other.m_resource)
252 {
253 if (m_resource) ++m_resource->refcount;
254 }
255
257 constexpr Surface(Surface&& other) noexcept
258 : Surface(other.release())
259 {
260 }
261
278 Surface(const PointRaw& size, PixelFormat format)
279 : m_resource(CheckError(SDL_CreateSurface(size.x, size.y, format)))
280 {
281 }
282
309 Surface(const PointRaw& size, PixelFormat format, void* pixels, int pitch)
310 : m_resource(CheckError(
311 SDL_CreateSurfaceFrom(size.x, size.y, format, pixels, pitch)))
312 {
313 }
314
351 Surface(StringParam file);
352
400 Surface(IOStreamParam src, bool closeio = false);
401
409 static constexpr Surface Borrow(SurfaceParam resource)
410 {
411 if (resource) {
412 ++resource.value->refcount;
413 return Surface(resource.value);
414 }
415 return {};
416 }
417
438 static Surface LoadBMP(IOStreamParam src, bool closeio = false);
439
458 static Surface LoadBMP(StringParam file);
459
460#if SDL_VERSION_ATLEAST(3, 4, 0)
461
483 static Surface LoadPNG(IOStreamParam src, bool closeio = false);
484
507 static Surface LoadPNG(StringParam file);
508
509#endif // SDL_VERSION_ATLEAST(3, 4, 0)
510
512 constexpr const SurfaceRaw operator->() const noexcept { return m_resource; }
513
515 constexpr SurfaceRaw operator->() noexcept { return m_resource; }
516
518 ~Surface() { SDL_DestroySurface(m_resource); }
519
521 constexpr Surface& operator=(Surface&& other) noexcept
522 {
523 std::swap(m_resource, other.m_resource);
524 return *this;
525 }
526
528 constexpr Surface& operator=(const Surface& other) noexcept = default;
529
531 constexpr SurfaceRaw get() const noexcept { return m_resource; }
532
534 constexpr SurfaceRaw release() noexcept
535 {
536 auto r = m_resource;
537 m_resource = nullptr;
538 return r;
539 }
540
542 constexpr auto operator<=>(const Surface& other) const noexcept = default;
543
545 constexpr explicit operator bool() const noexcept { return !!m_resource; }
546
548 constexpr operator SurfaceParam() const noexcept { return {m_resource}; }
549
562 void Destroy();
563
569 constexpr bool MustLock() const { return SDL::MustLock(m_resource); }
570
609
626 void SetColorspace(Colorspace colorspace);
627
646
675
695 void SetPalette(PaletteParam palette);
696
709 Palette GetPalette() const;
710
735
749 bool HasAlternateImages() const;
750
770
787
813
825 void Unlock(SurfaceLock&& lock);
826
849 void SaveBMP(IOStreamParam dst, bool closeio = false) const;
850
871 void SaveBMP(StringParam file) const;
872
873#if SDL_VERSION_ATLEAST(3, 4, 0)
874
891 void SavePNG(IOStreamParam dst, bool closeio = false) const;
892
907 void SavePNG(StringParam file) const;
908
909#endif // SDL_VERSION_ATLEAST(3, 4, 0)
910
929 void SetRLE(bool enabled);
930
944 bool HasRLE() const;
945
967 void SetColorKey(std::optional<Uint32> key);
968
978 void ClearColorKey();
979
992 bool HasColorKey() const;
993
1012 std::optional<Uint32> GetColorKey() const;
1013
1036 void SetColorMod(Uint8 r, Uint8 g, Uint8 b);
1037
1054 void GetColorMod(Uint8* r, Uint8* g, Uint8* b) const;
1055
1075 void SetAlphaMod(Uint8 alpha);
1076
1089 Uint8 GetAlphaMod() const;
1090
1105 void SetMod(Color color);
1106
1114 Color GetMod() const;
1115
1133 void SetBlendMode(BlendMode blendMode);
1134
1147 BlendMode GetBlendMode() const;
1148
1172
1178 void ResetClipRect();
1179
1197 Rect GetClipRect() const;
1198
1210 void Flip(FlipMode flip);
1211
1212#if SDL_VERSION_ATLEAST(3, 4, 0)
1213
1240 Surface Rotate(float angle);
1241
1242#endif // SDL_VERSION_ATLEAST(3, 4, 0)
1243
1260 Surface Duplicate() const;
1261
1278 Surface Scale(const PointRaw& size, ScaleMode scaleMode) const;
1279
1306 Surface Convert(PixelFormat format) const;
1307
1336 PaletteParam palette,
1337 Colorspace colorspace,
1338 PropertiesParam props) const;
1339
1354 void PremultiplyAlpha(bool linear);
1355
1372 void Clear(const FColorRaw& c);
1373
1398 void FillRect(OptionalRef<const RectRaw> rect, Uint32 color);
1399
1410 void Fill(Uint32 color);
1411
1435 void FillRects(SpanRef<const RectRaw> rects, Uint32 color);
1436
1506 void Blit(SurfaceParam src,
1509
1580 void BlitAt(SurfaceParam src,
1582 const PointRaw& dstpos);
1583
1604 void BlitUnchecked(SurfaceParam src,
1605 const RectRaw& srcrect,
1606 const RectRaw& dstrect);
1607
1628 void BlitScaled(SurfaceParam src,
1631 ScaleMode scaleMode);
1632
1655 const RectRaw& srcrect,
1656 const RectRaw& dstrect,
1657 ScaleMode scaleMode);
1658
1659#if SDL_VERSION_ATLEAST(3, 4, 0)
1660
1680 void Stretch(SurfaceParam src,
1681 OptionalRef<RectRaw> srcrect,
1682 OptionalRef<RectRaw> dstrect,
1683 ScaleMode scaleMode);
1684
1685#endif // SDL_VERSION_ATLEAST(3, 4, 0)
1686
1708 void BlitTiled(SurfaceParam src,
1711
1739 float scale,
1740 ScaleMode scaleMode,
1742
1775 void Blit9Grid(SurfaceParam src,
1777 int left_width,
1778 int right_width,
1779 int top_height,
1780 int bottom_height,
1782 float scale = 1,
1783 ScaleMode scaleMode = SCALEMODE_NEAREST);
1784
1815 Uint32 MapRGB(Uint8 r, Uint8 g, Uint8 b) const;
1816
1845 Uint32 MapRGBA(ColorRaw c) const;
1846
1872 void ReadPixel(const PointRaw& p,
1873 Uint8* r,
1874 Uint8* g,
1875 Uint8* b,
1876 Uint8* a) const;
1877
1893 Color ReadPixel(const PointRaw& p) const;
1894
1917 void ReadPixelFloat(const PointRaw& p,
1918 float* r,
1919 float* g,
1920 float* b,
1921 float* a) const;
1922
1938 FColor ReadPixelFloat(const PointRaw& p) const;
1939
1958 void WritePixel(const PointRaw& p, ColorRaw c);
1959
1975 void WritePixelFloat(const PointRaw& p, const FColorRaw& c);
1976
1978 constexpr int GetWidth() const;
1979
1981 constexpr int GetHeight() const;
1982
1984 constexpr Point GetSize() const;
1985
1987 constexpr int GetPitch() const;
1988
1990 constexpr PixelFormat GetFormat() const;
1991
1993 constexpr void* GetPixels() const;
1994};
1995
1998{
1999 using Surface::Surface;
2000
2008 SurfaceRef(SurfaceRaw resource) noexcept
2009 : Surface(Borrow(resource))
2010 {
2011 }
2012
2014 SurfaceRef(Surface resource) noexcept
2015 : Surface(std::move(resource))
2016 {
2017 }
2018};
2019
2038{
2039 SurfaceRef m_lock;
2040
2041public:
2067 SurfaceLock(SurfaceRef resource);
2068
2070 SurfaceLock(const SurfaceLock& other) = delete;
2071
2073 constexpr SurfaceLock(SurfaceLock&& other) noexcept
2074 : m_lock(other.m_lock)
2075 {
2076 other.m_lock = {};
2077 }
2078
2091
2092 SurfaceLock& operator=(const SurfaceLock& other) = delete;
2093
2096 {
2097 std::swap(m_lock, other.m_lock);
2098 return *this;
2099 }
2100
2102 constexpr operator bool() const { return bool(m_lock); }
2103
2129 void ReadPixel(const PointRaw& p,
2130 Uint8* r,
2131 Uint8* g,
2132 Uint8* b,
2133 Uint8* a) const
2134 {
2135 m_lock.ReadPixel(p, r, g, b, a);
2136 }
2137
2156 Color ReadPixel(const PointRaw& p) const { return m_lock.ReadPixel(p); }
2157
2181 float* r,
2182 float* g,
2183 float* b,
2184 float* a) const
2185 {
2186 m_lock.ReadPixelFloat(p, r, g, b, a);
2187 }
2188
2205 {
2206 return m_lock.ReadPixelFloat(p);
2207 }
2208
2227 void WritePixel(const PointRaw& p, ColorRaw c) { m_lock.WritePixel(p, c); }
2228
2244 void WritePixelFloat(const PointRaw& p, const FColorRaw& c)
2245 {
2246 m_lock.WritePixelFloat(p, c);
2247 }
2248
2250 constexpr int GetWidth() const { return m_lock.GetWidth(); }
2251
2253 constexpr int GetHeight() const { return m_lock.GetHeight(); }
2254
2256 constexpr Point GetSize() const { return m_lock.GetSize(); }
2257
2259 constexpr int GetPitch() const { return m_lock.GetPitch(); }
2260
2262 constexpr PixelFormat GetFormat() const { return m_lock.GetFormat(); }
2263
2265 constexpr void* GetPixels() const { return m_lock.GetPixels(); }
2266
2278 void reset();
2279
2281 SurfaceRef get() { return m_lock; }
2282
2284 void release() { m_lock.release(); }
2285};
2286
2304inline Surface CreateSurface(const PointRaw& size, PixelFormat format)
2305{
2306 return Surface(size, format);
2307}
2308
2336 PixelFormat format,
2337 void* pixels,
2338 int pitch)
2339{
2340 return Surface(size, format, pixels, pitch);
2341}
2342
2357inline void DestroySurface(SurfaceRaw surface) { SDL_DestroySurface(surface); }
2358
2360
2399{
2400 return {CheckError(SDL_GetSurfaceProperties(surface))};
2401}
2402
2404{
2405 return SDL::GetSurfaceProperties(m_resource);
2406}
2407
2408namespace prop::Surface {
2409
2410constexpr auto SDR_WHITE_POINT_FLOAT = SDL_PROP_SURFACE_SDR_WHITE_POINT_FLOAT;
2411
2412constexpr auto HDR_HEADROOM_FLOAT = SDL_PROP_SURFACE_HDR_HEADROOM_FLOAT;
2413
2414constexpr auto TONEMAP_OPERATOR_STRING =
2415 SDL_PROP_SURFACE_TONEMAP_OPERATOR_STRING;
2416
2417#if SDL_VERSION_ATLEAST(3, 2, 6)
2418
2419constexpr auto HOTSPOT_X_NUMBER = SDL_PROP_SURFACE_HOTSPOT_X_NUMBER;
2420
2421constexpr auto HOTSPOT_Y_NUMBER = SDL_PROP_SURFACE_HOTSPOT_Y_NUMBER;
2422
2423#endif // SDL_VERSION_ATLEAST(3, 2, 6)
2424
2425#if SDL_VERSION_ATLEAST(3, 4, 0)
2426
2427constexpr auto ROTATION_FLOAT = SDL_PROP_SURFACE_ROTATION_FLOAT;
2428
2429#endif // SDL_VERSION_ATLEAST(3, 4, 0)
2430
2431} // namespace prop::Surface
2432
2450inline void SetSurfaceColorspace(SurfaceParam surface, Colorspace colorspace)
2451{
2452 CheckError(SDL_SetSurfaceColorspace(surface, colorspace));
2453}
2454
2455inline void Surface::SetColorspace(Colorspace colorspace)
2456{
2457 SDL::SetSurfaceColorspace(m_resource, colorspace);
2458}
2459
2479{
2480 return SDL_GetSurfaceColorspace(surface);
2481}
2482
2484{
2485 return SDL::GetSurfaceColorspace(m_resource);
2486}
2487
2516{
2517 return Palette::Borrow(CheckError(SDL_CreateSurfacePalette(surface)));
2518}
2519
2521{
2522 return SDL::CreateSurfacePalette(m_resource);
2523}
2524
2545inline void SetSurfacePalette(SurfaceParam surface, PaletteParam palette)
2546{
2547 CheckError(SDL_SetSurfacePalette(surface, palette));
2548}
2549
2551{
2552 SDL::SetSurfacePalette(m_resource, palette);
2553}
2554
2569{
2570 return Palette::Borrow(SDL_GetSurfacePalette(surface));
2571}
2572
2574{
2575 return SDL::GetSurfacePalette(m_resource);
2576}
2577
2604{
2605 CheckError(SDL_AddSurfaceAlternateImage(surface, image));
2606}
2607
2609{
2610 SDL::AddSurfaceAlternateImage(m_resource, image);
2611}
2612
2628{
2629 return SDL_SurfaceHasAlternateImages(surface);
2630}
2631
2633{
2634 return SDL::SurfaceHasAlternateImages(m_resource);
2635}
2636
2661{
2662 int count = 0;
2663 auto data = SDL_GetSurfaceImages(surface, &count);
2664 return OwnArray<SurfaceRaw>(CheckError(data), count);
2665}
2666
2668{
2669 return SDL::GetSurfaceImages(m_resource);
2670}
2671
2690{
2691 SDL_RemoveSurfaceAlternateImages(surface);
2692}
2693
2695{
2697}
2698
2724inline void LockSurface(SurfaceParam surface)
2725{
2726 CheckError(SDL_LockSurface(surface));
2727}
2728
2729inline SurfaceLock Surface::Lock() { return {SurfaceRef(*this)}; }
2730
2732 : m_lock(std::move(resource))
2733{
2734 LockSurface(m_lock);
2735}
2736
2750inline void UnlockSurface(SurfaceParam surface) { SDL_UnlockSurface(surface); }
2751
2752inline void Surface::Unlock(SurfaceLock&& lock)
2753{
2754 SDL_assert_paranoid(lock.get() == *this);
2755 lock.reset();
2756}
2757
2759{
2760 if (!m_lock) return;
2761 UnlockSurface(m_lock);
2762 m_lock = {};
2763}
2764
2765#ifndef SDL3PP_ENABLE_IMAGE
2766#if SDL_VERSION_ATLEAST(3, 4, 0)
2767
2787inline Surface LoadSurface(IOStreamParam src, bool closeio = false)
2788{
2789 return Surface{SDL_LoadSurface_IO(src, closeio)};
2790}
2791
2809inline Surface LoadSurface(StringParam file)
2810{
2811 return Surface{SDL_LoadSurface(file)};
2812}
2813#endif // SDL_VERSION_ATLEAST(3, 4, 0)
2814#endif // SDL3PP_ENABLE_IMAGE
2815
2836inline Surface LoadBMP(IOStreamParam src, bool closeio = false)
2837{
2838 return Surface(SDL_LoadBMP_IO(src, closeio));
2839}
2840
2859inline Surface LoadBMP(StringParam file) { return Surface(SDL_LoadBMP(file)); }
2860
2861inline Surface Surface::LoadBMP(IOStreamParam src, bool closeio)
2862{
2863 return SDL::LoadBMP(src, closeio);
2864}
2865
2867{
2868 return SDL::LoadBMP(std::move(file));
2869}
2870
2894inline void SaveBMP(SurfaceConstParam surface,
2895 IOStreamParam dst,
2896 bool closeio = false)
2897{
2898 CheckError(SDL_SaveBMP_IO(surface, dst, closeio));
2899}
2900
2922inline void SaveBMP(SurfaceConstParam surface, StringParam file)
2923{
2924 CheckError(SDL_SaveBMP(surface, file));
2925}
2926
2927inline void Surface::SaveBMP(IOStreamParam dst, bool closeio) const
2928{
2929 SDL::SaveBMP(m_resource, dst, closeio);
2930}
2931
2932inline void Surface::SaveBMP(StringParam file) const
2933{
2934 SDL::SaveBMP(m_resource, std::move(file));
2935}
2936
2937#if SDL_VERSION_ATLEAST(3, 4, 0)
2938
2963inline Surface LoadPNG(IOStreamParam src, bool closeio = false)
2964{
2965 return Surface(SDL_LoadPNG_IO(src, closeio));
2966}
2967
2990inline Surface LoadPNG(StringParam file) { return Surface(SDL_LoadPNG(file)); }
2991
2992inline Surface Surface::LoadPNG(IOStreamParam src, bool closeio)
2993{
2994 return SDL::LoadPNG(src, closeio);
2995}
2996
2998{
2999 return SDL::LoadPNG(std::move(file));
3000}
3001
3019inline void SavePNG(SurfaceConstParam surface,
3020 IOStreamParam dst,
3021 bool closeio = false)
3022{
3023 CheckError(SDL_SavePNG_IO(surface, dst, closeio));
3024}
3025
3041inline void SavePNG(SurfaceConstParam surface, StringParam file)
3042{
3043 CheckError(SDL_SavePNG(surface, file));
3044}
3045
3046inline void Surface::SavePNG(IOStreamParam dst, bool closeio) const
3047{
3048 SDL::SavePNG(m_resource, dst, closeio);
3049}
3050
3051inline void Surface::SavePNG(StringParam file) const
3052{
3053 SDL::SavePNG(m_resource, std::move(file));
3054}
3055
3056#endif // SDL_VERSION_ATLEAST(3, 4, 0)
3057
3077inline void SetSurfaceRLE(SurfaceParam surface, bool enabled)
3078{
3079 CheckError(SDL_SetSurfaceRLE(surface, enabled));
3080}
3081
3082inline void Surface::SetRLE(bool enabled)
3083{
3084 SDL::SetSurfaceRLE(m_resource, enabled);
3085}
3086
3102{
3103 return SDL_SurfaceHasRLE(surface);
3104}
3105
3106inline bool Surface::HasRLE() const { return SDL::SurfaceHasRLE(m_resource); }
3107
3130inline void SetSurfaceColorKey(SurfaceParam surface, std::optional<Uint32> key)
3131{
3132 CheckError(SDL_SetSurfaceColorKey(surface, key.has_value(), key.value_or(0)));
3133}
3134
3135inline void Surface::SetColorKey(std::optional<Uint32> key)
3136{
3137 SDL::SetSurfaceColorKey(m_resource, key);
3138}
3139
3151{
3152 SetSurfaceColorKey(surface, std::nullopt);
3153}
3154
3156
3173{
3174 return SDL_SurfaceHasColorKey(surface);
3175}
3176
3177inline bool Surface::HasColorKey() const
3178{
3179 return SDL::SurfaceHasColorKey(m_resource);
3180}
3181
3201inline std::optional<Uint32> GetSurfaceColorKey(SurfaceConstParam surface)
3202{
3203 if (Uint32 key; SDL_GetSurfaceColorKey(surface, &key)) return key;
3204 return std::nullopt;
3205}
3206
3207inline std::optional<Uint32> Surface::GetColorKey() const
3208{
3209 return SDL::GetSurfaceColorKey(m_resource);
3210}
3211
3235inline void SetSurfaceColorMod(SurfaceParam surface, Uint8 r, Uint8 g, Uint8 b)
3236{
3237 CheckError(SDL_SetSurfaceColorMod(surface, r, g, b));
3238}
3239
3241{
3242 SDL::SetSurfaceColorMod(m_resource, r, g, b);
3243}
3244
3263 Uint8* r,
3264 Uint8* g,
3265 Uint8* b)
3266{
3267 CheckError(SDL_GetSurfaceColorMod(surface, r, g, b));
3268}
3269
3270inline void Surface::GetColorMod(Uint8* r, Uint8* g, Uint8* b) const
3271{
3272 SDL::GetSurfaceColorMod(m_resource, r, g, b);
3273}
3274
3295inline void SetSurfaceAlphaMod(SurfaceParam surface, Uint8 alpha)
3296{
3297 CheckError(SDL_SetSurfaceAlphaMod(surface, alpha));
3298}
3299
3300inline void Surface::SetAlphaMod(Uint8 alpha)
3301{
3302 SDL::SetSurfaceAlphaMod(m_resource, alpha);
3303}
3304
3320{
3321 Uint8 alpha;
3322 CheckError(SDL_GetSurfaceAlphaMod(surface, &alpha));
3323 return alpha;
3324}
3325
3327{
3328 return SDL::GetSurfaceAlphaMod(m_resource);
3329}
3330
3346inline void SetSurfaceMod(SurfaceParam surface, Color color)
3347{
3348 SetSurfaceColorMod(surface, color.r, color.g, color.b);
3349 SetSurfaceAlphaMod(surface, color.a);
3350}
3351
3352inline void Surface::SetMod(Color color) { SetSurfaceMod(m_resource, color); }
3353
3363{
3364 Color c;
3365 GetSurfaceColorMod(surface, &c.r, &c.g, &c.b);
3366 c.a = GetSurfaceAlphaMod(surface);
3367 return c;
3368}
3369
3370inline Color Surface::GetMod() const { return SDL::GetSurfaceMod(m_resource); }
3371
3390inline void SetSurfaceBlendMode(SurfaceParam surface, BlendMode blendMode)
3391{
3392 CheckError(SDL_SetSurfaceBlendMode(surface, blendMode));
3393}
3394
3395inline void Surface::SetBlendMode(BlendMode blendMode)
3396{
3397 SDL::SetSurfaceBlendMode(m_resource, blendMode);
3398}
3399
3414{
3415 BlendMode blendmode;
3416 CheckError(SDL_GetSurfaceBlendMode(surface, &blendmode));
3417 return blendmode;
3418}
3419
3421{
3422 return SDL::GetSurfaceBlendMode(m_resource);
3423}
3424
3449{
3450 return SDL_SetSurfaceClipRect(surface, rect);
3451}
3452
3454{
3455 return SDL::SetSurfaceClipRect(m_resource, rect);
3456}
3457
3464{
3465 SetSurfaceClipRect(surface, std::nullopt);
3466}
3467
3469
3489{
3490 Rect r;
3491 CheckError(SDL_GetSurfaceClipRect(surface, &r));
3492 return r;
3493}
3494
3496{
3497 return SDL::GetSurfaceClipRect(m_resource);
3498}
3499
3512inline void FlipSurface(SurfaceParam surface, FlipMode flip)
3513{
3514 CheckError(SDL_FlipSurface(surface, flip));
3515}
3516
3517inline void Surface::Flip(FlipMode flip) { SDL::FlipSurface(m_resource, flip); }
3518
3519#if SDL_VERSION_ATLEAST(3, 4, 0)
3520
3548inline Surface RotateSurface(SurfaceParam surface, float angle)
3549{
3550 return Surface{SDL_RotateSurface(surface, angle)};
3551}
3552
3553inline Surface Surface::Rotate(float angle)
3554{
3555 return SDL::RotateSurface(m_resource, angle);
3556}
3557
3558#endif // SDL_VERSION_ATLEAST(3, 4, 0)
3559
3580{
3581 return Surface(SDL_DuplicateSurface(surface));
3582}
3583
3585{
3586 return SDL::DuplicateSurface(m_resource);
3587}
3588
3609 const PointRaw& size,
3610 ScaleMode scaleMode)
3611{
3612 return Surface(SDL_ScaleSurface(surface, size.x, size.y, scaleMode));
3613}
3614
3615inline Surface Surface::Scale(const PointRaw& size, ScaleMode scaleMode) const
3616{
3617 return SDL::ScaleSurface(m_resource, size, scaleMode);
3618}
3619
3648{
3649 return Surface(SDL_ConvertSurface(surface, format));
3650}
3651
3653{
3654 return SDL::ConvertSurface(m_resource, format);
3655}
3656
3686 PixelFormat format,
3687 PaletteParam palette,
3688 Colorspace colorspace,
3689 PropertiesParam props)
3690{
3691 return Surface{SDL_ConvertSurfaceAndColorspace(
3692 surface, format, palette, colorspace, props)};
3693}
3694
3696 PaletteParam palette,
3697 Colorspace colorspace,
3698 PropertiesParam props) const
3699{
3701 m_resource, format, palette, colorspace, props);
3702}
3703
3724inline void ConvertPixels(const PointRaw& size,
3725 PixelFormat src_format,
3726 const void* src,
3727 int src_pitch,
3728 PixelFormat dst_format,
3729 void* dst,
3730 int dst_pitch)
3731{
3732 CheckError(SDL_ConvertPixels(
3733 size.x, size.y, src_format, src, src_pitch, dst_format, dst, dst_pitch));
3734}
3735
3765inline void ConvertPixelsAndColorspace(const PointRaw& size,
3766 PixelFormat src_format,
3767 Colorspace src_colorspace,
3768 PropertiesParam src_properties,
3769 const void* src,
3770 int src_pitch,
3771 PixelFormat dst_format,
3772 Colorspace dst_colorspace,
3773 PropertiesParam dst_properties,
3774 void* dst,
3775 int dst_pitch)
3776{
3777 CheckError(SDL_ConvertPixelsAndColorspace(size.x,
3778 size.y,
3779 src_format,
3780 src_colorspace,
3781 src_properties,
3782 src,
3783 src_pitch,
3784 dst_format,
3785 dst_colorspace,
3786 dst_properties,
3787 dst,
3788 dst_pitch));
3789}
3790
3813inline void PremultiplyAlpha(const PointRaw& size,
3814 PixelFormat src_format,
3815 const void* src,
3816 int src_pitch,
3817 PixelFormat dst_format,
3818 void* dst,
3819 int dst_pitch,
3820 bool linear)
3821{
3822 CheckError(SDL_PremultiplyAlpha(size.x,
3823 size.y,
3824 src_format,
3825 src,
3826 src_pitch,
3827 dst_format,
3828 dst,
3829 dst_pitch,
3830 linear));
3831}
3832
3848inline void PremultiplySurfaceAlpha(SurfaceParam surface, bool linear)
3849{
3850 CheckError(SDL_PremultiplySurfaceAlpha(surface, linear));
3851}
3852
3853inline void Surface::PremultiplyAlpha(bool linear)
3854{
3855 SDL::PremultiplySurfaceAlpha(m_resource, linear);
3856}
3857
3875inline void ClearSurface(SurfaceParam surface, const FColorRaw& c)
3876{
3877 CheckError(SDL_ClearSurface(surface, c.r, c.g, c.b, c.a));
3878}
3879
3880inline void Surface::Clear(const FColorRaw& c)
3881{
3882 SDL::ClearSurface(m_resource, c);
3883}
3884
3912 Uint32 color)
3913{
3914 CheckError(SDL_FillSurfaceRect(dst, rect, color));
3915}
3916
3918{
3919 SDL::FillSurfaceRect(m_resource, rect, color);
3920}
3921
3933inline void FillSurface(SurfaceParam dst, Uint32 color)
3934{
3935 FillSurfaceRect(dst, std::nullopt, color);
3936}
3937
3938inline void Surface::Fill(Uint32 color) { SDL::FillSurface(m_resource, color); }
3939
3966 Uint32 color)
3967{
3968 CheckError(SDL_FillSurfaceRects(dst, rects.data(), rects.size(), color));
3969}
3970
3972{
3973 SDL::FillSurfaceRects(m_resource, rects, color);
3974}
3975
4048 SurfaceParam dst,
4050{
4051 CheckError(SDL_BlitSurface(src, srcrect, dst, dstrect));
4052}
4053
4057{
4058 SDL::BlitSurface(src, srcrect, m_resource, dstrect);
4059}
4060
4063 const PointRaw& dstpos)
4064{
4065 Blit(src, srcrect, Rect{dstpos, {}});
4066}
4067
4137 SurfaceParam dst,
4138 const PointRaw& dstpos)
4139{
4140 BlitSurface(src, srcrect, dst, SDL_Rect{dstpos.x, dstpos.y});
4141}
4142
4165 const RectRaw& srcrect,
4166 SurfaceParam dst,
4167 const RectRaw& dstrect)
4168{
4169 CheckError(SDL_BlitSurfaceUnchecked(src, &srcrect, dst, &dstrect));
4170}
4171
4173 const RectRaw& srcrect,
4174 const RectRaw& dstrect)
4175{
4176 SDL::BlitSurfaceUnchecked(src, srcrect, m_resource, dstrect);
4177}
4178
4202 SurfaceParam dst,
4204 ScaleMode scaleMode)
4205{
4206 CheckError(SDL_BlitSurfaceScaled(src, srcrect, dst, dstrect, scaleMode));
4207}
4208
4212 ScaleMode scaleMode)
4213{
4214 SDL::BlitSurfaceScaled(src, srcrect, m_resource, dstrect, scaleMode);
4215}
4216
4240 const RectRaw& srcrect,
4241 SurfaceParam dst,
4242 const RectRaw& dstrect,
4243 ScaleMode scaleMode)
4244{
4245 CheckError(
4246 SDL_BlitSurfaceUncheckedScaled(src, &srcrect, dst, &dstrect, scaleMode));
4247}
4248
4250 const RectRaw& srcrect,
4251 const RectRaw& dstrect,
4252 ScaleMode scaleMode)
4253{
4254 SDL::BlitSurfaceUncheckedScaled(src, srcrect, m_resource, dstrect, scaleMode);
4255}
4256
4257#if SDL_VERSION_ATLEAST(3, 4, 0)
4258
4280 OptionalRef<RectRaw> srcrect,
4281 SurfaceParam dst,
4282 OptionalRef<RectRaw> dstrect,
4283 ScaleMode scaleMode)
4284{
4285 CheckError(SDL_StretchSurface(src, srcrect, dst, dstrect, scaleMode));
4286}
4287
4289 OptionalRef<RectRaw> srcrect,
4290 OptionalRef<RectRaw> dstrect,
4291 ScaleMode scaleMode)
4292{
4293 SDL::StretchSurface(src, srcrect, m_resource, dstrect, scaleMode);
4294}
4295
4296#endif // SDL_VERSION_ATLEAST(3, 4, 0)
4297
4322 SurfaceParam dst,
4324{
4325 CheckError(SDL_BlitSurfaceTiled(src, srcrect, dst, dstrect));
4326}
4327
4331{
4332 SDL::BlitSurfaceTiled(src, srcrect, m_resource, dstrect);
4333}
4334
4363 float scale,
4364 ScaleMode scaleMode,
4365 SurfaceParam dst,
4367{
4368 CheckError(SDL_BlitSurfaceTiledWithScale(
4369 src, srcrect, scale, scaleMode, dst, dstrect));
4370}
4371
4374 float scale,
4375 ScaleMode scaleMode,
4377{
4379 src, srcrect, scale, scaleMode, m_resource, dstrect);
4380}
4381
4417 int left_width,
4418 int right_width,
4419 int top_height,
4420 int bottom_height,
4421 SurfaceParam dst,
4423 float scale = 1,
4424 ScaleMode scaleMode = SCALEMODE_NEAREST)
4425{
4426 CheckError(SDL_BlitSurface9Grid(src,
4427 srcrect,
4428 left_width,
4429 right_width,
4430 top_height,
4431 bottom_height,
4432 scale,
4433 scaleMode,
4434 dst,
4435 dstrect));
4436}
4437
4440 int left_width,
4441 int right_width,
4442 int top_height,
4443 int bottom_height,
4445 float scale,
4446 ScaleMode scaleMode)
4447{
4449 srcrect,
4450 left_width,
4451 right_width,
4452 top_height,
4453 bottom_height,
4454 m_resource,
4455 dstrect,
4456 scale,
4457 scaleMode);
4458}
4459
4492 Uint8 r,
4493 Uint8 g,
4494 Uint8 b)
4495{
4496 return SDL_MapSurfaceRGB(surface, r, g, b);
4497}
4498
4500{
4501 return SDL::MapSurfaceRGB(m_resource, r, g, b);
4502}
4503
4534{
4535 return SDL_MapSurfaceRGBA(surface, c.r, c.g, c.b, c.a);
4536}
4537
4539{
4540 return SDL::MapSurfaceRGBA(m_resource, c);
4541}
4542
4570 const PointRaw& p,
4571 Uint8* r,
4572 Uint8* g,
4573 Uint8* b,
4574 Uint8* a)
4575{
4576 CheckError(SDL_ReadSurfacePixel(surface, p.x, p.y, r, g, b, a));
4577}
4578
4599{
4600 Color c;
4601 ReadSurfacePixel(surface, p, &c.r, &c.g, &c.b, &c.a);
4602 return c;
4603}
4604
4631inline void ReadSurfacePixel(const SurfaceLock& lock,
4632 const PointRaw& p,
4633 Uint8* r,
4634 Uint8* g,
4635 Uint8* b,
4636 Uint8* a)
4637{
4638 lock.ReadPixel(p, r, g, b, a);
4639}
4640
4660inline Color ReadSurfacePixel(const SurfaceLock& lock, const PointRaw& p)
4661{
4662 return lock.ReadPixel(p);
4663}
4664
4665inline void Surface::ReadPixel(const PointRaw& p,
4666 Uint8* r,
4667 Uint8* g,
4668 Uint8* b,
4669 Uint8* a) const
4670{
4671 SDL::ReadSurfacePixel(m_resource, p, r, g, b, a);
4672}
4673
4674inline Color Surface::ReadPixel(const PointRaw& p) const
4675{
4676 return SDL::ReadSurfacePixel(m_resource, p);
4677}
4678
4703 const PointRaw& p,
4704 float* r,
4705 float* g,
4706 float* b,
4707 float* a)
4708{
4709 CheckError(SDL_ReadSurfacePixelFloat(surface, p.x, p.y, r, g, b, a));
4710}
4711
4729 const PointRaw& p)
4730{
4731 FColor c;
4732 ReadSurfacePixelFloat(surface, p, &c.r, &c.g, &c.b, &c.a);
4733 return c;
4734}
4735
4759inline void ReadSurfacePixelFloat(const SurfaceLock& lock,
4760 const PointRaw& p,
4761 float* r,
4762 float* g,
4763 float* b,
4764 float* a)
4765{
4766 lock.ReadPixelFloat(p, r, g, b, a);
4767}
4768
4786{
4787 return lock.ReadPixelFloat(p);
4788}
4789
4791 float* r,
4792 float* g,
4793 float* b,
4794 float* a) const
4795{
4796 SDL::ReadSurfacePixelFloat(m_resource, p, r, g, b, a);
4797}
4798
4800{
4801 return SDL::ReadSurfacePixelFloat(m_resource, p);
4802}
4803
4824 const PointRaw& p,
4825 ColorRaw c)
4826{
4827 CheckError(SDL_WriteSurfacePixel(surface, p.x, p.y, c.r, c.g, c.b, c.a));
4828}
4829
4849inline void WriteSurfacePixel(SurfaceLock& lock, const PointRaw& p, ColorRaw c)
4850{
4851 lock.WritePixel(p, c);
4852}
4853
4854inline void Surface::WritePixel(const PointRaw& p, ColorRaw c)
4855{
4856 SDL::WriteSurfacePixel(m_resource, p, c);
4857}
4858
4876 const PointRaw& p,
4877 const FColorRaw& c)
4878{
4879 CheckError(SDL_WriteSurfacePixelFloat(surface, p.x, p.y, c.r, c.g, c.b, c.a));
4880}
4881
4899 const PointRaw& p,
4900 const FColorRaw& c)
4901{
4902 lock.WritePixelFloat(p, c);
4903}
4904
4905inline void Surface::WritePixelFloat(const PointRaw& p, const FColorRaw& c)
4906{
4907 SDL::WriteSurfacePixelFloat(m_resource, p, c);
4908}
4909
4911constexpr int GetSurfaceWidth(SurfaceConstParam surface) { return surface->w; }
4912
4914constexpr int GetSurfaceWidth(const SurfaceLock& lock)
4915{
4916 return lock.GetWidth();
4917}
4918
4919constexpr int Surface::GetWidth() const
4920{
4921 return SDL::GetSurfaceWidth(m_resource);
4922}
4923
4925constexpr int GetSurfaceHeight(SurfaceConstParam surface) { return surface->h; }
4926
4928constexpr int GetSurfaceHeight(const SurfaceLock& lock)
4929{
4930 return lock.GetHeight();
4931}
4932
4933constexpr int Surface::GetHeight() const
4934{
4935 return SDL::GetSurfaceHeight(m_resource);
4936}
4937
4940{
4941 return Point(surface->w, surface->h);
4942}
4943
4945constexpr Point GetSurfaceSize(const SurfaceLock& lock)
4946{
4947 return lock.GetSize();
4948}
4949
4950constexpr Point Surface::GetSize() const
4951{
4952 return SDL::GetSurfaceSize(m_resource);
4953}
4954
4957{
4958 return surface->pitch;
4959}
4960
4962constexpr int GetSurfacePitch(const SurfaceLock& lock)
4963{
4964 return lock.GetPitch();
4965}
4966
4967constexpr int Surface::GetPitch() const
4968{
4969 return SDL::GetSurfacePitch(m_resource);
4970}
4971
4974{
4975 return surface->format;
4976}
4977
4980{
4981 return lock.GetFormat();
4982}
4983
4985{
4986 return SDL::GetSurfaceFormat(m_resource);
4987}
4988
4990constexpr void* GetSurfacePixels(SurfaceConstParam surface)
4991{
4992 return surface->pixels;
4993}
4994
4996constexpr void* GetSurfacePixels(const SurfaceLock& lock)
4997{
4998 return lock.GetPixels();
4999}
5000
5001constexpr void* Surface::GetPixels() const
5002{
5003 return SDL::GetSurfacePixels(m_resource);
5004}
5005
5007
5008} // namespace SDL
5009
5010#endif /* SDL3PP_SURFACE_H_ */
Colorspace definitions.
Definition: SDL3pp_pixels.h:1657
Optional-like shim for references.
Definition: SDL3pp_optionalRef.h:20
Base class for SDL memory allocated array wrap.
Definition: SDL3pp_ownPtr.h:44
A set of indexed colors representing a palette.
Definition: SDL3pp_pixels.h:2479
static constexpr Palette Borrow(PaletteParam resource)
Safely borrows the from PaletteParam.
Definition: SDL3pp_pixels.h:2543
Pixel format.
Definition: SDL3pp_pixels.h:414
span-like for empty-derived structs
Definition: SDL3pp_spanRef.h:24
constexpr T * data() const
Retrieves contained data.
Definition: SDL3pp_spanRef.h:75
constexpr size_t size() const
Retrieves contained size.
Definition: SDL3pp_spanRef.h:69
Helpers to use C++ strings parameters.
Definition: SDL3pp_strings.h:43
Set up a surface for directly accessing the pixels.
Definition: SDL3pp_surface.h:2038
constexpr PixelFormat GetFormat() const
Get the pixel format.
Definition: SDL3pp_surface.h:2262
FColor ReadPixelFloat(const PointRaw &p) const
Retrieves a single pixel from a surface.
Definition: SDL3pp_surface.h:2204
~SurfaceLock()
Release a surface after directly accessing the pixels.
Definition: SDL3pp_surface.h:2090
constexpr int GetHeight() const
Get the height in pixels.
Definition: SDL3pp_surface.h:2253
constexpr int GetWidth() const
Get the width in pixels.
Definition: SDL3pp_surface.h:2250
SurfaceRef get()
Get the reference to locked resource.
Definition: SDL3pp_surface.h:2281
constexpr void * GetPixels() const
Get the pixels.
Definition: SDL3pp_surface.h:2265
void release()
Releases the lock without unlocking.
Definition: SDL3pp_surface.h:2284
void ReadPixel(const PointRaw &p, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a) const
Retrieves a single pixel from a surface.
Definition: SDL3pp_surface.h:2129
constexpr SurfaceLock(SurfaceLock &&other) noexcept
Move constructor.
Definition: SDL3pp_surface.h:2073
void WritePixelFloat(const PointRaw &p, const FColorRaw &c)
Writes a single pixel to a surface.
Definition: SDL3pp_surface.h:2244
SurfaceLock & operator=(SurfaceLock &&other) noexcept
Assignment operator.
Definition: SDL3pp_surface.h:2095
void WritePixel(const PointRaw &p, ColorRaw c)
Writes a single pixel to a surface.
Definition: SDL3pp_surface.h:2227
constexpr Point GetSize() const
Get the size in pixels.
Definition: SDL3pp_surface.h:2256
Color ReadPixel(const PointRaw &p) const
Retrieves a single pixel from a surface.
Definition: SDL3pp_surface.h:2156
SurfaceLock(const SurfaceLock &other)=delete
Copy constructor.
void ReadPixelFloat(const PointRaw &p, float *r, float *g, float *b, float *a) const
Retrieves a single pixel from a surface.
Definition: SDL3pp_surface.h:2180
constexpr int GetPitch() const
Get pitch in bytes.
Definition: SDL3pp_surface.h:2259
A collection of pixels used in software blitting.
Definition: SDL3pp_surface.h:227
constexpr const SurfaceRaw operator->() const noexcept
member access to underlying SurfaceRaw.
Definition: SDL3pp_surface.h:512
Surface(const PointRaw &size, PixelFormat format)
Allocate a new surface with a specific pixel format.
Definition: SDL3pp_surface.h:278
constexpr SurfaceRaw release() noexcept
Retrieves underlying SurfaceRaw and clear this.
Definition: SDL3pp_surface.h:534
constexpr Surface & operator=(Surface &&other) noexcept
Assignment operator.
Definition: SDL3pp_surface.h:521
constexpr Surface(const Surface &other)
Copy constructor.
Definition: SDL3pp_surface.h:250
constexpr SurfaceRaw operator->() noexcept
member access to underlying SurfaceRaw.
Definition: SDL3pp_surface.h:515
constexpr Surface(Surface &&other) noexcept
Move constructor.
Definition: SDL3pp_surface.h:257
constexpr Surface(std::nullptr_t=nullptr) noexcept
Default ctor.
Definition: SDL3pp_surface.h:232
constexpr Surface(const SurfaceRaw resource) noexcept
Constructs from SurfaceParam.
Definition: SDL3pp_surface.h:244
~Surface()
Destructor.
Definition: SDL3pp_surface.h:518
constexpr auto operator<=>(const Surface &other) const noexcept=default
Comparison.
constexpr Surface & operator=(const Surface &other) noexcept=default
Assignment operator.
Surface(const PointRaw &size, PixelFormat format, void *pixels, int pitch)
Allocate a new surface with a specific pixel format and existing pixel data.
Definition: SDL3pp_surface.h:309
static constexpr Surface Borrow(SurfaceParam resource)
Safely borrows the from SurfaceParam.
Definition: SDL3pp_surface.h:409
constexpr SurfaceRaw get() const noexcept
Retrieves underlying SurfaceRaw.
Definition: SDL3pp_surface.h:531
constexpr bool MustLock() const
Evaluates to true if the surface needs to be locked before access.
Definition: SDL3pp_surface.h:569
#define SDL_assert_paranoid(condition)
An assertion test that is performed only when built with paranoid settings.
Definition: SDL3pp_assert.h:383
Uint32 BlendMode
A set of blend modes used in drawing operations.
Definition: SDL3pp_blendmode.h:35
constexpr void CheckError(bool result)
Check and throw if returned value from SDL is an error.
Definition: SDL3pp_error.h:197
SDL_FColor FColorRaw
Alias to raw representation for FColor.
Definition: SDL3pp_pixels.h:89
SDL_Color ColorRaw
Alias to raw representation for Color.
Definition: SDL3pp_pixels.h:83
SDL_Rect RectRaw
Alias to raw representation for Rect.
Definition: SDL3pp_rect.h:34
SDL_Point PointRaw
Alias to raw representation for Point.
Definition: SDL3pp_rect.h:22
void SaveBMP(SurfaceParam surface, StringParam file)
Save an Surface into a BMP image file.
Definition: SDL3pp_image.h:2409
Surface LoadBMP(IOStreamParam src)
Load a BMP image directly.
Definition: SDL3pp_image.h:1580
Surface LoadPNG(IOStreamParam src)
Load a PNG image directly.
Definition: SDL3pp_image.h:1876
Surface LoadSurface(StringParam file)
Load an image from a filesystem path into a software surface.
Definition: SDL3pp_image.h:258
void SavePNG(SurfaceParam surface, StringParam file)
Save an Surface into a PNG image file.
Definition: SDL3pp_image.h:2631
::Uint32 Uint32
An unsigned 32-bit integer type.
Definition: SDL3pp_stdinc.h:341
::Uint8 Uint8
An unsigned 8-bit integer type.
Definition: SDL3pp_stdinc.h:289
SurfaceLock(SurfaceRef resource)
Set up a surface for directly accessing the pixels.
Definition: SDL3pp_surface.h:2731
void ResetSurfaceClipRect(SurfaceParam surface)
Disable the clipping rectangle for a surface.
Definition: SDL3pp_surface.h:3463
constexpr int GetSurfaceHeight(SurfaceConstParam surface)
Get the height in pixels.
Definition: SDL3pp_surface.h:4925
void BlitSurfaceUnchecked(SurfaceParam src, const RectRaw &srcrect, SurfaceParam dst, const RectRaw &dstrect)
Perform low-level surface blitting only.
Definition: SDL3pp_surface.h:4164
Uint32 MapSurfaceRGBA(SurfaceConstParam surface, ColorRaw c)
Map an RGBA quadruple to a pixel value for a surface.
Definition: SDL3pp_surface.h:4533
Rect GetSurfaceClipRect(SurfaceConstParam surface)
Get the clipping rectangle for a surface.
Definition: SDL3pp_surface.h:3488
Surface ScaleSurface(SurfaceConstParam surface, const PointRaw &size, ScaleMode scaleMode)
Creates a new surface identical to the existing surface, scaled to the desired size.
Definition: SDL3pp_surface.h:3608
Rect GetClipRect() const
Get the clipping rectangle for a surface.
Definition: SDL3pp_surface.h:3495
void ClearSurface(SurfaceParam surface, const FColorRaw &c)
Clear a surface with a specific color, with floating point precision.
Definition: SDL3pp_surface.h:3875
Uint8 GetSurfaceAlphaMod(SurfaceConstParam surface)
Get the additional alpha value used in blit operations.
Definition: SDL3pp_surface.h:3319
Palette CreateSurfacePalette(SurfaceParam surface)
Create a palette and associate it with a surface.
Definition: SDL3pp_surface.h:2515
Palette GetPalette() const
Get the palette used by a surface.
Definition: SDL3pp_surface.h:2573
std::optional< Uint32 > GetColorKey() const
Get the color key (transparent pixel) for a surface.
Definition: SDL3pp_surface.h:3207
void SetSurfaceMod(SurfaceParam surface, Color color)
Set an additional color and alpha value multiplied into blit operations.
Definition: SDL3pp_surface.h:3346
constexpr FlipMode FLIP_VERTICAL
flip vertically
Definition: SDL3pp_surface.h:188
bool SetSurfaceClipRect(SurfaceParam surface, OptionalRef< const RectRaw > rect)
Set the clipping rectangle for a surface.
Definition: SDL3pp_surface.h:3447
constexpr PixelFormat GetFormat() const
Get the pixel format.
Definition: SDL3pp_surface.h:4984
void Destroy()
Free a surface.
Definition: SDL3pp_surface.h:2359
void BlitSurfaceScaled(SurfaceParam src, OptionalRef< const RectRaw > srcrect, SurfaceParam dst, OptionalRef< const RectRaw > dstrect, ScaleMode scaleMode)
Perform a scaled blit to a destination surface, which may be of a different format.
Definition: SDL3pp_surface.h:4200
void SavePNG(IOStreamParam dst, bool closeio=false) const
Save a surface to a seekable SDL data stream in PNG format.
Definition: SDL3pp_surface.h:3046
bool SurfaceHasAlternateImages(SurfaceConstParam surface)
Return whether a surface has alternate versions available.
Definition: SDL3pp_surface.h:2627
void FillSurfaceRects(SurfaceParam dst, SpanRef< const RectRaw > rects, Uint32 color)
Perform a fast fill of a set of rectangles with a specific color.
Definition: SDL3pp_surface.h:3964
constexpr SurfaceFlags SURFACE_SIMD_ALIGNED
Surface uses pixel memory allocated with aligned_alloc()
Definition: SDL3pp_surface.h:139
BlendMode GetBlendMode() const
Get the blend mode used for blit operations.
Definition: SDL3pp_surface.h:3420
constexpr SurfaceFlags SURFACE_LOCK_NEEDED
Surface needs to be locked to access pixels.
Definition: SDL3pp_surface.h:132
constexpr void * GetSurfacePixels(SurfaceConstParam surface)
Get the pixels.
Definition: SDL3pp_surface.h:4990
void SetSurfacePalette(SurfaceParam surface, PaletteParam palette)
Set the palette used by a surface.
Definition: SDL3pp_surface.h:2545
bool SurfaceHasRLE(SurfaceConstParam surface)
Returns whether the surface is RLE enabled.
Definition: SDL3pp_surface.h:3101
void DestroySurface(SurfaceRaw surface)
Free a surface.
Definition: SDL3pp_surface.h:2357
void FillRects(SpanRef< const RectRaw > rects, Uint32 color)
Perform a fast fill of a set of rectangles with a specific color.
Definition: SDL3pp_surface.h:3971
Uint32 MapRGB(Uint8 r, Uint8 g, Uint8 b) const
Map an RGB triple to an opaque pixel value for a surface.
Definition: SDL3pp_surface.h:4499
void BlitSurfaceUncheckedScaled(SurfaceParam src, const RectRaw &srcrect, SurfaceParam dst, const RectRaw &dstrect, ScaleMode scaleMode)
Perform low-level surface scaled blitting only.
Definition: SDL3pp_surface.h:4239
bool HasRLE() const
Returns whether the surface is RLE enabled.
Definition: SDL3pp_surface.h:3106
constexpr int GetHeight() const
Get the height in pixels.
Definition: SDL3pp_surface.h:4933
constexpr FlipMode FLIP_NONE
Do not flip.
Definition: SDL3pp_surface.h:184
void WriteSurfacePixel(SurfaceParam surface, const PointRaw &p, ColorRaw c)
Writes a single pixel to a surface.
Definition: SDL3pp_surface.h:4823
bool SurfaceHasColorKey(SurfaceConstParam surface)
Returns whether the surface has a color key.
Definition: SDL3pp_surface.h:3172
BlendMode GetSurfaceBlendMode(SurfaceConstParam surface)
Get the blend mode used for blit operations.
Definition: SDL3pp_surface.h:3413
void Blit9Grid(SurfaceParam src, OptionalRef< const RectRaw > srcrect, int left_width, int right_width, int top_height, int bottom_height, OptionalRef< const RectRaw > dstrect, float scale=1, ScaleMode scaleMode=SCALEMODE_NEAREST)
Perform a scaled blit using the 9-grid algorithm to a destination surface, which may be of a differen...
Definition: SDL3pp_surface.h:4438
void BlitTiledWithScale(SurfaceParam src, OptionalRef< const RectRaw > srcrect, float scale, ScaleMode scaleMode, OptionalRef< const RectRaw > dstrect)
Perform a scaled and tiled blit to a destination surface, which may be of a different format.
Definition: SDL3pp_surface.h:4372
constexpr SurfaceFlags SURFACE_PREALLOCATED
Surface uses preallocated pixel memory.
Definition: SDL3pp_surface.h:129
void BlitSurfaceAt(SurfaceParam src, OptionalRef< const RectRaw > srcrect, SurfaceParam dst, const PointRaw &dstpos)
Performs a fast blit from the source surface to the destination surface with clipping.
Definition: SDL3pp_surface.h:4135
constexpr PixelFormat GetSurfaceFormat(SurfaceConstParam surface)
Get the pixel format.
Definition: SDL3pp_surface.h:4973
bool HasColorKey() const
Returns whether the surface has a color key.
Definition: SDL3pp_surface.h:3177
void BlitUncheckedScaled(SurfaceParam src, const RectRaw &srcrect, const RectRaw &dstrect, ScaleMode scaleMode)
Perform low-level surface scaled blitting only.
Definition: SDL3pp_surface.h:4249
constexpr ScaleMode SCALEMODE_LINEAR
linear filtering
Definition: SDL3pp_surface.h:164
void SetColorKey(std::optional< Uint32 > key)
Set the color key (transparent pixel) in a surface.
Definition: SDL3pp_surface.h:3135
void PremultiplyAlpha(bool linear)
Premultiply the alpha in a surface.
Definition: SDL3pp_surface.h:3853
void SaveBMP(IOStreamParam dst, bool closeio=false) const
Save a surface to a seekable SDL data stream in BMP format.
Definition: SDL3pp_surface.h:2927
Colorspace GetSurfaceColorspace(SurfaceConstParam surface)
Get the colorspace used by a surface.
Definition: SDL3pp_surface.h:2478
Surface DuplicateSurface(SurfaceConstParam surface)
Creates a new surface identical to the existing surface.
Definition: SDL3pp_surface.h:3579
std::optional< Uint32 > GetSurfaceColorKey(SurfaceConstParam surface)
Get the color key (transparent pixel) for a surface.
Definition: SDL3pp_surface.h:3201
Palette CreatePalette()
Create a palette and associate it with a surface.
Definition: SDL3pp_surface.h:2520
void reset()
Release a surface after directly accessing the pixels.
Definition: SDL3pp_surface.h:2758
void Blit(SurfaceParam src, OptionalRef< const RectRaw > srcrect, OptionalRef< const RectRaw > dstrect)
Performs a fast blit from the source surface to the destination surface with clipping.
Definition: SDL3pp_surface.h:4054
void SetSurfaceColorspace(SurfaceParam surface, Colorspace colorspace)
Set the colorspace used by a surface.
Definition: SDL3pp_surface.h:2450
Colorspace GetColorspace() const
Get the colorspace used by a surface.
Definition: SDL3pp_surface.h:2483
void ReadSurfacePixel(SurfaceConstParam surface, const PointRaw &p, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a)
Retrieves a single pixel from a surface.
Definition: SDL3pp_surface.h:4569
constexpr ScaleMode SCALEMODE_NEAREST
nearest pixel sampling
Definition: SDL3pp_surface.h:161
void Flip(FlipMode flip)
Flip a surface vertically or horizontally.
Definition: SDL3pp_surface.h:3517
Surface CreateSurfaceFrom(const PointRaw &size, PixelFormat format, void *pixels, int pitch)
Allocate a new surface with a specific pixel format and existing pixel data.
Definition: SDL3pp_surface.h:2335
void FlipSurface(SurfaceParam surface, FlipMode flip)
Flip a surface vertically or horizontally.
Definition: SDL3pp_surface.h:3512
void ResetClipRect()
Disable the clipping rectangle for a surface.
Definition: SDL3pp_surface.h:3468
PropertiesRef GetProperties() const
Get the properties associated with a surface.
Definition: SDL3pp_surface.h:2403
constexpr ScaleMode SCALEMODE_PIXELART
nearest pixel sampling with improved scaling for pixel art, available since SDL 3....
Definition: SDL3pp_surface.h:173
constexpr SurfaceFlags SURFACE_LOCKED
Surface is currently locked.
Definition: SDL3pp_surface.h:135
Surface ConvertSurface(SurfaceConstParam surface, PixelFormat format)
Copy an existing surface to a new surface of the specified format.
Definition: SDL3pp_surface.h:3647
constexpr Point GetSurfaceSize(SurfaceConstParam surface)
Get the size in pixels.
Definition: SDL3pp_surface.h:4939
constexpr int GetSurfaceWidth(SurfaceConstParam surface)
Get the width in pixels.
Definition: SDL3pp_surface.h:4911
bool HasAlternateImages() const
Return whether a surface has alternate versions available.
Definition: SDL3pp_surface.h:2632
void FillSurface(SurfaceParam dst, Uint32 color)
Perform a fast fill of a rectangle with a specific color.
Definition: SDL3pp_surface.h:3933
SDL_Surface * SurfaceRaw
Alias to raw representation for Surface.
Definition: SDL3pp_surface.h:46
constexpr int GetPitch() const
Get pitch in bytes.
Definition: SDL3pp_surface.h:4967
void SetSurfaceColorMod(SurfaceParam surface, Uint8 r, Uint8 g, Uint8 b)
Set an additional color value multiplied into blit operations.
Definition: SDL3pp_surface.h:3235
Surface ConvertSurfaceAndColorspace(SurfaceConstParam surface, PixelFormat format, PaletteParam palette, Colorspace colorspace, PropertiesParam props)
Copy an existing surface to a new surface of the specified format and colorspace.
Definition: SDL3pp_surface.h:3685
void BlitSurface9Grid(SurfaceParam src, OptionalRef< const RectRaw > srcrect, int left_width, int right_width, int top_height, int bottom_height, SurfaceParam dst, OptionalRef< const RectRaw > dstrect, float scale=1, ScaleMode scaleMode=SCALEMODE_NEAREST)
Perform a scaled blit using the 9-grid algorithm to a destination surface, which may be of a differen...
Definition: SDL3pp_surface.h:4415
void RemoveAlternateImages()
Remove all alternate versions of a surface.
Definition: SDL3pp_surface.h:2694
Surface Convert(PixelFormat format) const
Copy an existing surface to a new surface of the specified format.
Definition: SDL3pp_surface.h:3652
void Stretch(SurfaceParam src, OptionalRef< RectRaw > srcrect, OptionalRef< RectRaw > dstrect, ScaleMode scaleMode)
Perform a stretched pixel copy from one surface to another.
Definition: SDL3pp_surface.h:4288
constexpr Point GetSize() const
Get the size in pixels.
Definition: SDL3pp_surface.h:4950
void SetSurfaceAlphaMod(SurfaceParam surface, Uint8 alpha)
Set an additional alpha value used in blit operations.
Definition: SDL3pp_surface.h:3295
Uint8 GetAlphaMod() const
Get the additional alpha value used in blit operations.
Definition: SDL3pp_surface.h:3326
constexpr bool MustLock(SurfaceConstParam S)
Evaluates to true if the surface needs to be locked before access.
Definition: SDL3pp_surface.h:146
Surface Duplicate() const
Creates a new surface identical to the existing surface.
Definition: SDL3pp_surface.h:3584
static Surface LoadBMP(IOStreamParam src, bool closeio=false)
Load a BMP image from a seekable SDL data stream.
Definition: SDL3pp_surface.h:2861
void Clear(const FColorRaw &c)
Clear a surface with a specific color, with floating point precision.
Definition: SDL3pp_surface.h:3880
Surface RotateSurface(SurfaceParam surface, float angle)
Return a copy of a surface rotated clockwise a number of degrees.
Definition: SDL3pp_surface.h:3548
void BlitSurfaceTiled(SurfaceParam src, OptionalRef< const RectRaw > srcrect, SurfaceParam dst, OptionalRef< const RectRaw > dstrect)
Perform a tiled blit to a destination surface, which may be of a different format.
Definition: SDL3pp_surface.h:4320
void SetSurfaceColorKey(SurfaceParam surface, std::optional< Uint32 > key)
Set the color key (transparent pixel) in a surface.
Definition: SDL3pp_surface.h:3130
static Surface LoadPNG(IOStreamParam src, bool closeio=false)
Load a PNG image from a seekable SDL data stream.
Definition: SDL3pp_surface.h:2992
void SetSurfaceRLE(SurfaceParam surface, bool enabled)
Set the RLE acceleration hint for a surface.
Definition: SDL3pp_surface.h:3077
void SetMod(Color color)
Set an additional color and alpha value multiplied into blit operations.
Definition: SDL3pp_surface.h:3352
SDL_FlipMode FlipMode
The flip mode.
Definition: SDL3pp_surface.h:182
Uint32 MapSurfaceRGB(SurfaceConstParam surface, Uint8 r, Uint8 g, Uint8 b)
Map an RGB triple to an opaque pixel value for a surface.
Definition: SDL3pp_surface.h:4491
void GetColorMod(Uint8 *r, Uint8 *g, Uint8 *b) const
Get the additional color value multiplied into blit operations.
Definition: SDL3pp_surface.h:3270
SurfaceLock Lock()
Set up a surface for directly accessing the pixels.
Definition: SDL3pp_surface.h:2729
constexpr ScaleMode SCALEMODE_INVALID
INVALID.
Definition: SDL3pp_surface.h:157
constexpr int GetWidth() const
Get the width in pixels.
Definition: SDL3pp_surface.h:4919
void UnlockSurface(SurfaceParam surface)
Release a surface after directly accessing the pixels.
Definition: SDL3pp_surface.h:2750
void PremultiplySurfaceAlpha(SurfaceParam surface, bool linear)
Premultiply the alpha in a surface.
Definition: SDL3pp_surface.h:3848
void SetColorMod(Uint8 r, Uint8 g, Uint8 b)
Set an additional color value multiplied into blit operations.
Definition: SDL3pp_surface.h:3240
void PremultiplyAlpha(const PointRaw &size, PixelFormat src_format, const void *src, int src_pitch, PixelFormat dst_format, void *dst, int dst_pitch, bool linear)
Premultiply the alpha on a block of pixels.
Definition: SDL3pp_surface.h:3813
void BlitAt(SurfaceParam src, OptionalRef< const RectRaw > srcrect, const PointRaw &dstpos)
Performs a fast blit from the source surface to the destination surface with clipping.
Definition: SDL3pp_surface.h:4061
void BlitSurfaceTiledWithScale(SurfaceParam src, OptionalRef< const RectRaw > srcrect, float scale, ScaleMode scaleMode, SurfaceParam dst, OptionalRef< const RectRaw > dstrect)
Perform a scaled and tiled blit to a destination surface, which may be of a different format.
Definition: SDL3pp_surface.h:4361
void SetBlendMode(BlendMode blendMode)
Set the blend mode used for blit operations.
Definition: SDL3pp_surface.h:3395
OwnArray< SurfaceRaw > GetImages() const
Get an array including all versions of a surface.
Definition: SDL3pp_surface.h:2667
Surface Rotate(float angle)
Return a copy of a surface rotated clockwise a number of degrees.
Definition: SDL3pp_surface.h:3553
Surface CreateSurface(const PointRaw &size, PixelFormat format)
Allocate a new surface with a specific pixel format.
Definition: SDL3pp_surface.h:2304
OwnArray< SurfaceRaw > GetSurfaceImages(SurfaceConstParam surface)
Get an array including all versions of a surface.
Definition: SDL3pp_surface.h:2660
constexpr int GetSurfacePitch(SurfaceConstParam surface)
Get pitch in bytes.
Definition: SDL3pp_surface.h:4956
constexpr FlipMode FLIP_HORIZONTAL
flip horizontally
Definition: SDL3pp_surface.h:186
void BlitScaled(SurfaceParam src, OptionalRef< const RectRaw > srcrect, OptionalRef< const RectRaw > dstrect, ScaleMode scaleMode)
Perform a scaled blit to a destination surface, which may be of a different format.
Definition: SDL3pp_surface.h:4209
void ReadPixel(const PointRaw &p, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a) const
Retrieves a single pixel from a surface.
Definition: SDL3pp_surface.h:4665
void ReadSurfacePixelFloat(SurfaceConstParam surface, const PointRaw &p, float *r, float *g, float *b, float *a)
Retrieves a single pixel from a surface.
Definition: SDL3pp_surface.h:4702
Palette GetSurfacePalette(SurfaceConstParam surface)
Get the palette used by a surface.
Definition: SDL3pp_surface.h:2568
void StretchSurface(SurfaceParam src, OptionalRef< RectRaw > srcrect, SurfaceParam dst, OptionalRef< RectRaw > dstrect, ScaleMode scaleMode)
Perform a stretched pixel copy from one surface to another.
Definition: SDL3pp_surface.h:4279
void FillSurfaceRect(SurfaceParam dst, OptionalRef< const RectRaw > rect, Uint32 color)
Perform a fast fill of a rectangle with a specific color.
Definition: SDL3pp_surface.h:3910
Color GetSurfaceMod(SurfaceConstParam surface)
Get the additional color and alpha value multiplied into blit operations.
Definition: SDL3pp_surface.h:3362
void Fill(Uint32 color)
Perform a fast fill of a rectangle with a specific color.
Definition: SDL3pp_surface.h:3938
Uint32 MapRGBA(ColorRaw c) const
Map an RGBA quadruple to a pixel value for a surface.
Definition: SDL3pp_surface.h:4538
Surface Scale(const PointRaw &size, ScaleMode scaleMode) const
Creates a new surface identical to the existing surface, scaled to the desired size.
Definition: SDL3pp_surface.h:3615
void ConvertPixelsAndColorspace(const PointRaw &size, PixelFormat src_format, Colorspace src_colorspace, PropertiesParam src_properties, const void *src, int src_pitch, PixelFormat dst_format, Colorspace dst_colorspace, PropertiesParam dst_properties, void *dst, int dst_pitch)
Copy a block of pixels of one format and colorspace to another format and colorspace.
Definition: SDL3pp_surface.h:3765
void SetColorspace(Colorspace colorspace)
Set the colorspace used by a surface.
Definition: SDL3pp_surface.h:2455
void BlitTiled(SurfaceParam src, OptionalRef< const RectRaw > srcrect, OptionalRef< const RectRaw > dstrect)
Perform a tiled blit to a destination surface, which may be of a different format.
Definition: SDL3pp_surface.h:4328
void ClearColorKey()
Unset the color key (transparent pixel) in a surface.
Definition: SDL3pp_surface.h:3155
void AddSurfaceAlternateImage(SurfaceParam surface, SurfaceParam image)
Add an alternate version of a surface.
Definition: SDL3pp_surface.h:2603
Uint32 SurfaceFlags
The flags on an Surface.
Definition: SDL3pp_surface.h:127
void WritePixel(const PointRaw &p, ColorRaw c)
Writes a single pixel to a surface.
Definition: SDL3pp_surface.h:4854
PropertiesRef GetSurfaceProperties(SurfaceConstParam surface)
Get the properties associated with a surface.
Definition: SDL3pp_surface.h:2398
void BlitSurface(SurfaceParam src, OptionalRef< const RectRaw > srcrect, SurfaceParam dst, OptionalRef< const RectRaw > dstrect)
Performs a fast blit from the source surface to the destination surface with clipping.
Definition: SDL3pp_surface.h:4046
void FillRect(OptionalRef< const RectRaw > rect, Uint32 color)
Perform a fast fill of a rectangle with a specific color.
Definition: SDL3pp_surface.h:3917
void Unlock(SurfaceLock &&lock)
Release a surface after directly accessing the pixels.
Definition: SDL3pp_surface.h:2752
void ReadPixelFloat(const PointRaw &p, float *r, float *g, float *b, float *a) const
Retrieves a single pixel from a surface.
Definition: SDL3pp_surface.h:4790
void GetSurfaceColorMod(SurfaceConstParam surface, Uint8 *r, Uint8 *g, Uint8 *b)
Get the additional color value multiplied into blit operations.
Definition: SDL3pp_surface.h:3262
void SetAlphaMod(Uint8 alpha)
Set an additional alpha value used in blit operations.
Definition: SDL3pp_surface.h:3300
constexpr void * GetPixels() const
Get the pixels.
Definition: SDL3pp_surface.h:5001
SDL_ScaleMode ScaleMode
The scaling mode.
Definition: SDL3pp_surface.h:153
void SetRLE(bool enabled)
Set the RLE acceleration hint for a surface.
Definition: SDL3pp_surface.h:3082
void BlitUnchecked(SurfaceParam src, const RectRaw &srcrect, const RectRaw &dstrect)
Perform low-level surface blitting only.
Definition: SDL3pp_surface.h:4172
void ConvertPixels(const PointRaw &size, PixelFormat src_format, const void *src, int src_pitch, PixelFormat dst_format, void *dst, int dst_pitch)
Copy a block of pixels of one format to another format.
Definition: SDL3pp_surface.h:3724
void ClearSurfaceColorKey(SurfaceParam surface)
Unset the color key (transparent pixel) in a surface.
Definition: SDL3pp_surface.h:3150
void WriteSurfacePixelFloat(SurfaceParam surface, const PointRaw &p, const FColorRaw &c)
Writes a single pixel to a surface.
Definition: SDL3pp_surface.h:4875
void SetPalette(PaletteParam palette)
Set the palette used by a surface.
Definition: SDL3pp_surface.h:2550
Color GetMod() const
Get the additional color and alpha value multiplied into blit operations.
Definition: SDL3pp_surface.h:3370
void LockSurface(SurfaceParam surface)
Set up a surface for directly accessing the pixels.
Definition: SDL3pp_surface.h:2724
constexpr FlipMode FLIP_HORIZONTAL_AND_VERTICAL
flip horizontally and vertically (not a diagonal flip)
Definition: SDL3pp_surface.h:193
void SetSurfaceBlendMode(SurfaceParam surface, BlendMode blendMode)
Set the blend mode used for blit operations.
Definition: SDL3pp_surface.h:3390
bool SetClipRect(OptionalRef< const RectRaw > rect)
Set the clipping rectangle for a surface.
Definition: SDL3pp_surface.h:3453
void AddAlternateImage(SurfaceParam image)
Add an alternate version of a surface.
Definition: SDL3pp_surface.h:2608
void WritePixelFloat(const PointRaw &p, const FColorRaw &c)
Writes a single pixel to a surface.
Definition: SDL3pp_surface.h:4905
void RemoveSurfaceAlternateImages(SurfaceParam surface)
Remove all alternate versions of a surface.
Definition: SDL3pp_surface.h:2689
Main include header for the SDL3pp library.
A structure that represents a color as RGBA components.
Definition: SDL3pp_pixels.h:2192
The bits of this structure can be directly reinterpreted as a float-packed color which uses the PIXEL...
Definition: SDL3pp_pixels.h:2365
Safely wrap IOStream for non owning parameters.
Definition: SDL3pp_iostream.h:34
Safely wrap Palette for non owning parameters.
Definition: SDL3pp_pixels.h:105
The structure that defines a point (using integers).
Definition: SDL3pp_rect.h:83
Safely wrap Properties for non owning parameters.
Definition: SDL3pp_properties.h:53
Semi-safe reference for Properties.
Definition: SDL3pp_properties.h:716
A rectangle, with the origin at the upper left (using integers).
Definition: SDL3pp_rect.h:845
Safely wrap Surface for non owning const parameters.
Definition: SDL3pp_surface.h:83
constexpr SurfaceConstParam(const SurfaceRaw value)
Constructs from SurfaceRaw.
Definition: SDL3pp_surface.h:87
constexpr SurfaceConstParam(std::nullptr_t=nullptr)
Constructs null/invalid.
Definition: SDL3pp_surface.h:99
constexpr SurfaceConstParam(SurfaceParam value)
Constructs from SurfaceParam.
Definition: SDL3pp_surface.h:93
const SurfaceRaw value
parameter's const SurfaceRaw
Definition: SDL3pp_surface.h:84
constexpr auto operator<=>(const SurfaceConstParam &other) const =default
Comparison.
constexpr auto operator->()
member access to underlying SurfaceRaw.
Definition: SDL3pp_surface.h:114
Safely wrap Surface for non owning parameters.
Definition: SDL3pp_surface.h:53
SurfaceRaw value
parameter's SurfaceRaw
Definition: SDL3pp_surface.h:54
constexpr auto operator->()
member access to underlying SurfaceRaw.
Definition: SDL3pp_surface.h:78
constexpr SurfaceParam(SurfaceRaw value)
Constructs from SurfaceRaw.
Definition: SDL3pp_surface.h:57
constexpr SurfaceParam(std::nullptr_t=nullptr)
Constructs null/invalid.
Definition: SDL3pp_surface.h:63
constexpr auto operator<=>(const SurfaceParam &other) const =default
Comparison.
Safe reference for Surface.
Definition: SDL3pp_surface.h:1998
SurfaceRef(Surface resource) noexcept
Constructs from Surface.
Definition: SDL3pp_surface.h:2014
SurfaceRef(SurfaceRaw resource) noexcept
Constructs from SurfaceRaw.
Definition: SDL3pp_surface.h:2008