LkEngine 0.1.2
 
Loading...
Searching...
No Matches
MemoryUtils.h
1#pragma once
2
3#include <stb/stb_image.h>
4#include <stb/stb_image_resize2.h>
5
6namespace LkEngine::MemoryUtils {
7
8 static unsigned char* ResizeImageData(const void* Data,
9 const uint64_t MemorySizeInBytes,
10 const int OldWidth,
11 const int OldHeight,
12 const int NewWidth,
13 const int NewHeight,
14 const stbir_pixel_layout PixelLayout = STBIR_RGBA)
15 {
16 stbi_uc* ResizedMemoryAlloc = (stbi_uc*)malloc(MemorySizeInBytes);
17 stbir_resize_uint8_linear((stbi_uc*)Data,
18 OldWidth,
19 OldHeight,
20 0,
21 ResizedMemoryAlloc,
22 NewWidth,
23 NewHeight,
24 0,
25 PixelLayout);
26
27 return ResizedMemoryAlloc;
28 }
29
30}