Image decoding for many popular formats for Simple Directmedia Layer.

Related tags

Game sdl2 sdl-image
Overview
SDL_image 2.0

The latest version of this library is available from:
http://www.libsdl.org/projects/SDL_image/

This is a simple library to load images of various formats as SDL surfaces.
This library supports BMP, PNM (PPM/PGM/PBM), XPM, LBM, PCX, GIF, JPEG, PNG,
TGA, TIFF, and simple SVG formats.

API:
#include "SDL_image.h"

	SDL_Surface *IMG_Load(const char *file);
or
	SDL_Surface *IMG_Load_RW(SDL_RWops *src, int freesrc);
or
	SDL_Surface *IMG_LoadTyped_RW(SDL_RWops *src, int freesrc, char *type);

where type is a string specifying the format (i.e. "PNG" or "pcx").
Note that IMG_Load_RW cannot load TGA images.

To create a surface from an XPM image included in C source, use:

	SDL_Surface *IMG_ReadXPMFromArray(char **xpm);

An example program 'showimage' is included, with source in showimage.c

JPEG support requires the JPEG library: http://www.ijg.org/
PNG support requires the PNG library: http://www.libpng.org/pub/png/libpng.html
    and the Zlib library: http://www.gzip.org/zlib/
TIFF support requires the TIFF library: ftp://ftp.sgi.com/graphics/tiff/
    and the Zlib library: http://www.gzip.org/zlib/

If you have these libraries installed in non-standard places, you can
try adding those paths to the configure script, e.g.
sh ./configure CPPFLAGS="-I/somewhere/include" LDFLAGS="-L/somewhere/lib"
If this works, you may need to add /somewhere/lib to your LD_LIBRARY_PATH
so shared library loading works correctly.

