Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating blank image for manipulation #211

Closed
Paril opened this issue May 11, 2024 · 3 comments
Closed

Creating blank image for manipulation #211

Paril opened this issue May 11, 2024 · 3 comments

Comments

@Paril
Copy link

Paril commented May 11, 2024

The one big thing I'm noticing is missing is that I can't create a SAIL-backed image for manipulation purposes; I can load an image from disk, create a new image with null pixels of WxH of a format, or create an image holding a shallow pointer to an existing block of memory, but I can't create an image and ask SAIL to allocate the required space for me to then work with (a hypothetical sail::image(width, height, format)). Currently my only option is to allocate the required space ahead of time, allocate a SAIL image pointing to it, perform operation(s) and then do a deep copy to a new sail::image so that it now owns the memory.

The justification for this is mainly to not need to lug around two different pointers, & that nearly every image library has the option to do this sort of thing (think procedurally generated images or custom conversion routines that aren't currently supported by SAIL, like converting grayscale to a specified indexed palette or something).

@HappySeaFox
Copy link
Owner

HappySeaFox commented May 12, 2024

Please try the latest master, I've just commited a couple of fixes.

@Paril
Copy link
Author

Paril commented May 14, 2024

Thanks, I will check them out ASAP. A secondary question since I need to try a specific revision instead of just using vcpkg: what am I missing to get static linking working? I can get shared libs working no problem, but when trying with static, it seems to not be compiling in the created .c file from sail-codecs (unresolved external symbol __imp_sail_enabled_codecs, etc).

My setup is as follows:

set(SAIL_BUILD_APPS NO)
set(SAIL_BUILD_EXAMPLES NO)
set(BUILD_TESTING NO)
set(BUILD_SHARED_LIBS NO)
#SET(SAIL_COMBINE_CODECS YES)
SET(SAIL_ONLY_CODECS jpeg png pcx tga wal xbm)
add_subdirectory(thirdparty/sail)

target_link_libraries(qmdlr PRIVATE sail sail-c++ sail-codecs)
target_compile_definitions(qmdlr PRIVATE SAIL_STATIC)

If I swap SHARED_LIBS to yes (+ use combine codecs) and remove SAIL_STATIC it does work though, so at least I can test that way for now, but ideally I'd like to statically embed everything.

@HappySeaFox
Copy link
Owner

You can still use vcpkg, just update REF and SHA512 in ports/sail/portfile.cmake in your local vcpkg copy like that:

    REF master
    SHA512 4d6a6e61305c89aee94bd278f3c2f4e539c01802563e03d81ea25c0c03cfcab081866b0901b8462bda5800b1742ed70d592d7f84939dec2c04f3ff40c8fea352

My setup is as follows:

With static libs, SAIL creates an extra library sail-codecs-archive. Try to link against it along with other sail libs. Be prepared to face linking errors against libjpeg and similar libraries. I'd recommend to use vcpkg.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants