Compare commits
10 Commits
abcb8a1473
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b3efc7807e
|
||
|
|
a7a4a0aa48
|
||
|
|
d5ffcc4c6e
|
||
|
|
1ded3ab244
|
||
|
|
277546a574
|
||
|
|
a263068844
|
||
|
|
8405cbc9e1
|
||
|
|
9ce87e7427
|
||
|
|
1dec054b3d
|
||
|
|
b1b9dfee25
|
1
3rdParty/CMakeLists.txt
vendored
1
3rdParty/CMakeLists.txt
vendored
@@ -37,6 +37,7 @@ add_subdirectory(moodycamel_concurrentqueue)
|
|||||||
add_subdirectory(tinyusdz)
|
add_subdirectory(tinyusdz)
|
||||||
add_subdirectory(dds_image)
|
add_subdirectory(dds_image)
|
||||||
add_subdirectory(brotli)
|
add_subdirectory(brotli)
|
||||||
|
add_subdirectory(libtiff)
|
||||||
|
|
||||||
if (NOT IOS AND OPENVULKANO_ENABLE_CURL)
|
if (NOT IOS AND OPENVULKANO_ENABLE_CURL)
|
||||||
add_subdirectory(curl)
|
add_subdirectory(curl)
|
||||||
|
|||||||
2
3rdParty/libarchive/CMakeLists.txt
vendored
2
3rdParty/libarchive/CMakeLists.txt
vendored
@@ -26,7 +26,7 @@ function(LinkLibArchive TARGET)
|
|||||||
elseif (EXISTS ${CMAKE_BINARY_DIR}/deps/INSTALL/lib/libarchive.a)
|
elseif (EXISTS ${CMAKE_BINARY_DIR}/deps/INSTALL/lib/libarchive.a)
|
||||||
set(LibArchive_LIBRARIES ${CMAKE_BINARY_DIR}/deps/INSTALL/lib/libarchive.a)
|
set(LibArchive_LIBRARIES ${CMAKE_BINARY_DIR}/deps/INSTALL/lib/libarchive.a)
|
||||||
endif()
|
endif()
|
||||||
set(ZLIB_USE_STATIC_LIBS ON)
|
set(ZLIB_USE_STATIC_LIBS ON CACHE BOOL "" FORCE)
|
||||||
find_package(ZLIB REQUIRED)
|
find_package(ZLIB REQUIRED)
|
||||||
find_package(zstd REQUIRED)
|
find_package(zstd REQUIRED)
|
||||||
find_package(LZ4 QUIET)
|
find_package(LZ4 QUIET)
|
||||||
|
|||||||
25
3rdParty/libtiff/CMakeLists.txt
vendored
Normal file
25
3rdParty/libtiff/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
include(FetchContent)
|
||||||
|
|
||||||
|
if(NOT DEFINED LIBTIFF_REPO)
|
||||||
|
set(LIBTIFF_REPO https://git.madvoxel.net/Mirrors/libtiff.git)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
set(FETCHCONTENT_UPDATES_DISCONNECTED ON)
|
||||||
|
|
||||||
|
FetchContent_Declare(
|
||||||
|
libtiff
|
||||||
|
EXCLUDE_FROM_ALL
|
||||||
|
GIT_REPOSITORY ${LIBTIFF_REPO}
|
||||||
|
GIT_SHALLOW TRUE
|
||||||
|
)
|
||||||
|
|
||||||
|
set(tiff-static ON CACHE BOOL "" FORCE)
|
||||||
|
set(tiff-tools OFF CACHE BOOL "" FORCE)
|
||||||
|
set(tiff-tests OFF CACHE BOOL "" FORCE)
|
||||||
|
set(tiff-docs OFF CACHE BOOL "" FORCE)
|
||||||
|
set(tiff-contrib OFF CACHE BOOL "" FORCE)
|
||||||
|
set(tiff-opengl OFF CACHE BOOL "" FORCE)
|
||||||
|
set(ZLIB_USE_STATIC_LIBS ON CACHE BOOL "" FORCE)
|
||||||
|
|
||||||
|
list(APPEND CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR}/deps/INSTALL)
|
||||||
|
FetchContent_MakeAvailable(libtiff)
|
||||||
@@ -8,6 +8,10 @@ if ("${PLATFORM}" STREQUAL "OS64" OR "${PLATFORM}" STREQUAL "OS64COMBINED")
|
|||||||
set(ENABLE_ARC OFF)
|
set(ENABLE_ARC OFF)
|
||||||
set(DEPLOYMENT_TARGET "14.0")
|
set(DEPLOYMENT_TARGET "14.0")
|
||||||
set(CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_SOURCE_DIR}/cmake/toolchain/ios.toolchain.cmake")
|
set(CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_SOURCE_DIR}/cmake/toolchain/ios.toolchain.cmake")
|
||||||
|
|
||||||
|
if(NOT DEFINED CMAKE_IGNORE_PREFIX_PATH OR CMAKE_IGNORE_PREFIX_PATH STREQUAL "")
|
||||||
|
set(CMAKE_IGNORE_PREFIX_PATH "/opt/homebrew") # CACHE STRING "Prefixes to ignore during find_* calls" FORCE
|
||||||
|
endif()
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
|
set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
|
||||||
|
|||||||
@@ -13,6 +13,15 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
|||||||
GENERATED_DATA_PATH="$1"
|
GENERATED_DATA_PATH="$1"
|
||||||
SHADER_PATH="$2"
|
SHADER_PATH="$2"
|
||||||
UNIQUE_ENTRY_NAME="$3"
|
UNIQUE_ENTRY_NAME="$3"
|
||||||
|
BIN2C_EXE="${4:-bin2c}"
|
||||||
|
|
||||||
|
if [[ "$(uname)" != "Darwin" ]]; then
|
||||||
|
if [ -z "$4" ]; then
|
||||||
|
if [ -e "$HOME/bin/bin2c" ]; then
|
||||||
|
BIN2C_EXE="$HOME/bin/bin2c"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
HEADER_PATH="$1"/"GeneratedShaderData_${3}.h"
|
HEADER_PATH="$1"/"GeneratedShaderData_${3}.h"
|
||||||
C_PATH="$1"/"GeneratedShaderData_${3}.c"
|
C_PATH="$1"/"GeneratedShaderData_${3}.c"
|
||||||
@@ -59,7 +68,7 @@ for unique_name in ${unique_file_names[@]} ; do
|
|||||||
check_return_code
|
check_return_code
|
||||||
done
|
done
|
||||||
|
|
||||||
(cd "$GENERATED_DATA_PATH" && bin2c -t -d $unique_name.h -o $unique_name.c *.spv)
|
(cd "$GENERATED_DATA_PATH" && "$BIN2C_EXE" -t -d $unique_name.h -o $unique_name.c *.spv)
|
||||||
check_return_code
|
check_return_code
|
||||||
rm "$GENERATED_DATA_PATH"/*.spv
|
rm "$GENERATED_DATA_PATH"/*.spv
|
||||||
|
|
||||||
|
|||||||
@@ -2,5 +2,5 @@ execute_process(COMMAND "@BASH_EXECUTABLE@" CompileShaders.sh "@SHADER_OUTPUT_DE
|
|||||||
WORKING_DIRECTORY "@SCRIPT_FOLDER@"
|
WORKING_DIRECTORY "@SCRIPT_FOLDER@"
|
||||||
RESULT_VARIABLE res_var)
|
RESULT_VARIABLE res_var)
|
||||||
if(NOT "${res_var}" STREQUAL "0")
|
if(NOT "${res_var}" STREQUAL "0")
|
||||||
message(FATAL_ERROR "Failed to recompile shaders")
|
message(FATAL_ERROR "Failed to recompile shaders. Result: ${res_val}")
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
20
cmake/functions/OverrideFindProgram.cmake
Normal file
20
cmake/functions/OverrideFindProgram.cmake
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
if(NOT COMMAND _original_find_program)
|
||||||
|
# Save the original find_program as _original_find_program
|
||||||
|
macro(_original_find_program)
|
||||||
|
_find_program(${ARGV})
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
# Now override find_program
|
||||||
|
function(find_program)
|
||||||
|
message("running find_program with CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH=ON, CMAKE_FIND_USE_CMAKE_SYSTEM_PATH=ON")
|
||||||
|
set(CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH ON)
|
||||||
|
set(CMAKE_FIND_USE_CMAKE_SYSTEM_PATH ON)
|
||||||
|
|
||||||
|
cmake_parse_arguments(PARSE_ARGV 0 FWD "" "" "")
|
||||||
|
set(quotedArgs "")
|
||||||
|
foreach(arg IN LISTS FWD_UNPARSED_ARGUMENTS)
|
||||||
|
string(APPEND quotedArgs " [===[${arg}]===]")
|
||||||
|
endforeach()
|
||||||
|
cmake_language(EVAL CODE "_find_program(${quotedArgs})")
|
||||||
|
endfunction()
|
||||||
|
endif()
|
||||||
@@ -15,6 +15,9 @@ if ("${BASH_EXECUTABLE}" STREQUAL "")
|
|||||||
find_program(BASH_PROGRAM bash NO_CACHE REQUIRED)
|
find_program(BASH_PROGRAM bash NO_CACHE REQUIRED)
|
||||||
set(BASH_EXECUTABLE ${BASH_PROGRAM} CACHE FILEPATH "Path to bash executable" FORCE)
|
set(BASH_EXECUTABLE ${BASH_PROGRAM} CACHE FILEPATH "Path to bash executable" FORCE)
|
||||||
endif()
|
endif()
|
||||||
|
if ("${BASH_EXECUTABLE}" STREQUAL "") # fallback to just bash and hope it works, this way at least we should get some proper error
|
||||||
|
set(BASH_EXECUTABLE "bash" CACHE FILEPATH "Path to bash executable" FORCE)
|
||||||
|
endif()
|
||||||
# go from openVulkano/OpenVulkanoCpp to openVulkano
|
# go from openVulkano/OpenVulkanoCpp to openVulkano
|
||||||
cmake_path(GET CMAKE_CURRENT_SOURCE_DIR PARENT_PATH ROOT_FOLDER)
|
cmake_path(GET CMAKE_CURRENT_SOURCE_DIR PARENT_PATH ROOT_FOLDER)
|
||||||
set(SCRIPT_FOLDER "${ROOT_FOLDER}/Scripts")
|
set(SCRIPT_FOLDER "${ROOT_FOLDER}/Scripts")
|
||||||
@@ -75,7 +78,7 @@ if (IOS)
|
|||||||
)
|
)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
target_link_libraries(openVulkanoCpp PUBLIC magic_enum brotlienc brotlidec yaml-cpp fmt spdlog glm pugixml stb eigen utf8cpp imgui_internal TracyClient stud-uuid ryml unordered_dense concurrentqueue units dds_image)
|
target_link_libraries(openVulkanoCpp PUBLIC magic_enum brotlienc brotlidec yaml-cpp fmt spdlog glm pugixml stb eigen utf8cpp imgui_internal TracyClient stud-uuid ryml unordered_dense concurrentqueue units dds_image tiff)
|
||||||
if (OPENVULKANO_ENABLE_KTX)
|
if (OPENVULKANO_ENABLE_KTX)
|
||||||
target_link_libraries(openVulkanoCpp PUBLIC ktx)
|
target_link_libraries(openVulkanoCpp PUBLIC ktx)
|
||||||
endif ()
|
endif ()
|
||||||
|
|||||||
333
openVulkanoCpp/Image/TiffWrapper.hpp
Normal file
333
openVulkanoCpp/Image/TiffWrapper.hpp
Normal file
@@ -0,0 +1,333 @@
|
|||||||
|
/*
|
||||||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#pragma clang diagnostic push
|
||||||
|
#pragma ide diagnostic ignored "OCUnusedGlobalDeclarationInspection"
|
||||||
|
|
||||||
|
#include "Math/Math.hpp"
|
||||||
|
#include <tiffio.h>
|
||||||
|
#include <filesystem>
|
||||||
|
|
||||||
|
namespace OpenVulkano
|
||||||
|
{
|
||||||
|
class TiffCompression
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
enum Compression: uint8_t { UNKNOWN = 0, NONE, LZW, JPEG, DEFLATE, ZSTD };
|
||||||
|
|
||||||
|
TiffCompression() : compression(NONE) {}
|
||||||
|
TiffCompression(Compression compression) : compression(compression) {}
|
||||||
|
TiffCompression(const TiffCompression&) = default;
|
||||||
|
TiffCompression(TiffCompression&&) = default;
|
||||||
|
|
||||||
|
TiffCompression& operator =(const Compression comp) { compression = comp; return *this; }
|
||||||
|
TiffCompression& operator =(const TiffCompression&) = default;
|
||||||
|
TiffCompression& operator =(TiffCompression&&) = default;
|
||||||
|
|
||||||
|
[[nodiscard]] uint16_t GetTiffType() const
|
||||||
|
{
|
||||||
|
switch (compression)
|
||||||
|
{
|
||||||
|
case LZW: return COMPRESSION_LZW;
|
||||||
|
case JPEG: return COMPRESSION_JPEG;
|
||||||
|
case DEFLATE: return COMPRESSION_DEFLATE;
|
||||||
|
case ZSTD: return COMPRESSION_ZSTD;
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
return COMPRESSION_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static TiffCompression FromTiffType(const uint16_t comp)
|
||||||
|
{
|
||||||
|
switch (comp)
|
||||||
|
{
|
||||||
|
case COMPRESSION_NONE: return NONE;
|
||||||
|
case COMPRESSION_LZW: return LZW;
|
||||||
|
case COMPRESSION_JPEG: return JPEG;
|
||||||
|
case COMPRESSION_DEFLATE: return DEFLATE;
|
||||||
|
case COMPRESSION_ZSTD: return ZSTD;
|
||||||
|
}
|
||||||
|
return UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
Compression compression;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TiffWrapper final
|
||||||
|
{
|
||||||
|
TIFF* tiff = nullptr;
|
||||||
|
|
||||||
|
public:
|
||||||
|
//region Base C++ wrapping
|
||||||
|
TiffWrapper() = default;
|
||||||
|
TiffWrapper(const std::filesystem::path& path) { Open(path); }
|
||||||
|
TiffWrapper(const TiffWrapper&) = delete;
|
||||||
|
TiffWrapper(TiffWrapper&& other) : tiff(other.tiff) { other.tiff = nullptr; }
|
||||||
|
~TiffWrapper() { }
|
||||||
|
TiffWrapper& Open(const std::filesystem::path& path)
|
||||||
|
{
|
||||||
|
Close();
|
||||||
|
#ifdef _WIN32
|
||||||
|
tiff = TIFFOpenW(path.c_str(), "w");
|
||||||
|
#else
|
||||||
|
tiff = TIFFOpen(path.c_str(), "w");
|
||||||
|
#endif
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
void Close() { if (tiff) TIFFClose(tiff); tiff = nullptr; }
|
||||||
|
operator TIFF*() { return tiff; }
|
||||||
|
TiffWrapper& operator =(const TiffWrapper&) = delete;
|
||||||
|
TiffWrapper& operator =(TiffWrapper&& other) { Close(); tiff = other.tiff; other.tiff = nullptr; return *this; }
|
||||||
|
//endregion
|
||||||
|
|
||||||
|
//region TIFF functions
|
||||||
|
void Cleanup() { TIFFCleanup(tiff); }
|
||||||
|
bool Flush() { return TIFFFlush(tiff); }
|
||||||
|
bool FlushData() { return TIFFFlushData(tiff); }
|
||||||
|
|
||||||
|
//region TIFF fields
|
||||||
|
template<typename... Args>
|
||||||
|
void SetField(uint32_t tag, Args&&... args)
|
||||||
|
{
|
||||||
|
TIFFSetField(tiff, tag, std::forward<Args>(args)...);
|
||||||
|
}
|
||||||
|
void UnsetField(uint32_t tag) { TIFFUnsetField(tiff, tag); }
|
||||||
|
template<typename... Args>
|
||||||
|
bool GetField(const uint32_t tag, Args&&... args) const { return TIFFGetField(tiff, tag, std::forward<Args>(args)...); }
|
||||||
|
int VGetField(const uint32_t tag, va_list ap) { return TIFFVGetField(tiff, tag, ap); }
|
||||||
|
[[nodiscard]] int GetFieldDefaulted(const uint32_t tag) { return TIFFGetFieldDefaulted(tiff, tag); }
|
||||||
|
int VGetFieldDefaulted(const uint32_t tag, va_list ap) { return TIFFVGetFieldDefaulted(tiff, tag, ap); }
|
||||||
|
//endregion
|
||||||
|
|
||||||
|
[[nodiscard]] int GetTagListCount() const { return TIFFGetTagListCount(tiff); }
|
||||||
|
[[nodiscard]] uint32_t GetTagListEntry(const int tagIndex) const { return TIFFGetTagListEntry(tiff, tagIndex); }
|
||||||
|
|
||||||
|
[[nodiscard]] const TIFFField* FindField(const uint32_t tag, const TIFFDataType dt) { return TIFFFindField(tiff, tag, dt); }
|
||||||
|
[[nodiscard]] const TIFFField* FieldWithTag(const uint32_t tag) { return TIFFFieldWithTag(tiff, tag); }
|
||||||
|
[[nodiscard]] const TIFFField* FieldWithName(const char* tag) { return TIFFFieldWithName(tiff, tag); }
|
||||||
|
|
||||||
|
[[nodiscard]] TIFFTagMethods* AccessTagMethods() const { return TIFFAccessTagMethods(tiff); }
|
||||||
|
[[nodiscard]] void* GetClientInfo(const char* name) const { return TIFFGetClientInfo(tiff, name); }
|
||||||
|
void SetClientInfo(void* data, const char* name) { TIFFSetClientInfo(tiff, data, name); }
|
||||||
|
|
||||||
|
bool ReadDirectory() { return TIFFReadDirectory(tiff); }
|
||||||
|
bool ReadCustomDirectory(const uint64_t dirOffset, const TIFFFieldArray* infoArray) {
|
||||||
|
return TIFFReadCustomDirectory(tiff, dirOffset, infoArray);
|
||||||
|
}
|
||||||
|
bool ReadEXIFDirectory(const uint64_t dirOffset) { return TIFFReadEXIFDirectory(tiff, dirOffset); }
|
||||||
|
bool ReadGPSDirectory(const uint64_t dirOffset) { return TIFFReadGPSDirectory(tiff, dirOffset); }
|
||||||
|
|
||||||
|
[[nodiscard]] uint64_t ScanlineSize64() const { return TIFFScanlineSize64(tiff); }
|
||||||
|
[[nodiscard]] tmsize_t ScanlineSize() const { return TIFFScanlineSize(tiff); }
|
||||||
|
[[nodiscard]] uint64_t RasterScanlineSize64() const { return TIFFRasterScanlineSize64(tiff); }
|
||||||
|
[[nodiscard]] tmsize_t RasterScanlineSize() const { return TIFFRasterScanlineSize(tiff); }
|
||||||
|
[[nodiscard]] uint64_t StripSize64() const { return TIFFStripSize64(tiff); }
|
||||||
|
[[nodiscard]] tmsize_t StripSize() const { return TIFFStripSize(tiff); }
|
||||||
|
[[nodiscard]] uint64_t RawStripSize64(const uint32_t strip) const { return TIFFRawStripSize64(tiff, strip); }
|
||||||
|
[[nodiscard]] tmsize_t RawStripSize(const uint32_t strip) const { return TIFFRawStripSize(tiff, strip); }
|
||||||
|
[[nodiscard]] uint64_t VStripSize64(const uint32_t numRows) const { return TIFFVStripSize64(tiff, numRows); }
|
||||||
|
[[nodiscard]] tmsize_t VStripSize(const uint32_t numRows) const { return TIFFVStripSize(tiff, numRows); }
|
||||||
|
[[nodiscard]] uint64_t TileRowSize64() const { return TIFFTileRowSize64(tiff); }
|
||||||
|
[[nodiscard]] tmsize_t TileRowSize() const { return TIFFTileRowSize(tiff); }
|
||||||
|
[[nodiscard]] uint64_t TileSize64() const { return TIFFTileSize64(tiff); }
|
||||||
|
[[nodiscard]] tmsize_t TileSize() const { return TIFFTileSize(tiff); }
|
||||||
|
[[nodiscard]] uint64_t VTileSize64(const uint32_t numRows) const { return TIFFVTileSize64(tiff, numRows); }
|
||||||
|
[[nodiscard]] tmsize_t VTileSize(const uint32_t numRows) const { return TIFFVTileSize(tiff, numRows); }
|
||||||
|
[[nodiscard]] uint32_t DefaultStripSize(uint32_t request) { return TIFFDefaultStripSize(tiff, request); }
|
||||||
|
[[nodiscard]] Math::Vector2ui DefaultTileSize() const
|
||||||
|
{
|
||||||
|
Math::Vector2ui res;
|
||||||
|
TIFFDefaultTileSize(tiff, &res.x, &res.y);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
[[nodiscard]] int FileDescriptor() { return TIFFFileno(tiff); }
|
||||||
|
int SetFileDescriptor(int fd) { return TIFFSetFileno(tiff, fd); }
|
||||||
|
[[nodiscard]] thandle_t Clientdata() const { return TIFFClientdata(tiff); }
|
||||||
|
thandle_t SetClientdata(thandle_t newValue) { return TIFFSetClientdata(tiff, newValue); }
|
||||||
|
[[nodiscard]] int GetMode() const { return TIFFGetMode(tiff); }
|
||||||
|
int SetMode(int mode) { return TIFFSetMode(tiff, mode); }
|
||||||
|
[[nodiscard]] bool IsTiled() const { return TIFFIsTiled(tiff); }
|
||||||
|
[[nodiscard]] bool IsByteSwapped() const { return TIFFIsByteSwapped(tiff); }
|
||||||
|
[[nodiscard]] bool IsUpSampled() const { return TIFFIsUpSampled(tiff); }
|
||||||
|
[[nodiscard]] bool IsMSB2LSB() const { return TIFFIsMSB2LSB(tiff); }
|
||||||
|
[[nodiscard]] bool IsBigEndian() const { return TIFFIsBigEndian(tiff); }
|
||||||
|
[[nodiscard]] TIFFReadWriteProc GetReadProc() const { return TIFFGetReadProc(tiff); }
|
||||||
|
[[nodiscard]] TIFFReadWriteProc GetWriteProc() const { return TIFFGetWriteProc(tiff); }
|
||||||
|
[[nodiscard]] TIFFSeekProc GetSeekProc() const { return TIFFGetSeekProc(tiff); }
|
||||||
|
[[nodiscard]] TIFFCloseProc GetCloseProc() const { return TIFFGetCloseProc(tiff); }
|
||||||
|
[[nodiscard]] TIFFSizeProc GetSizeProc() const { return TIFFGetSizeProc(tiff); }
|
||||||
|
[[nodiscard]] TIFFMapFileProc GetMapFileProc() const { return TIFFGetMapFileProc(tiff); }
|
||||||
|
[[nodiscard]] TIFFUnmapFileProc GetUnmapFileProc() const { return TIFFGetUnmapFileProc(tiff); }
|
||||||
|
[[nodiscard]] uint32_t CurrentRow() const { return TIFFCurrentRow(tiff); }
|
||||||
|
[[nodiscard]] uint16_t CurrentDirectory() const { return TIFFCurrentDirectory(tiff); }
|
||||||
|
[[nodiscard]] uint16_t NumberOfDirectories() const { return TIFFNumberOfDirectories(tiff); }
|
||||||
|
[[nodiscard]] uint64_t CurrentDirOffset() const { return TIFFCurrentDirOffset(tiff); }
|
||||||
|
[[nodiscard]] uint32_t CurrentStrip() const { return TIFFCurrentStrip(tiff); }
|
||||||
|
[[nodiscard]] uint32_t CurrentTile() const { return TIFFCurrentTile(tiff); }
|
||||||
|
int ReadBufferSetup(void* bp, tmsize_t size) {
|
||||||
|
return TIFFReadBufferSetup(tiff, bp, size);
|
||||||
|
}
|
||||||
|
int WriteBufferSetup(void * bp, tmsize_t size) {
|
||||||
|
return TIFFWriteBufferSetup(tiff, bp, size);
|
||||||
|
}
|
||||||
|
int SetupStrips() const { return TIFFSetupStrips(tiff); }
|
||||||
|
int WriteCheck(int p0, const char * p1) {
|
||||||
|
return TIFFWriteCheck(tiff, p0, p1);
|
||||||
|
}
|
||||||
|
void FreeDirectory() { TIFFFreeDirectory(tiff); }
|
||||||
|
int CreateDirectory() { return TIFFCreateDirectory(tiff); }
|
||||||
|
int CreateCustomDirectory(const TIFFFieldArray * p0) {
|
||||||
|
return TIFFCreateCustomDirectory(tiff, p0);
|
||||||
|
}
|
||||||
|
int CreateEXIFDirectory() { return TIFFCreateEXIFDirectory(tiff); }
|
||||||
|
bool LastDirectory() { return TIFFLastDirectory(tiff); }
|
||||||
|
int SetDirectory(unsigned short int p0) {
|
||||||
|
return TIFFSetDirectory(tiff, p0);
|
||||||
|
}
|
||||||
|
int SetSubDirectory(uint64_t p0) {
|
||||||
|
return TIFFSetSubDirectory(tiff, p0);
|
||||||
|
}
|
||||||
|
int UnlinkDirectory(unsigned short int p0) {
|
||||||
|
return TIFFUnlinkDirectory(tiff, p0);
|
||||||
|
}
|
||||||
|
int WriteDirectory() {
|
||||||
|
return TIFFWriteDirectory(tiff);
|
||||||
|
}
|
||||||
|
int WriteCustomDirectory(uint64_t* dirOffset) {
|
||||||
|
return TIFFWriteCustomDirectory(tiff, dirOffset);
|
||||||
|
}
|
||||||
|
int CheckpointDirectory() {
|
||||||
|
return TIFFCheckpointDirectory(tiff);
|
||||||
|
}
|
||||||
|
int RewriteDirectory() {
|
||||||
|
return TIFFRewriteDirectory(tiff);
|
||||||
|
}
|
||||||
|
void PrintDirectory(FILE* file, long flags) {
|
||||||
|
TIFFPrintDirectory(tiff, file, flags);
|
||||||
|
}
|
||||||
|
int ReadScanline(void * buf, uint32_t row, unsigned short int sample) {
|
||||||
|
return TIFFReadScanline(tiff, buf, row, sample);
|
||||||
|
}
|
||||||
|
int WriteScanline(void * buf, uint32_t row, unsigned short int sample) {
|
||||||
|
return TIFFWriteScanline(tiff, buf, row, sample);
|
||||||
|
}
|
||||||
|
int ReadRGBAImage(uint32_t rwidth, uint32_t rheight, uint32_t* raster, int stop) {
|
||||||
|
return TIFFReadRGBAImage(tiff, rwidth, rheight, raster, stop);
|
||||||
|
}
|
||||||
|
int ReadRGBAImageOriented(uint32_t rwidth, uint32_t rheight,
|
||||||
|
uint32_t *raster, int orientation, int stop) {
|
||||||
|
return TIFFReadRGBAImageOriented(tiff, rwidth, rheight, raster, orientation, stop);
|
||||||
|
}
|
||||||
|
int ReadRGBAStrip(uint32_t row, uint32_t *raster) {
|
||||||
|
return TIFFReadRGBAStrip(tiff, row, raster);
|
||||||
|
}
|
||||||
|
int ReadRGBATile(uint32_t col, uint32_t row, uint32_t *raster) {
|
||||||
|
return TIFFReadRGBATile(tiff, col, row, raster);
|
||||||
|
}
|
||||||
|
int ReadRGBAStripExt(uint32_t row, uint32_t *raster, int stop_on_error) {
|
||||||
|
return TIFFReadRGBAStripExt(tiff, row, raster, stop_on_error);
|
||||||
|
}
|
||||||
|
int ReadRGBATileExt(uint32_t col, uint32_t row, uint32_t *raster, int stop_on_error) {
|
||||||
|
return TIFFReadRGBATileExt(tiff, col, row, raster, stop_on_error);
|
||||||
|
}
|
||||||
|
int RGBAImageOK(char p0[1024]) {
|
||||||
|
return TIFFRGBAImageOK(tiff, p0);
|
||||||
|
}
|
||||||
|
[[nodiscard]] std::string FileName() const { return TIFFFileName(tiff); }
|
||||||
|
uint32_t ComputeTile(uint32_t x, uint32_t y, uint32_t z, unsigned short int s) {
|
||||||
|
return TIFFComputeTile(tiff, x, y, z, s);
|
||||||
|
}
|
||||||
|
int CheckTile(uint32_t x, uint32_t y, uint32_t z, unsigned short int s) {
|
||||||
|
return TIFFCheckTile(tiff, x, y, z, s);
|
||||||
|
}
|
||||||
|
[[nodiscard]] uint32_t NumberOfTiles() const { return TIFFNumberOfTiles(tiff); }
|
||||||
|
tmsize_t ReadTile(void * buf, uint32_t x, uint32_t y, uint32_t z, unsigned short int s) {
|
||||||
|
return TIFFReadTile(tiff, buf, x, y, z, s);
|
||||||
|
}
|
||||||
|
tmsize_t WriteTile(void* buf, uint32_t x, uint32_t y, uint32_t z = 0, uint16_t s = 0) {
|
||||||
|
return TIFFWriteTile(tiff, buf, x, y, z, s);
|
||||||
|
}
|
||||||
|
uint32_t ComputeStrip(uint32_t row, uint16_t sample) {
|
||||||
|
return TIFFComputeStrip(tiff, row, sample);
|
||||||
|
}
|
||||||
|
[[nodiscard]] uint32_t NumberOfStrips() const { return TIFFNumberOfStrips(tiff); }
|
||||||
|
tmsize_t ReadEncodedStrip(uint32_t strip, void* buf, tmsize_t size) {
|
||||||
|
return TIFFReadEncodedStrip(tiff, strip, buf, size);
|
||||||
|
}
|
||||||
|
tmsize_t ReadRawStrip(uint32_t strip, void* buf, tmsize_t size) {
|
||||||
|
return TIFFReadRawStrip(tiff, strip, buf, size);
|
||||||
|
}
|
||||||
|
tmsize_t ReadEncodedTile(uint32_t tile, void* buf, tmsize_t size) {
|
||||||
|
return TIFFReadEncodedTile(tiff, tile, buf, size);
|
||||||
|
}
|
||||||
|
tmsize_t ReadRawTile(uint32_t tile, void* buf, tmsize_t size) {
|
||||||
|
return TIFFReadRawTile(tiff, tile, buf, size);
|
||||||
|
}
|
||||||
|
tmsize_t WriteEncodedStrip(uint32_t strip, void* data, tmsize_t cc) {
|
||||||
|
return TIFFWriteEncodedStrip(tiff, strip, data, cc);
|
||||||
|
}
|
||||||
|
tmsize_t WriteRawStrip(uint32_t strip, void* data, tmsize_t cc) {
|
||||||
|
return TIFFWriteRawStrip(tiff, strip, data, cc);
|
||||||
|
}
|
||||||
|
tmsize_t WriteEncodedTile(uint32_t tile, void* data, tmsize_t cc) {
|
||||||
|
return TIFFWriteEncodedTile(tiff, tile, data, cc);
|
||||||
|
}
|
||||||
|
tmsize_t WriteRawTile(uint32_t tile, void* data, tmsize_t cc) {
|
||||||
|
return TIFFWriteRawTile(tiff, tile, data, cc);
|
||||||
|
}
|
||||||
|
void SetWriteOffset(const uint64_t offset) { TIFFSetWriteOffset(tiff, offset); }
|
||||||
|
//endregion
|
||||||
|
|
||||||
|
//region Convenience TIFF field functions
|
||||||
|
//TODO get defaults
|
||||||
|
void SetResolution(const Math::Vector2ui& resolution)
|
||||||
|
{
|
||||||
|
SetField(TIFFTAG_IMAGEWIDTH, resolution.x);
|
||||||
|
SetField(TIFFTAG_IMAGELENGTH, resolution.y);
|
||||||
|
}
|
||||||
|
void SetTileResolution(const Math::Vector2ui& resolution)
|
||||||
|
{
|
||||||
|
SetField(TIFFTAG_TILEWIDTH, resolution.x);
|
||||||
|
SetField(TIFFTAG_TILELENGTH, resolution.y);
|
||||||
|
}
|
||||||
|
[[nodiscard]] Math::Vector2ui GetResolution() const
|
||||||
|
{
|
||||||
|
Math::Vector2ui resolution;
|
||||||
|
GetField(TIFFTAG_IMAGEWIDTH, &resolution.x);
|
||||||
|
GetField(TIFFTAG_IMAGELENGTH, &resolution.y);
|
||||||
|
return resolution;
|
||||||
|
}
|
||||||
|
[[nodiscard]] Math::Vector2ui GetTileResolution() const
|
||||||
|
{
|
||||||
|
Math::Vector2ui resolution;
|
||||||
|
GetField(TIFFTAG_TILEWIDTH, &resolution.x);
|
||||||
|
GetField(TIFFTAG_TILELENGTH, &resolution.y);
|
||||||
|
return resolution;
|
||||||
|
}
|
||||||
|
void SetCompression(const TiffCompression compression)
|
||||||
|
{
|
||||||
|
SetField(TIFFTAG_COMPRESSION, compression.GetTiffType());
|
||||||
|
}
|
||||||
|
[[nodiscard]] TiffCompression GetCompression() const
|
||||||
|
{
|
||||||
|
uint16_t comp;
|
||||||
|
GetField(TIFFTAG_COMPRESSION, &comp);
|
||||||
|
return TiffCompression::FromTiffType(comp);
|
||||||
|
}
|
||||||
|
void SetResolutionUnit(const Math::Vector2f& scale, uint16_t type = RESUNIT_INCH)
|
||||||
|
{
|
||||||
|
SetField(TIFFTAG_RESOLUTIONUNIT, type);
|
||||||
|
SetField(TIFFTAG_XRESOLUTION, scale.x);
|
||||||
|
SetField(TIFFTAG_YRESOLUTION, scale.y);
|
||||||
|
}
|
||||||
|
//endregion
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma clang diagnostic pop
|
||||||
Reference in New Issue
Block a user