Added image resize.

This commit is contained in:
Branimir Karadžić
2017-04-18 20:56:50 -07:00
parent 01b04ae372
commit 4a29607def
5 changed files with 31 additions and 0 deletions

View File

@@ -57,6 +57,12 @@ namespace bimg
, uint16_t _height
);
///
bool imageResizeRgba32fLinear(
ImageContainer* _dst
, const ImageContainer* _src
);
} // namespace bimg
#endif // BIMG_ENCODE_H_HEADER_GUARD

View File

@@ -12,6 +12,7 @@ project "bimg"
}
files {
path.join(BIMG_DIR, "include/**"),
path.join(BIMG_DIR, "src/image.*"),
}

View File

@@ -15,6 +15,7 @@ project "bimg_decode"
}
files {
path.join(BIMG_DIR, "include/**"),
path.join(BIMG_DIR, "src/image_decode.*"),
}

View File

@@ -15,6 +15,7 @@ project "bimg_encode"
}
files {
path.join(BIMG_DIR, "include/**"),
path.join(BIMG_DIR, "src/image_encode.*"),
path.join(BIMG_DIR, "3rdparty/libsquish/**.cpp"),
path.join(BIMG_DIR, "3rdparty/libsquish/**.h"),

View File

@@ -12,6 +12,13 @@
#include <pvrtc/PvrTcEncoder.h>
#include <edtaa3/edtaa3func.h>
BX_PRAGMA_DIAGNOSTIC_PUSH();
BX_PRAGMA_DIAGNOSTIC_IGNORED_MSVC(4100) // warning C4100: 'alloc_context': unreferenced formal parameter
BX_PRAGMA_DIAGNOSTIC_IGNORED_MSVC(4702) // warning C4702: unreachable code
#define STB_IMAGE_RESIZE_IMPLEMENTATION
#include <stb/stb_image_resize.h>
BX_PRAGMA_DIAGNOSTIC_POP();
extern "C" {
#include <iqa.h>
}
@@ -301,4 +308,19 @@ namespace bimg
return result;
}
bool imageResizeRgba32fLinear(ImageContainer* _dst, const ImageContainer* _src)
{
int result = stbir_resize_float_generic(
(const float*)_src->m_data, _src->m_width, _src->m_height, _src->m_width*16
, ( float*)_dst->m_data, _dst->m_width, _dst->m_height, _dst->m_width*16
, 4, 1
, 0
, STBIR_EDGE_CLAMP
, STBIR_FILTER_DEFAULT
, STBIR_COLORSPACE_LINEAR
, NULL
);
return 1 == result;
}
} // namespace bimg