This library is under the zlib License, see the file "COPYING.txt" for details.
Comments
  • `--enable-jxl-shared` does not result in dynamically loaded `libjxl`

    `--enable-jxl-shared` does not result in dynamically loaded `libjxl`

    Adding --enable-jxl-shared does not make libjxl dynamically loaded since SONAME of libjxl has two digits separated by dot:

    https://github.com/libjxl/libjxl/blob/101fa3f748578553b3fb25e5f78cee69d938356a/lib/CMakeLists.txt#L19-L24

    and SDL_image discards any file not matching <libname>.so.<digit>+: https://github.com/libsdl-org/SDL_image/blob/3572a87e97bc7163eda30775880d3eeebd7c54c0/configure.ac#L135

    Note: created PR in SDL to fix this: https://github.com/libsdl-org/SDL/pull/5901. If accepted I will create similar one for SDL_image.

    opened by jpalus 26
  • Add missing options to cmake script

    Add missing options to cmake script

    don't merge yet

    Known issues that need to be fixed before merging can occur:

    • [x] cmake cannot build with vendored dependencies: https://github.com/libsdl-org/SDL_image/pull/189#issuecomment-1121476928
    • [x] on mingw with dynamic libraries + system libraries, the cmake script uses the import library instead of the dll
    • [x] on Linux with dynamic libraries, the cmake script might select the shared library with the "longest version name". It should e.g. for libpng my system packages provides:
      /usr/lib64/libpng16.so -> libpng16.so.16.37.0
      /usr/lib64/libpng16.so.16 -> libpng16.so.16.37.0
      /usr/lib64/libpng16.so.16.37.0
      

      Because /usr/lib64/libpng16.so links to libpng16.so.16.37.0, it selects that one (and /usr/lib64/libpng16.16 is ignored).

    • [ ] consider testing CMake on mingw, as demonstrated in https://github.com/libsdl-org/SDL_image/pull/189#issuecomment-1122173090

    This pr improves (imho) the cmake build script by:

    • adding options for enabling/disabling each loader
    • allow switching between vendored and system libraries for jpeg/libpng/libwebp/libtiff/zlib
    • make the file names of the created libraries/files in a prefix the same
    • installs a SDL2_image-config.cmake file to enable cmake users to do find_package(SDL2_image CONFIG) and use a SDL2::SDL2_image target.
    • for compatibility, also create a SDL2_image.pc file
    • I think this provides a better solution then #187 to add PIC => I have added a BUILD_PIC option. (#187 was caused by libjpeg building a static library without PIC, which cannot be used inside a shared library)
    • adds support for dynamically loading libraries (instead of linking to them at build time)

    See https://github.com/libsdl-org/SDL_image/pull/189#issuecomment-1121476928 for current issues.

    When building using system dependencies, the install prefix looks like:

    prefix
    ├── include
    │   └── SDL2
    │       └── SDL_image.h
    ├── lib64
    │   ├── cmake
    │   │   └── SDL2_image
    │   │       ├── SDL2_image-config.cmake
    │   │       ├── SDL2_image-targets.cmake
    │   │       └── SDL2_image-targets-noconfig.cmake
    │   ├── libSDL2_image-2.0.so -> libSDL2_image-2.0.so.0
    │   ├── libSDL2_image-2.0.so.0 -> libSDL2_image-2.0.so.0.6.0
    │   ├── libSDL2_image-2.0.so.0.6.0
    │   ├── libSDL2_image.so -> libSDL2_image-2.0.so
    │   └── pkgconfig
    │       └── SDL2_image.pc
    └── share
        └── licenses
            └── SDL2_image
                └── LICENSE.txt
    
    9 directories, 10 files
    

    When building+installing all dependencies, the install prefix looks like:

    prefix
    ├── include
    │   └── SDL2
    │       └── SDL_image.h
    ├── lib64
    │   ├── cmake
    │   │   └── SDL2_image
    │   │       ├── SDL2_image-config.cmake
    │   │       ├── SDL2_image-targets.cmake
    │   │       └── SDL2_image-targets-noconfig.cmake
    │   ├── libjpeg.so
    │   ├── libpng16.so -> libpng16.so.16
    │   ├── libpng16.so.16 -> libpng16.so.16.37.0
    │   ├── libpng16.so.16.37.0
    │   ├── libSDL2_image-2.0.so -> libSDL2_image-2.0.so.0
    │   ├── libSDL2_image-2.0.so.0 -> libSDL2_image-2.0.so.0.6.0
    │   ├── libSDL2_image-2.0.so.0.6.0
    │   ├── libSDL2_image.so -> libSDL2_image-2.0.so
    │   ├── libtiff.so -> libtiff.so.5
    │   ├── libtiff.so.5 -> libtiff.so.5.6.0
    │   ├── libtiff.so.5.6.0
    │   ├── libz.so -> libz.so.1
    │   ├── libz.so.1 -> libz.so.1.2.11
    │   ├── libz.so.1.2.11
    │   └── pkgconfig
    │       └── SDL2_image.pc
    └── share
        └── licenses
            └── SDL2_image
                └── LICENSE.txt
    
    9 directories, 20 files
    

    The prefix for a shared mingw build:

    prefix
    ├── bin
    │   └── SDL2_image.dll
    ├── include
    │   └── SDL2
    │       └── SDL_image.h
    ├── lib
    │   ├── cmake
    │   │   └── SDL2_image
    │   │       ├── SDL2_image-config.cmake
    │   │       ├── SDL2_image-targets.cmake
    │   │       └── SDL2_image-targets-noconfig.cmake
    │   ├── libSDL2_image.dll.a
    │   └── pkgconfig
    │       └── SDL2_image.pc
    └── share
        └── licenses
            └── SDL2_image
                └── LICENSE.txt
    
    10 directories, 8 files
    

    Tested on [email protected] and [email protected]

    Some feedback would be appreciated.

    TODO:

    • [ ] Compatibility with Cmake's FindSDL_image? Or it that one only looking for 1.x?
    opened by madebr 23
  • webp image animation support

    webp image animation support

    webp image is support animation. Hope this feature can be added.

    Below is my own trial code:

    IMG_webp.c

    #include <webp/decode.h>
    #include <webp/demux.h>
    
    IMG_Animation *IMG_LoadWEBPAnimation_RW(SDL_RWops *src)
    {
        Sint64 start;
        const char *error = NULL;
        Uint32 Rmask;
        Uint32 Gmask;
        Uint32 Bmask;
        Uint32 Amask;
        WebPBitstreamFeatures features;
        struct WebPDemuxer* dmuxer = NULL;
        IMG_Animation *anim = NULL;
        int raw_data_size;
        uint8_t *raw_data = NULL;
        int r;
        uint8_t *ret;
    
        if ( !src ) {
            /* The error message has been set in SDL_RWFromFile */
            return NULL;
        }
    
        start = SDL_RWtell(src);
    
        if ( (IMG_Init(IMG_INIT_WEBP) & IMG_INIT_WEBP) == 0 ) {
            goto error;
        }
    
        raw_data_size = -1;
        if ( !webp_getinfo( src, &raw_data_size ) ) {
            error = "Invalid WEBP Animation";
            goto error;
        }
    
        raw_data = (uint8_t*) SDL_malloc( raw_data_size );
        if ( raw_data == NULL ) {
            error = "Failed to allocate enough buffer for WEBP Animation";
            goto error;
        }
    
        r = (int)SDL_RWread(src, raw_data, 1, raw_data_size );
        if ( r != raw_data_size ) {
            error = "Failed to read WEBP Animation";
            goto error;
        }
    
        if ( lib.WebPGetFeaturesInternal( raw_data, raw_data_size, &features, WEBP_DECODER_ABI_VERSION ) != VP8_STATUS_OK ) {
            error = "WebPGetFeatures has failed";
            goto error;
        }
    
        /* Check if it's ok !*/
    #if SDL_BYTEORDER == SDL_LIL_ENDIAN
        Rmask = 0x000000FF;
        Gmask = 0x0000FF00;
        Bmask = 0x00FF0000;
        Amask = (features.has_alpha) ? 0xFF000000 : 0;
    #else
        {
            int s = (features.has_alpha) ? 0 : 8;
            Rmask = 0xFF000000 >> s;
            Gmask = 0x00FF0000 >> s;
            Bmask = 0x0000FF00 >> s;
            Amask = 0x000000FF >> s;
        }
    #endif
    
        WebPIterator iter;
        WebPData wd = { raw_data , raw_data_size};
        dmuxer = WebPDemux(&wd);
        anim = (IMG_Animation *)SDL_malloc(sizeof(IMG_Animation));
        anim->w = features.width;
        anim->h = features.height;
        anim->count = WebPDemuxGetI(dmuxer, WEBP_FF_FRAME_COUNT);
        anim->frames = (SDL_Surface **)SDL_calloc(anim->count, sizeof(*anim->frames));
        anim->delays = (int *)SDL_calloc(anim->count, sizeof(*anim->delays));
        for (int frame_idx = 0; frame_idx < (anim->count); frame_idx++) {
            if (WebPDemuxGetFrame(dmuxer, frame_idx, &iter) == 0) {
                break;
            }
            SDL_Surface* curr = SDL_CreateRGBSurface(SDL_SWSURFACE,
                features.width, features.height,
                features.has_alpha?32:24, Rmask,Gmask,Bmask,Amask);
            if ( curr == NULL ) {
                error = "Failed to allocate SDL_Surface";
                goto error;
            }
            anim->frames[frame_idx] = curr;
            anim->delays[frame_idx] = iter.duration;
            if ( features.has_alpha ) {
                ret = lib.WebPDecodeRGBAInto(
                    iter.fragment.bytes,
                    iter.fragment.size,
                    (uint8_t *)curr->pixels,
                    curr->pitch * curr->h,
                    curr->pitch);
            } else {
                ret = lib.WebPDecodeRGBInto(
                    iter.fragment.bytes, iter.fragment.size,
                    (uint8_t *)curr->pixels,
                    curr->pitch * curr->h,
                    curr->pitch);
            }
            if (ret == NULL) {
                break;
            }
        }
        if (dmuxer) {
            WebPDemuxDelete(dmuxer);
        }
    
        if ( raw_data ) {
            SDL_free( raw_data );
        }
        return anim;
    error:
        if (anim) {
            IMG_FreeAnimation(anim);
        }
        if (dmuxer) {
            WebPDemuxDelete(dmuxer);
        }
        if (raw_data) {
            SDL_free( raw_data );
        }
    
        if (error) {
            IMG_SetError( "%s", error );
        }
        SDL_RWseek(src, start, RW_SEEK_SET);
        return(NULL);
    }
    

    IMG.c

    static struct {
        const char *type;
        int (SDLCALL *is)(SDL_RWops *src);
        IMG_Animation *(SDLCALL *load)(SDL_RWops *src);
    } supported_anims[] = {
        /* keep magicless formats first */
        { "GIF", IMG_isGIF, IMG_LoadGIFAnimation_RW },
    +   { "WEBP", IMG_isWEBP, IMG_LoadWEBPAnimation_RW },
    };
    

    demo.c

    #include <SDL.h>
    #include <SDL_image.h>
    #include <stdio.h>
    
    #define CHECK_SDL_ERROR(ret) if (ret != 0) {\
        printf("sdl error: %s\n", SDL_GetError());\
        return 2;\
    }
    
    #undef main
    int main(int argc, char* argv[])
    {
        int windowWidth = 800;
        int windowHeight = 600;
        int ret = 0;
        ret = SDL_Init(SDL_INIT_VIDEO);
        CHECK_SDL_ERROR(ret);
    
        SDL_Window* window;
        SDL_Renderer* renderer;
        SDL_Event event;
        SDL_bool exit = SDL_FALSE;
        SDL_SetHint(SDL_HINT_RENDER_VSYNC, "1");
        SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "1");
        ret = SDL_CreateWindowAndRenderer(windowWidth, windowHeight, SDL_WINDOW_ALLOW_HIGHDPI, &window, &renderer);
        CHECK_SDL_ERROR(ret);
        SDL_SetRenderDrawColor(renderer, 0xff, 0xff, 0xff, 0xff);
        SDL_RenderClear(renderer);
    
        IMG_Animation *anim = IMG_LoadAnimation(argv[1]);
        if (anim == NULL) {
            printf("load image err: %s\n", SDL_GetError());
            return 1;
        }
        int frameIndex = 0;
        SDL_Surface* firstImageSurface = anim->frames[0];
        SDL_Texture* texture = SDL_CreateTextureFromSurface(
            renderer,
            firstImageSurface);
        firstImageSurface = NULL;
        while (!exit)
        {
            while (SDL_PollEvent(&event))
                switch (event.type) {
                    case SDL_QUIT:
                        exit = SDL_TRUE;
                        break;
                }
            
    
            SDL_SetRenderDrawColor(renderer, 0xff, 0xff, 0xff, 0xff);
            SDL_RenderClear(renderer);
    
            SDL_Surface* imageSurface = anim->frames[frameIndex];
            SDL_Rect imgRect = {0,0, imageSurface->w, imageSurface->h};
    
            SDL_UpdateTexture(texture, &imgRect, (unsigned char*)imageSurface->pixels, imageSurface->pitch);
    
            SDL_RenderCopy(renderer, texture, &imgRect, &imgRect);
            SDL_RenderPresent(renderer);
    
            SDL_Delay(anim->delays[frameIndex]);
            frameIndex++;
            if (frameIndex >= anim->count) {
                frameIndex = 0;
            }
        }
        IMG_FreeAnimation(anim);
        SDL_DestroyTexture(texture);
        SDL_DestroyRenderer(renderer);
        SDL_DestroyWindow(window);
        SDL_Quit();
        return 0;
    }
    
    opened by zeromake 14
  • WebP included with official Windows binaries but not macOS framework?

    WebP included with official Windows binaries but not macOS framework?

    Hi everyone,

    Just testing out the new SDL2 releases with PySDL2 and noticed in the unit tests that WebP support has been removed from the official macOS release .framework. However, the changelog doesn't indicate that it was removed and the WebP .dll is still found in the "optional" folder for the Windows binaries. Was this a deliberate change or accidental?

    Just wondering whether I should remove the unit test for WebP support on macOS or wait for a 2.6.1.

    Also, sorry I didn't test this sooner before the official release! I've been busy with a new internship that eaten up a lot of my free time.

    Best,

    • Austin
    opened by a-hurst 12
  • Use specific CMake version on github workflow

    Use specific CMake version on github workflow

    The reasoning behind this extra github workflow dependency is enforcing compatibility with the minimum required cmake version we declared at the top of the cmake build script.

    opened by madebr 12
  • Define for SAVE_PNG support

    Define for SAVE_PNG support

    It would be nice to re-add the define to compile out the PNG support:

    eg:

    diff --git a/Android.mk b/Android.mk
    index c6d83db..7e9ab1c 100644
    --- a/Android.mk
    +++ b/Android.mk
    @@ -127,6 +136,11 @@ ifeq ($(SUPPORT_PNG),true)
         LOCAL_CFLAGS += -DLOAD_PNG
         LOCAL_STATIC_LIBRARIES += png
         LOCAL_LDLIBS += -lz
    +ifeq ($(SUPPORT_SAVE_PNG),true)
    +    LOCAL_CFLAGS += -DSDL_IMAGE_SAVE_PNG=1
    +else
    +    LOCAL_CFLAGS += -DSDL_IMAGE_SAVE_PNG=0
    +endif
     endif
     
     ifeq ($(SUPPORT_WEBP),true)
    diff --git a/IMG_png.c b/IMG_png.c
    index 462fe2f..61b5621 100644
    --- a/IMG_png.c
    +++ b/IMG_png.c
    @@ -23,9 +23,8 @@
     
     #include "SDL_image.h"
     
    -/* We'll have PNG save support by default */
    -#ifndef SAVE_PNG
    -#define SAVE_PNG    1
    +#if !defined(SDL_IMAGE_SAVE_PNG)
    +#  define SDL_IMAGE_SAVE_PNG 1
     #endif
     
     #if defined(USE_STBIMAGE)
    @@ -115,7 +116,7 @@ static struct {
         jmp_buf* (*png_set_longjmp_fn) (png_structrp, png_longjmp_ptr, size_t);
     #endif
     #endif
    -#if SAVE_PNG
    +#if SDL_IMAGE_SAVE_PNG
         png_structp (*png_create_write_struct) (png_const_charp user_png_ver, png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warn_fn);
         void (*png_destroy_write_struct) (png_structpp png_ptr_ptr, png_infopp info_ptr_ptr);
         void (*png_set_write_fn) (png_structrp png_ptr, png_voidp io_ptr, png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn);
    @@ -170,7 +173,7 @@ int IMG_InitPNG()
             FUNCTION_LOADER(png_set_longjmp_fn, jmp_buf* (*) (png_structrp, png_longjmp_ptr, size_t))
     #endif
     #endif
    -#if SAVE_PNG
    +#if SDL_IMAGE_SAVE_PNG
             FUNCTION_LOADER(png_create_write_struct, png_structp (*) (png_const_charp user_png_ver, png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warn_fn))
             FUNCTION_LOADER(png_destroy_write_struct, void (*) (png_structpp png_ptr_ptr, png_infopp info_ptr_ptr))
             FUNCTION_LOADER(png_set_write_fn, void (*) (png_structrp png_ptr, png_voidp io_ptr, png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn))
    
    @@ -540,7 +599,7 @@ SDL_Surface *IMG_LoadPNG_RW(SDL_RWops *src)
     
     #endif /* LOAD_PNG */
     
    -#if SAVE_PNG
    +#if SDL_IMAGE_SAVE_PNG
     
     #if SDL_BYTEORDER == SDL_LIL_ENDIAN
     static const Uint32 png_format = SDL_PIXELFORMAT_ABGR8888;
    @@ -732,7 +791,7 @@ static int IMG_SavePNG_RW_miniz(SDL_Surface *surface, SDL_RWops *dst, int freeds
     }
     #endif /* LOAD_PNG_DYNAMIC || !WANT_LIBPNG */
     
    -#endif /* SAVE_PNG */
    +#endif /* SDL_IMAGE_SAVE_PNG */
     
     int IMG_SavePNG(SDL_Surface *surface, const char *file)
     {
    @@ -746,7 +805,7 @@ int IMG_SavePNG(SDL_Surface *surface, const char *file)
     
     int IMG_SavePNG_RW(SDL_Surface *surface, SDL_RWops *dst, int freedst)
     {
    -#if SAVE_PNG
    +#if SDL_IMAGE_SAVE_PNG
     #ifdef USE_LIBPNG
         if ((IMG_Init(IMG_INIT_PNG) & IMG_INIT_PNG) != 0) {
             if (IMG_SavePNG_RW_libpng(surface, dst, freedst) == 0) {
    @@ -763,5 +822,5 @@ int IMG_SavePNG_RW(SDL_Surface *surface, SDL_RWops *dst, int freedst)
     #else
         return IMG_SetError("SDL_image built without PNG save support");
     
    -#endif /* SAVE_PNG */
    +#endif /* SDL_IMAGE_SAVE_PNG */
     }
    
    opened by 1bsyl 12
  • Fix libjxl building using CMake

    Fix libjxl building using CMake

    @madebr has made some upstream patches for libjxl and dependencies:

    This issue is open to track the upstream pull requests. If they're not accepted, we can fork the projects and make the changes on libsdl-org repos.

    opened by slouken 12
  • Fix for two build errors with CMake

    Fix for two build errors with CMake

    Bug 1: Position independent code

    Compiling SDL2_image as a shared library will not enable CMAKE_POSITION_INDEPENDENT_CODE, which is necessary for libjpeg as it is always compiled as a static library.

    Before this fix, attempting to compile SDL2_image with BUILD_SHARED_LIBS=ON gives the following message at compile time:

    /usr/bin/ld: external/jpeg-9d/libjpeg.a(jcapimin.c.o): relocation R_X86_64_PC32 against symbol `jpeg_natural_order' can not be used when making a shared object; recompile with -fPIC
    

    I fixed this by enabling CMAKE_POSITION_INDEPENDENT_CODE (which is CMake's flag for -fPIC) for all builds, regardless of BUILD_SHARED_LIBS.

    Bug 2: Compiling with system SDL

    SDL2_image attempts to compile against SDL2::SDL2 all the time, although that target may not be valid if SDL was found with find_package(SDL2 REQUIRED). The variables SDL2_LIBRARIES and SDL2_LIBRARIES serve that purpose; I added a check for SDL2_FOUND (which is truthy if and only if find_package(SDL2 REQUIRED) was used successfully) and made it use those variables instead.

    Note: I noticed SDL2_image also uses -DDLL_EXPORT for shared libraries on Windows; since I don't have a Windows machine nearby at the moment, I couldn't check whether it was related to the was SDL2 is compiled or not, and I didn't add it in this PR. Testing dynamic linking on Windows might be necessary before merging this PR.

    opened by Semphriss 12
  • Improve CMake build system

    Improve CMake build system

    • Use 'SDL2IMAGE_' prefix for all options
    • Create SDL2_image::SDL2_image when building a shared library, create SDL2_image::SDL2_image-static when building a static library
    • Aim is to use same CMake layout as SDL_ttf/SDL_mixer
    • Create libSDL2_imaged.so symbolic link ('d' suffix) (when building debug build type)
    • Add PrivateSdlFunctions.cmake script for common functionality between SDL_ttf/SDL_mixer
    • Add FindXXX.cmake scripts for dependencies that don't provide cmake configuration files
    • Bring jpeg/png saving support to cmake (#235)
    • Update the git submodules
    • Test CMake on mingw64 (using system dependencies there)
    • Add MacOS CI
    • Create symbolic link at build time + install it
    • Only install SDL2_image.pc when building a shared SDL2_image (to avoid overwriting when later installing a static SDL2_image)
    • Allow parallel installation of cmake support of a static and shared SDL2_image
    • Add a single SDL2IMAGE_VENDORED option to use vendored libraries for everything, or none at all.
    • Add Macos dylib versioning

    I haven't added these scripts to EXTRA_DIST in Makefile.am yet, to allow some maturing + extra tests.

    Need review on:

    • ease of use: the cmake recipe is strict with its configuration options. When an option is configured to be enabled (-DSDL2IMAGE_xxx=ON), the cmake script will complain loudly instead of silently ignoring the option.
    • vendored libraries: build these as shared or static libraries? Always building these as static libraries makes perhaps most sense.
    opened by madebr 11
  • A question regarding developer library files.

    A question regarding developer library files.

    Hello everyone, I'm a newbie and I have a question:- When I checked (SDL_image library for developers) files list, I found two editions, one for VC and the other for MINGW, my question is: Is this means the first one is to work with MS.Visual C++ and the second one is for the MinGW compiler? And if this is true then why there isn't version 1. xxx for MinGW? (I'm talking about development in the Windows environment, not Linux)

    opened by WLD-Graphic 10
  • upgrade to newer miniz from mainstream?

    upgrade to newer miniz from mainstream?

    Mainstream miniz received many updates: Do we want to upgrade?

    Similar question for nanosvg, which we have two or three commits missing compared to mainstream.

    opened by sezero 10
  • XPM color names support

    XPM color names support

    Hi,

    i'm using ImageMagick to converting my images to XPM files. And ImageMagick uses color names, which can be problem with SDL. I got error colour parse error when i try to load this cube.scad.xpm.gz xpm. Other application works fine, so the problem can be in missing color names definitions.

    My versions:

    Linux thinkpad 6.0.0-4-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.0.8-1 (2022-11-11) x86_64 GNU/Linux
    
    ii  libsdl2-2.0-0:amd64                      2.24.2+dfsg-1                     amd64        Simple DirectMedia Layer
    ii  libsdl2-dev:amd64                        2.24.2+dfsg-1                     amd64        Simple DirectMedia Layer development files
    ii  libsdl2-image-2.0-0:amd64                2.6.2+dfsg-2                      amd64        Image loading library for Simple DirectMedia Layer 2, libraries
    ii  libsdl2-image-dev:amd64                  2.6.2+dfsg-2                      amd64        Image loading library for Simple DirectMedia Layer 2, development files
    ii  libsdl2-mixer-2.0-0:amd64                2.6.2+dfsg-2                      amd64        Mixer library for Simple DirectMedia Layer 2, libraries
    ii  libsdl2-ttf-2.0-0:amd64                  2.20.1+dfsg-2                     amd64        TrueType Font library for Simple DirectMedia Layer 2, libraries
    ii  libsdl2-ttf-dev:amd64                    2.20.1+dfsg-2                     amd64        TrueType Font library for Simple DirectMedia Layer 2, development files
    
    opened by ondratu 1
  • Build issues on Cygwin + GCC (WITHOUT mingw)

    Build issues on Cygwin + GCC (WITHOUT mingw)

    Hi, I downloaded the source for the latest stable release, and these didn't work, like they normally should.

    external/download.sh
    mkdir build
    cd build
    ../configure
    make
    make install
    

    Instead, I had to go into the generated makefile, and change the following lines to this:

    CFLAGS = -g -O2 -I/usr/include/SDL2 -DSDL_MAIN_HANDLED -Wall
    LIBS = -lSDL2
    

    I've yet to test if this installed properly, though the console says everything is ok with the install...

    Oh, and it seemed like the external format files weren't discovered for some reason, IDK why.

    opened by Ratstail91 0
  • Is there a version of SDL_Image that supports M1 Macs (ARM64)?

    Is there a version of SDL_Image that supports M1 Macs (ARM64)?

    I see some references to ARM code in the general source of SDL_IMAGE. But when I downloaded the latest pre-build DMG (2.6.2), XCode still sees no arm64 branch. I don't have any issues with the SDL2 library or even the SDL2_TTF library.

    I was wondering if there's been an explicit build for M1 Macs yet? Or maybe someone has experience in building from source on the M1?

    Thanks so much for your help - I've been trying to rewrite my needed functions from scratch in the meantime, but getting SDL_Image to work would be so much better. :)

    • Jeff
    opened by jdiamondGitHub 1
  • Why stb_image as default?

    Why stb_image as default?

    Hello,

    I'm trying to understand the benefits of using stb_image in SDL_image by default. Can you please elaborate why stb_image is used now by default?

    There's a number of format features it doesn't support, the speed is slower (especially compression is much worse), and it's not threadsafe for errors.

    These regressions make using the libsdl . org windows binaries unsuitable for us. It will make supporting different SDL_image configurations more difficult... if different distros start compiling SDL_image with stb_image and some don't.

    opened by illume 1
  • Restore support for lodepng?

    Restore support for lodepng?

    This was supported very briefly in 2019 (added in commit d3d2b9635fee99e23a79305959da66eb657329c0, removed in commit ef2488c0ffb8972f8afc67ef500ba39c49b3d9ee). Since SDL_image now prefers using single header libraries, and stb_image lacks support for palette output (see #298), it might be worth restoring lodepng support and using it instead of stb_image and miniz.

    opened by ccawley2011 3
Releases(release-2.6.2)
Owner
Simple Directmedia Layer
Simple Directmedia Layer (SDL) is a framework for creating cross-platform games and applications.
Simple Directmedia Layer
Simple Directmedia Layer

Simple DirectMedia Layer (SDL) Version 2.0 --- https://www.libsdl.org/ Simple Di

Simple Directmedia Layer 4.3k Nov 25, 2022
Simple Directmedia Layer

hb-sdl Harbour bindings for SDL 2.0.16, a Simple DirectMedia Layer is a cross-platform development library designed to provide low level access to aud

Rafał Jopek 3 Nov 8, 2022
Simple DirectMedia Layer (SDL) 1.2 for Symbian S60v1 devices such as the Nokia N-Gage.

SDL 1.2 Even though SDL 1.2 is outdated and officially no longer supported, this is an attempt to get it running on Symbian S60v1 devices such as the

N-Gage SDK. 4 Apr 4, 2022
A lightweight, self-contained library for gizmo editing commonly found in many game engines

This project is a lightweight, self-contained library for gizmo editing commonly found in many game engines. It includes mechanisms for manipulating 3d position, rotation, and scale. Implemented in C++11, the library does not perform rendering directly and instead provides a per-frame buffer of world-space triangles.

Dimitri Diakopoulos 388 Nov 29, 2022
An SDL-1.2 compatibility layer that uses SDL 2.0 behind the scenes.

Simple DirectMedia Layer (SDL) sdl12-compat --- https://www.libsdl.org/ This is t

Simple Directmedia Layer 131 Nov 25, 2022
GammaGo is an interactive go game system that integrates image recognition with robot arm control.

Introduction GammaGo is an interactive go game system that integrates image recognition with robot arm control. This repository contains all the neces

Jin Zihang 5 Jul 31, 2022
VTK is an open-source software system for image processing, 3D graphics, volume rendering and visualization

Introduction VTK is an open-source software system for image processing, 3D graphics, volume rendering and visualization. VTK includes many advanced a

Kitware, Inc. 2k Nov 28, 2022
A simple and easy-to-use library to enjoy videogames programming

raylib is a simple and easy-to-use library to enjoy videogames programming. raylib is highly inspired by Borland BGI graphics lib and by XNA framework

Ray 11.1k Nov 23, 2022
A simple text-based adventure game

The Lighthouse of Doom This repository contain a simple text-based adventure game, implemented twice, once in portable C, and once in Z80 assembly lan

Steve Kemp 55 Nov 1, 2022
Simple tower defense game using C++ with Entity Component System (ECS)

CubbyTower CubbyTower is a simple tower defense game using C++ with Entity Component System (ECS). The code is built on C++17 and can be compiled with

Chris Ohk 35 Nov 18, 2022
Simple CSV localization system for Unreal Engine 4

BYG Localization We wanted to support fan localization for Industries of Titan and found that Unreal's built-in localization system was not exactly wh

Brace Yourself Games 55 Nov 19, 2022
A single-header C++ library for making simple 2D games

A single-header C++ library for making simple 2D games PLATFORM: Windows LANGUAGE: C++ ENVIRONMENT: Visual Studio Why? Learning C++ is often seen as d

Sumo Digital Academy 63 Nov 22, 2022
Simple, fast, easy to get started mid-level game engine written in Zig

Alka Game engine written in zig, compatible with master branch. This engine does provide a toolset for you but generally you have to implement how the

Kiakra 22 Oct 23, 2022
A simple localization framework that can re-localize in built maps based on FAST-LIO.

Realtime 3D global localization in a pre-built point cloud map. By fusing low-frequency global localization (about 0.5~0.2Hz), and high-frequency odometry from FAST-LIO, the entire system is computationally efficient.

KINO 234 Nov 18, 2022
A simple snake game made in C language.

My-snake-game This is my first game more to come! to play the game execute the snake.exe and press X to start. W to go up / D to go right / A to go le

Ayman Baioumy 4 Aug 31, 2022
A simple shooter game like Space Invaders that runs on QMK Firmware.

About A simple shooter game like Space Invaders that runs on QMK Firmware. What is it like? Player's Manual English: manual_en.md Japanese: manual_jp.

null 5 Sep 30, 2022
Dragon's Dice Roller aims to be a lightweight, simple, reliable and easy-to-use dice roller for RPG games.

Dragon's Dice Roller is the first and (so far the only) open source RPG dice roller written in C available on GitHub. It aims to be a lightweight, simple, reliable and easy-to-use dice roller for any kind of role-playing game.

Michael Kolesidis 10 Apr 22, 2022
A c program to play a simple 2 players tic tac toe game

Tic_Tac_Toe_Game A c program to play a simple 2 players tic tac toe game Tic-tac-toe is a simple game for two players who take turns marking the space

Muhammad Zain Ul Haque 1 Oct 28, 2021
A simple game framework written in C++ using SDL

SGF SGF (Simple Game Framework) is, as the name implies; a very simple and easy to use game framework written in C++ using SDL. Currently the project

Cam K. 1 Nov 4, 2021