建档
This commit is contained in:
32
Library/SDL2_image-2.5.2/.gitmodules
vendored
Normal file
32
Library/SDL2_image-2.5.2/.gitmodules
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
[submodule "external/jpeg"]
|
||||
path = external/jpeg
|
||||
url = https://github.com/libsdl-org/jpeg.git
|
||||
branch = v9e-SDL
|
||||
[submodule "external/libpng"]
|
||||
path = external/libpng
|
||||
url = https://github.com/libsdl-org/libpng.git
|
||||
branch = v1.6.37-SDL
|
||||
[submodule "external/libwebp"]
|
||||
path = external/libwebp
|
||||
url = https://github.com/libsdl-org/libwebp.git
|
||||
branch = 1.0.3-SDL
|
||||
[submodule "external/libtiff"]
|
||||
path = external/libtiff
|
||||
url = https://github.com/libsdl-org/libtiff.git
|
||||
branch = v4.2.0-SDL
|
||||
[submodule "external/zlib"]
|
||||
path = external/zlib
|
||||
url = https://github.com/libsdl-org/zlib.git
|
||||
branch = v1.2.12-SDL
|
||||
[submodule "external/libjxl"]
|
||||
path = external/libjxl
|
||||
url = https://github.com/libsdl-org/libjxl.git
|
||||
branch = v0.6.1-SDL
|
||||
[submodule "external/libavif"]
|
||||
path = external/libavif
|
||||
url = https://github.com/libsdl-org/libavif.git
|
||||
branch = v0.10.1-SDL
|
||||
[submodule "external/dav1d"]
|
||||
path = external/dav1d
|
||||
url = https://github.com/libsdl-org/dav1d.git
|
||||
branch = 1.0.0-SDL
|
||||
168
Library/SDL2_image-2.5.2/Android.mk
Normal file
168
Library/SDL2_image-2.5.2/Android.mk
Normal file
@@ -0,0 +1,168 @@
|
||||
SDL_IMAGE_LOCAL_PATH := $(call my-dir)
|
||||
|
||||
|
||||
# Enable this if you want PNG and JPG support with minimal dependencies
|
||||
USE_STBIMAGE ?= true
|
||||
|
||||
# The additional formats below require downloading third party dependencies,
|
||||
# using the external/download.sh script.
|
||||
|
||||
# Enable this if you want to support loading AVIF images
|
||||
# The library path should be a relative path to this directory.
|
||||
SUPPORT_AVIF ?= false
|
||||
AVIF_LIBRARY_PATH := external/libavif
|
||||
DAV1D_LIBRARY_PATH := external/dav1d
|
||||
|
||||
# Enable this if you want to support loading JPEG images using libjpeg
|
||||
# The library path should be a relative path to this directory.
|
||||
SUPPORT_JPG ?= false
|
||||
SUPPORT_SAVE_JPG ?= true
|
||||
JPG_LIBRARY_PATH := external/jpeg
|
||||
|
||||
# Enable this if you want to support loading JPEG-XL images
|
||||
# The library path should be a relative path to this directory.
|
||||
SUPPORT_JXL ?= false
|
||||
JXL_LIBRARY_PATH := external/libjxl
|
||||
|
||||
# Enable this if you want to support loading PNG images using libpng
|
||||
# The library path should be a relative path to this directory.
|
||||
SUPPORT_PNG ?= false
|
||||
SUPPORT_SAVE_PNG ?= true
|
||||
PNG_LIBRARY_PATH := external/libpng
|
||||
|
||||
# Enable this if you want to support loading WebP images
|
||||
# The library path should be a relative path to this directory.
|
||||
SUPPORT_WEBP ?= false
|
||||
WEBP_LIBRARY_PATH := external/libwebp
|
||||
|
||||
|
||||
# Build the library
|
||||
ifeq ($(SUPPORT_AVIF),true)
|
||||
include $(SDL_IMAGE_LOCAL_PATH)/$(AVIF_LIBRARY_PATH)/Android.mk
|
||||
include $(SDL_IMAGE_LOCAL_PATH)/$(DAV1D_LIBRARY_PATH)/Android.mk
|
||||
endif
|
||||
|
||||
# Build the library
|
||||
ifeq ($(SUPPORT_JPG),true)
|
||||
include $(SDL_IMAGE_LOCAL_PATH)/$(JPG_LIBRARY_PATH)/Android.mk
|
||||
endif
|
||||
|
||||
# Build the library
|
||||
ifeq ($(SUPPORT_JXL),true)
|
||||
include $(SDL_IMAGE_LOCAL_PATH)/$(JXL_LIBRARY_PATH)/Android.mk
|
||||
endif
|
||||
|
||||
# Build the library
|
||||
ifeq ($(SUPPORT_PNG),true)
|
||||
include $(SDL_IMAGE_LOCAL_PATH)/$(PNG_LIBRARY_PATH)/Android.mk
|
||||
endif
|
||||
|
||||
# Build the library
|
||||
ifeq ($(SUPPORT_WEBP),true)
|
||||
include $(SDL_IMAGE_LOCAL_PATH)/$(WEBP_LIBRARY_PATH)/Android.mk
|
||||
endif
|
||||
|
||||
|
||||
# Restore local path
|
||||
LOCAL_PATH := $(SDL_IMAGE_LOCAL_PATH)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := SDL2_image
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
IMG.c \
|
||||
IMG_avif.c \
|
||||
IMG_bmp.c \
|
||||
IMG_gif.c \
|
||||
IMG_jpg.c \
|
||||
IMG_jxl.c \
|
||||
IMG_lbm.c \
|
||||
IMG_pcx.c \
|
||||
IMG_png.c \
|
||||
IMG_pnm.c \
|
||||
IMG_qoi.c \
|
||||
IMG_stb.c \
|
||||
IMG_svg.c \
|
||||
IMG_tga.c \
|
||||
IMG_tif.c \
|
||||
IMG_webp.c \
|
||||
IMG_WIC.c \
|
||||
IMG_xcf.c \
|
||||
IMG_xpm.c.arm \
|
||||
IMG_xv.c \
|
||||
IMG_xxx.c
|
||||
|
||||
LOCAL_CFLAGS := -DLOAD_BMP -DLOAD_GIF -DLOAD_LBM -DLOAD_PCX -DLOAD_PNM \
|
||||
-DLOAD_SVG -DLOAD_TGA -DLOAD_XCF -DLOAD_XPM -DLOAD_XV \
|
||||
-DLOAD_QOI
|
||||
LOCAL_LDLIBS :=
|
||||
LOCAL_STATIC_LIBRARIES :=
|
||||
LOCAL_SHARED_LIBRARIES := SDL2
|
||||
|
||||
ifeq ($(USE_STBIMAGE),true)
|
||||
LOCAL_CFLAGS += -DLOAD_JPG -DLOAD_PNG -DUSE_STBIMAGE
|
||||
endif
|
||||
|
||||
ifeq ($(SUPPORT_AVIF),true)
|
||||
LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(AVIF_LIBRARY_PATH)/include
|
||||
LOCAL_CFLAGS += -DLOAD_AVIF
|
||||
LOCAL_STATIC_LIBRARIES += avif
|
||||
LOCAL_WHOLE_STATIC_LIBRARIES += dav1d dav1d-8bit dav1d-16bit
|
||||
endif
|
||||
|
||||
ifeq ($(SUPPORT_JPG),true)
|
||||
LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(JPG_LIBRARY_PATH)
|
||||
LOCAL_CFLAGS += -DLOAD_JPG
|
||||
LOCAL_STATIC_LIBRARIES += jpeg
|
||||
ifeq ($(SUPPORT_SAVE_JPG),true)
|
||||
LOCAL_CFLAGS += -DSDL_IMAGE_SAVE_JPG=1
|
||||
else
|
||||
LOCAL_CFLAGS += -DSDL_IMAGE_SAVE_JPG=0
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(SUPPORT_JXL),true)
|
||||
LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(JXL_LIBRARY_PATH)/lib/include \
|
||||
$(LOCAL_PATH)/$(JXL_LIBRARY_PATH)/android
|
||||
LOCAL_CFLAGS += -DLOAD_JXL
|
||||
LOCAL_STATIC_LIBRARIES += jxl
|
||||
endif
|
||||
|
||||
ifeq ($(SUPPORT_PNG),true)
|
||||
LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(PNG_LIBRARY_PATH)
|
||||
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)
|
||||
LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(WEBP_LIBRARY_PATH)/src
|
||||
LOCAL_CFLAGS += -DLOAD_WEBP
|
||||
LOCAL_STATIC_LIBRARIES += webp
|
||||
endif
|
||||
|
||||
LOCAL_EXPORT_C_INCLUDES += $(LOCAL_PATH)
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
###########################
|
||||
#
|
||||
# SDL2_image static library
|
||||
#
|
||||
###########################
|
||||
|
||||
LOCAL_MODULE := SDL2_image_static
|
||||
|
||||
LOCAL_MODULE_FILENAME := libSDL2_image
|
||||
|
||||
LOCAL_LDLIBS :=
|
||||
LOCAL_EXPORT_LDLIBS :=
|
||||
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
|
||||
191
Library/SDL2_image-2.5.2/CHANGES.txt
Normal file
191
Library/SDL2_image-2.5.2/CHANGES.txt
Normal file
@@ -0,0 +1,191 @@
|
||||
2.6.0:
|
||||
* Added stb_image as the default backend for JPG and PNG images loading.
|
||||
To use libpng and libjpg instead configure using --disable-stb-image
|
||||
* Added IMG_LoadSizedSVG_RW()
|
||||
* Added support for AVIF images (https://github.com/AOMediaCodec/libavif)
|
||||
* Added IMG_ReadXPMFromArrayToRGB888()
|
||||
* Added support for JXL images (https://jpegxl.info/)
|
||||
* Added support for QOI images (https://qoiformat.org/)
|
||||
* Fixed XCF regression introduced in 2.0.5
|
||||
* Added support for loading animated GIFs
|
||||
* LoadBMP() now loads files using SDL2
|
||||
* Allow using libwebpdecoder instead libwebp.
|
||||
|
||||
2.0.5:
|
||||
Sam Lantinga - Wed Jun 19 07:30:51 PDT 2019
|
||||
* Updated external libraries libpng-1.6.32, libwebp-1.0.2
|
||||
Sam Lantinga - Tue Jun 11 00:17:01 PDT 2019
|
||||
* Fixed a number of security issues:
|
||||
TALOS-2019-0820
|
||||
TALOS-2019-0821
|
||||
TALOS-2019-0841
|
||||
TALOS-2019-0842
|
||||
TALOS-2019-0843
|
||||
TALOS-2019-0844
|
||||
Sathyanarayanan Gunasekaran, Brian Palmer, Charlie Birks, Amadeus - Mon Jun 10 16:48:20 PDT 2019
|
||||
* Ported SDL_image to emscripten
|
||||
|
||||
2.0.4:
|
||||
Michał Janiszewski - Fri Sept 28 22:00:26 PST 2018
|
||||
* Fixed memory issues in the XCF loader
|
||||
Ryan Gordon - Wed Sept 26 14:58:31 PST 2018
|
||||
* Fixed a number of security issues, including TALOS-2018-0645
|
||||
|
||||
2.0.3:
|
||||
Ryan Gordon - Sun Jan 28 21:28:16 PST 2018
|
||||
* Fixed a number of security issues:
|
||||
TALOS-2017-0488
|
||||
TALOS-2017-0489
|
||||
TALOS-2017-0490
|
||||
TALOS-2017-0491
|
||||
TALOS-2017-0497
|
||||
TALOS-2017-0498
|
||||
TALOS-2017-0499
|
||||
Sam Lantinga - Sun Jan 28 21:24:10 PST 2018
|
||||
* Added a dependency on SDL 2.0.8
|
||||
|
||||
2.0.2:
|
||||
Sam Lantinga - Sat Oct 21 23:42:28 PDT 2017
|
||||
* Added simple SVG image support based on Nano SVG
|
||||
Sam Lantinga - Sat Oct 21 22:14:34 PDT 2017
|
||||
* Updated external libraries jpeg-9b, libpng-1.6.32, libwebp-0.6.0, tiff-4.0.8 and zlib-1.2.11
|
||||
Yves Younan - Fri, Oct 6, 2017 3:38:38 PM
|
||||
* Fixed security vulnerability in XCF image loader
|
||||
Alexey - Tue Sep 12 00:41:53 PDT 2017
|
||||
* Added optional support for loading images using Windows Imaging Component
|
||||
Fabian Greffrath - Tue Sep 12 00:15:56 PDT 2017
|
||||
* Added libpng save support for much smaller 8-bit images
|
||||
Alexey - Mon Sep 11 23:50:31 PDT 2017
|
||||
* Added JPG save support when built with jpeglib
|
||||
IMG_SaveJPG() and IMG_SaveJPG_RW()
|
||||
|
||||
2.0.1:
|
||||
Jeffrey Carpenter - Sat Nov 29 12:06:05 2014
|
||||
* Fixed image colorspace issue on iOS and Mac OS X
|
||||
Sam Lantinga - Sun Jun 15 17:33:46 2014
|
||||
* Fixed support for transparency in XPM files
|
||||
Davide Coppola - Thu Apr 17 17:30:12 2014
|
||||
* Fixed building JPEG support on Android
|
||||
David Ludwig - Tue Apr 01 19:40:35 2014
|
||||
* Added support for building for Windows RT and Windows Phone
|
||||
Timur - Wed Dec 11 21:24:36 2013
|
||||
* Fixed memory leak in webp image loading
|
||||
Patrice Mandin - Thu Nov 07 19:15:28 2013
|
||||
* Fixed loading BMP files with large BITMAPINFOHEADER structures
|
||||
Sam Lantinga - Fri Oct 11 21:54:20 2013
|
||||
* Fixed building with libpng 1.4
|
||||
|
||||
2.0.0:
|
||||
Sam Lantinga - Sun Jun 2 22:25:31 PDT 2013
|
||||
* Added PNG save support based on miniz.c by Rich Geldreich
|
||||
IMG_SavePNG(), IMG_SavePNG_RW()
|
||||
Sam Lantinga - Sat Jun 1 19:11:26 PDT 2013
|
||||
* Updated for SDL 2.0 release
|
||||
Sam Lantinga - Sat Mar 23 13:36:51 PDT 2013
|
||||
* Fixed bug setting colorkey for indexed PNG images
|
||||
Torsten Stremlau - Sun Mar 10 10:19:25 PDT 2013
|
||||
* Added support for alpha and lossless WEBP images
|
||||
|
||||
1.2.12:
|
||||
mscott - 2012-02-06 19:40:23 PST
|
||||
* Fixed image corruption when using ImageIO framework
|
||||
Sylvain - Thu Nov 22 13:09:59 PST 2012
|
||||
* Added extended XPM color table (disabled by default in IMG_xpm.c)
|
||||
Sam Lantinga - Thu Jan 19 23:18:09 EST 2012
|
||||
* Fixed regression in 1.2.11 loading 8-bit PNG images with libpng
|
||||
|
||||
1.2.11:
|
||||
Sam Lantinga - Sat Jan 14 17:54:38 EST 2012
|
||||
* Fixed loading 8-bit PNG images on Mac OS X
|
||||
Sam Lantinga - Sat Dec 31 09:35:40 EST 2011
|
||||
* SDL_image is now under the zlib license
|
||||
Michael Bonfils - Mon Nov 28 21:46:00 EST 2011
|
||||
* Added WEBP image support
|
||||
Thomas Klausner - Wed Jan 19 19:31:25 PST 2011
|
||||
* Fixed compiling with libpng 1.4
|
||||
Sam Lantinga - Mon Jan 10 12:09:57 2011 -0800
|
||||
* Added Android.mk to build on the Android platform
|
||||
Sam Lantinga - Mon May 10 22:42:53 PDT 2010
|
||||
* Fixed loading HAM6 images with stencil mask
|
||||
Mark Tucker - Fri, 27 Nov 2009 12:38:21 -0500
|
||||
* Fixed bug loading 15 and 16 bit BMP images
|
||||
|
||||
1.2.10:
|
||||
Sam Lantinga - Sat Nov 14 11:22:14 PST 2009
|
||||
* Fixed bug loading multiple images
|
||||
|
||||
1.2.9:
|
||||
Sam Lantinga - Tue Nov 10 00:29:20 PST 2009
|
||||
* Fixed alpha premultiplication on Mac OS X and iPhone OS
|
||||
Sam Lantinga - Sun Nov 8 07:52:11 PST 2009
|
||||
* Fixed checking for IMG_Init() return value in image loaders
|
||||
|
||||
1.2.8:
|
||||
Sam Lantinga - Sun Oct 4 13:12:54 PDT 2009
|
||||
* Added support for uncompressed PCX files
|
||||
Mason Wheeler - 2009-06-10 06:29:45 PDT
|
||||
* Added IMG_Init()/IMG_Quit() to prevent constantly loading and unloading DLLs
|
||||
Couriersud - Mon, 12 Jan 2009 17:21:13 -0800
|
||||
* Added support for ICO and CUR image files
|
||||
Eric Wing - Fri, 2 Jan 2009 02:01:16 -0800
|
||||
* Added ImageIO loading infrastructure for Mac OS X
|
||||
* Added UIImage loading infrastructure for iPhone / iPod Touch
|
||||
|
||||
1.2.7:
|
||||
Sam Lantinga - Sun Nov 2 15:08:27 PST 2008
|
||||
* Fixed buffer overflow in BMP loading code, discovered by j00ru//vx
|
||||
Sam Lantinga - Fri Dec 28 08:34:54 PST 2007
|
||||
* Fixed buffer overflow in GIF loading code, discovered by Michael Skladnikiewicz
|
||||
|
||||
1.2.6:
|
||||
Sam lantinga - Wed Jul 18 00:30:32 PDT 2007
|
||||
* Improved detection of libjpeg, libpng, and libtiff at configure time
|
||||
* PNG and TIFF images are correctly identified even if dynamic libraries
|
||||
to load them aren't available.
|
||||
* Fixed loading of TIFF images using libtiff 3.6
|
||||
Sam Lantinga - Thu Jul 5 07:52:35 2007
|
||||
* Fixed static linking with libjpeg
|
||||
Michael Koch - Tue Feb 13 10:09:17 2007
|
||||
* Fixed crash in IMG_ReadXPMFromArray()
|
||||
|
||||
1.2.5:
|
||||
Maurizio Monge - Sun May 14 13:57:32 PDT 2006
|
||||
* Fixed loading BMP palettes at unusual offsets
|
||||
Sam Lantinga - Thu May 11 21:51:19 PDT 2006
|
||||
* Added support for dynamically loading libjpeg, libpng, and libtiff.
|
||||
Sam Lantinga - Sun Apr 30 01:48:40 PDT 2006
|
||||
* Added gcc-fat.sh for generating Universal binaries on Mac OS X
|
||||
* Updated libtool support to version 1.5.22
|
||||
Sam Lantinga - Sat Feb 4 15:17:44 PST 2006
|
||||
* Added support for XV thumbnail images
|
||||
Gautier Portet - Fri, 19 Mar 2004 17:35:12 +0100
|
||||
* Added support for 32-bit BMP files with alpha
|
||||
|
||||
1.2.4:
|
||||
Pierre G. Richard - Fri, 30 Jul 2004 11:13:11 +0000 (UTC)
|
||||
* Added support for RLE encoded BMP files
|
||||
Marc Le Douarain - Fri, 26 Dec 2003 18:23:42 +0100
|
||||
* Added EHB and HAM mode support to the ILBM loader
|
||||
Sam Lantinga - Wed Nov 19 00:23:44 PST 2003
|
||||
* Updated libtool support for new mingw32 DLL build process
|
||||
Holger Schemel - Mon, 04 Aug 2003 21:50:52 +0200
|
||||
* Fixed crash loading certain PCX images
|
||||
Kyle Davenport - Sat, 19 Apr 2003 17:13:31 -0500
|
||||
* Added .la files to the development RPM, fixing RPM build on RedHat 8
|
||||
|
||||
1.2.3:
|
||||
Ryan C. Gordon - Sat, 8 Feb 2003 09:36:33 -0500
|
||||
* Fixed memory leak with non-seekable SDL_RWops
|
||||
Marc Le Douarain - Sun, 22 Dec 2002 22:59:51 +0100
|
||||
* Added 24-bit support to the ILBM format loader
|
||||
Sam Lantinga - Sun Oct 20 20:55:46 PDT 2002
|
||||
* Added shared library support for MacOS X
|
||||
Pete Shinners - Thu Jun 20 10:05:54 PDT 2002
|
||||
* The JPEG loader can now load EXIF format JPEG images
|
||||
Dag-Erling Smorgrav - Thu May 2 19:09:48 PDT 2002
|
||||
* The XCF loader now ignores invisible layers and channels
|
||||
|
||||
1.2.2:
|
||||
Sam Lantinga - Sat Apr 13 07:49:47 PDT 2002
|
||||
* Updated autogen.sh for new versions of automake
|
||||
* Specify the SDL API calling convention (C by default)
|
||||
783
Library/SDL2_image-2.5.2/CMakeLists.txt
Normal file
783
Library/SDL2_image-2.5.2/CMakeLists.txt
Normal file
@@ -0,0 +1,783 @@
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
|
||||
|
||||
# See docs/release_checklist.md
|
||||
set(MAJOR_VERSION 2)
|
||||
set(MINOR_VERSION 5)
|
||||
set(MICRO_VERSION 2)
|
||||
set(SDL_REQUIRED_VERSION 2.0.9)
|
||||
|
||||
# For historical reasons this is 3.0.0 rather than the expected 1.0.0
|
||||
set(DYLIB_COMPATIBILITY_VERSION "3.0.0")
|
||||
|
||||
include(PrivateSdlFunctions)
|
||||
sdl_calculate_derived_version_variables()
|
||||
|
||||
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
|
||||
message(FATAL_ERROR "Prevented in-tree built. Please create a build directory outside of the SDL_image source code and call cmake from there")
|
||||
endif()
|
||||
|
||||
project(SDL2_image
|
||||
LANGUAGES C
|
||||
VERSION "${FULL_VERSION}"
|
||||
)
|
||||
|
||||
message(STATUS "Configuring ${PROJECT_NAME} ${PROJECT_VERSION}")
|
||||
|
||||
# Set defaults preventing destination file conflicts
|
||||
set(SDL2IMAGE_DEBUG_POSTFIX "d"
|
||||
CACHE STRING "Name suffix for debug builds")
|
||||
mark_as_advanced(SDL2IMAGE_DEBUG_POSTFIX)
|
||||
|
||||
# Assume MSVC projects don't have a package manager and need vendored dependencies (by default).
|
||||
# Most other platforms have some kind of package manager.
|
||||
# FIXME: consider a package manager such as conan/vcpkg instead of vendoring
|
||||
if(MSVC)
|
||||
set(vendored_default ON)
|
||||
else()
|
||||
set(vendored_default OFF)
|
||||
endif()
|
||||
|
||||
include(CMakeDependentOption)
|
||||
include(CMakePackageConfigHelpers)
|
||||
include(GNUInstallDirs)
|
||||
|
||||
option(CMAKE_POSITION_INDEPENDENT_CODE "Build static libraries with -fPIC" ON)
|
||||
option(BUILD_SHARED_LIBS "Build the library as a shared library" ON)
|
||||
|
||||
option(SDL2IMAGE_INSTALL "Enable SDL2_image install target" ON)
|
||||
option(SDL2IMAGE_DEPS_SHARED "Load dependencies dynamically" ON)
|
||||
option(SDL2IMAGE_VENDORED "Use vendored third-party libraries" ${vendored_default})
|
||||
|
||||
option(SDL2IMAGE_SAMPLES "Build the SDL2_image sample program(s)" ON)
|
||||
cmake_dependent_option(SDL2IMAGE_SAMPLES_INSTALL "Install the SDL2_image sample program(s)" OFF "SDL2IMAGE_SAMPLES;SDL2IMAGE_INSTALL" OFF)
|
||||
|
||||
option(SDL2IMAGE_TESTS "Build unit tests?" OFF)
|
||||
cmake_dependent_option(SDL2IMAGE_TESTS_INSTALL "Install unit tests?" OFF "SDL2IMAGE_TESTS;SDL2IMAGE_INSTALL" OFF)
|
||||
|
||||
option(SDL2IMAGE_BACKEND_STB "Use stb_image for loading JPEG and PNG files" ON)
|
||||
cmake_dependent_option(SDL2IMAGE_BACKEND_WIC "Add WIC backend (Windows Imaging Component)" OFF WIN32 OFF)
|
||||
cmake_dependent_option(SDL2IMAGE_BACKEND_IMAGEIO "Use native Mac OS X frameworks for loading images" ON APPLE OFF)
|
||||
|
||||
option(SDL2IMAGE_AVIF "Support loading AVIF images" OFF)
|
||||
option(SDL2IMAGE_BMP "Support loading BMP images" ON)
|
||||
option(SDL2IMAGE_GIF "Support loading GIF images" ON)
|
||||
option(SDL2IMAGE_JPG "Support loading JPEG images" ON)
|
||||
option(SDL2IMAGE_JXL "Support loading JXL images" OFF)
|
||||
option(SDL2IMAGE_LBM "Support loading LBM images" ON)
|
||||
option(SDL2IMAGE_PCX "Support loading PCX images" ON)
|
||||
option(SDL2IMAGE_PNG "Support loading PNG images" ON)
|
||||
option(SDL2IMAGE_PNM "Support loading PNM images" ON)
|
||||
option(SDL2IMAGE_QOI "Support loading QOI images" ON)
|
||||
option(SDL2IMAGE_SVG "Support loading SVG images" ON)
|
||||
option(SDL2IMAGE_TGA "Support loading TGA images" ON)
|
||||
option(SDL2IMAGE_TIF "Support loading TIFF images" OFF)
|
||||
option(SDL2IMAGE_WEBP "Support loading WEBP images" OFF)
|
||||
option(SDL2IMAGE_XCF "Support loading XCF images" ON)
|
||||
option(SDL2IMAGE_XPM "Support loading XPM images" ON)
|
||||
option(SDL2IMAGE_XV "Support loading XV images" ON)
|
||||
|
||||
cmake_dependent_option(SDL2IMAGE_JPG_SAVE "Add JPEG save support" ON SDL2IMAGE_JPG OFF)
|
||||
cmake_dependent_option(SDL2IMAGE_PNG_SAVE "Add PNG save support" ON SDL2IMAGE_PNG OFF)
|
||||
|
||||
set(LIBAVIF_MINIMUM_VERSION "0.9.1")
|
||||
if(SDL2IMAGE_VENDORED AND SDL2IMAGE_AVIF)
|
||||
set(SDL2IMAGE_AVIF_VENDORED ON)
|
||||
else()
|
||||
set(SDL2IMAGE_AVIF_VENDORED OFF)
|
||||
endif()
|
||||
cmake_dependent_option(SDL2IMAGE_AVIF_SHARED "Dynamically load AVIF support (requires shared libavif)"
|
||||
${SDL2IMAGE_DEPS_SHARED} SDL2IMAGE_AVIF OFF)
|
||||
|
||||
if(SDL2IMAGE_VENDORED AND SDL2IMAGE_JPG AND NOT (SDL2IMAGE_BACKEND_WIC OR SDL2IMAGE_BACKEND_STB OR SDL2IMAGE_BACKEND_IMAGEIO))
|
||||
set(SDL2IMAGE_JPG_VENDORED ON)
|
||||
else()
|
||||
set(SDL2IMAGE_JPG_VENDORED OFF)
|
||||
endif()
|
||||
cmake_dependent_option(SDL2IMAGE_JPG_SHARED "Dynamically load JPG support (requires shared libjpeg)"
|
||||
${SDL2IMAGE_DEPS_SHARED} "SDL2IMAGE_JPG;NOT SDL2IMAGE_BACKEND_WIC;NOT SDL2IMAGE_BACKEND_STB;NOT SDL2IMAGE_BACKEND_IMAGEIO" OFF)
|
||||
|
||||
if(SDL2IMAGE_VENDORED AND SDL2IMAGE_JXL)
|
||||
set(SDL2IMAGE_JXL_VENDORED ON)
|
||||
else()
|
||||
set(SDL2IMAGE_JXL_VENDORED OFF)
|
||||
endif()
|
||||
cmake_dependent_option(SDL2IMAGE_JXL_SHARED "Dynamically load JXL support (requires shared libjxl)"
|
||||
${SDL2IMAGE_DEPS_SHARED} SDL2IMAGE_JXL OFF)
|
||||
|
||||
if(SDL2IMAGE_VENDORED AND SDL2IMAGE_PNG AND NOT (SDL2IMAGE_BACKEND_WIC OR SDL2IMAGE_BACKEND_STB OR SDL2IMAGE_BACKEND_IMAGEIO))
|
||||
set(SDL2IMAGE_PNG_VENDORED ON)
|
||||
else()
|
||||
set(SDL2IMAGE_PNG_VENDORED OFF)
|
||||
endif()
|
||||
cmake_dependent_option(SDL2IMAGE_PNG_SHARED "Dynamically load PNG support (requires shared libpng)"
|
||||
${SDL2IMAGE_DEPS_SHARED} "SDL2IMAGE_PNG;NOT SDL2IMAGE_BACKEND_WIC;NOT SDL2IMAGE_BACKEND_STB;NOT SDL2IMAGE_BACKEND_IMAGEIO" OFF)
|
||||
|
||||
if(SDL2IMAGE_VENDORED AND SDL2IMAGE_TIF)
|
||||
set(SDL2IMAGE_TIF_VENDORED ON)
|
||||
else()
|
||||
set(SDL2IMAGE_TIF_VENDORED OFF)
|
||||
endif()
|
||||
cmake_dependent_option(SDL2IMAGE_TIF_SHARED "Dynamically load TIFF support (requires shared libtiff)"
|
||||
${SDL2IMAGE_DEPS_SHARED} SDL2IMAGE_TIF OFF)
|
||||
|
||||
if(SDL2IMAGE_VENDORED AND SDL2IMAGE_WEBP)
|
||||
set(SDL2IMAGE_WEBP_VENDORED ON)
|
||||
else()
|
||||
set(SDL2IMAGE_WEBP_VENDORED OFF)
|
||||
endif()
|
||||
cmake_dependent_option(SDL2IMAGE_WEBP_SHARED "Dynamically load WEBP support (requires shared libwebp)"
|
||||
${SDL2IMAGE_DEPS_SHARED} SDL2IMAGE_WEBP OFF)
|
||||
|
||||
if(SDL2IMAGE_PNG_VENDORED)
|
||||
set(SDL2IMAGE_ZLIB ON)
|
||||
else()
|
||||
set(SDL2IMAGE_ZLIB OFF)
|
||||
endif()
|
||||
|
||||
if(SDL2IMAGE_VENDORED AND SDL2IMAGE_PNG_VENDORED)
|
||||
set(SDL2IMAGE_ZLIB_VENDORED ON)
|
||||
else()
|
||||
set(SDL2IMAGE_ZLIB_VENDORED OFF)
|
||||
endif()
|
||||
if(SDL2IMAGE_PNG_SHARED)
|
||||
set(SDL2IMAGE_ZLIB_SHARED ON)
|
||||
else()
|
||||
set(SDL2IMAGE_ZLIB_SHARED OFF)
|
||||
endif()
|
||||
|
||||
# Save BUILD_SHARED_LIBS variable
|
||||
set(SDL2IMAGE_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS})
|
||||
|
||||
if(SDL2IMAGE_BUILD_SHARED_LIBS)
|
||||
set(sdl2_image_export_name SDL2_image)
|
||||
set(sdl2_image_install_name_infix shared)
|
||||
set(sdl2_target_name SDL2::SDL2)
|
||||
else()
|
||||
set(sdl2_image_export_name SDL2_image-static)
|
||||
set(sdl2_image_install_name_infix static)
|
||||
set(sdl2_target_name SDL2::SDL2-static)
|
||||
endif()
|
||||
|
||||
sdl_find_sdl2(${sdl2_target_name} ${SDL_REQUIRED_VERSION})
|
||||
|
||||
# Set PROJECT_VERSION of subprojects to "" if it's project call does not set VERSION
|
||||
cmake_policy(SET CMP0048 NEW)
|
||||
|
||||
# Allow cmake_dependent_option to use "Full Condition Syntax"
|
||||
if(POLICY CMP0127)
|
||||
cmake_policy(SET CMP0127 NEW)
|
||||
endif()
|
||||
|
||||
# OpenGL is required by dependencies of (dependencies of) some vendored libraries
|
||||
if(NOT DEFINED OpenGL_GL_PREFERENCE)
|
||||
set(OpenGL_GL_PREFERENCE GLVND)
|
||||
endif()
|
||||
|
||||
add_library(SDL2_image
|
||||
IMG.c
|
||||
IMG_WIC.c
|
||||
IMG_avif.c
|
||||
IMG_bmp.c
|
||||
IMG_gif.c
|
||||
IMG_jpg.c
|
||||
IMG_jxl.c
|
||||
IMG_lbm.c
|
||||
IMG_pcx.c
|
||||
IMG_png.c
|
||||
IMG_pnm.c
|
||||
IMG_qoi.c
|
||||
IMG_stb.c
|
||||
IMG_svg.c
|
||||
IMG_tga.c
|
||||
IMG_tif.c
|
||||
IMG_webp.c
|
||||
IMG_xcf.c
|
||||
IMG_xpm.c
|
||||
IMG_xv.c
|
||||
IMG_xxx.c
|
||||
)
|
||||
add_library(SDL2_image::${sdl2_image_export_name} ALIAS SDL2_image)
|
||||
target_include_directories(SDL2_image PUBLIC
|
||||
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>"
|
||||
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/SDL2>"
|
||||
)
|
||||
target_compile_definitions(SDL2_image PRIVATE
|
||||
BUILD_SDL
|
||||
SDL_BUILD_MAJOR_VERSION=${MAJOR_VERSION}
|
||||
SDL_BUILD_MINOR_VERSION=${MINOR_VERSION}
|
||||
SDL_BUILD_MICRO_VERSION=${MICRO_VERSION}
|
||||
)
|
||||
target_link_libraries(SDL2_image PRIVATE ${sdl2_target_name})
|
||||
if(WIN32 AND SDL2IMAGE_BUILD_SHARED_LIBS)
|
||||
target_sources(SDL2_image PRIVATE
|
||||
version.rc
|
||||
)
|
||||
endif()
|
||||
set_target_properties(SDL2_image PROPERTIES
|
||||
DEFINE_SYMBOL DLL_EXPORT
|
||||
PUBLIC_HEADER SDL_image.h
|
||||
EXPORT_NAME ${sdl2_image_export_name}
|
||||
C_VISIBILITY_PRESET "hidden"
|
||||
)
|
||||
if(NOT ANDROID)
|
||||
set_target_properties(SDL2_image PROPERTIES
|
||||
DEBUG_POSTFIX "${SDL2IMAGE_DEBUG_POSTFIX}"
|
||||
)
|
||||
if(APPLE)
|
||||
# the SOVERSION property corresponds to the compatibility version and VERSION corresponds to the current version
|
||||
# https://cmake.org/cmake/help/latest/prop_tgt/SOVERSION.html#mach-o-versions
|
||||
set_target_properties(SDL2_image PROPERTIES
|
||||
SOVERSION "${DYLIB_COMPATIBILITY_VERSION}"
|
||||
VERSION "${DYLIB_CURRENT_VERSION}"
|
||||
)
|
||||
else()
|
||||
set_target_properties(SDL2_image PROPERTIES
|
||||
SOVERSION "${LT_MAJOR}"
|
||||
VERSION "${LT_VERSION}"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
if(SDL2IMAGE_BUILD_SHARED_LIBS AND (APPLE OR (UNIX AND NOT ANDROID)))
|
||||
add_custom_command(TARGET SDL2_image POST_BUILD
|
||||
COMMAND "${CMAKE_COMMAND}" -E create_symlink "$<TARGET_SONAME_FILE_NAME:SDL2_image>" "libSDL2_image$<$<CONFIG:Debug>:${SDL2IMAGE_DEBUG_POSTFIX}>$<TARGET_FILE_SUFFIX:SDL2_image>"
|
||||
# BYPRODUCTS "libSDL2_image$<$<CONFIG:Debug>:${SDL2IMAGE_DEBUG_POSTFIX}>$<TARGET_FILE_SUFFIX:SDL2_image>" # Needs CMake 3.20
|
||||
WORKING_DIRECTORY "${PROJECT_BINARY_DIR}"
|
||||
)
|
||||
endif()
|
||||
if(SDL2IMAGE_BUILD_SHARED_LIBS)
|
||||
if(WIN32 OR OS2)
|
||||
set_target_properties(SDL2_image PROPERTIES
|
||||
PREFIX ""
|
||||
)
|
||||
endif()
|
||||
if(OS2)
|
||||
# OS/2 doesn't support a DLL name longer than 8 characters.
|
||||
set_target_properties(SDL2_image PROPERTIES
|
||||
OUTPUT_NAME "SDL2img"
|
||||
)
|
||||
elseif(UNIX AND NOT ANDROID)
|
||||
set_target_properties(SDL2_image PROPERTIES
|
||||
OUTPUT_NAME "SDL2_image-${LT_RELEASE}"
|
||||
)
|
||||
endif()
|
||||
else()
|
||||
if(MSVC OR (WATCOM AND (WIN32 OR OS2)))
|
||||
set_target_properties(SDL2_image PROPERTIES
|
||||
OUTPUT_NAME "SDL2_image-static"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Use `Compatible Interface Properties` to ensure a shared SDL2_image is built with a shared SDL2
|
||||
if(SDL2IMAGE_BUILD_SHARED_LIBS)
|
||||
set_property(TARGET SDL2_image PROPERTY INTERFACE_SDL2_SHARED ${SDL2IMAGE_BUILD_SHARED_LIBS})
|
||||
set_property(TARGET SDL2_image APPEND PROPERTY COMPATIBLE_INTERFACE_BOOL SDL2_SHARED)
|
||||
endif()
|
||||
|
||||
if(SDL2IMAGE_BUILD_SHARED_LIBS)
|
||||
sdl_target_link_options_no_undefined(SDL2_image)
|
||||
endif()
|
||||
|
||||
if(SDL2IMAGE_BUILD_SHARED_LIBS)
|
||||
# Make sure static library dependencies are built with -fPIC when building a shared SDL2_image
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
endif()
|
||||
|
||||
set(INSTALL_EXTRA_TARGETS)
|
||||
set(PC_LIBS)
|
||||
set(PC_REQUIRES)
|
||||
|
||||
if(SDL2IMAGE_BACKEND_STB)
|
||||
target_compile_definitions(SDL2_image PRIVATE USE_STBIMAGE)
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
if(SDL2IMAGE_BACKEND_IMAGEIO)
|
||||
target_link_options(SDL2_image PRIVATE -Wl,-framework,ApplicationServices)
|
||||
target_link_libraries(SDL2_image PRIVATE objc)
|
||||
target_sources(SDL2_image PRIVATE
|
||||
IMG_ImageIO.m
|
||||
)
|
||||
else()
|
||||
target_compile_definitions(SDL2_image PRIVATE SDL_IMAGE_USE_COMMON_BACKEND)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(SDL2IMAGE_BACKEND_WIC)
|
||||
target_compile_definitions(SDL2_image PRIVATE SDL_IMAGE_USE_WIC_BACKEND)
|
||||
endif()
|
||||
|
||||
if(SDL2IMAGE_ZLIB)
|
||||
if(SDL2IMAGE_ZLIB_VENDORED)
|
||||
message(STATUS "${PROJECT_NAME}: Using vendored zlib")
|
||||
sdl_check_project_in_subfolder(external/zlib zlib SDL2IMAGE_VENDORED)
|
||||
add_subdirectory(external/zlib EXCLUDE_FROM_ALL)
|
||||
# PNG_BUILD_ZLIB variable is used by vendored libpng
|
||||
set(PNG_BUILD_ZLIB ON CACHE BOOL "libpng option to tell it should use 'our' vendored ZLIB library" FORCE)
|
||||
# ZLIB_INCLUDE_DIR variable is used by vendored libpng
|
||||
set(ZLIB_INCLUDE_DIR "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/external/zlib;${CMAKE_CURRENT_BINARY_DIR}/external/zlib>" CACHE STRING "path of zlib, passed to libpng" FORCE)
|
||||
# ZLIB_LIBRARY variable is used by vendored libpng
|
||||
if(SDL2IMAGE_ZLIB_SHARED)
|
||||
set(ZLIB_LIBRARY zlib)
|
||||
else()
|
||||
set(ZLIB_LIBRARY zlibstatic)
|
||||
endif()
|
||||
list(APPEND INSTALL_EXTRA_TARGETS ${ZLIB_LIBRARY})
|
||||
else()
|
||||
message(STATUS "${PROJECT_NAME}: Using system zlib")
|
||||
find_package(ZLIB REQUIRED)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(SDL2IMAGE_AVIF)
|
||||
target_compile_definitions(SDL2_image PRIVATE LOAD_AVIF)
|
||||
if(SDL2IMAGE_AVIF_VENDORED)
|
||||
message(STATUS "${PROJECT_NAME}: Using vendored libavif")
|
||||
message(FATAL_ERROR "libavif is not vendored (yet)")
|
||||
sdl_check_project_in_subfolder(external/libavif libavif SDL2IMAGE_VENDORED)
|
||||
set(BUILD_SHARED_LIBS ${SDL2IMAGE_AVIF_SHARED})
|
||||
add_subdirectory(external/libavif EXCLUDE_FROM_ALL)
|
||||
list(APPEND INSTALL_EXTRA_TARGETS libavif)
|
||||
if(NOT SDL2IMAGE_AVIF_SHARED)
|
||||
list(APPEND PC_LIBS -l$<TARGET_FILE_BASE_NAME:avif>)
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "${PROJECT_NAME}: Using system libavif")
|
||||
find_package(libavif ${LIBAVIF_MINIMUM_VERSION} REQUIRED)
|
||||
list(APPEND PC_REQUIRES libavif)
|
||||
endif()
|
||||
if(SDL2IMAGE_AVIF_SHARED)
|
||||
target_include_directories(SDL2_image PRIVATE
|
||||
$<TARGET_PROPERTY:avif,INCLUDE_DIRECTORIES>
|
||||
$<TARGET_PROPERTY:avif,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
$<TARGET_PROPERTY:avif,INTERFACE_SYSTEM_INCLUDE_DIRECTORIES>
|
||||
)
|
||||
target_get_dynamic_library(dynamic_avif avif)
|
||||
message(STATUS "Dynamic libavif: ${dynamic_avif}")
|
||||
target_compile_definitions(SDL2_image PRIVATE "LOAD_AVIF_DYNAMIC=\"${dynamic_avif}\"")
|
||||
if(SDL2IMAGE_AVIF_VENDORED)
|
||||
add_dependencies(SDL2_image avif)
|
||||
endif()
|
||||
else()
|
||||
target_link_libraries(SDL2_image PRIVATE avif)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(SDL2IMAGE_BMP)
|
||||
target_compile_definitions(SDL2_image PRIVATE LOAD_BMP)
|
||||
endif()
|
||||
|
||||
if(SDL2IMAGE_GIF)
|
||||
target_compile_definitions(SDL2_image PRIVATE LOAD_GIF)
|
||||
endif()
|
||||
|
||||
if(SDL2IMAGE_JPG)
|
||||
target_compile_definitions(SDL2_image PRIVATE
|
||||
LOAD_JPG
|
||||
SDL_IMAGE_SAVE_JPG=$<BOOL:${SDL2IMAGE_JPG_SAVE}>
|
||||
)
|
||||
if(NOT SDL2IMAGE_BACKEND_STB AND NOT SDL2IMAGE_BACKEND_WIC AND NOT SDL2IMAGE_BACKEND_IMAGEIO)
|
||||
if(SDL2IMAGE_JPG_VENDORED)
|
||||
message(STATUS "${PROJECT_NAME}: Using vendored libjpeg")
|
||||
sdl_check_project_in_subfolder(external/jpeg libjpeg SDL2IMAGE_VENDORED)
|
||||
set(BUILD_SHARED_LIBS ${SDL2IMAGE_JPG_SHARED})
|
||||
add_subdirectory(external/jpeg EXCLUDE_FROM_ALL)
|
||||
list(APPEND INSTALL_EXTRA_TARGETS jpeg)
|
||||
if(NOT SDL2IMAGE_JPG_SHARED)
|
||||
list(APPEND PC_LIBS -l$<TARGET_FILE_BASE_NAME:jpeg>)
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "${PROJECT_NAME}: Using system libjpeg")
|
||||
find_package(JPEG REQUIRED)
|
||||
list(APPEND PC_REQUIRES libjpeg)
|
||||
endif()
|
||||
if(SDL2IMAGE_JPG_SHARED)
|
||||
target_include_directories(SDL2_image PRIVATE
|
||||
$<TARGET_PROPERTY:JPEG::JPEG,INCLUDE_DIRECTORIES>
|
||||
$<TARGET_PROPERTY:JPEG::JPEG,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
$<TARGET_PROPERTY:JPEG::JPEG,INTERFACE_SYSTEM_INCLUDE_DIRECTORIES>
|
||||
)
|
||||
target_get_dynamic_library(dynamic_jpeg JPEG::JPEG)
|
||||
message(STATUS "Dynamic libjpeg: ${dynamic_jpeg}")
|
||||
target_compile_definitions(SDL2_image PRIVATE "LOAD_JPG_DYNAMIC=\"${dynamic_jpeg}\"")
|
||||
if(SDL2IMAGE_JPG_VENDORED)
|
||||
add_dependencies(SDL2_image JPEG::JPEG)
|
||||
endif()
|
||||
else()
|
||||
target_link_libraries(SDL2_image PRIVATE JPEG::JPEG)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(SDL2IMAGE_JXL)
|
||||
target_compile_definitions(SDL2_image PRIVATE LOAD_JXL)
|
||||
if(SDL2IMAGE_JXL_VENDORED)
|
||||
enable_language(CXX)
|
||||
message(STATUS "${PROJECT_NAME}: Using vendored libjxl")
|
||||
set(BUILD_TESTING OFF)
|
||||
# JPEGXL_ENABLE_MANPAGES variable is used by libjxl
|
||||
set(JPEGXL_ENABLE_MANPAGES OFF CACHE BOOL "libjxl manpage option" FORCE)
|
||||
# JPEGXL_ENABLE_PLUGINS variable is used by libjxl
|
||||
set(JPEGXL_ENABLE_PLUGINS OFF CACHE BOOL "libjxl manpage option" FORCE)
|
||||
# JPEGXL_ENABLE_SKCMS variable is used by libjxl
|
||||
set(JPEGXL_ENABLE_SKCMS OFF CACHE BOOL "libjxl skcms option" FORCE)
|
||||
# JPEGXL_FORCE_SYSTEM_HWY variable is used by libjxl
|
||||
set(JPEGXL_FORCE_SYSTEM_HWY OFF CACHE BOOL "libjxl highway option" FORCE)
|
||||
sdl_check_project_in_subfolder(external/libjxl libjxl SDL2IMAGE_VENDORED)
|
||||
set(BUILD_SHARED_LIBS ${SDL2IMAGE_JXL_SHARED})
|
||||
add_subdirectory(external/libjxl EXCLUDE_FROM_ALL)
|
||||
if(BUILD_SHARED_LIBS)
|
||||
set(jxl_lib jxl)
|
||||
list(APPEND INSTALL_EXTRA_TARGETS brotlidec brotlicommon brotlienc hwy ${jxl_lib})
|
||||
if(NOT SDL2IMAGE_JXL_SHARED)
|
||||
list(APPEND PC_LIBS
|
||||
-l$<TARGET_FILE_BASE_NAME:brotlidec> -l$<TARGET_FILE_BASE_NAME:brotlicommon>
|
||||
-l$<TARGET_FILE_BASE_NAME:brotlienc> -l$<TARGET_FILE_BASE_NAME:${jxl_lib}>
|
||||
)
|
||||
endif()
|
||||
else()
|
||||
set(jxl_lib jxl_dec-static)
|
||||
list(APPEND INSTALL_EXTRA_TARGETS brotlidec-static brotlicommon-static hwy ${jxl_lib})
|
||||
endif()
|
||||
if(NOT TARGET libjxl::libjxl)
|
||||
add_library(libjxl::libjxl ALIAS ${jxl_lib})
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "${PROJECT_NAME}: Using system libjxl")
|
||||
list(APPEND PC_REQUIRES libjxl)
|
||||
find_package(libjxl REQUIRED)
|
||||
endif()
|
||||
if(SDL2IMAGE_JXL_SHARED)
|
||||
target_include_directories(SDL2_image PRIVATE
|
||||
$<TARGET_PROPERTY:libjxl::libjxl,INCLUDE_DIRECTORIES>
|
||||
$<TARGET_PROPERTY:libjxl::libjxl,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
$<TARGET_PROPERTY:libjxl::libjxl,INTERFACE_SYSTEM_INCLUDE_DIRECTORIES>
|
||||
)
|
||||
target_get_dynamic_library(dynamic_jxl libjxl::libjxl)
|
||||
message(STATUS "Dynamic libjxl: ${dynamic_jxl}")
|
||||
target_compile_definitions(SDL2_image PRIVATE "LOAD_JXL_DYNAMIC=\"${dynamic_jxl}\"")
|
||||
if(SDL2IMAGE_JXL_VENDORED)
|
||||
add_dependencies(SDL2_image libjxl::libjxl)
|
||||
endif()
|
||||
else()
|
||||
target_link_libraries(SDL2_image PRIVATE libjxl::libjxl)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(SDL2IMAGE_LBM)
|
||||
target_compile_definitions(SDL2_image PRIVATE LOAD_LBM)
|
||||
endif()
|
||||
|
||||
if(SDL2IMAGE_PCX)
|
||||
target_compile_definitions(SDL2_image PRIVATE LOAD_PCX)
|
||||
endif()
|
||||
|
||||
if(SDL2IMAGE_PNG)
|
||||
target_compile_definitions(SDL2_image PRIVATE
|
||||
LOAD_PNG
|
||||
SDL_IMAGE_SAVE_PNG=$<BOOL:${SDL2IMAGE_PNG_SAVE}>
|
||||
)
|
||||
if(NOT SDL2IMAGE_BACKEND_STB AND NOT SDL2IMAGE_BACKEND_WIC AND NOT SDL2IMAGE_BACKEND_IMAGEIO)
|
||||
set(HAVE_LD_VERSION_SCRIPT OFF CACHE BOOL "" FORCE)
|
||||
if(SDL2IMAGE_PNG_VENDORED)
|
||||
message(STATUS "${PROJECT_NAME}: Using vendored libpng")
|
||||
sdl_check_project_in_subfolder(external/libpng libpng SDL2IMAGE_VENDORED)
|
||||
add_subdirectory(external/libpng EXCLUDE_FROM_ALL)
|
||||
if(SDL2IMAGE_BUILD_SHARED_LIBS)
|
||||
set(PNG_LIBRARY png)
|
||||
else()
|
||||
set(PNG_LIBRARY png_static)
|
||||
endif()
|
||||
add_library(PNG::PNG ALIAS ${PNG_LIBRARY})
|
||||
target_include_directories(SDL2_image PRIVATE external/libpng)
|
||||
list(APPEND INSTALL_EXTRA_TARGETS ${PNG_LIBRARY})
|
||||
if(NOT SDL2IMAGE_PNG_SHARED)
|
||||
list(APPEND PC_LIBS -l$<TARGET_FILE_BASE_NAME:${PNG_LIBRARY}>)
|
||||
if(SDL2IMAGE_ZLIB_VENDORED)
|
||||
list(APPEND PC_LIBS -l$<TARGET_FILE_BASE_NAME:${ZLIB_LIBRARY}>)
|
||||
else()
|
||||
list(APPEND PC_REQUIRES zlib)
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "${PROJECT_NAME}: Using system libpng")
|
||||
find_package(PNG REQUIRED)
|
||||
list(APPEND PC_REQUIRES libpng)
|
||||
endif()
|
||||
if(SDL2IMAGE_PNG_SHARED)
|
||||
target_include_directories(SDL2_image PRIVATE
|
||||
$<TARGET_PROPERTY:PNG::PNG,INCLUDE_DIRECTORIES>
|
||||
$<TARGET_PROPERTY:PNG::PNG,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
$<TARGET_PROPERTY:PNG::PNG,INTERFACE_SYSTEM_INCLUDE_DIRECTORIES>
|
||||
)
|
||||
target_get_dynamic_library(dynamic_png PNG::PNG)
|
||||
message(STATUS "Dynamic libpng: ${dynamic_png}")
|
||||
target_compile_definitions(SDL2_image PRIVATE "LOAD_PNG_DYNAMIC=\"${dynamic_png}\"")
|
||||
if(SDL2IMAGE_PNG_VENDORED)
|
||||
add_dependencies(SDL2_image PNG::PNG)
|
||||
endif()
|
||||
else()
|
||||
target_link_libraries(SDL2_image PRIVATE PNG::PNG)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(SDL2IMAGE_PNM)
|
||||
target_compile_definitions(SDL2_image PRIVATE LOAD_PNM)
|
||||
endif()
|
||||
|
||||
if(SDL2IMAGE_QOI)
|
||||
target_compile_definitions(SDL2_image PRIVATE LOAD_QOI)
|
||||
endif()
|
||||
|
||||
if(SDL2IMAGE_SVG)
|
||||
target_compile_definitions(SDL2_image PRIVATE LOAD_SVG)
|
||||
endif()
|
||||
|
||||
if(SDL2IMAGE_TGA)
|
||||
target_compile_definitions(SDL2_image PRIVATE LOAD_TGA)
|
||||
endif()
|
||||
|
||||
if(SDL2IMAGE_TIF)
|
||||
target_compile_definitions(SDL2_image PRIVATE LOAD_TIF)
|
||||
if(SDL2IMAGE_TIF_VENDORED)
|
||||
message(STATUS "${PROJECT_NAME}: Using vendored libtiff")
|
||||
# jpeg variable is used by vendored libtiff
|
||||
set(jpeg OFF CACHE BOOL "libtiff: jpeg option" FORCE)
|
||||
# libdeflate variable is used by vendored libtiff
|
||||
set(libdeflate OFF CACHE BOOL "libtiff: libdeflate option" FORCE)
|
||||
# DEFLATE_FOUND variable is used by vendored libtiff
|
||||
set(DEFLATE_FOUND OFF CACHE BOOL "libtiff: libdeflate option" FORCE)
|
||||
# zlib variable is used by vendored libtiff (controls use of `find_package`)
|
||||
set(zlib OFF CACHE BOOL "libtiff: find zlib using find_package" FORCE)
|
||||
# ZLIB_FOUND is used by vendored libtiff
|
||||
set(ZLIB_FOUND "")
|
||||
# lzma variable is used by vendored libtiff
|
||||
set(lzma OFF CACHE BOOL "libtiff: lzma option" FORCE)
|
||||
# webp variable is used by vendored libtiff
|
||||
set(webp OFF CACHE BOOL "libtiff: webp option" FORCE)
|
||||
# zstd variable is used by vendored libtiff
|
||||
set(zstd OFF CACHE BOOL "libtiff: zstd option" FORCE)
|
||||
# ZSTD_FOUND variable is used by vendored libtiff
|
||||
set(ZSTD_FOUND OFF)
|
||||
# WEBP_LIBRARY variable is used by vendored libtiff
|
||||
set(WEBP_LIBRARY "")
|
||||
sdl_check_project_in_subfolder(external/libtiff libtiff SDL2IMAGE_VENDORED)
|
||||
set(BUILD_SHARED_LIBS ${SDL2IMAGE_TIF_SHARED})
|
||||
add_subdirectory(external/libtiff EXCLUDE_FROM_ALL)
|
||||
add_library(TIFF::TIFF ALIAS tiff)
|
||||
list(APPEND INSTALL_EXTRA_TARGETS tiff)
|
||||
if(NOT SDL2IMAGE_TIF_SHARED)
|
||||
list(APPEND PC_LIBS -l$<TARGET_FILE_BASE_NAME:tiff>)
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "${PROJECT_NAME}: Using system libtiff")
|
||||
find_package(TIFF REQUIRED)
|
||||
list(APPEND PC_REQUIRES libtiff-4)
|
||||
endif()
|
||||
if(SDL2IMAGE_TIF_SHARED)
|
||||
target_include_directories(SDL2_image PRIVATE
|
||||
$<TARGET_PROPERTY:TIFF::TIFF,INCLUDE_DIRECTORIES>
|
||||
$<TARGET_PROPERTY:TIFF::TIFF,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
$<TARGET_PROPERTY:TIFF::TIFF,INTERFACE_SYSTEM_INCLUDE_DIRECTORIES>
|
||||
)
|
||||
target_get_dynamic_library(dynamic_tif TIFF::TIFF)
|
||||
message(STATUS "Dynamic libtiff: ${dynamic_tif}")
|
||||
target_compile_definitions(SDL2_image PRIVATE "LOAD_TIF_DYNAMIC=\"${dynamic_tif}\"")
|
||||
if(SDL2IMAGE_TIF_VENDORED)
|
||||
add_dependencies(SDL2_image TIFF::TIFF)
|
||||
endif()
|
||||
else()
|
||||
target_link_libraries(SDL2_image PRIVATE TIFF::TIFF)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(SDL2IMAGE_WEBP)
|
||||
target_compile_definitions(SDL2_image PRIVATE LOAD_WEBP)
|
||||
# missing cpufeatures
|
||||
if(SDL2IMAGE_WEBP_VENDORED)
|
||||
message(STATUS "${PROJECT_NAME}: Using vendored libwebp")
|
||||
sdl_check_project_in_subfolder(external/libwebp libwebp SDL2IMAGE_VENDORED)
|
||||
set(BUILD_SHARED_LIBS ${SDL2IMAGE_WEBP_SHARED})
|
||||
add_subdirectory(external/libwebp EXCLUDE_FROM_ALL)
|
||||
target_include_directories(SDL2_image PRIVATE external/libwebp/src)
|
||||
add_library(WebP::webp ALIAS webp)
|
||||
list(APPEND INSTALL_EXTRA_TARGETS webp)
|
||||
else()
|
||||
message(STATUS "${PROJECT_NAME}: Using system libwebp")
|
||||
find_package(webp REQUIRED)
|
||||
list(APPEND PC_REQUIRES libwebp)
|
||||
endif()
|
||||
if(SDL2IMAGE_WEBP_SHARED)
|
||||
target_include_directories(SDL2_image PRIVATE
|
||||
$<TARGET_PROPERTY:WebP::webp,INCLUDE_DIRECTORIES>
|
||||
$<TARGET_PROPERTY:WebP::webp,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
$<TARGET_PROPERTY:WebP::webp,INTERFACE_SYSTEM_INCLUDE_DIRECTORIES>
|
||||
)
|
||||
target_get_dynamic_library(dynamic_webp WebP::webp)
|
||||
message(STATUS "Dynamic libwebp: ${dynamic_webp}")
|
||||
target_compile_definitions(SDL2_image PRIVATE "LOAD_WEBP_DYNAMIC=\"${dynamic_webp}\"")
|
||||
if(SDL2IMAGE_WEBP_VENDORED)
|
||||
add_dependencies(SDL2_image WebP::webp)
|
||||
endif()
|
||||
else()
|
||||
target_link_libraries(SDL2_image PRIVATE WebP::webp)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(SDL2IMAGE_XCF)
|
||||
target_compile_definitions(SDL2_image PRIVATE LOAD_XCF)
|
||||
endif()
|
||||
|
||||
if(SDL2IMAGE_XPM)
|
||||
target_compile_definitions(SDL2_image PRIVATE LOAD_XPM)
|
||||
endif()
|
||||
|
||||
if(SDL2IMAGE_XV)
|
||||
target_compile_definitions(SDL2_image PRIVATE LOAD_XV)
|
||||
endif()
|
||||
|
||||
# Restore BUILD_SHARED_LIBS
|
||||
set(BUILD_SHARED_LIBS ${SDL2IMAGE_BUILD_SHARED_LIBS})
|
||||
|
||||
if(SDL2IMAGE_INSTALL)
|
||||
install(
|
||||
TARGETS SDL2_image
|
||||
EXPORT SDL2ImageExports
|
||||
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT devel
|
||||
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT library
|
||||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT library
|
||||
PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/SDL2" COMPONENT devel
|
||||
)
|
||||
|
||||
if(INSTALL_EXTRA_TARGETS)
|
||||
install(
|
||||
TARGETS ${INSTALL_EXTRA_TARGETS}
|
||||
EXPORT SDL2ImageExports
|
||||
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT devel
|
||||
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT library
|
||||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT library
|
||||
PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" COMPONENT devel
|
||||
)
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
set(PKG_PREFIX "SDL2_image.framework/Resources")
|
||||
elseif(WIN32 AND NOT MINGW)
|
||||
set(PKG_PREFIX "cmake")
|
||||
else()
|
||||
set(PKG_PREFIX "${CMAKE_INSTALL_LIBDIR}/cmake/SDL2_image")
|
||||
endif()
|
||||
|
||||
configure_package_config_file(SDL2_imageConfig.cmake.in SDL2_imageConfig.cmake
|
||||
INSTALL_DESTINATION "${PKG_PREFIX}"
|
||||
)
|
||||
write_basic_package_version_file("${PROJECT_BINARY_DIR}/SDL2_imageConfigVersion.cmake"
|
||||
VERSION ${FULL_VERSION}
|
||||
COMPATIBILITY AnyNewerVersion
|
||||
)
|
||||
install(
|
||||
FILES
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/SDL2_imageConfig.cmake"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/SDL2_imageConfigVersion.cmake"
|
||||
cmake/Findlibjxl.cmake
|
||||
cmake/Findwebp.cmake
|
||||
DESTINATION "${PKG_PREFIX}"
|
||||
COMPONENT devel
|
||||
)
|
||||
install(EXPORT SDL2ImageExports
|
||||
FILE SDL2_image-${sdl2_image_install_name_infix}-targets.cmake
|
||||
NAMESPACE SDL2_image::
|
||||
DESTINATION "${PKG_PREFIX}"
|
||||
COMPONENT devel
|
||||
)
|
||||
|
||||
if(SDL2IMAGE_BUILD_SHARED_LIBS)
|
||||
# Only create a .pc file for a shared SDL2_image
|
||||
set(prefix "${CMAKE_INSTALL_PREFIX}")
|
||||
set(exec_prefix "\${prefix}")
|
||||
set(libdir "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}")
|
||||
set(includedir "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}")
|
||||
set(PACKAGE "${PROJECT_NAME}")
|
||||
set(VERSION "${FULL_VERSION}")
|
||||
set(SDL_VERSION "${SDL_REQUIRED_VERSION}")
|
||||
string(JOIN " " PC_REQUIRES ${PC_REQUIRES})
|
||||
string(JOIN " " PC_LIBS ${PC_LIBS})
|
||||
configure_file("${PROJECT_SOURCE_DIR}/SDL2_image.pc.in" "${CMAKE_CURRENT_BINARY_DIR}/SDL2_image.pc.intermediate" @ONLY)
|
||||
file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/SDL2_image-$<CONFIG>.pc" INPUT "${CMAKE_CURRENT_BINARY_DIR}/SDL2_image.pc.intermediate")
|
||||
|
||||
set(PC_DESTDIR)
|
||||
if(CMAKE_SYSTEM_NAME MATCHES FreeBSD)
|
||||
# FreeBSD uses ${PREFIX}/libdata/pkgconfig
|
||||
set(PC_DESTDIR "libdata/pkgconfig")
|
||||
else()
|
||||
set(PC_DESTDIR "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
|
||||
endif()
|
||||
# Only install a SDL2_image.pc file in Release mode
|
||||
install(CODE "
|
||||
# FIXME: use file(COPY_FILE) if minimum CMake version >= 3.21
|
||||
execute_process(COMMAND \"\${CMAKE_COMMAND}\" -E copy_if_different
|
||||
\"${CMAKE_CURRENT_BINARY_DIR}/SDL2_image-$<CONFIG>.pc\"
|
||||
\"${CMAKE_CURRENT_BINARY_DIR}/SDL2_image.pc\")
|
||||
file(INSTALL DESTINATION \"\${CMAKE_INSTALL_PREFIX}/${PC_DESTDIR}\"
|
||||
TYPE FILE
|
||||
FILES \"${CMAKE_CURRENT_BINARY_DIR}/SDL2_image.pc\")" CONFIG Release COMPONENT devel)
|
||||
endif()
|
||||
|
||||
if(SDL2IMAGE_BUILD_SHARED_LIBS AND (APPLE OR (UNIX AND NOT ANDROID)))
|
||||
install(
|
||||
FILES
|
||||
"${PROJECT_BINARY_DIR}/libSDL2_image$<$<CONFIG:Debug>:${SDL2IMAGE_DEBUG_POSTFIX}>$<TARGET_FILE_SUFFIX:SDL2_image>"
|
||||
DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||
COMPONENT devel
|
||||
)
|
||||
endif()
|
||||
|
||||
install(FILES "LICENSE.txt"
|
||||
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/licenses/${PROJECT_NAME}"
|
||||
COMPONENT library
|
||||
)
|
||||
endif()
|
||||
|
||||
if(SDL2IMAGE_SAMPLES)
|
||||
add_executable(showanim showanim.c)
|
||||
add_executable(showimage showimage.c)
|
||||
|
||||
find_package(SDL2main)
|
||||
|
||||
foreach(prog showanim showimage)
|
||||
# FIXME: mingw should be handled by SDL2::SDL2(-static) target
|
||||
if(MINGW)
|
||||
target_link_libraries(${prog} PRIVATE mingw32)
|
||||
target_link_options(${prog} PRIVATE -mwindows)
|
||||
endif()
|
||||
target_link_libraries(${prog} PRIVATE SDL2_image::${sdl2_image_export_name})
|
||||
if(TARGET SDL2::SDL2main)
|
||||
target_link_libraries(${prog} PRIVATE SDL2::SDL2main)
|
||||
endif()
|
||||
target_link_libraries(${prog} PRIVATE ${sdl2_target_name})
|
||||
|
||||
if(SDL2IMAGE_SAMPLES_INSTALL)
|
||||
install(TARGETS ${prog}
|
||||
RUNTIME DESTINATION "{CMAKE_INSTALL_BINDIR}"
|
||||
)
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
add_library(SDL2::image INTERFACE IMPORTED GLOBAL)
|
||||
set_target_properties(SDL2::image PROPERTIES
|
||||
INTERFACE_LINK_LIBRARIES "SDL2_image"
|
||||
)
|
||||
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.17")
|
||||
set_target_properties(SDL2::image PROPERTIES
|
||||
DEPRECATION "Use SDL2_image::SDL2_image or SDL2_image::SDL2_image-static instead"
|
||||
)
|
||||
endif()
|
||||
|
||||
if(SDL2IMAGE_TESTS)
|
||||
enable_testing()
|
||||
add_subdirectory(test)
|
||||
endif()
|
||||
441
Library/SDL2_image-2.5.2/IMG.c
Normal file
441
Library/SDL2_image-2.5.2/IMG.c
Normal file
@@ -0,0 +1,441 @@
|
||||
/*
|
||||
SDL_image: An example image loading library for use with SDL
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
/* A simple library to load images of various formats as SDL surfaces */
|
||||
|
||||
#include "SDL_image.h"
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#include <emscripten/emscripten.h>
|
||||
#endif
|
||||
|
||||
#if defined(SDL_BUILD_MAJOR_VERSION) && defined(SDL_COMPILE_TIME_ASSERT)
|
||||
SDL_COMPILE_TIME_ASSERT(SDL_BUILD_MAJOR_VERSION,
|
||||
SDL_IMAGE_MAJOR_VERSION == SDL_BUILD_MAJOR_VERSION);
|
||||
SDL_COMPILE_TIME_ASSERT(SDL_BUILD_MINOR_VERSION,
|
||||
SDL_IMAGE_MINOR_VERSION == SDL_BUILD_MINOR_VERSION);
|
||||
SDL_COMPILE_TIME_ASSERT(SDL_BUILD_MICRO_VERSION,
|
||||
SDL_IMAGE_PATCHLEVEL == SDL_BUILD_MICRO_VERSION);
|
||||
#endif
|
||||
|
||||
#if defined(SDL_COMPILE_TIME_ASSERT)
|
||||
SDL_COMPILE_TIME_ASSERT(SDL_IMAGE_MAJOR_VERSION_min, SDL_IMAGE_MAJOR_VERSION >= 0);
|
||||
/* Limited only by the need to fit in SDL_version */
|
||||
SDL_COMPILE_TIME_ASSERT(SDL_IMAGE_MAJOR_VERSION_max, SDL_IMAGE_MAJOR_VERSION <= 255);
|
||||
|
||||
SDL_COMPILE_TIME_ASSERT(SDL_IMAGE_MINOR_VERSION_min, SDL_IMAGE_MINOR_VERSION >= 0);
|
||||
/* Limited only by the need to fit in SDL_version */
|
||||
SDL_COMPILE_TIME_ASSERT(SDL_IMAGE_MINOR_VERSION_max, SDL_IMAGE_MINOR_VERSION <= 255);
|
||||
|
||||
SDL_COMPILE_TIME_ASSERT(SDL_IMAGE_PATCHLEVEL_min, SDL_IMAGE_PATCHLEVEL >= 0);
|
||||
/* Limited by its encoding in SDL_VERSIONNUM and in the ABI versions */
|
||||
SDL_COMPILE_TIME_ASSERT(SDL_IMAGE_PATCHLEVEL_max, SDL_IMAGE_PATCHLEVEL <= 99);
|
||||
#endif
|
||||
|
||||
/* Table of image detection and loading functions */
|
||||
static struct {
|
||||
const char *type;
|
||||
int (SDLCALL *is)(SDL_RWops *src);
|
||||
SDL_Surface *(SDLCALL *load)(SDL_RWops *src);
|
||||
} supported[] = {
|
||||
/* keep magicless formats first */
|
||||
{ "TGA", NULL, IMG_LoadTGA_RW },
|
||||
{ "AVIF",IMG_isAVIF,IMG_LoadAVIF_RW },
|
||||
{ "CUR", IMG_isCUR, IMG_LoadCUR_RW },
|
||||
{ "ICO", IMG_isICO, IMG_LoadICO_RW },
|
||||
{ "BMP", IMG_isBMP, IMG_LoadBMP_RW },
|
||||
{ "GIF", IMG_isGIF, IMG_LoadGIF_RW },
|
||||
{ "JPG", IMG_isJPG, IMG_LoadJPG_RW },
|
||||
{ "JXL", IMG_isJXL, IMG_LoadJXL_RW },
|
||||
{ "LBM", IMG_isLBM, IMG_LoadLBM_RW },
|
||||
{ "PCX", IMG_isPCX, IMG_LoadPCX_RW },
|
||||
{ "PNG", IMG_isPNG, IMG_LoadPNG_RW },
|
||||
{ "PNM", IMG_isPNM, IMG_LoadPNM_RW }, /* P[BGP]M share code */
|
||||
{ "SVG", IMG_isSVG, IMG_LoadSVG_RW },
|
||||
{ "TIF", IMG_isTIF, IMG_LoadTIF_RW },
|
||||
{ "XCF", IMG_isXCF, IMG_LoadXCF_RW },
|
||||
{ "XPM", IMG_isXPM, IMG_LoadXPM_RW },
|
||||
{ "XV", IMG_isXV, IMG_LoadXV_RW },
|
||||
{ "WEBP", IMG_isWEBP, IMG_LoadWEBP_RW },
|
||||
{ "QOI", IMG_isQOI, IMG_LoadQOI_RW },
|
||||
};
|
||||
|
||||
/* Table of animation detection and loading functions */
|
||||
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 },
|
||||
};
|
||||
|
||||
const SDL_version *IMG_Linked_Version(void)
|
||||
{
|
||||
static SDL_version linked_version;
|
||||
SDL_IMAGE_VERSION(&linked_version);
|
||||
return(&linked_version);
|
||||
}
|
||||
|
||||
extern int IMG_InitAVIF(void);
|
||||
extern void IMG_QuitAVIF(void);
|
||||
extern int IMG_InitJPG(void);
|
||||
extern void IMG_QuitJPG(void);
|
||||
extern int IMG_InitJXL(void);
|
||||
extern void IMG_QuitJXL(void);
|
||||
extern int IMG_InitPNG(void);
|
||||
extern void IMG_QuitPNG(void);
|
||||
extern int IMG_InitTIF(void);
|
||||
extern void IMG_QuitTIF(void);
|
||||
|
||||
extern int IMG_InitWEBP(void);
|
||||
extern void IMG_QuitWEBP(void);
|
||||
|
||||
static int initialized = 0;
|
||||
|
||||
int IMG_Init(int flags)
|
||||
{
|
||||
int result = 0;
|
||||
|
||||
if (flags & IMG_INIT_AVIF) {
|
||||
if ((initialized & IMG_INIT_AVIF) || IMG_InitAVIF() == 0) {
|
||||
result |= IMG_INIT_AVIF;
|
||||
}
|
||||
}
|
||||
if (flags & IMG_INIT_JPG) {
|
||||
if ((initialized & IMG_INIT_JPG) || IMG_InitJPG() == 0) {
|
||||
result |= IMG_INIT_JPG;
|
||||
}
|
||||
}
|
||||
if (flags & IMG_INIT_JXL) {
|
||||
if ((initialized & IMG_INIT_JXL) || IMG_InitJXL() == 0) {
|
||||
result |= IMG_INIT_JXL;
|
||||
}
|
||||
}
|
||||
if (flags & IMG_INIT_PNG) {
|
||||
if ((initialized & IMG_INIT_PNG) || IMG_InitPNG() == 0) {
|
||||
result |= IMG_INIT_PNG;
|
||||
}
|
||||
}
|
||||
if (flags & IMG_INIT_TIF) {
|
||||
if ((initialized & IMG_INIT_TIF) || IMG_InitTIF() == 0) {
|
||||
result |= IMG_INIT_TIF;
|
||||
}
|
||||
}
|
||||
if (flags & IMG_INIT_WEBP) {
|
||||
if ((initialized & IMG_INIT_WEBP) || IMG_InitWEBP() == 0) {
|
||||
result |= IMG_INIT_WEBP;
|
||||
}
|
||||
}
|
||||
initialized |= result;
|
||||
|
||||
return initialized;
|
||||
}
|
||||
|
||||
void IMG_Quit()
|
||||
{
|
||||
if (initialized & IMG_INIT_AVIF) {
|
||||
IMG_QuitAVIF();
|
||||
}
|
||||
if (initialized & IMG_INIT_JPG) {
|
||||
IMG_QuitJPG();
|
||||
}
|
||||
if (initialized & IMG_INIT_JXL) {
|
||||
IMG_QuitJXL();
|
||||
}
|
||||
if (initialized & IMG_INIT_PNG) {
|
||||
IMG_QuitPNG();
|
||||
}
|
||||
if (initialized & IMG_INIT_TIF) {
|
||||
IMG_QuitTIF();
|
||||
}
|
||||
if (initialized & IMG_INIT_WEBP) {
|
||||
IMG_QuitWEBP();
|
||||
}
|
||||
initialized = 0;
|
||||
}
|
||||
|
||||
#if !defined(__APPLE__) || defined(SDL_IMAGE_USE_COMMON_BACKEND)
|
||||
/* Load an image from a file */
|
||||
SDL_Surface *IMG_Load(const char *file)
|
||||
{
|
||||
#if __EMSCRIPTEN__
|
||||
int w, h;
|
||||
char *data;
|
||||
SDL_Surface *surf;
|
||||
|
||||
data = emscripten_get_preloaded_image_data(file, &w, &h);
|
||||
if (data != NULL) {
|
||||
surf = SDL_CreateRGBSurface(0, w, h, 32, 0xFF, 0xFF00, 0xFF0000, 0xFF000000);
|
||||
if (surf != NULL) {
|
||||
memcpy(surf->pixels, data, w * h * 4);
|
||||
}
|
||||
free(data);
|
||||
return surf;
|
||||
}
|
||||
#endif
|
||||
|
||||
SDL_RWops *src = SDL_RWFromFile(file, "rb");
|
||||
const char *ext = SDL_strrchr(file, '.');
|
||||
if (ext) {
|
||||
ext++;
|
||||
}
|
||||
if (!src) {
|
||||
/* The error message has been set in SDL_RWFromFile */
|
||||
return NULL;
|
||||
}
|
||||
return IMG_LoadTyped_RW(src, 1, ext);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Load an image from an SDL datasource (for compatibility) */
|
||||
SDL_Surface *IMG_Load_RW(SDL_RWops *src, int freesrc)
|
||||
{
|
||||
return IMG_LoadTyped_RW(src, freesrc, NULL);
|
||||
}
|
||||
|
||||
/* Portable case-insensitive string compare function */
|
||||
static int IMG_string_equals(const char *str1, const char *str2)
|
||||
{
|
||||
while ( *str1 && *str2 ) {
|
||||
if ( SDL_toupper((unsigned char)*str1) !=
|
||||
SDL_toupper((unsigned char)*str2) )
|
||||
break;
|
||||
++str1;
|
||||
++str2;
|
||||
}
|
||||
return (!*str1 && !*str2);
|
||||
}
|
||||
|
||||
/* Load an image from an SDL datasource, optionally specifying the type */
|
||||
SDL_Surface *IMG_LoadTyped_RW(SDL_RWops *src, int freesrc, const char *type)
|
||||
{
|
||||
int i;
|
||||
SDL_Surface *image;
|
||||
|
||||
/* Make sure there is something to do.. */
|
||||
if ( src == NULL ) {
|
||||
IMG_SetError("Passed a NULL data source");
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/* See whether or not this data source can handle seeking */
|
||||
if ( SDL_RWseek(src, 0, RW_SEEK_CUR) < 0 ) {
|
||||
IMG_SetError("Can't seek in this data source");
|
||||
if (freesrc)
|
||||
SDL_RWclose(src);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
/*load through preloadedImages*/
|
||||
|
||||
if ( src->type == SDL_RWOPS_STDFILE ) {
|
||||
int w, h, success;
|
||||
char *data;
|
||||
SDL_Surface *surf;
|
||||
|
||||
data = emscripten_get_preloaded_image_data_from_FILE(src->hidden.stdio.fp, &w, &h);
|
||||
|
||||
if (data)
|
||||
{
|
||||
surf = SDL_CreateRGBSurface(0, w, h, 32, 0xFF, 0xFF00, 0xFF0000, 0xFF000000);
|
||||
if (surf != NULL) {
|
||||
memcpy(surf->pixels, data, w * h * 4);
|
||||
}
|
||||
free(data);
|
||||
|
||||
if (freesrc)
|
||||
SDL_RWclose(src);
|
||||
|
||||
/* If SDL_CreateRGBSurface returns NULL, it has set the error message for us */
|
||||
return surf;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Detect the type of image being loaded */
|
||||
for ( i=0; i < SDL_arraysize(supported); ++i ) {
|
||||
if (supported[i].is) {
|
||||
if (!supported[i].is(src))
|
||||
continue;
|
||||
} else {
|
||||
/* magicless format */
|
||||
if (!type || !IMG_string_equals(type, supported[i].type))
|
||||
continue;
|
||||
}
|
||||
#ifdef DEBUG_IMGLIB
|
||||
fprintf(stderr, "IMGLIB: Loading image as %s\n",
|
||||
supported[i].type);
|
||||
#endif
|
||||
image = supported[i].load(src);
|
||||
if (freesrc)
|
||||
SDL_RWclose(src);
|
||||
return image;
|
||||
}
|
||||
|
||||
if ( freesrc ) {
|
||||
SDL_RWclose(src);
|
||||
}
|
||||
IMG_SetError("Unsupported image format");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#if SDL_VERSION_ATLEAST(2,0,0)
|
||||
SDL_Texture *IMG_LoadTexture(SDL_Renderer *renderer, const char *file)
|
||||
{
|
||||
SDL_Texture *texture = NULL;
|
||||
SDL_Surface *surface = IMG_Load(file);
|
||||
if (surface) {
|
||||
texture = SDL_CreateTextureFromSurface(renderer, surface);
|
||||
SDL_FreeSurface(surface);
|
||||
}
|
||||
return texture;
|
||||
}
|
||||
|
||||
SDL_Texture *IMG_LoadTexture_RW(SDL_Renderer *renderer, SDL_RWops *src, int freesrc)
|
||||
{
|
||||
SDL_Texture *texture = NULL;
|
||||
SDL_Surface *surface = IMG_Load_RW(src, freesrc);
|
||||
if (surface) {
|
||||
texture = SDL_CreateTextureFromSurface(renderer, surface);
|
||||
SDL_FreeSurface(surface);
|
||||
}
|
||||
return texture;
|
||||
}
|
||||
|
||||
SDL_Texture *IMG_LoadTextureTyped_RW(SDL_Renderer *renderer, SDL_RWops *src, int freesrc, const char *type)
|
||||
{
|
||||
SDL_Texture *texture = NULL;
|
||||
SDL_Surface *surface = IMG_LoadTyped_RW(src, freesrc, type);
|
||||
if (surface) {
|
||||
texture = SDL_CreateTextureFromSurface(renderer, surface);
|
||||
SDL_FreeSurface(surface);
|
||||
}
|
||||
return texture;
|
||||
}
|
||||
#endif /* SDL 2.0 */
|
||||
|
||||
/* Load an animation from a file */
|
||||
IMG_Animation *IMG_LoadAnimation(const char *file)
|
||||
{
|
||||
SDL_RWops *src = SDL_RWFromFile(file, "rb");
|
||||
const char *ext = SDL_strrchr(file, '.');
|
||||
if (ext) {
|
||||
ext++;
|
||||
}
|
||||
if (!src) {
|
||||
/* The error message has been set in SDL_RWFromFile */
|
||||
return NULL;
|
||||
}
|
||||
return IMG_LoadAnimationTyped_RW(src, 1, ext);
|
||||
}
|
||||
|
||||
/* Load an animation from an SDL datasource (for compatibility) */
|
||||
IMG_Animation *IMG_LoadAnimation_RW(SDL_RWops *src, int freesrc)
|
||||
{
|
||||
return IMG_LoadAnimationTyped_RW(src, freesrc, NULL);
|
||||
}
|
||||
|
||||
/* Load an animation from an SDL datasource, optionally specifying the type */
|
||||
IMG_Animation *IMG_LoadAnimationTyped_RW(SDL_RWops *src, int freesrc, const char *type)
|
||||
{
|
||||
int i;
|
||||
IMG_Animation *anim;
|
||||
SDL_Surface *image;
|
||||
|
||||
/* Make sure there is something to do.. */
|
||||
if ( src == NULL ) {
|
||||
IMG_SetError("Passed a NULL data source");
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/* See whether or not this data source can handle seeking */
|
||||
if ( SDL_RWseek(src, 0, RW_SEEK_CUR) < 0 ) {
|
||||
IMG_SetError("Can't seek in this data source");
|
||||
if (freesrc)
|
||||
SDL_RWclose(src);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/* Detect the type of image being loaded */
|
||||
for ( i=0; i < SDL_arraysize(supported_anims); ++i ) {
|
||||
if (supported_anims[i].is) {
|
||||
if (!supported_anims[i].is(src))
|
||||
continue;
|
||||
} else {
|
||||
/* magicless format */
|
||||
if (!type || !IMG_string_equals(type, supported_anims[i].type))
|
||||
continue;
|
||||
}
|
||||
#ifdef DEBUG_IMGLIB
|
||||
fprintf(stderr, "IMGLIB: Loading image as %s\n",
|
||||
supported_anims[i].type);
|
||||
#endif
|
||||
anim = supported_anims[i].load(src);
|
||||
if (freesrc)
|
||||
SDL_RWclose(src);
|
||||
return anim;
|
||||
}
|
||||
|
||||
/* Create a single frame animation from an image */
|
||||
image = IMG_LoadTyped_RW(src, freesrc, type);
|
||||
if (image) {
|
||||
anim = (IMG_Animation *)SDL_malloc(sizeof(*anim));
|
||||
if (anim) {
|
||||
anim->w = image->w;
|
||||
anim->h = image->h;
|
||||
anim->count = 1;
|
||||
|
||||
anim->frames = (SDL_Surface **)SDL_calloc(anim->count, sizeof(*anim->frames));
|
||||
anim->delays = (int *)SDL_calloc(anim->count, sizeof(*anim->delays));
|
||||
|
||||
if (anim->frames && anim->delays) {
|
||||
anim->frames[0] = image;
|
||||
return anim;
|
||||
}
|
||||
IMG_FreeAnimation(anim);
|
||||
}
|
||||
SDL_FreeSurface(image);
|
||||
SDL_OutOfMemory();
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void IMG_FreeAnimation(IMG_Animation *anim)
|
||||
{
|
||||
if (anim) {
|
||||
if (anim->frames) {
|
||||
int i;
|
||||
for (i = 0; i < anim->count; ++i) {
|
||||
if (anim->frames[i]) {
|
||||
SDL_FreeSurface(anim->frames[i]);
|
||||
}
|
||||
}
|
||||
SDL_free(anim->frames);
|
||||
}
|
||||
if (anim->delays) {
|
||||
SDL_free(anim->delays);
|
||||
}
|
||||
SDL_free(anim);
|
||||
}
|
||||
}
|
||||
|
||||
592
Library/SDL2_image-2.5.2/IMG_ImageIO.m
Normal file
592
Library/SDL2_image-2.5.2/IMG_ImageIO.m
Normal file
@@ -0,0 +1,592 @@
|
||||
/*
|
||||
* IMG_ImageIO.c
|
||||
* SDL_image
|
||||
*
|
||||
* Created by Eric Wing on 1/1/09.
|
||||
* Copyright 2009 __MyCompanyName__. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#if defined(__APPLE__) && !defined(SDL_IMAGE_USE_COMMON_BACKEND)
|
||||
|
||||
#include "SDL_image.h"
|
||||
|
||||
// Used because CGDataProviderCreate became deprecated in 10.5
|
||||
#include <AvailabilityMacros.h>
|
||||
#include <TargetConditionals.h>
|
||||
#include <Foundation/Foundation.h>
|
||||
|
||||
#if (TARGET_OS_IPHONE == 1) || (TARGET_IPHONE_SIMULATOR == 1)
|
||||
#import <MobileCoreServices/MobileCoreServices.h> // for UTCoreTypes.h
|
||||
#import <ImageIO/ImageIO.h>
|
||||
#import <UIKit/UIImage.h>
|
||||
#else
|
||||
// For ImageIO framework and also LaunchServices framework (for UTIs)
|
||||
#include <ApplicationServices/ApplicationServices.h>
|
||||
#endif
|
||||
|
||||
/**************************************************************
|
||||
***** Begin Callback functions for block reading *************
|
||||
**************************************************************/
|
||||
|
||||
// This callback reads some bytes from an SDL_rwops and copies it
|
||||
// to a Quartz buffer (supplied by Apple framework).
|
||||
static size_t MyProviderGetBytesCallback(void* rwops_userdata, void* quartz_buffer, size_t the_count)
|
||||
{
|
||||
return (size_t)SDL_RWread((struct SDL_RWops *)rwops_userdata, quartz_buffer, 1, the_count);
|
||||
}
|
||||
|
||||
// This callback is triggered when the data provider is released
|
||||
// so you can clean up any resources.
|
||||
static void MyProviderReleaseInfoCallback(void* rwops_userdata)
|
||||
{
|
||||
// What should I put here?
|
||||
// I think the user and SDL_RWops controls closing, so I don't do anything.
|
||||
}
|
||||
|
||||
static void MyProviderRewindCallback(void* rwops_userdata)
|
||||
{
|
||||
SDL_RWseek((struct SDL_RWops *)rwops_userdata, 0, RW_SEEK_SET);
|
||||
}
|
||||
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 // CGDataProviderCreateSequential was introduced in 10.5; CGDataProviderCreate is deprecated
|
||||
off_t MyProviderSkipForwardBytesCallback(void* rwops_userdata, off_t the_count)
|
||||
{
|
||||
off_t start_position = SDL_RWtell((struct SDL_RWops *)rwops_userdata);
|
||||
SDL_RWseek((struct SDL_RWops *)rwops_userdata, the_count, RW_SEEK_CUR);
|
||||
off_t end_position = SDL_RWtell((struct SDL_RWops *)rwops_userdata);
|
||||
return (end_position - start_position);
|
||||
}
|
||||
#else // CGDataProviderCreate was deprecated in 10.5
|
||||
static void MyProviderSkipBytesCallback(void* rwops_userdata, size_t the_count)
|
||||
{
|
||||
SDL_RWseek((struct SDL_RWops *)rwops_userdata, the_count, RW_SEEK_CUR);
|
||||
}
|
||||
#endif
|
||||
|
||||
/**************************************************************
|
||||
***** End Callback functions for block reading ***************
|
||||
**************************************************************/
|
||||
|
||||
// This creates a CGImageSourceRef which is a handle to an image that can be used to examine information
|
||||
// about the image or load the actual image data.
|
||||
static CGImageSourceRef CreateCGImageSourceFromRWops(SDL_RWops* rw_ops, CFDictionaryRef hints_and_options)
|
||||
{
|
||||
CGImageSourceRef source_ref;
|
||||
|
||||
// Similar to SDL_RWops, Apple has their own callbacks for dealing with data streams.
|
||||
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 // CGDataProviderCreateSequential was introduced in 10.5; CGDataProviderCreate is deprecated
|
||||
CGDataProviderSequentialCallbacks provider_callbacks =
|
||||
{
|
||||
0,
|
||||
MyProviderGetBytesCallback,
|
||||
MyProviderSkipForwardBytesCallback,
|
||||
MyProviderRewindCallback,
|
||||
MyProviderReleaseInfoCallback
|
||||
};
|
||||
|
||||
CGDataProviderRef data_provider = CGDataProviderCreateSequential(rw_ops, &provider_callbacks);
|
||||
|
||||
|
||||
#else // CGDataProviderCreate was deprecated in 10.5
|
||||
|
||||
CGDataProviderCallbacks provider_callbacks =
|
||||
{
|
||||
MyProviderGetBytesCallback,
|
||||
MyProviderSkipBytesCallback,
|
||||
MyProviderRewindCallback,
|
||||
MyProviderReleaseInfoCallback
|
||||
};
|
||||
|
||||
CGDataProviderRef data_provider = CGDataProviderCreate(rw_ops, &provider_callbacks);
|
||||
#endif
|
||||
// Get the CGImageSourceRef.
|
||||
// The dictionary can be NULL or contain hints to help ImageIO figure out the image type.
|
||||
source_ref = CGImageSourceCreateWithDataProvider(data_provider, hints_and_options);
|
||||
CGDataProviderRelease(data_provider);
|
||||
return source_ref;
|
||||
}
|
||||
|
||||
/* Create a CGImageSourceRef from a file. */
|
||||
/* Remember to CFRelease the created source when done. */
|
||||
static CGImageSourceRef CreateCGImageSourceFromFile(const char* the_path)
|
||||
{
|
||||
CFURLRef the_url = NULL;
|
||||
CGImageSourceRef source_ref = NULL;
|
||||
CFStringRef cf_string = NULL;
|
||||
|
||||
/* Create a CFString from a C string */
|
||||
cf_string = CFStringCreateWithCString(NULL, the_path, kCFStringEncodingUTF8);
|
||||
if (!cf_string) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Create a CFURL from a CFString */
|
||||
the_url = CFURLCreateWithFileSystemPath(NULL, cf_string, kCFURLPOSIXPathStyle, false);
|
||||
|
||||
/* Don't need the CFString any more (error or not) */
|
||||
CFRelease(cf_string);
|
||||
|
||||
if(!the_url)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
source_ref = CGImageSourceCreateWithURL(the_url, NULL);
|
||||
/* Don't need the URL any more (error or not) */
|
||||
CFRelease(the_url);
|
||||
|
||||
return source_ref;
|
||||
}
|
||||
|
||||
static CGImageRef CreateCGImageFromCGImageSource(CGImageSourceRef image_source)
|
||||
{
|
||||
CGImageRef image_ref = NULL;
|
||||
|
||||
if(NULL == image_source)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Get the first item in the image source (some image formats may
|
||||
// contain multiple items).
|
||||
image_ref = CGImageSourceCreateImageAtIndex(image_source, 0, NULL);
|
||||
if(NULL == image_ref)
|
||||
{
|
||||
IMG_SetError("CGImageSourceCreateImageAtIndex() failed");
|
||||
}
|
||||
return image_ref;
|
||||
}
|
||||
|
||||
static CFDictionaryRef CreateHintDictionary(CFStringRef uti_string_hint)
|
||||
{
|
||||
CFDictionaryRef hint_dictionary = NULL;
|
||||
|
||||
if(uti_string_hint != NULL)
|
||||
{
|
||||
// Do a bunch of work to setup a CFDictionary containing the jpeg compression properties.
|
||||
CFStringRef the_keys[1];
|
||||
CFStringRef the_values[1];
|
||||
|
||||
the_keys[0] = kCGImageSourceTypeIdentifierHint;
|
||||
the_values[0] = uti_string_hint;
|
||||
|
||||
// kCFTypeDictionaryKeyCallBacks or kCFCopyStringDictionaryKeyCallBacks?
|
||||
hint_dictionary = CFDictionaryCreate(NULL, (const void**)&the_keys, (const void**)&the_values, 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
|
||||
}
|
||||
return hint_dictionary;
|
||||
}
|
||||
|
||||
// Once we have our image, we need to get it into an SDL_Surface
|
||||
static SDL_Surface* Create_SDL_Surface_From_CGImage_RGB(CGImageRef image_ref)
|
||||
{
|
||||
/* This code is adapted from Apple's Documentation found here:
|
||||
* http://developer.apple.com/documentation/GraphicsImaging/Conceptual/OpenGL-MacProgGuide/index.html
|
||||
* Listing 9-4††Using a Quartz image as a texture source.
|
||||
* Unfortunately, this guide doesn't show what to do about
|
||||
* non-RGBA image formats so I'm making the rest up.
|
||||
* All this code should be scrutinized.
|
||||
*/
|
||||
|
||||
size_t w = CGImageGetWidth(image_ref);
|
||||
size_t h = CGImageGetHeight(image_ref);
|
||||
CGRect rect = {{0, 0}, {w, h}};
|
||||
|
||||
CGImageAlphaInfo alpha = CGImageGetAlphaInfo(image_ref);
|
||||
//size_t bits_per_pixel = CGImageGetBitsPerPixel(image_ref);
|
||||
size_t bits_per_component = 8;
|
||||
|
||||
SDL_Surface* surface;
|
||||
Uint32 Amask;
|
||||
Uint32 Rmask;
|
||||
Uint32 Gmask;
|
||||
Uint32 Bmask;
|
||||
|
||||
CGContextRef bitmap_context;
|
||||
CGBitmapInfo bitmap_info;
|
||||
CGColorSpaceRef color_space = CGColorSpaceCreateDeviceRGB();
|
||||
|
||||
if (alpha == kCGImageAlphaNone ||
|
||||
alpha == kCGImageAlphaNoneSkipFirst ||
|
||||
alpha == kCGImageAlphaNoneSkipLast) {
|
||||
bitmap_info = kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder32Host; /* XRGB */
|
||||
Amask = 0x00000000;
|
||||
} else {
|
||||
/* kCGImageAlphaFirst isn't supported */
|
||||
//bitmap_info = kCGImageAlphaFirst | kCGBitmapByteOrder32Host; /* ARGB */
|
||||
bitmap_info = kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host; /* ARGB */
|
||||
Amask = 0xFF000000;
|
||||
}
|
||||
|
||||
Rmask = 0x00FF0000;
|
||||
Gmask = 0x0000FF00;
|
||||
Bmask = 0x000000FF;
|
||||
|
||||
surface = SDL_CreateRGBSurface(SDL_SWSURFACE, (int)w, (int)h, 32, Rmask, Gmask, Bmask, Amask);
|
||||
if (surface)
|
||||
{
|
||||
// Sets up a context to be drawn to with surface->pixels as the area to be drawn to
|
||||
bitmap_context = CGBitmapContextCreate(
|
||||
surface->pixels,
|
||||
surface->w,
|
||||
surface->h,
|
||||
bits_per_component,
|
||||
surface->pitch,
|
||||
color_space,
|
||||
bitmap_info
|
||||
);
|
||||
|
||||
// Draws the image into the context's image_data
|
||||
CGContextDrawImage(bitmap_context, rect, image_ref);
|
||||
|
||||
CGContextRelease(bitmap_context);
|
||||
|
||||
// FIXME: Reverse the premultiplied alpha
|
||||
if ((bitmap_info & kCGBitmapAlphaInfoMask) == kCGImageAlphaPremultipliedFirst) {
|
||||
int i, j;
|
||||
Uint8 *p = (Uint8 *)surface->pixels;
|
||||
for (i = surface->h * surface->pitch/4; i--; ) {
|
||||
#if __LITTLE_ENDIAN__
|
||||
Uint8 A = p[3];
|
||||
if (A) {
|
||||
for (j = 0; j < 3; ++j) {
|
||||
p[j] = (p[j] * 255) / A;
|
||||
}
|
||||
}
|
||||
#else
|
||||
Uint8 A = p[0];
|
||||
if (A) {
|
||||
for (j = 1; j < 4; ++j) {
|
||||
p[j] = (p[j] * 255) / A;
|
||||
}
|
||||
}
|
||||
#endif /* ENDIAN */
|
||||
p += 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (color_space)
|
||||
{
|
||||
CGColorSpaceRelease(color_space);
|
||||
}
|
||||
|
||||
return surface;
|
||||
}
|
||||
static SDL_Surface* Create_SDL_Surface_From_CGImage_Index(CGImageRef image_ref)
|
||||
{
|
||||
size_t w = CGImageGetWidth(image_ref);
|
||||
size_t h = CGImageGetHeight(image_ref);
|
||||
size_t bits_per_pixel = CGImageGetBitsPerPixel(image_ref);
|
||||
size_t bytes_per_row = CGImageGetBytesPerRow(image_ref);
|
||||
|
||||
SDL_Surface* surface;
|
||||
SDL_Palette* palette;
|
||||
CGColorSpaceRef color_space = CGImageGetColorSpace(image_ref);
|
||||
CGColorSpaceRef base_color_space = CGColorSpaceGetBaseColorSpace(color_space);
|
||||
size_t num_components = CGColorSpaceGetNumberOfComponents(base_color_space);
|
||||
size_t num_entries = CGColorSpaceGetColorTableCount(color_space);
|
||||
uint8_t *entry, entries[num_components * num_entries];
|
||||
|
||||
/* What do we do if it's not RGB? */
|
||||
if (num_components != 3) {
|
||||
SDL_SetError("Unknown colorspace components %lu", num_components);
|
||||
return NULL;
|
||||
}
|
||||
if (bits_per_pixel != 8) {
|
||||
SDL_SetError("Unknown bits_per_pixel %lu", bits_per_pixel);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CGColorSpaceGetColorTable(color_space, entries);
|
||||
surface = SDL_CreateRGBSurface(SDL_SWSURFACE, (int)w, (int)h, (int)bits_per_pixel, 0, 0, 0, 0);
|
||||
if (surface) {
|
||||
uint8_t* pixels = (uint8_t*)surface->pixels;
|
||||
CGDataProviderRef provider = CGImageGetDataProvider(image_ref);
|
||||
NSData* data = (id)CGDataProviderCopyData(provider);
|
||||
[data autorelease];
|
||||
const uint8_t* bytes = [data bytes];
|
||||
size_t i;
|
||||
|
||||
palette = surface->format->palette;
|
||||
for (i = 0, entry = entries; i < num_entries; ++i) {
|
||||
palette->colors[i].r = entry[0];
|
||||
palette->colors[i].g = entry[1];
|
||||
palette->colors[i].b = entry[2];
|
||||
entry += num_components;
|
||||
}
|
||||
|
||||
for (i = 0; i < h; ++i) {
|
||||
SDL_memcpy(pixels, bytes, w);
|
||||
pixels += surface->pitch;
|
||||
bytes += bytes_per_row;
|
||||
}
|
||||
}
|
||||
return surface;
|
||||
}
|
||||
static SDL_Surface* Create_SDL_Surface_From_CGImage(CGImageRef image_ref)
|
||||
{
|
||||
CGColorSpaceRef color_space = CGImageGetColorSpace(image_ref);
|
||||
if (CGColorSpaceGetModel(color_space) == kCGColorSpaceModelIndexed) {
|
||||
return Create_SDL_Surface_From_CGImage_Index(image_ref);
|
||||
} else {
|
||||
return Create_SDL_Surface_From_CGImage_RGB(image_ref);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifdef JPG_USES_IMAGEIO
|
||||
|
||||
int IMG_InitJPG()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void IMG_QuitJPG()
|
||||
{
|
||||
}
|
||||
|
||||
#endif /* JPG_USES_IMAGEIO */
|
||||
|
||||
#ifdef PNG_USES_IMAGEIO
|
||||
|
||||
int IMG_InitPNG()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void IMG_QuitPNG()
|
||||
{
|
||||
}
|
||||
|
||||
#endif /* PNG_USES_IMAGEIO */
|
||||
|
||||
int IMG_InitTIF()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void IMG_QuitTIF()
|
||||
{
|
||||
}
|
||||
|
||||
static int Internal_isType (SDL_RWops *rw_ops, CFStringRef uti_string_to_test)
|
||||
{
|
||||
int is_type = 0;
|
||||
|
||||
if (rw_ops == NULL)
|
||||
return 0;
|
||||
|
||||
Sint64 start = SDL_RWtell(rw_ops);
|
||||
CFDictionaryRef hint_dictionary = CreateHintDictionary(uti_string_to_test);
|
||||
CGImageSourceRef image_source = CreateCGImageSourceFromRWops(rw_ops, hint_dictionary);
|
||||
|
||||
if (hint_dictionary != NULL) {
|
||||
CFRelease(hint_dictionary);
|
||||
}
|
||||
|
||||
if (NULL == image_source) {
|
||||
// reset the file pointer
|
||||
SDL_RWseek(rw_ops, start, SEEK_SET);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// This will get the UTI of the container, not the image itself.
|
||||
// Under most cases, this won't be a problem.
|
||||
// But if a person passes an icon file which contains a bmp,
|
||||
// the format will be of the icon file.
|
||||
// But I think the main SDL_image codebase has this same problem so I'm not going to worry about it.
|
||||
CFStringRef uti_type = CGImageSourceGetType(image_source);
|
||||
// CFShow(uti_type);
|
||||
|
||||
// Unsure if we really want conformance or equality
|
||||
is_type = (int)UTTypeConformsTo(uti_string_to_test, uti_type);
|
||||
|
||||
CFRelease(image_source);
|
||||
|
||||
// reset the file pointer
|
||||
SDL_RWseek(rw_ops, start, SEEK_SET);
|
||||
return is_type;
|
||||
}
|
||||
|
||||
#ifdef BMP_USES_IMAGEIO
|
||||
|
||||
int IMG_isCUR(SDL_RWops *src)
|
||||
{
|
||||
/* FIXME: Is this a supported type? */
|
||||
return Internal_isType(src, CFSTR("com.microsoft.cur"));
|
||||
}
|
||||
|
||||
int IMG_isICO(SDL_RWops *src)
|
||||
{
|
||||
return Internal_isType(src, kUTTypeICO);
|
||||
}
|
||||
|
||||
int IMG_isBMP(SDL_RWops *src)
|
||||
{
|
||||
return Internal_isType(src, kUTTypeBMP);
|
||||
}
|
||||
|
||||
#endif /* BMP_USES_IMAGEIO */
|
||||
|
||||
int IMG_isGIF(SDL_RWops *src)
|
||||
{
|
||||
return Internal_isType(src, kUTTypeGIF);
|
||||
}
|
||||
|
||||
#ifdef JPG_USES_IMAGEIO
|
||||
|
||||
// Note: JPEG 2000 is kUTTypeJPEG2000
|
||||
int IMG_isJPG(SDL_RWops *src)
|
||||
{
|
||||
return Internal_isType(src, kUTTypeJPEG);
|
||||
}
|
||||
|
||||
#endif /* JPG_USES_IMAGEIO */
|
||||
|
||||
#ifdef PNG_USES_IMAGEIO
|
||||
|
||||
int IMG_isPNG(SDL_RWops *src)
|
||||
{
|
||||
return Internal_isType(src, kUTTypePNG);
|
||||
}
|
||||
|
||||
#endif /* PNG_USES_IMAGEIO */
|
||||
|
||||
// This isn't a public API function. Apple seems to be able to identify tga's.
|
||||
int IMG_isTGA(SDL_RWops *src)
|
||||
{
|
||||
return Internal_isType(src, CFSTR("com.truevision.tga-image"));
|
||||
}
|
||||
|
||||
int IMG_isTIF(SDL_RWops *src)
|
||||
{
|
||||
return Internal_isType(src, kUTTypeTIFF);
|
||||
}
|
||||
|
||||
static SDL_Surface *LoadImageFromRWops (SDL_RWops *rw_ops, CFStringRef uti_string_hint)
|
||||
{
|
||||
CFDictionaryRef hint_dictionary = CreateHintDictionary(uti_string_hint);
|
||||
CGImageSourceRef image_source = CreateCGImageSourceFromRWops(rw_ops, hint_dictionary);
|
||||
|
||||
if (hint_dictionary != NULL)
|
||||
CFRelease(hint_dictionary);
|
||||
|
||||
if (NULL == image_source)
|
||||
return NULL;
|
||||
|
||||
CGImageRef image_ref = CreateCGImageFromCGImageSource(image_source);
|
||||
CFRelease(image_source);
|
||||
|
||||
if (NULL == image_ref)
|
||||
return NULL;
|
||||
SDL_Surface *sdl_surface = Create_SDL_Surface_From_CGImage(image_ref);
|
||||
CFRelease(image_ref);
|
||||
|
||||
return sdl_surface;
|
||||
}
|
||||
|
||||
static SDL_Surface* LoadImageFromFile (const char *file)
|
||||
{
|
||||
CGImageSourceRef image_source = NULL;
|
||||
|
||||
image_source = CreateCGImageSourceFromFile(file);
|
||||
|
||||
if(NULL == image_source)
|
||||
return NULL;
|
||||
|
||||
CGImageRef image_ref = CreateCGImageFromCGImageSource(image_source);
|
||||
CFRelease(image_source);
|
||||
|
||||
if (NULL == image_ref)
|
||||
return NULL;
|
||||
SDL_Surface *sdl_surface = Create_SDL_Surface_From_CGImage(image_ref);
|
||||
CFRelease(image_ref);
|
||||
return sdl_surface;
|
||||
}
|
||||
|
||||
#ifdef BMP_USES_IMAGEIO
|
||||
|
||||
SDL_Surface* IMG_LoadCUR_RW (SDL_RWops *src)
|
||||
{
|
||||
/* FIXME: Is this a supported type? */
|
||||
return LoadImageFromRWops(src, CFSTR("com.microsoft.cur"));
|
||||
}
|
||||
|
||||
SDL_Surface* IMG_LoadICO_RW (SDL_RWops *src)
|
||||
{
|
||||
return LoadImageFromRWops(src, kUTTypeICO);
|
||||
}
|
||||
|
||||
SDL_Surface* IMG_LoadBMP_RW (SDL_RWops *src)
|
||||
{
|
||||
return LoadImageFromRWops(src, kUTTypeBMP);
|
||||
}
|
||||
|
||||
#endif /* BMP_USES_IMAGEIO */
|
||||
|
||||
SDL_Surface* IMG_LoadGIF_RW (SDL_RWops *src)
|
||||
{
|
||||
return LoadImageFromRWops (src, kUTTypeGIF);
|
||||
}
|
||||
|
||||
#ifdef JPG_USES_IMAGEIO
|
||||
|
||||
SDL_Surface* IMG_LoadJPG_RW (SDL_RWops *src)
|
||||
{
|
||||
return LoadImageFromRWops (src, kUTTypeJPEG);
|
||||
}
|
||||
|
||||
#endif /* JPG_USES_IMAGEIO */
|
||||
|
||||
#ifdef PNG_USES_IMAGEIO
|
||||
|
||||
SDL_Surface* IMG_LoadPNG_RW (SDL_RWops *src)
|
||||
{
|
||||
return LoadImageFromRWops (src, kUTTypePNG);
|
||||
}
|
||||
|
||||
#endif /* PNG_USES_IMAGEIO */
|
||||
|
||||
SDL_Surface* IMG_LoadTGA_RW (SDL_RWops *src)
|
||||
{
|
||||
return LoadImageFromRWops(src, CFSTR("com.truevision.tga-image"));
|
||||
}
|
||||
|
||||
SDL_Surface* IMG_LoadTIF_RW (SDL_RWops *src)
|
||||
{
|
||||
return LoadImageFromRWops(src, kUTTypeTIFF);
|
||||
}
|
||||
|
||||
// Since UIImage doesn't really support streams well, we should optimize for the file case.
|
||||
// Apple provides both stream and file loading functions in ImageIO.
|
||||
// Potentially, Apple can optimize for either case.
|
||||
SDL_Surface* IMG_Load (const char *file)
|
||||
{
|
||||
SDL_Surface *surface = NULL;
|
||||
char *ext = strrchr(file, '.');
|
||||
if (ext) {
|
||||
ext++;
|
||||
}
|
||||
|
||||
if (ext && (SDL_strcasecmp(ext, "ico") == 0 || SDL_strcasecmp(ext, "cur") == 0)) {
|
||||
/* CreateCGImageSourceFromFile() doesn't detect the correct format, skip it */
|
||||
} else {
|
||||
surface = LoadImageFromFile(file);
|
||||
}
|
||||
if (!surface) {
|
||||
// Either the file doesn't exist or ImageIO doesn't understand the format.
|
||||
// For the latter case, fallback to the native SDL_image handlers.
|
||||
SDL_RWops *src = SDL_RWFromFile(file, "rb");
|
||||
if (!src) {
|
||||
/* The error message has been set in SDL_RWFromFile */
|
||||
return NULL;
|
||||
}
|
||||
surface = IMG_LoadTyped_RW(src, 1, ext);
|
||||
}
|
||||
return surface;
|
||||
}
|
||||
|
||||
#endif /* defined(__APPLE__) && !defined(SDL_IMAGE_USE_COMMON_BACKEND) */
|
||||
308
Library/SDL2_image-2.5.2/IMG_WIC.c
Normal file
308
Library/SDL2_image-2.5.2/IMG_WIC.c
Normal file
@@ -0,0 +1,308 @@
|
||||
/*
|
||||
SDL_image: An example image loading library for use with SDL
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#if defined(SDL_IMAGE_USE_WIC_BACKEND)
|
||||
|
||||
#include "SDL_image.h"
|
||||
#define COBJMACROS
|
||||
#include <initguid.h>
|
||||
#include <wincodec.h>
|
||||
|
||||
static IWICImagingFactory* wicFactory = NULL;
|
||||
|
||||
static int WIC_Init()
|
||||
{
|
||||
if (wicFactory == NULL) {
|
||||
HRESULT hr = CoCreateInstance(
|
||||
&CLSID_WICImagingFactory,
|
||||
NULL,
|
||||
CLSCTX_INPROC_SERVER,
|
||||
&IID_IWICImagingFactory,
|
||||
(void**)&wicFactory
|
||||
);
|
||||
if (FAILED(hr)) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void WIC_Quit()
|
||||
{
|
||||
if (wicFactory) {
|
||||
IWICImagingFactory_Release(wicFactory);
|
||||
}
|
||||
}
|
||||
|
||||
int IMG_InitPNG()
|
||||
{
|
||||
return WIC_Init();
|
||||
}
|
||||
|
||||
void IMG_QuitPNG()
|
||||
{
|
||||
WIC_Quit();
|
||||
}
|
||||
|
||||
int IMG_InitJPG()
|
||||
{
|
||||
return WIC_Init();
|
||||
}
|
||||
|
||||
void IMG_QuitJPG()
|
||||
{
|
||||
WIC_Quit();
|
||||
}
|
||||
|
||||
int IMG_InitTIF()
|
||||
{
|
||||
return WIC_Init();
|
||||
}
|
||||
|
||||
void IMG_QuitTIF()
|
||||
{
|
||||
WIC_Quit();
|
||||
}
|
||||
|
||||
int IMG_isPNG(SDL_RWops *src)
|
||||
{
|
||||
Sint64 start;
|
||||
int is_PNG;
|
||||
Uint8 magic[4];
|
||||
|
||||
if ( !src ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
start = SDL_RWtell(src);
|
||||
is_PNG = 0;
|
||||
if ( SDL_RWread(src, magic, 1, sizeof(magic)) == sizeof(magic) ) {
|
||||
if ( magic[0] == 0x89 &&
|
||||
magic[1] == 'P' &&
|
||||
magic[2] == 'N' &&
|
||||
magic[3] == 'G' ) {
|
||||
is_PNG = 1;
|
||||
}
|
||||
}
|
||||
SDL_RWseek(src, start, RW_SEEK_SET);
|
||||
return(is_PNG);
|
||||
}
|
||||
|
||||
int IMG_isJPG(SDL_RWops *src)
|
||||
{
|
||||
Sint64 start;
|
||||
int is_JPG;
|
||||
int in_scan;
|
||||
Uint8 magic[4];
|
||||
|
||||
/* This detection code is by Steaphan Greene <stea@cs.binghamton.edu> */
|
||||
/* Blame me, not Sam, if this doesn't work right. */
|
||||
/* And don't forget to report the problem to the the sdl list too! */
|
||||
|
||||
if (!src)
|
||||
return 0;
|
||||
start = SDL_RWtell(src);
|
||||
is_JPG = 0;
|
||||
in_scan = 0;
|
||||
if (SDL_RWread(src, magic, 2, 1)) {
|
||||
if ((magic[0] == 0xFF) && (magic[1] == 0xD8)) {
|
||||
is_JPG = 1;
|
||||
while (is_JPG == 1) {
|
||||
if (SDL_RWread(src, magic, 1, 2) != 2) {
|
||||
is_JPG = 0;
|
||||
}
|
||||
else if ((magic[0] != 0xFF) && (in_scan == 0)) {
|
||||
is_JPG = 0;
|
||||
}
|
||||
else if ((magic[0] != 0xFF) || (magic[1] == 0xFF)) {
|
||||
/* Extra padding in JPEG (legal) */
|
||||
/* or this is data and we are scanning */
|
||||
SDL_RWseek(src, -1, RW_SEEK_CUR);
|
||||
}
|
||||
else if (magic[1] == 0xD9) {
|
||||
/* Got to end of good JPEG */
|
||||
break;
|
||||
}
|
||||
else if ((in_scan == 1) && (magic[1] == 0x00)) {
|
||||
/* This is an encoded 0xFF within the data */
|
||||
}
|
||||
else if ((magic[1] >= 0xD0) && (magic[1] < 0xD9)) {
|
||||
/* These have nothing else */
|
||||
}
|
||||
else if (SDL_RWread(src, magic + 2, 1, 2) != 2) {
|
||||
is_JPG = 0;
|
||||
}
|
||||
else {
|
||||
/* Yes, it's big-endian */
|
||||
Sint64 innerStart;
|
||||
Uint32 size;
|
||||
Sint64 end;
|
||||
innerStart = SDL_RWtell(src);
|
||||
size = (magic[2] << 8) + magic[3];
|
||||
end = SDL_RWseek(src, size - 2, RW_SEEK_CUR);
|
||||
if (end != innerStart + size - 2) is_JPG = 0;
|
||||
if (magic[1] == 0xDA) {
|
||||
/* Now comes the actual JPEG meat */
|
||||
#ifdef FAST_IS_JPEG
|
||||
/* Ok, I'm convinced. It is a JPEG. */
|
||||
break;
|
||||
#else
|
||||
/* I'm not convinced. Prove it! */
|
||||
in_scan = 1;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
SDL_RWseek(src, start, RW_SEEK_SET);
|
||||
return(is_JPG);
|
||||
}
|
||||
|
||||
int IMG_isTIF(SDL_RWops* src)
|
||||
{
|
||||
Sint64 start;
|
||||
int is_TIF;
|
||||
Uint8 magic[4];
|
||||
|
||||
if (!src)
|
||||
return 0;
|
||||
start = SDL_RWtell(src);
|
||||
is_TIF = 0;
|
||||
if (SDL_RWread(src, magic, 1, sizeof(magic)) == sizeof(magic)) {
|
||||
if ((magic[0] == 'I' &&
|
||||
magic[1] == 'I' &&
|
||||
magic[2] == 0x2a &&
|
||||
magic[3] == 0x00) ||
|
||||
(magic[0] == 'M' &&
|
||||
magic[1] == 'M' &&
|
||||
magic[2] == 0x00 &&
|
||||
magic[3] == 0x2a)) {
|
||||
is_TIF = 1;
|
||||
}
|
||||
}
|
||||
SDL_RWseek(src, start, RW_SEEK_SET);
|
||||
return(is_TIF);
|
||||
}
|
||||
|
||||
static SDL_Surface* WIC_LoadImage(SDL_RWops *src)
|
||||
{
|
||||
SDL_Surface* surface = NULL;
|
||||
|
||||
IWICStream* stream = NULL;
|
||||
IWICBitmapDecoder* bitmapDecoder = NULL;
|
||||
IWICBitmapFrameDecode* bitmapFrame = NULL;
|
||||
IWICFormatConverter* formatConverter = NULL;
|
||||
UINT width, height;
|
||||
|
||||
if (wicFactory == NULL && (WIC_Init() < 0)) {
|
||||
IMG_SetError("WIC failed to initialize!");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Sint64 fileSize = SDL_RWsize(src);
|
||||
Uint8* memoryBuffer = (Uint8*)SDL_malloc(fileSize);
|
||||
if (!memoryBuffer) {
|
||||
SDL_OutOfMemory();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
SDL_RWread(src, memoryBuffer, 1, fileSize);
|
||||
|
||||
#define DONE_IF_FAILED(X) if (FAILED((X))) { goto done; }
|
||||
DONE_IF_FAILED(IWICImagingFactory_CreateStream(wicFactory, &stream));
|
||||
DONE_IF_FAILED(IWICStream_InitializeFromMemory(stream, memoryBuffer, fileSize));
|
||||
DONE_IF_FAILED(IWICImagingFactory_CreateDecoderFromStream(
|
||||
wicFactory,
|
||||
(IStream*)stream,
|
||||
NULL,
|
||||
WICDecodeMetadataCacheOnDemand,
|
||||
&bitmapDecoder
|
||||
));
|
||||
DONE_IF_FAILED(IWICBitmapDecoder_GetFrame(bitmapDecoder, 0, &bitmapFrame));
|
||||
DONE_IF_FAILED(IWICImagingFactory_CreateFormatConverter(wicFactory, &formatConverter));
|
||||
DONE_IF_FAILED(IWICFormatConverter_Initialize(
|
||||
formatConverter,
|
||||
(IWICBitmapSource*)bitmapFrame,
|
||||
&GUID_WICPixelFormat32bppPRGBA,
|
||||
WICBitmapDitherTypeNone,
|
||||
NULL,
|
||||
0.0,
|
||||
WICBitmapPaletteTypeCustom
|
||||
));
|
||||
DONE_IF_FAILED(IWICBitmapFrameDecode_GetSize(bitmapFrame, &width, &height));
|
||||
#undef DONE_IF_FAILED
|
||||
|
||||
surface = SDL_CreateRGBSurface(
|
||||
0,
|
||||
width,
|
||||
height,
|
||||
32,
|
||||
0x000000FF,
|
||||
0x0000FF00,
|
||||
0x00FF0000,
|
||||
0xFF000000
|
||||
);
|
||||
IWICFormatConverter_CopyPixels(
|
||||
formatConverter,
|
||||
NULL,
|
||||
width * 4,
|
||||
width * height * 4,
|
||||
(BYTE*)surface->pixels
|
||||
);
|
||||
|
||||
done:
|
||||
if (formatConverter) {
|
||||
IWICFormatConverter_Release(formatConverter);
|
||||
}
|
||||
if (bitmapFrame) {
|
||||
IWICBitmapFrameDecode_Release(bitmapFrame);
|
||||
}
|
||||
if (bitmapDecoder) {
|
||||
IWICBitmapDecoder_Release(bitmapDecoder);
|
||||
}
|
||||
if (stream) {
|
||||
IWICStream_Release(stream);
|
||||
}
|
||||
|
||||
SDL_free(memoryBuffer);
|
||||
|
||||
return surface;
|
||||
}
|
||||
|
||||
SDL_Surface *IMG_LoadPNG_RW(SDL_RWops *src)
|
||||
{
|
||||
return WIC_LoadImage(src);
|
||||
}
|
||||
|
||||
SDL_Surface *IMG_LoadJPG_RW(SDL_RWops *src)
|
||||
{
|
||||
return WIC_LoadImage(src);
|
||||
}
|
||||
|
||||
SDL_Surface *IMG_LoadTIF_RW(SDL_RWops *src)
|
||||
{
|
||||
return WIC_LoadImage(src);
|
||||
}
|
||||
|
||||
#endif /* SDL_IMAGE_USE_WIC_BACKEND */
|
||||
|
||||
339
Library/SDL2_image-2.5.2/IMG_avif.c
Normal file
339
Library/SDL2_image-2.5.2/IMG_avif.c
Normal file
@@ -0,0 +1,339 @@
|
||||
/*
|
||||
SDL_image: An example image loading library for use with SDL
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
/* This is a AVIF image file loading framework */
|
||||
|
||||
#include "SDL_image.h"
|
||||
|
||||
#ifdef LOAD_AVIF
|
||||
|
||||
#include <avif/avif.h>
|
||||
#include <limits.h> /* for INT_MAX */
|
||||
|
||||
|
||||
static struct {
|
||||
int loaded;
|
||||
void *handle;
|
||||
avifBool (*avifPeekCompatibleFileType)(const avifROData * input);
|
||||
avifDecoder * (*avifDecoderCreate)(void);
|
||||
void (*avifDecoderDestroy)(avifDecoder * decoder);
|
||||
void (*avifDecoderSetIO)(avifDecoder * decoder, avifIO * io);
|
||||
avifResult (*avifDecoderParse)(avifDecoder * decoder);
|
||||
avifResult (*avifDecoderNextImage)(avifDecoder * decoder);
|
||||
avifResult (*avifImageYUVToRGB)(const avifImage * image, avifRGBImage * rgb);
|
||||
} lib;
|
||||
|
||||
#ifdef LOAD_AVIF_DYNAMIC
|
||||
#define FUNCTION_LOADER(FUNC, SIG) \
|
||||
lib.FUNC = (SIG) SDL_LoadFunction(lib.handle, #FUNC); \
|
||||
if (lib.FUNC == NULL) { SDL_UnloadObject(lib.handle); return -1; }
|
||||
#else
|
||||
#define FUNCTION_LOADER(FUNC, SIG) \
|
||||
lib.FUNC = FUNC; \
|
||||
if (lib.FUNC == NULL) { IMG_SetError("Missing avif.framework"); return -1; }
|
||||
#endif
|
||||
|
||||
int IMG_InitAVIF()
|
||||
{
|
||||
if ( lib.loaded == 0 ) {
|
||||
#ifdef LOAD_AVIF_DYNAMIC
|
||||
lib.handle = SDL_LoadObject(LOAD_AVIF_DYNAMIC);
|
||||
if ( lib.handle == NULL ) {
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
FUNCTION_LOADER(avifPeekCompatibleFileType, avifBool (*)(const avifROData * input))
|
||||
FUNCTION_LOADER(avifDecoderCreate, avifDecoder *(*)(void))
|
||||
FUNCTION_LOADER(avifDecoderDestroy, void (*)(avifDecoder * decoder))
|
||||
FUNCTION_LOADER(avifDecoderSetIO, void (*)(avifDecoder * decoder, avifIO * io))
|
||||
FUNCTION_LOADER(avifDecoderParse, avifResult (*)(avifDecoder * decoder))
|
||||
FUNCTION_LOADER(avifDecoderNextImage, avifResult (*)(avifDecoder * decoder))
|
||||
FUNCTION_LOADER(avifImageYUVToRGB, avifResult (*)(const avifImage * image, avifRGBImage * rgb))
|
||||
}
|
||||
++lib.loaded;
|
||||
|
||||
return 0;
|
||||
}
|
||||
void IMG_QuitAVIF()
|
||||
{
|
||||
if ( lib.loaded == 0 ) {
|
||||
return;
|
||||
}
|
||||
if ( lib.loaded == 1 ) {
|
||||
#ifdef LOAD_AVIF_DYNAMIC
|
||||
SDL_UnloadObject(lib.handle);
|
||||
#endif
|
||||
}
|
||||
--lib.loaded;
|
||||
}
|
||||
|
||||
static SDL_bool ReadAVIFHeader(SDL_RWops *src, Uint8 **header_data, size_t *header_size)
|
||||
{
|
||||
Uint8 magic[16];
|
||||
Uint64 size;
|
||||
size_t read = 0;
|
||||
Uint8 *data;
|
||||
|
||||
*header_data = NULL;
|
||||
*header_size = 0;
|
||||
|
||||
if (!SDL_RWread(src, magic, 8, 1)) {
|
||||
return SDL_FALSE;
|
||||
}
|
||||
read += 8;
|
||||
|
||||
if (SDL_memcmp(&magic[4], "ftyp", 4) != 0) {
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
size = (((size_t)magic[0] << 24) |
|
||||
((size_t)magic[1] << 16) |
|
||||
((size_t)magic[2] << 8) |
|
||||
((size_t)magic[3] << 0));
|
||||
if (size == 1) {
|
||||
/* 64-bit header size */
|
||||
if (!SDL_RWread(src, &magic[8], 8, 1)) {
|
||||
return SDL_FALSE;
|
||||
}
|
||||
read += 8;
|
||||
|
||||
size = (((Uint64)magic[8] << 56) |
|
||||
((Uint64)magic[9] << 48) |
|
||||
((Uint64)magic[10] << 40) |
|
||||
((Uint64)magic[11] << 32) |
|
||||
((Uint64)magic[12] << 24) |
|
||||
((Uint64)magic[13] << 16) |
|
||||
((Uint64)magic[14] << 8) |
|
||||
((Uint64)magic[15] << 0));
|
||||
}
|
||||
|
||||
if (size > INT_MAX) {
|
||||
return SDL_FALSE;
|
||||
}
|
||||
if (size <= read) {
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
/* Read in the header */
|
||||
data = (Uint8 *)SDL_malloc(size);
|
||||
if (!data) {
|
||||
return SDL_FALSE;
|
||||
}
|
||||
SDL_memcpy(data, magic, read);
|
||||
|
||||
if (!SDL_RWread(src, &data[read], (size - read), 1)) {
|
||||
SDL_free(data);
|
||||
return SDL_FALSE;
|
||||
}
|
||||
*header_data = data;
|
||||
*header_size = (size_t)size;
|
||||
return SDL_TRUE;
|
||||
}
|
||||
|
||||
/* See if an image is contained in a data source */
|
||||
int IMG_isAVIF(SDL_RWops *src)
|
||||
{
|
||||
Sint64 start;
|
||||
int is_AVIF;
|
||||
Uint8 *data;
|
||||
size_t size;
|
||||
|
||||
if ( !src )
|
||||
return 0;
|
||||
|
||||
start = SDL_RWtell(src);
|
||||
is_AVIF = 0;
|
||||
if (ReadAVIFHeader(src, &data, &size)) {
|
||||
/* This might be AVIF, do more thorough checks */
|
||||
if ((IMG_Init(IMG_INIT_AVIF) & IMG_INIT_AVIF) != 0) {
|
||||
avifROData header;
|
||||
|
||||
header.data = data;
|
||||
header.size = size;
|
||||
is_AVIF = lib.avifPeekCompatibleFileType(&header);
|
||||
}
|
||||
SDL_free(data);
|
||||
}
|
||||
SDL_RWseek(src, start, RW_SEEK_SET);
|
||||
return(is_AVIF);
|
||||
}
|
||||
|
||||
/* Context for AFIF I/O operations */
|
||||
typedef struct
|
||||
{
|
||||
SDL_RWops *src;
|
||||
Uint64 start;
|
||||
uint8_t *data;
|
||||
size_t size;
|
||||
} avifIOContext;
|
||||
|
||||
static avifResult ReadAVIFIO(struct avifIO * io, uint32_t readFlags, uint64_t offset, size_t size, avifROData * out)
|
||||
{
|
||||
avifIOContext *context = (avifIOContext *)io->data;
|
||||
|
||||
/* The AVIF reader bounces all over, so always seek to the correct offset */
|
||||
if (SDL_RWseek(context->src, context->start + offset, RW_SEEK_SET) < 0) {
|
||||
return AVIF_RESULT_IO_ERROR;
|
||||
}
|
||||
|
||||
if (size > context->size) {
|
||||
uint8_t *data = (uint8_t *)SDL_realloc(context->data, size);
|
||||
if (!data) {
|
||||
return AVIF_RESULT_IO_ERROR;
|
||||
}
|
||||
context->data = data;
|
||||
context->size = size;
|
||||
}
|
||||
|
||||
out->data = context->data;
|
||||
out->size = SDL_RWread(context->src, context->data, 1, size);
|
||||
if (out->size == 0) {
|
||||
return AVIF_RESULT_IO_ERROR;
|
||||
}
|
||||
|
||||
return AVIF_RESULT_OK;
|
||||
}
|
||||
|
||||
static void DestroyAVIFIO(struct avifIO * io)
|
||||
{
|
||||
avifIOContext *context = (avifIOContext *)io->data;
|
||||
|
||||
if (context->data) {
|
||||
SDL_free(context->data);
|
||||
context->data = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* Load a AVIF type image from an SDL datasource */
|
||||
SDL_Surface *IMG_LoadAVIF_RW(SDL_RWops *src)
|
||||
{
|
||||
Sint64 start;
|
||||
avifDecoder *decoder = NULL;
|
||||
avifIO io;
|
||||
avifIOContext context;
|
||||
avifRGBImage rgb;
|
||||
avifResult result;
|
||||
SDL_Surface *surface = NULL;
|
||||
|
||||
if (!src) {
|
||||
/* The error message has been set in SDL_RWFromFile */
|
||||
return NULL;
|
||||
}
|
||||
start = SDL_RWtell(src);
|
||||
|
||||
if ((IMG_Init(IMG_INIT_AVIF) & IMG_INIT_AVIF) == 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
SDL_zero(context);
|
||||
SDL_zero(io);
|
||||
SDL_zero(rgb);
|
||||
|
||||
decoder = lib.avifDecoderCreate();
|
||||
if (!decoder) {
|
||||
IMG_SetError("Couldn't create AVIF decoder");
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Be permissive so we can load as many images as possible */
|
||||
decoder->strictFlags = AVIF_STRICT_DISABLED;
|
||||
|
||||
context.src = src;
|
||||
context.start = start;
|
||||
io.destroy = DestroyAVIFIO;
|
||||
io.read = ReadAVIFIO;
|
||||
io.data = &context;
|
||||
lib.avifDecoderSetIO(decoder, &io);
|
||||
|
||||
result = lib.avifDecoderParse(decoder);
|
||||
if (result != AVIF_RESULT_OK) {
|
||||
IMG_SetError("Couldn't parse AVIF image: %d", result);
|
||||
goto done;
|
||||
}
|
||||
|
||||
result = lib.avifDecoderNextImage(decoder);
|
||||
if (result != AVIF_RESULT_OK) {
|
||||
IMG_SetError("Couldn't get AVIF image: %d", result);
|
||||
goto done;
|
||||
}
|
||||
|
||||
surface = SDL_CreateRGBSurfaceWithFormat(0, decoder->image->width, decoder->image->height, 0, SDL_PIXELFORMAT_ARGB8888);
|
||||
if (!surface) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Convert the YUV image to RGB */
|
||||
rgb.width = surface->w;
|
||||
rgb.height = surface->h;
|
||||
rgb.depth = 8;
|
||||
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
|
||||
rgb.format = AVIF_RGB_FORMAT_BGRA;
|
||||
#else
|
||||
rgb.format = AVIF_RGB_FORMAT_ARGB;
|
||||
#endif
|
||||
rgb.pixels = (uint8_t *)surface->pixels;
|
||||
rgb.rowBytes = (uint32_t)surface->pitch;
|
||||
result = lib.avifImageYUVToRGB(decoder->image, &rgb);
|
||||
if (result != AVIF_RESULT_OK) {
|
||||
IMG_SetError("Couldn't convert AVIF image to RGB: %d", result);
|
||||
SDL_FreeSurface(surface);
|
||||
surface = NULL;
|
||||
goto done;
|
||||
}
|
||||
|
||||
done:
|
||||
if (decoder) {
|
||||
lib.avifDecoderDestroy(decoder);
|
||||
}
|
||||
if (!surface) {
|
||||
SDL_RWseek(src, start, RW_SEEK_SET);
|
||||
}
|
||||
return surface;
|
||||
}
|
||||
|
||||
#else
|
||||
#if _MSC_VER >= 1300
|
||||
#pragma warning(disable : 4100) /* warning C4100: 'op' : unreferenced formal parameter */
|
||||
#endif
|
||||
|
||||
int IMG_InitAVIF()
|
||||
{
|
||||
IMG_SetError("AVIF images are not supported");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
void IMG_QuitAVIF()
|
||||
{
|
||||
}
|
||||
|
||||
/* See if an image is contained in a data source */
|
||||
int IMG_isAVIF(SDL_RWops *src)
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
||||
/* Load a AVIF type image from an SDL datasource */
|
||||
SDL_Surface *IMG_LoadAVIF_RW(SDL_RWops *src)
|
||||
{
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
#endif /* LOAD_AVIF */
|
||||
503
Library/SDL2_image-2.5.2/IMG_bmp.c
Normal file
503
Library/SDL2_image-2.5.2/IMG_bmp.c
Normal file
@@ -0,0 +1,503 @@
|
||||
/*
|
||||
SDL_image: An example image loading library for use with SDL
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#if (!defined(__APPLE__) || defined(SDL_IMAGE_USE_COMMON_BACKEND)) || !defined(BMP_USES_IMAGEIO)
|
||||
|
||||
/* This is a BMP image file loading framework
|
||||
*
|
||||
* ICO/CUR file support is here as well since it uses similar internal
|
||||
* representation
|
||||
*
|
||||
* A good test suite of BMP images is available at:
|
||||
* http://entropymine.com/jason/bmpsuite/bmpsuite/html/bmpsuite.html
|
||||
*/
|
||||
|
||||
#include "SDL_image.h"
|
||||
|
||||
#ifdef LOAD_BMP
|
||||
|
||||
/* See if an image is contained in a data source */
|
||||
int IMG_isBMP(SDL_RWops *src)
|
||||
{
|
||||
Sint64 start;
|
||||
int is_BMP;
|
||||
char magic[2];
|
||||
|
||||
if ( !src )
|
||||
return 0;
|
||||
start = SDL_RWtell(src);
|
||||
is_BMP = 0;
|
||||
if ( SDL_RWread(src, magic, sizeof(magic), 1) ) {
|
||||
if ( SDL_strncmp(magic, "BM", 2) == 0 ) {
|
||||
is_BMP = 1;
|
||||
}
|
||||
}
|
||||
SDL_RWseek(src, start, RW_SEEK_SET);
|
||||
return(is_BMP);
|
||||
}
|
||||
|
||||
static int IMG_isICOCUR(SDL_RWops *src, int type)
|
||||
{
|
||||
Sint64 start;
|
||||
int is_ICOCUR;
|
||||
|
||||
/* The Win32 ICO file header (14 bytes) */
|
||||
Uint16 bfReserved;
|
||||
Uint16 bfType;
|
||||
Uint16 bfCount;
|
||||
|
||||
if ( !src )
|
||||
return 0;
|
||||
start = SDL_RWtell(src);
|
||||
is_ICOCUR = 0;
|
||||
bfReserved = SDL_ReadLE16(src);
|
||||
bfType = SDL_ReadLE16(src);
|
||||
bfCount = SDL_ReadLE16(src);
|
||||
if ((bfReserved == 0) && (bfType == type) && (bfCount != 0))
|
||||
is_ICOCUR = 1;
|
||||
SDL_RWseek(src, start, RW_SEEK_SET);
|
||||
|
||||
return (is_ICOCUR);
|
||||
}
|
||||
|
||||
int IMG_isICO(SDL_RWops *src)
|
||||
{
|
||||
return IMG_isICOCUR(src, 1);
|
||||
}
|
||||
|
||||
int IMG_isCUR(SDL_RWops *src)
|
||||
{
|
||||
return IMG_isICOCUR(src, 2);
|
||||
}
|
||||
|
||||
#include "SDL_error.h"
|
||||
#include "SDL_video.h"
|
||||
#include "SDL_endian.h"
|
||||
|
||||
/* Compression encodings for BMP files */
|
||||
#ifndef BI_RGB
|
||||
#define BI_RGB 0
|
||||
#define BI_RLE8 1
|
||||
#define BI_RLE4 2
|
||||
#define BI_BITFIELDS 3
|
||||
#endif
|
||||
|
||||
static SDL_Surface *LoadBMP_RW (SDL_RWops *src, int freesrc)
|
||||
{
|
||||
return SDL_LoadBMP_RW(src, freesrc);
|
||||
}
|
||||
|
||||
static Uint8
|
||||
SDL_Read8(SDL_RWops * src)
|
||||
{
|
||||
Uint8 value;
|
||||
|
||||
SDL_RWread(src, &value, 1, 1);
|
||||
return (value);
|
||||
}
|
||||
|
||||
static SDL_Surface *
|
||||
LoadICOCUR_RW(SDL_RWops * src, int type, int freesrc)
|
||||
{
|
||||
SDL_bool was_error;
|
||||
Sint64 fp_offset = 0;
|
||||
int bmpPitch;
|
||||
int i,j, pad;
|
||||
SDL_Surface *surface;
|
||||
/*
|
||||
Uint32 Rmask;
|
||||
Uint32 Gmask;
|
||||
Uint32 Bmask;
|
||||
*/
|
||||
Uint8 *bits;
|
||||
int ExpandBMP;
|
||||
int maxCol = 0;
|
||||
int icoOfs = 0;
|
||||
Uint32 palette[256];
|
||||
|
||||
/* The Win32 ICO file header (14 bytes) */
|
||||
Uint16 bfReserved;
|
||||
Uint16 bfType;
|
||||
Uint16 bfCount;
|
||||
|
||||
/* The Win32 BITMAPINFOHEADER struct (40 bytes) */
|
||||
Uint32 biSize;
|
||||
Sint32 biWidth;
|
||||
Sint32 biHeight;
|
||||
/* Uint16 biPlanes; */
|
||||
Uint16 biBitCount;
|
||||
Uint32 biCompression;
|
||||
/*
|
||||
Uint32 biSizeImage;
|
||||
Sint32 biXPelsPerMeter;
|
||||
Sint32 biYPelsPerMeter;
|
||||
Uint32 biClrImportant;
|
||||
*/
|
||||
Uint32 biClrUsed;
|
||||
|
||||
/* Make sure we are passed a valid data source */
|
||||
surface = NULL;
|
||||
was_error = SDL_FALSE;
|
||||
if (src == NULL) {
|
||||
was_error = SDL_TRUE;
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Read in the ICO file header */
|
||||
fp_offset = SDL_RWtell(src);
|
||||
SDL_ClearError();
|
||||
|
||||
bfReserved = SDL_ReadLE16(src);
|
||||
bfType = SDL_ReadLE16(src);
|
||||
bfCount = SDL_ReadLE16(src);
|
||||
if ((bfReserved != 0) || (bfType != type) || (bfCount == 0)) {
|
||||
IMG_SetError("File is not a Windows %s file", type == 1 ? "ICO" : "CUR");
|
||||
was_error = SDL_TRUE;
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Read the Win32 Icon Directory */
|
||||
for (i = 0; i < bfCount; i++) {
|
||||
/* Icon Directory Entries */
|
||||
int bWidth = SDL_Read8(src); /* Uint8, but 0 = 256 ! */
|
||||
int bHeight = SDL_Read8(src); /* Uint8, but 0 = 256 ! */
|
||||
int bColorCount = SDL_Read8(src); /* Uint8, but 0 = 256 ! */
|
||||
/*
|
||||
Uint8 bReserved;
|
||||
Uint16 wPlanes;
|
||||
Uint16 wBitCount;
|
||||
Uint32 dwBytesInRes;
|
||||
*/
|
||||
Uint32 dwImageOffset;
|
||||
|
||||
/* bReserved = */ SDL_Read8(src);
|
||||
/* wPlanes = */ SDL_ReadLE16(src);
|
||||
/* wBitCount = */ SDL_ReadLE16(src);
|
||||
/* dwBytesInRes = */ SDL_ReadLE32(src);
|
||||
dwImageOffset = SDL_ReadLE32(src);
|
||||
|
||||
if (!bWidth)
|
||||
bWidth = 256;
|
||||
if (!bHeight)
|
||||
bHeight = 256;
|
||||
if (!bColorCount)
|
||||
bColorCount = 256;
|
||||
|
||||
//printf("%dx%d@%d - %08x\n", bWidth, bHeight, bColorCount, dwImageOffset);
|
||||
if (bColorCount > maxCol) {
|
||||
maxCol = bColorCount;
|
||||
icoOfs = dwImageOffset;
|
||||
//printf("marked\n");
|
||||
}
|
||||
}
|
||||
|
||||
/* Advance to the DIB Data */
|
||||
if (SDL_RWseek(src, icoOfs, RW_SEEK_SET) < 0) {
|
||||
SDL_Error(SDL_EFSEEK);
|
||||
was_error = SDL_TRUE;
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Read the Win32 BITMAPINFOHEADER */
|
||||
biSize = SDL_ReadLE32(src);
|
||||
if (biSize == 40) {
|
||||
biWidth = SDL_ReadLE32(src);
|
||||
biHeight = SDL_ReadLE32(src);
|
||||
/* biPlanes = */ SDL_ReadLE16(src);
|
||||
biBitCount = SDL_ReadLE16(src);
|
||||
biCompression = SDL_ReadLE32(src);
|
||||
/* biSizeImage = */ SDL_ReadLE32(src);
|
||||
/* biXPelsPerMeter = */ SDL_ReadLE32(src);
|
||||
/* biYPelsPerMeter = */ SDL_ReadLE32(src);
|
||||
biClrUsed = SDL_ReadLE32(src);
|
||||
/* biClrImportant = */ SDL_ReadLE32(src);
|
||||
} else {
|
||||
IMG_SetError("Unsupported ICO bitmap format");
|
||||
was_error = SDL_TRUE;
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Check for read error */
|
||||
if (SDL_strcmp(SDL_GetError(), "") != 0) {
|
||||
was_error = SDL_TRUE;
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* We don't support any BMP compression right now */
|
||||
switch (biCompression) {
|
||||
case BI_RGB:
|
||||
/* Default values for the BMP format */
|
||||
switch (biBitCount) {
|
||||
case 1:
|
||||
case 4:
|
||||
ExpandBMP = biBitCount;
|
||||
biBitCount = 8;
|
||||
break;
|
||||
case 8:
|
||||
ExpandBMP = 8;
|
||||
break;
|
||||
case 24:
|
||||
ExpandBMP = 24;
|
||||
break;
|
||||
case 32:
|
||||
/*
|
||||
Rmask = 0x00FF0000;
|
||||
Gmask = 0x0000FF00;
|
||||
Bmask = 0x000000FF;
|
||||
*/
|
||||
ExpandBMP = 0;
|
||||
break;
|
||||
default:
|
||||
IMG_SetError("ICO file with unsupported bit count");
|
||||
was_error = SDL_TRUE;
|
||||
goto done;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
IMG_SetError("Compressed ICO files not supported");
|
||||
was_error = SDL_TRUE;
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* sanity check image size, so we don't overflow integers, etc. */
|
||||
if ((biWidth < 0) || (biWidth > 0xFFFFFF) ||
|
||||
(biHeight < 0) || (biHeight > 0xFFFFFF)) {
|
||||
IMG_SetError("Unsupported or invalid ICO dimensions");
|
||||
was_error = SDL_TRUE;
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Create a RGBA surface */
|
||||
biHeight = biHeight >> 1;
|
||||
//printf("%d x %d\n", biWidth, biHeight);
|
||||
surface =
|
||||
SDL_CreateRGBSurface(0, biWidth, biHeight, 32, 0x00FF0000,
|
||||
0x0000FF00, 0x000000FF, 0xFF000000);
|
||||
if (surface == NULL) {
|
||||
was_error = SDL_TRUE;
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Load the palette, if any */
|
||||
//printf("bc %d bused %d\n", biBitCount, biClrUsed);
|
||||
if (biBitCount <= 8) {
|
||||
if (biClrUsed == 0) {
|
||||
biClrUsed = 1 << biBitCount;
|
||||
}
|
||||
if (biClrUsed > SDL_arraysize(palette)) {
|
||||
IMG_SetError("Unsupported or incorrect biClrUsed field");
|
||||
was_error = SDL_TRUE;
|
||||
goto done;
|
||||
}
|
||||
for (i = 0; i < (int) biClrUsed; ++i) {
|
||||
SDL_RWread(src, &palette[i], 4, 1);
|
||||
}
|
||||
}
|
||||
|
||||
/* Read the surface pixels. Note that the bmp image is upside down */
|
||||
bits = (Uint8 *) surface->pixels + (surface->h * surface->pitch);
|
||||
switch (ExpandBMP) {
|
||||
case 1:
|
||||
bmpPitch = (biWidth + 7) >> 3;
|
||||
pad = (((bmpPitch) % 4) ? (4 - ((bmpPitch) % 4)) : 0);
|
||||
break;
|
||||
case 4:
|
||||
bmpPitch = (biWidth + 1) >> 1;
|
||||
pad = (((bmpPitch) % 4) ? (4 - ((bmpPitch) % 4)) : 0);
|
||||
break;
|
||||
case 8:
|
||||
bmpPitch = biWidth;
|
||||
pad = (((bmpPitch) % 4) ? (4 - ((bmpPitch) % 4)) : 0);
|
||||
break;
|
||||
case 24:
|
||||
bmpPitch = biWidth * 3;
|
||||
pad = (((bmpPitch) % 4) ? (4 - ((bmpPitch) % 4)) : 0);
|
||||
break;
|
||||
default:
|
||||
bmpPitch = biWidth * 4;
|
||||
pad = 0;
|
||||
break;
|
||||
}
|
||||
while (bits > (Uint8 *) surface->pixels) {
|
||||
bits -= surface->pitch;
|
||||
switch (ExpandBMP) {
|
||||
case 1:
|
||||
case 4:
|
||||
case 8:
|
||||
{
|
||||
Uint8 pixel = 0;
|
||||
int shift = (8 - ExpandBMP);
|
||||
for (i = 0; i < surface->w; ++i) {
|
||||
if (i % (8 / ExpandBMP) == 0) {
|
||||
if (!SDL_RWread(src, &pixel, 1, 1)) {
|
||||
IMG_SetError("Error reading from ICO");
|
||||
was_error = SDL_TRUE;
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
*((Uint32 *) bits + i) = (palette[pixel >> shift]);
|
||||
pixel <<= ExpandBMP;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 24:
|
||||
{
|
||||
Uint32 pixel;
|
||||
Uint8 channel;
|
||||
for (i = 0; i < surface->w; ++i) {
|
||||
pixel = 0;
|
||||
for (j = 0; j < 3; ++j) {
|
||||
/* Load each color channel into pixel */
|
||||
if (!SDL_RWread(src, &channel, 1, 1)) {
|
||||
IMG_SetError("Error reading from ICO");
|
||||
was_error = SDL_TRUE;
|
||||
goto done;
|
||||
}
|
||||
pixel |= (channel << (j * 8));
|
||||
}
|
||||
*((Uint32 *) bits + i) = pixel;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
if (SDL_RWread(src, bits, 1, surface->pitch)
|
||||
!= surface->pitch) {
|
||||
SDL_Error(SDL_EFREAD);
|
||||
was_error = SDL_TRUE;
|
||||
goto done;
|
||||
}
|
||||
break;
|
||||
}
|
||||
/* Skip padding bytes, ugh */
|
||||
if (pad) {
|
||||
Uint8 padbyte;
|
||||
for (i = 0; i < pad; ++i) {
|
||||
SDL_RWread(src, &padbyte, 1, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Read the mask pixels. Note that the bmp image is upside down */
|
||||
bits = (Uint8 *) surface->pixels + (surface->h * surface->pitch);
|
||||
ExpandBMP = 1;
|
||||
bmpPitch = (biWidth + 7) >> 3;
|
||||
pad = (((bmpPitch) % 4) ? (4 - ((bmpPitch) % 4)) : 0);
|
||||
while (bits > (Uint8 *) surface->pixels) {
|
||||
Uint8 pixel = 0;
|
||||
int shift = (8 - ExpandBMP);
|
||||
|
||||
bits -= surface->pitch;
|
||||
for (i = 0; i < surface->w; ++i) {
|
||||
if (i % (8 / ExpandBMP) == 0) {
|
||||
if (!SDL_RWread(src, &pixel, 1, 1)) {
|
||||
IMG_SetError("Error reading from ICO");
|
||||
was_error = SDL_TRUE;
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
*((Uint32 *) bits + i) |= ((pixel >> shift) ? 0 : 0xFF000000);
|
||||
pixel <<= ExpandBMP;
|
||||
}
|
||||
/* Skip padding bytes, ugh */
|
||||
if (pad) {
|
||||
Uint8 padbyte;
|
||||
for (i = 0; i < pad; ++i) {
|
||||
SDL_RWread(src, &padbyte, 1, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
done:
|
||||
if (was_error) {
|
||||
if (src) {
|
||||
SDL_RWseek(src, fp_offset, RW_SEEK_SET);
|
||||
}
|
||||
if (surface) {
|
||||
SDL_FreeSurface(surface);
|
||||
}
|
||||
surface = NULL;
|
||||
}
|
||||
if (freesrc && src) {
|
||||
SDL_RWclose(src);
|
||||
}
|
||||
return (surface);
|
||||
}
|
||||
|
||||
/* Load a BMP type image from an SDL datasource */
|
||||
SDL_Surface *IMG_LoadBMP_RW(SDL_RWops *src)
|
||||
{
|
||||
return(LoadBMP_RW(src, 0));
|
||||
}
|
||||
|
||||
/* Load a ICO type image from an SDL datasource */
|
||||
SDL_Surface *IMG_LoadICO_RW(SDL_RWops *src)
|
||||
{
|
||||
return(LoadICOCUR_RW(src, 1, 0));
|
||||
}
|
||||
|
||||
/* Load a CUR type image from an SDL datasource */
|
||||
SDL_Surface *IMG_LoadCUR_RW(SDL_RWops *src)
|
||||
{
|
||||
return(LoadICOCUR_RW(src, 2, 0));
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#if _MSC_VER >= 1300
|
||||
#pragma warning(disable : 4100) /* warning C4100: 'op' : unreferenced formal parameter */
|
||||
#endif
|
||||
|
||||
/* See if an image is contained in a data source */
|
||||
int IMG_isBMP(SDL_RWops *src)
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
||||
int IMG_isICO(SDL_RWops *src)
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
||||
int IMG_isCUR(SDL_RWops *src)
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
||||
/* Load a BMP type image from an SDL datasource */
|
||||
SDL_Surface *IMG_LoadBMP_RW(SDL_RWops *src)
|
||||
{
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/* Load a BMP type image from an SDL datasource */
|
||||
SDL_Surface *IMG_LoadCUR_RW(SDL_RWops *src)
|
||||
{
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/* Load a BMP type image from an SDL datasource */
|
||||
SDL_Surface *IMG_LoadICO_RW(SDL_RWops *src)
|
||||
{
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
#endif /* LOAD_BMP */
|
||||
|
||||
#endif /* !defined(__APPLE__) || defined(SDL_IMAGE_USE_COMMON_BACKEND) */
|
||||
808
Library/SDL2_image-2.5.2/IMG_gif.c
Normal file
808
Library/SDL2_image-2.5.2/IMG_gif.c
Normal file
@@ -0,0 +1,808 @@
|
||||
/*
|
||||
SDL_image: An example image loading library for use with SDL
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
/* This is a GIF image file loading framework */
|
||||
|
||||
#include "SDL_image.h"
|
||||
|
||||
#ifdef LOAD_GIF
|
||||
|
||||
/* Code from here to end of file has been adapted from XPaint: */
|
||||
/* +-------------------------------------------------------------------+ */
|
||||
/* | Copyright 1990, 1991, 1993 David Koblas. | */
|
||||
/* | Copyright 1996 Torsten Martinsen. | */
|
||||
/* | Permission to use, copy, modify, and distribute this software | */
|
||||
/* | and its documentation for any purpose and without fee is hereby | */
|
||||
/* | granted, provided that the above copyright notice appear in all | */
|
||||
/* | copies and that both that copyright notice and this permission | */
|
||||
/* | notice appear in supporting documentation. This software is | */
|
||||
/* | provided "as is" without express or implied warranty. | */
|
||||
/* +-------------------------------------------------------------------+ */
|
||||
|
||||
/* Adapted for use in SDL by Sam Lantinga -- 7/20/98 */
|
||||
/* Changes to work with SDL:
|
||||
|
||||
Include SDL header file
|
||||
Use SDL_Surface rather than xpaint Image structure
|
||||
Define SDL versions of RWSetMsg(), ImageNewCmap() and ImageSetCmap()
|
||||
*/
|
||||
#include "SDL.h"
|
||||
|
||||
#define Image SDL_Surface
|
||||
#define RWSetMsg IMG_SetError
|
||||
#define ImageNewCmap(w, h, s) SDL_CreateRGBSurface(SDL_SWSURFACE,w,h,8,0,0,0,0)
|
||||
#define ImageSetCmap(s, i, R, G, B) do { \
|
||||
s->format->palette->colors[i].r = R; \
|
||||
s->format->palette->colors[i].g = G; \
|
||||
s->format->palette->colors[i].b = B; \
|
||||
} while (0)
|
||||
/* * * * * */
|
||||
|
||||
#define GIF_DISPOSE_NA 0 /* No disposal specified */
|
||||
#define GIF_DISPOSE_NONE 1 /* Do not dispose */
|
||||
#define GIF_DISPOSE_RESTORE_BACKGROUND 2 /* Restore to background */
|
||||
#define GIF_DISPOSE_RESTORE_PREVIOUS 3 /* Restore to previous */
|
||||
|
||||
#define MAXCOLORMAPSIZE 256
|
||||
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
|
||||
#define CM_RED 0
|
||||
#define CM_GREEN 1
|
||||
#define CM_BLUE 2
|
||||
|
||||
#define MAX_LWZ_BITS 12
|
||||
|
||||
#define INTERLACE 0x40
|
||||
#define LOCALCOLORMAP 0x80
|
||||
#define BitSet(byte, bit) (((byte) & (bit)) == (bit))
|
||||
|
||||
#define ReadOK(file,buffer,len) SDL_RWread(file, buffer, len, 1)
|
||||
|
||||
#define LM_to_uint(a,b) (((b)<<8)|(a))
|
||||
|
||||
typedef struct {
|
||||
struct {
|
||||
unsigned int Width;
|
||||
unsigned int Height;
|
||||
unsigned char ColorMap[3][MAXCOLORMAPSIZE];
|
||||
unsigned int BitPixel;
|
||||
unsigned int ColorResolution;
|
||||
unsigned int Background;
|
||||
unsigned int AspectRatio;
|
||||
int GrayScale;
|
||||
} GifScreen;
|
||||
|
||||
struct {
|
||||
int transparent;
|
||||
int delayTime;
|
||||
int inputFlag;
|
||||
int disposal;
|
||||
} Gif89;
|
||||
|
||||
unsigned char buf[280];
|
||||
int curbit, lastbit, done, last_byte;
|
||||
|
||||
int fresh;
|
||||
int code_size, set_code_size;
|
||||
int max_code, max_code_size;
|
||||
int firstcode, oldcode;
|
||||
int clear_code, end_code;
|
||||
int table[2][(1 << MAX_LWZ_BITS)];
|
||||
int stack[(1 << (MAX_LWZ_BITS)) * 2], *sp;
|
||||
|
||||
int ZeroDataBlock;
|
||||
} State_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Image *image;
|
||||
int x, y;
|
||||
int disposal;
|
||||
int delay;
|
||||
} Frame_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int count;
|
||||
Frame_t *frames;
|
||||
} Anim_t;
|
||||
|
||||
static int ReadColorMap(SDL_RWops * src, int number,
|
||||
unsigned char buffer[3][MAXCOLORMAPSIZE], int *flag);
|
||||
static int DoExtension(SDL_RWops * src, int label, State_t * state);
|
||||
static int GetDataBlock(SDL_RWops * src, unsigned char *buf, State_t * state);
|
||||
static int GetCode(SDL_RWops * src, int code_size, int flag, State_t * state);
|
||||
static int LWZReadByte(SDL_RWops * src, int flag, int input_code_size, State_t * state);
|
||||
static Image *ReadImage(SDL_RWops * src, int len, int height, int,
|
||||
unsigned char cmap[3][MAXCOLORMAPSIZE],
|
||||
int gray, int interlace, int ignore, State_t * state);
|
||||
|
||||
static SDL_bool NormalizeFrames(Frame_t *frames, int count)
|
||||
{
|
||||
SDL_Surface *image;
|
||||
int i;
|
||||
int lastDispose = GIF_DISPOSE_RESTORE_BACKGROUND;
|
||||
int iRestore = 0;
|
||||
Uint32 fill;
|
||||
SDL_Rect rect;
|
||||
|
||||
|
||||
if (SDL_HasColorKey(frames[0].image)) {
|
||||
image = SDL_ConvertSurfaceFormat(frames[0].image, SDL_PIXELFORMAT_ARGB8888, 0);
|
||||
} else {
|
||||
image = SDL_ConvertSurfaceFormat(frames[0].image, SDL_PIXELFORMAT_RGB888, 0);
|
||||
}
|
||||
if (!image) {
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
fill = SDL_MapRGBA(image->format, 0, 0, 0, SDL_ALPHA_TRANSPARENT);
|
||||
|
||||
rect.x = 0;
|
||||
rect.y = 0;
|
||||
rect.w = image->w;
|
||||
rect.h = image->h;
|
||||
|
||||
for (i = 0; i < count; ++i) {
|
||||
switch (lastDispose) {
|
||||
case GIF_DISPOSE_RESTORE_BACKGROUND:
|
||||
SDL_FillRect(image, &rect, fill);
|
||||
break;
|
||||
case GIF_DISPOSE_RESTORE_PREVIOUS:
|
||||
SDL_BlitSurface(frames[iRestore].image, &rect, image, &rect);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (frames[i].disposal != GIF_DISPOSE_RESTORE_PREVIOUS) {
|
||||
iRestore = i;
|
||||
}
|
||||
|
||||
rect.x = (Sint16)frames[i].x;
|
||||
rect.y = (Sint16)frames[i].y;
|
||||
rect.w = frames[i].image->w;
|
||||
rect.h = frames[i].image->h;
|
||||
SDL_BlitSurface(frames[i].image, NULL, image, &rect);
|
||||
|
||||
SDL_FreeSurface(frames[i].image);
|
||||
frames[i].image = SDL_DuplicateSurface(image);
|
||||
if (!frames[i].image) {
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
lastDispose = frames[i].disposal;
|
||||
}
|
||||
|
||||
SDL_FreeSurface( image );
|
||||
|
||||
return SDL_TRUE;
|
||||
}
|
||||
|
||||
static Anim_t *
|
||||
IMG_LoadGIF_RW_Internal(SDL_RWops *src, SDL_bool load_anim)
|
||||
{
|
||||
unsigned char buf[16];
|
||||
unsigned char c;
|
||||
unsigned char localColorMap[3][MAXCOLORMAPSIZE];
|
||||
int grayScale;
|
||||
int useGlobalColormap;
|
||||
int bitPixel;
|
||||
char version[4];
|
||||
State_t *state = NULL;
|
||||
Image *image = NULL;
|
||||
Anim_t *anim;
|
||||
Frame_t *frames, *frame;
|
||||
|
||||
if (src == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
anim = (Anim_t *)SDL_calloc(1, sizeof(*anim));
|
||||
if (!anim) {
|
||||
SDL_OutOfMemory();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!ReadOK(src, buf, 6)) {
|
||||
RWSetMsg("error reading magic number");
|
||||
goto done;
|
||||
}
|
||||
if (SDL_strncmp((char *) buf, "GIF", 3) != 0) {
|
||||
RWSetMsg("not a GIF file");
|
||||
goto done;
|
||||
}
|
||||
SDL_memcpy(version, (char *) buf + 3, 3);
|
||||
version[3] = '\0';
|
||||
|
||||
if ((SDL_strcmp(version, "87a") != 0) && (SDL_strcmp(version, "89a") != 0)) {
|
||||
RWSetMsg("bad version number, not '87a' or '89a'");
|
||||
goto done;
|
||||
}
|
||||
state = (State_t *)SDL_calloc(1, sizeof(State_t));
|
||||
if (state == NULL) {
|
||||
SDL_OutOfMemory();
|
||||
goto done;
|
||||
}
|
||||
state->Gif89.transparent = -1;
|
||||
state->Gif89.delayTime = -1;
|
||||
state->Gif89.inputFlag = -1;
|
||||
state->Gif89.disposal = GIF_DISPOSE_NA;
|
||||
|
||||
if (!ReadOK(src, buf, 7)) {
|
||||
RWSetMsg("failed to read screen descriptor");
|
||||
goto done;
|
||||
}
|
||||
state->GifScreen.Width = LM_to_uint(buf[0], buf[1]);
|
||||
state->GifScreen.Height = LM_to_uint(buf[2], buf[3]);
|
||||
state->GifScreen.BitPixel = 2 << (buf[4] & 0x07);
|
||||
state->GifScreen.ColorResolution = (((buf[4] & 0x70) >> 3) + 1);
|
||||
state->GifScreen.Background = buf[5];
|
||||
state->GifScreen.AspectRatio = buf[6];
|
||||
|
||||
if (BitSet(buf[4], LOCALCOLORMAP)) { /* Global Colormap */
|
||||
if (ReadColorMap(src, state->GifScreen.BitPixel,
|
||||
state->GifScreen.ColorMap, &state->GifScreen.GrayScale)) {
|
||||
RWSetMsg("error reading global colormap");
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
for ( ; ; ) {
|
||||
if (!ReadOK(src, &c, 1)) {
|
||||
RWSetMsg("EOF / read error on image data");
|
||||
goto done;
|
||||
}
|
||||
if (c == ';') { /* GIF terminator */
|
||||
goto done;
|
||||
}
|
||||
if (c == '!') { /* Extension */
|
||||
if (!ReadOK(src, &c, 1)) {
|
||||
RWSetMsg("EOF / read error on extention function code");
|
||||
goto done;
|
||||
}
|
||||
DoExtension(src, c, state);
|
||||
continue;
|
||||
}
|
||||
if (c != ',') { /* Not a valid start character */
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!ReadOK(src, buf, 9)) {
|
||||
RWSetMsg("couldn't read left/top/width/height");
|
||||
goto done;
|
||||
}
|
||||
useGlobalColormap = !BitSet(buf[8], LOCALCOLORMAP);
|
||||
|
||||
bitPixel = 1 << ((buf[8] & 0x07) + 1);
|
||||
|
||||
if (!useGlobalColormap) {
|
||||
if (ReadColorMap(src, bitPixel, localColorMap, &grayScale)) {
|
||||
RWSetMsg("error reading local colormap");
|
||||
goto done;
|
||||
}
|
||||
image = ReadImage(src, LM_to_uint(buf[4], buf[5]),
|
||||
LM_to_uint(buf[6], buf[7]),
|
||||
bitPixel, localColorMap, grayScale,
|
||||
BitSet(buf[8], INTERLACE),
|
||||
0, state);
|
||||
} else {
|
||||
image = ReadImage(src, LM_to_uint(buf[4], buf[5]),
|
||||
LM_to_uint(buf[6], buf[7]),
|
||||
state->GifScreen.BitPixel, state->GifScreen.ColorMap,
|
||||
state->GifScreen.GrayScale, BitSet(buf[8], INTERLACE),
|
||||
0, state);
|
||||
}
|
||||
|
||||
if (image) {
|
||||
if (state->Gif89.transparent >= 0) {
|
||||
SDL_SetColorKey(image, SDL_TRUE, state->Gif89.transparent);
|
||||
}
|
||||
|
||||
frames = (Frame_t *)SDL_realloc(anim->frames, (anim->count + 1) * sizeof(*anim->frames));
|
||||
if (!frames) {
|
||||
SDL_OutOfMemory();
|
||||
goto done;
|
||||
}
|
||||
++anim->count;
|
||||
anim->frames = frames;
|
||||
frame = &anim->frames[anim->count - 1];
|
||||
|
||||
frame->image = image;
|
||||
frame->x = LM_to_uint(buf[0], buf[1]);
|
||||
frame->y = LM_to_uint(buf[2], buf[3]);
|
||||
frame->disposal = state->Gif89.disposal;
|
||||
if (state->Gif89.delayTime < 2) {
|
||||
frame->delay = 100; /* Default animation delay, matching browsers and Qt */
|
||||
} else {
|
||||
frame->delay = state->Gif89.delayTime * 10;
|
||||
}
|
||||
|
||||
if (!load_anim) {
|
||||
/* We only need one frame, we're done */
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
done:
|
||||
if (anim->count > 1) {
|
||||
/* Normalize the frames */
|
||||
if (!NormalizeFrames(anim->frames, anim->count)) {
|
||||
int i;
|
||||
for (i = 0; i < anim->count; ++i) {
|
||||
SDL_FreeSurface(anim->frames[i].image);
|
||||
}
|
||||
anim->count = 0;
|
||||
}
|
||||
}
|
||||
if (anim->count == 0) {
|
||||
SDL_free(anim->frames);
|
||||
SDL_free(anim);
|
||||
anim = NULL;
|
||||
}
|
||||
SDL_free(state);
|
||||
return anim;
|
||||
}
|
||||
|
||||
static int
|
||||
ReadColorMap(SDL_RWops *src, int number,
|
||||
unsigned char buffer[3][MAXCOLORMAPSIZE], int *gray)
|
||||
{
|
||||
int i;
|
||||
unsigned char rgb[3];
|
||||
int flag;
|
||||
|
||||
flag = TRUE;
|
||||
|
||||
for (i = 0; i < number; ++i) {
|
||||
if (!ReadOK(src, rgb, sizeof(rgb))) {
|
||||
RWSetMsg("bad colormap");
|
||||
return 1;
|
||||
}
|
||||
buffer[CM_RED][i] = rgb[0];
|
||||
buffer[CM_GREEN][i] = rgb[1];
|
||||
buffer[CM_BLUE][i] = rgb[2];
|
||||
flag &= (rgb[0] == rgb[1] && rgb[1] == rgb[2]);
|
||||
}
|
||||
|
||||
#if 0
|
||||
if (flag)
|
||||
*gray = (number == 2) ? PBM_TYPE : PGM_TYPE;
|
||||
else
|
||||
*gray = PPM_TYPE;
|
||||
#else
|
||||
*gray = 0;
|
||||
#endif
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static int
|
||||
DoExtension(SDL_RWops *src, int label, State_t * state)
|
||||
{
|
||||
unsigned char buf[256];
|
||||
|
||||
switch (label) {
|
||||
case 0x01: /* Plain Text Extension */
|
||||
break;
|
||||
case 0xff: /* Application Extension */
|
||||
break;
|
||||
case 0xfe: /* Comment Extension */
|
||||
while (GetDataBlock(src, buf, state) > 0)
|
||||
;
|
||||
return FALSE;
|
||||
case 0xf9: /* Graphic Control Extension */
|
||||
(void) GetDataBlock(src, buf, state);
|
||||
state->Gif89.disposal = (buf[0] >> 2) & 0x7;
|
||||
state->Gif89.inputFlag = (buf[0] >> 1) & 0x1;
|
||||
state->Gif89.delayTime = LM_to_uint(buf[1], buf[2]);
|
||||
if ((buf[0] & 0x1) != 0)
|
||||
state->Gif89.transparent = buf[3];
|
||||
|
||||
while (GetDataBlock(src, buf, state) > 0)
|
||||
;
|
||||
return FALSE;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
while (GetDataBlock(src, buf, state) > 0)
|
||||
;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static int
|
||||
GetDataBlock(SDL_RWops *src, unsigned char *buf, State_t * state)
|
||||
{
|
||||
unsigned char count;
|
||||
|
||||
if (!ReadOK(src, &count, 1)) {
|
||||
/* pm_message("error in getting DataBlock size" ); */
|
||||
return -1;
|
||||
}
|
||||
state->ZeroDataBlock = count == 0;
|
||||
|
||||
if ((count != 0) && (!ReadOK(src, buf, count))) {
|
||||
/* pm_message("error in reading DataBlock" ); */
|
||||
return -1;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
static int
|
||||
GetCode(SDL_RWops *src, int code_size, int flag, State_t * state)
|
||||
{
|
||||
int i, j, ret;
|
||||
unsigned char count;
|
||||
|
||||
if (flag) {
|
||||
state->curbit = 0;
|
||||
state->lastbit = 0;
|
||||
state->done = FALSE;
|
||||
return 0;
|
||||
}
|
||||
if ((state->curbit + code_size) >= state->lastbit) {
|
||||
if (state->done) {
|
||||
if (state->curbit >= state->lastbit)
|
||||
RWSetMsg("ran off the end of my bits");
|
||||
return -1;
|
||||
}
|
||||
state->buf[0] = state->buf[state->last_byte - 2];
|
||||
state->buf[1] = state->buf[state->last_byte - 1];
|
||||
|
||||
if ((ret = GetDataBlock(src, &state->buf[2], state)) > 0)
|
||||
count = (unsigned char) ret;
|
||||
else {
|
||||
count = 0;
|
||||
state->done = TRUE;
|
||||
}
|
||||
|
||||
state->last_byte = 2 + count;
|
||||
state->curbit = (state->curbit - state->lastbit) + 16;
|
||||
state->lastbit = (2 + count) * 8;
|
||||
}
|
||||
ret = 0;
|
||||
for (i = state->curbit, j = 0; j < code_size; ++i, ++j)
|
||||
ret |= ((state->buf[i / 8] & (1 << (i % 8))) != 0) << j;
|
||||
|
||||
state->curbit += code_size;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
LWZReadByte(SDL_RWops *src, int flag, int input_code_size, State_t * state)
|
||||
{
|
||||
int i, code, incode;
|
||||
|
||||
/* Fixed buffer overflow found by Michael Skladnikiewicz */
|
||||
if (input_code_size > MAX_LWZ_BITS)
|
||||
return -1;
|
||||
|
||||
if (flag) {
|
||||
state->set_code_size = input_code_size;
|
||||
state->code_size = state->set_code_size + 1;
|
||||
state->clear_code = 1 << state->set_code_size;
|
||||
state->end_code = state->clear_code + 1;
|
||||
state->max_code_size = 2 * state->clear_code;
|
||||
state->max_code = state->clear_code + 2;
|
||||
|
||||
GetCode(src, 0, TRUE, state);
|
||||
|
||||
state->fresh = TRUE;
|
||||
|
||||
for (i = 0; i < state->clear_code; ++i) {
|
||||
state->table[0][i] = 0;
|
||||
state->table[1][i] = i;
|
||||
}
|
||||
state->table[1][0] = 0;
|
||||
for (; i < (1 << MAX_LWZ_BITS); ++i)
|
||||
state->table[0][i] = 0;
|
||||
|
||||
state->sp = state->stack;
|
||||
|
||||
return 0;
|
||||
} else if (state->fresh) {
|
||||
state->fresh = FALSE;
|
||||
do {
|
||||
state->firstcode = state->oldcode = GetCode(src, state->code_size, FALSE, state);
|
||||
} while (state->firstcode == state->clear_code);
|
||||
return state->firstcode;
|
||||
}
|
||||
if (state->sp > state->stack)
|
||||
return *--state->sp;
|
||||
|
||||
while ((code = GetCode(src, state->code_size, FALSE, state)) >= 0) {
|
||||
if (code == state->clear_code) {
|
||||
for (i = 0; i < state->clear_code; ++i) {
|
||||
state->table[0][i] = 0;
|
||||
state->table[1][i] = i;
|
||||
}
|
||||
for (; i < (1 << MAX_LWZ_BITS); ++i)
|
||||
state->table[0][i] = state->table[1][i] = 0;
|
||||
state->code_size = state->set_code_size + 1;
|
||||
state->max_code_size = 2 * state->clear_code;
|
||||
state->max_code = state->clear_code + 2;
|
||||
state->sp = state->stack;
|
||||
state->firstcode = state->oldcode = GetCode(src, state->code_size, FALSE, state);
|
||||
return state->firstcode;
|
||||
} else if (code == state->end_code) {
|
||||
int count;
|
||||
unsigned char buf[260];
|
||||
|
||||
if (state->ZeroDataBlock)
|
||||
return -2;
|
||||
|
||||
while ((count = GetDataBlock(src, buf, state)) > 0)
|
||||
;
|
||||
|
||||
if (count != 0) {
|
||||
/*
|
||||
* pm_message("missing EOD in data stream (common occurence)");
|
||||
*/
|
||||
}
|
||||
return -2;
|
||||
}
|
||||
incode = code;
|
||||
|
||||
if (code >= state->max_code) {
|
||||
*state->sp++ = state->firstcode;
|
||||
code = state->oldcode;
|
||||
}
|
||||
while (code >= state->clear_code) {
|
||||
/* Guard against buffer overruns */
|
||||
if (code < 0 || code >= (1 << MAX_LWZ_BITS)) {
|
||||
RWSetMsg("invalid LWZ data");
|
||||
return -3;
|
||||
}
|
||||
*state->sp++ = state->table[1][code];
|
||||
if (code == state->table[0][code]) {
|
||||
RWSetMsg("circular table entry BIG ERROR");
|
||||
return -3;
|
||||
}
|
||||
code = state->table[0][code];
|
||||
}
|
||||
|
||||
/* Guard against buffer overruns */
|
||||
if (code < 0 || code >= (1 << MAX_LWZ_BITS)) {
|
||||
RWSetMsg("invalid LWZ data");
|
||||
return -4;
|
||||
}
|
||||
*state->sp++ = state->firstcode = state->table[1][code];
|
||||
|
||||
if ((code = state->max_code) < (1 << MAX_LWZ_BITS)) {
|
||||
state->table[0][code] = state->oldcode;
|
||||
state->table[1][code] = state->firstcode;
|
||||
++state->max_code;
|
||||
if ((state->max_code >= state->max_code_size) &&
|
||||
(state->max_code_size < (1 << MAX_LWZ_BITS))) {
|
||||
state->max_code_size *= 2;
|
||||
++state->code_size;
|
||||
}
|
||||
}
|
||||
state->oldcode = incode;
|
||||
|
||||
if (state->sp > state->stack)
|
||||
return *--state->sp;
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
||||
static Image *
|
||||
ReadImage(SDL_RWops * src, int len, int height, int cmapSize,
|
||||
unsigned char cmap[3][MAXCOLORMAPSIZE],
|
||||
int gray, int interlace, int ignore, State_t * state)
|
||||
{
|
||||
Image *image;
|
||||
unsigned char c;
|
||||
int i, v;
|
||||
int xpos = 0, ypos = 0, pass = 0;
|
||||
|
||||
(void) gray; /* unused */
|
||||
|
||||
/*
|
||||
** Initialize the compression routines
|
||||
*/
|
||||
if (!ReadOK(src, &c, 1)) {
|
||||
RWSetMsg("EOF / read error on image data");
|
||||
return NULL;
|
||||
}
|
||||
if (LWZReadByte(src, TRUE, c, state) < 0) {
|
||||
RWSetMsg("error reading image");
|
||||
return NULL;
|
||||
}
|
||||
/*
|
||||
** If this is an "uninteresting picture" ignore it.
|
||||
*/
|
||||
if (ignore) {
|
||||
while (LWZReadByte(src, FALSE, c, state) >= 0)
|
||||
;
|
||||
return NULL;
|
||||
}
|
||||
image = ImageNewCmap(len, height, cmapSize);
|
||||
if (!image) {
|
||||
return NULL;
|
||||
}
|
||||
if (!image->pixels) {
|
||||
SDL_FreeSurface(image);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
for (i = 0; i < cmapSize; i++)
|
||||
ImageSetCmap(image, i, cmap[CM_RED][i],
|
||||
cmap[CM_GREEN][i], cmap[CM_BLUE][i]);
|
||||
|
||||
while ((v = LWZReadByte(src, FALSE, c, state)) >= 0) {
|
||||
((Uint8 *)image->pixels)[xpos + ypos * image->pitch] = (Uint8)v;
|
||||
++xpos;
|
||||
if (xpos == len) {
|
||||
xpos = 0;
|
||||
if (interlace) {
|
||||
switch (pass) {
|
||||
case 0:
|
||||
case 1:
|
||||
ypos += 8;
|
||||
break;
|
||||
case 2:
|
||||
ypos += 4;
|
||||
break;
|
||||
case 3:
|
||||
ypos += 2;
|
||||
break;
|
||||
}
|
||||
|
||||
if (ypos >= height) {
|
||||
++pass;
|
||||
switch (pass) {
|
||||
case 1:
|
||||
ypos = 4;
|
||||
break;
|
||||
case 2:
|
||||
ypos = 2;
|
||||
break;
|
||||
case 3:
|
||||
ypos = 1;
|
||||
break;
|
||||
default:
|
||||
goto fini;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
++ypos;
|
||||
}
|
||||
}
|
||||
if (ypos >= height)
|
||||
break;
|
||||
}
|
||||
|
||||
fini:
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
/* Load a GIF type animation from an SDL datasource */
|
||||
IMG_Animation *IMG_LoadGIFAnimation_RW(SDL_RWops *src)
|
||||
{
|
||||
Anim_t *internal = IMG_LoadGIF_RW_Internal(src, SDL_TRUE);
|
||||
if (internal) {
|
||||
IMG_Animation *anim = (IMG_Animation *)SDL_malloc(sizeof(*anim));
|
||||
if (anim) {
|
||||
anim->w = internal->frames[0].image->w;
|
||||
anim->h = internal->frames[0].image->h;
|
||||
anim->count = internal->count;
|
||||
|
||||
anim->frames = (SDL_Surface **)SDL_calloc(anim->count, sizeof(*anim->frames));
|
||||
anim->delays = (int *)SDL_calloc(anim->count, sizeof(*anim->delays));
|
||||
|
||||
if (anim->frames && anim->delays) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < anim->count; ++i) {
|
||||
anim->frames[i] = internal->frames[i].image;
|
||||
anim->delays[i] = internal->frames[i].delay;
|
||||
}
|
||||
} else {
|
||||
IMG_FreeAnimation(anim);
|
||||
anim = NULL;
|
||||
}
|
||||
}
|
||||
if (!anim) {
|
||||
SDL_OutOfMemory();
|
||||
}
|
||||
SDL_free(internal->frames);
|
||||
SDL_free(internal);
|
||||
return anim;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
/* Load a GIF type animation from an SDL datasource */
|
||||
IMG_Animation *IMG_LoadGIFAnimation_RW(SDL_RWops *src)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif /* LOAD_GIF */
|
||||
|
||||
#if !defined(__APPLE__) || defined(SDL_IMAGE_USE_COMMON_BACKEND)
|
||||
|
||||
#ifdef LOAD_GIF
|
||||
|
||||
/* See if an image is contained in a data source */
|
||||
int IMG_isGIF(SDL_RWops *src)
|
||||
{
|
||||
Sint64 start;
|
||||
int is_GIF;
|
||||
char magic[6];
|
||||
|
||||
if ( !src )
|
||||
return 0;
|
||||
start = SDL_RWtell(src);
|
||||
is_GIF = 0;
|
||||
if ( SDL_RWread(src, magic, sizeof(magic), 1) ) {
|
||||
if ( (SDL_strncmp(magic, "GIF", 3) == 0) &&
|
||||
((SDL_memcmp(magic + 3, "87a", 3) == 0) ||
|
||||
(SDL_memcmp(magic + 3, "89a", 3) == 0)) ) {
|
||||
is_GIF = 1;
|
||||
}
|
||||
}
|
||||
SDL_RWseek(src, start, RW_SEEK_SET);
|
||||
return(is_GIF);
|
||||
}
|
||||
|
||||
/* Load a GIF type image from an SDL datasource */
|
||||
SDL_Surface *IMG_LoadGIF_RW(SDL_RWops *src)
|
||||
{
|
||||
SDL_Surface *image = NULL;
|
||||
Anim_t *internal = IMG_LoadGIF_RW_Internal(src, SDL_FALSE);
|
||||
if (internal) {
|
||||
image = internal->frames[0].image;
|
||||
SDL_free(internal->frames);
|
||||
SDL_free(internal);
|
||||
}
|
||||
return image;
|
||||
}
|
||||
|
||||
#else
|
||||
#if _MSC_VER >= 1300
|
||||
#pragma warning(disable : 4100) /* warning C4100: 'op' : unreferenced formal parameter */
|
||||
#endif
|
||||
|
||||
/* See if an image is contained in a data source */
|
||||
int IMG_isGIF(SDL_RWops *src)
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
||||
/* Load a GIF type image from an SDL datasource */
|
||||
SDL_Surface *IMG_LoadGIF_RW(SDL_RWops *src)
|
||||
{
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
#endif /* LOAD_GIF */
|
||||
|
||||
#endif /* !defined(__APPLE__) || defined(SDL_IMAGE_USE_COMMON_BACKEND) */
|
||||
790
Library/SDL2_image-2.5.2/IMG_jpg.c
Normal file
790
Library/SDL2_image-2.5.2/IMG_jpg.c
Normal file
@@ -0,0 +1,790 @@
|
||||
/*
|
||||
SDL_image: An example image loading library for use with SDL
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
/* This is a JPEG image file loading framework */
|
||||
|
||||
#include "SDL_image.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <setjmp.h>
|
||||
|
||||
|
||||
/* We'll have JPG save support by default */
|
||||
#ifndef SDL_IMAGE_SAVE_JPG
|
||||
#define SDL_IMAGE_SAVE_JPG 1
|
||||
#endif
|
||||
|
||||
#if defined(USE_STBIMAGE)
|
||||
#undef WANT_JPEGLIB
|
||||
#elif defined(SDL_IMAGE_USE_COMMON_BACKEND)
|
||||
#define WANT_JPEGLIB
|
||||
#elif defined(SDL_IMAGE_USE_WIC_BACKEND)
|
||||
#undef WANT_JPEGLIB
|
||||
#elif defined(__APPLE__) && defined(JPG_USES_IMAGEIO)
|
||||
#undef WANT_JPEGLIB
|
||||
#else
|
||||
#define WANT_JPEGLIB
|
||||
#endif
|
||||
|
||||
#ifdef LOAD_JPG
|
||||
|
||||
#ifdef WANT_JPEGLIB
|
||||
|
||||
#define USE_JPEGLIB
|
||||
|
||||
#include <jpeglib.h>
|
||||
|
||||
#ifdef JPEG_TRUE /* MinGW version of jpeg-8.x renamed TRUE to JPEG_TRUE etc. */
|
||||
typedef JPEG_boolean boolean;
|
||||
#define TRUE JPEG_TRUE
|
||||
#define FALSE JPEG_FALSE
|
||||
#endif
|
||||
|
||||
/* Define this for fast loading and not as good image quality */
|
||||
/*#define FAST_JPEG*/
|
||||
|
||||
/* Define this for quicker (but less perfect) JPEG identification */
|
||||
#define FAST_IS_JPEG
|
||||
|
||||
static struct {
|
||||
int loaded;
|
||||
void *handle;
|
||||
void (*jpeg_calc_output_dimensions) (j_decompress_ptr cinfo);
|
||||
void (*jpeg_CreateDecompress) (j_decompress_ptr cinfo, int version, size_t structsize);
|
||||
void (*jpeg_destroy_decompress) (j_decompress_ptr cinfo);
|
||||
boolean (*jpeg_finish_decompress) (j_decompress_ptr cinfo);
|
||||
int (*jpeg_read_header) (j_decompress_ptr cinfo, boolean require_image);
|
||||
JDIMENSION (*jpeg_read_scanlines) (j_decompress_ptr cinfo, JSAMPARRAY scanlines, JDIMENSION max_lines);
|
||||
boolean (*jpeg_resync_to_restart) (j_decompress_ptr cinfo, int desired);
|
||||
boolean (*jpeg_start_decompress) (j_decompress_ptr cinfo);
|
||||
void (*jpeg_CreateCompress) (j_compress_ptr cinfo, int version, size_t structsize);
|
||||
void (*jpeg_start_compress) (j_compress_ptr cinfo, boolean write_all_tables);
|
||||
void (*jpeg_set_quality) (j_compress_ptr cinfo, int quality, boolean force_baseline);
|
||||
void (*jpeg_set_defaults) (j_compress_ptr cinfo);
|
||||
JDIMENSION (*jpeg_write_scanlines) (j_compress_ptr cinfo, JSAMPARRAY scanlines, JDIMENSION num_lines);
|
||||
void (*jpeg_finish_compress) (j_compress_ptr cinfo);
|
||||
void (*jpeg_destroy_compress) (j_compress_ptr cinfo);
|
||||
struct jpeg_error_mgr * (*jpeg_std_error) (struct jpeg_error_mgr * err);
|
||||
} lib;
|
||||
|
||||
#ifdef LOAD_JPG_DYNAMIC
|
||||
#define FUNCTION_LOADER(FUNC, SIG) \
|
||||
lib.FUNC = (SIG) SDL_LoadFunction(lib.handle, #FUNC); \
|
||||
if (lib.FUNC == NULL) { SDL_UnloadObject(lib.handle); return -1; }
|
||||
#else
|
||||
#define FUNCTION_LOADER(FUNC, SIG) \
|
||||
lib.FUNC = FUNC;
|
||||
#endif
|
||||
|
||||
int IMG_InitJPG()
|
||||
{
|
||||
if ( lib.loaded == 0 ) {
|
||||
#ifdef LOAD_JPG_DYNAMIC
|
||||
lib.handle = SDL_LoadObject(LOAD_JPG_DYNAMIC);
|
||||
if ( lib.handle == NULL ) {
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
FUNCTION_LOADER(jpeg_calc_output_dimensions, void (*) (j_decompress_ptr cinfo))
|
||||
FUNCTION_LOADER(jpeg_CreateDecompress, void (*) (j_decompress_ptr cinfo, int version, size_t structsize))
|
||||
FUNCTION_LOADER(jpeg_destroy_decompress, void (*) (j_decompress_ptr cinfo))
|
||||
FUNCTION_LOADER(jpeg_finish_decompress, boolean (*) (j_decompress_ptr cinfo))
|
||||
FUNCTION_LOADER(jpeg_read_header, int (*) (j_decompress_ptr cinfo, boolean require_image))
|
||||
FUNCTION_LOADER(jpeg_read_scanlines, JDIMENSION (*) (j_decompress_ptr cinfo, JSAMPARRAY scanlines, JDIMENSION max_lines))
|
||||
FUNCTION_LOADER(jpeg_resync_to_restart, boolean (*) (j_decompress_ptr cinfo, int desired))
|
||||
FUNCTION_LOADER(jpeg_start_decompress, boolean (*) (j_decompress_ptr cinfo))
|
||||
FUNCTION_LOADER(jpeg_CreateCompress, void (*) (j_compress_ptr cinfo, int version, size_t structsize))
|
||||
FUNCTION_LOADER(jpeg_start_compress, void (*) (j_compress_ptr cinfo, boolean write_all_tables))
|
||||
FUNCTION_LOADER(jpeg_set_quality, void (*) (j_compress_ptr cinfo, int quality, boolean force_baseline))
|
||||
FUNCTION_LOADER(jpeg_set_defaults, void (*) (j_compress_ptr cinfo))
|
||||
FUNCTION_LOADER(jpeg_write_scanlines, JDIMENSION (*) (j_compress_ptr cinfo, JSAMPARRAY scanlines, JDIMENSION num_lines))
|
||||
FUNCTION_LOADER(jpeg_finish_compress, void (*) (j_compress_ptr cinfo))
|
||||
FUNCTION_LOADER(jpeg_destroy_compress, void (*) (j_compress_ptr cinfo))
|
||||
FUNCTION_LOADER(jpeg_std_error, struct jpeg_error_mgr * (*) (struct jpeg_error_mgr * err))
|
||||
}
|
||||
++lib.loaded;
|
||||
|
||||
return 0;
|
||||
}
|
||||
void IMG_QuitJPG()
|
||||
{
|
||||
if ( lib.loaded == 0 ) {
|
||||
return;
|
||||
}
|
||||
if ( lib.loaded == 1 ) {
|
||||
#ifdef LOAD_JPG_DYNAMIC
|
||||
SDL_UnloadObject(lib.handle);
|
||||
#endif
|
||||
}
|
||||
--lib.loaded;
|
||||
}
|
||||
|
||||
/* See if an image is contained in a data source */
|
||||
int IMG_isJPG(SDL_RWops *src)
|
||||
{
|
||||
Sint64 start;
|
||||
int is_JPG;
|
||||
int in_scan;
|
||||
Uint8 magic[4];
|
||||
|
||||
/* This detection code is by Steaphan Greene <stea@cs.binghamton.edu> */
|
||||
/* Blame me, not Sam, if this doesn't work right. */
|
||||
/* And don't forget to report the problem to the the sdl list too! */
|
||||
|
||||
if ( !src )
|
||||
return 0;
|
||||
start = SDL_RWtell(src);
|
||||
is_JPG = 0;
|
||||
in_scan = 0;
|
||||
if ( SDL_RWread(src, magic, 2, 1) ) {
|
||||
if ( (magic[0] == 0xFF) && (magic[1] == 0xD8) ) {
|
||||
is_JPG = 1;
|
||||
while (is_JPG == 1) {
|
||||
if(SDL_RWread(src, magic, 1, 2) != 2) {
|
||||
is_JPG = 0;
|
||||
} else if( (magic[0] != 0xFF) && (in_scan == 0) ) {
|
||||
is_JPG = 0;
|
||||
} else if( (magic[0] != 0xFF) || (magic[1] == 0xFF) ) {
|
||||
/* Extra padding in JPEG (legal) */
|
||||
/* or this is data and we are scanning */
|
||||
SDL_RWseek(src, -1, RW_SEEK_CUR);
|
||||
} else if(magic[1] == 0xD9) {
|
||||
/* Got to end of good JPEG */
|
||||
break;
|
||||
} else if( (in_scan == 1) && (magic[1] == 0x00) ) {
|
||||
/* This is an encoded 0xFF within the data */
|
||||
} else if( (magic[1] >= 0xD0) && (magic[1] < 0xD9) ) {
|
||||
/* These have nothing else */
|
||||
} else if(SDL_RWread(src, magic+2, 1, 2) != 2) {
|
||||
is_JPG = 0;
|
||||
} else {
|
||||
/* Yes, it's big-endian */
|
||||
Sint64 innerStart;
|
||||
Uint32 size;
|
||||
Sint64 end;
|
||||
innerStart = SDL_RWtell(src);
|
||||
size = (magic[2] << 8) + magic[3];
|
||||
end = SDL_RWseek(src, size-2, RW_SEEK_CUR);
|
||||
if ( end != innerStart + size - 2 ) is_JPG = 0;
|
||||
if ( magic[1] == 0xDA ) {
|
||||
/* Now comes the actual JPEG meat */
|
||||
#ifdef FAST_IS_JPEG
|
||||
/* Ok, I'm convinced. It is a JPEG. */
|
||||
break;
|
||||
#else
|
||||
/* I'm not convinced. Prove it! */
|
||||
in_scan = 1;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
SDL_RWseek(src, start, RW_SEEK_SET);
|
||||
return(is_JPG);
|
||||
}
|
||||
|
||||
#define INPUT_BUFFER_SIZE 4096
|
||||
typedef struct {
|
||||
struct jpeg_source_mgr pub;
|
||||
|
||||
SDL_RWops *ctx;
|
||||
Uint8 buffer[INPUT_BUFFER_SIZE];
|
||||
} my_source_mgr;
|
||||
|
||||
/*
|
||||
* Initialize source --- called by jpeg_read_header
|
||||
* before any data is actually read.
|
||||
*/
|
||||
static void init_source (j_decompress_ptr cinfo)
|
||||
{
|
||||
/* We don't actually need to do anything */
|
||||
(void)cinfo;
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Fill the input buffer --- called whenever buffer is emptied.
|
||||
*/
|
||||
static boolean fill_input_buffer (j_decompress_ptr cinfo)
|
||||
{
|
||||
my_source_mgr * src = (my_source_mgr *) cinfo->src;
|
||||
int nbytes;
|
||||
|
||||
nbytes = (int)SDL_RWread(src->ctx, src->buffer, 1, INPUT_BUFFER_SIZE);
|
||||
if (nbytes <= 0) {
|
||||
/* Insert a fake EOI marker */
|
||||
src->buffer[0] = (Uint8) 0xFF;
|
||||
src->buffer[1] = (Uint8) JPEG_EOI;
|
||||
nbytes = 2;
|
||||
}
|
||||
src->pub.next_input_byte = src->buffer;
|
||||
src->pub.bytes_in_buffer = nbytes;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Skip data --- used to skip over a potentially large amount of
|
||||
* uninteresting data (such as an APPn marker).
|
||||
*
|
||||
* Writers of suspendable-input applications must note that skip_input_data
|
||||
* is not granted the right to give a suspension return. If the skip extends
|
||||
* beyond the data currently in the buffer, the buffer can be marked empty so
|
||||
* that the next read will cause a fill_input_buffer call that can suspend.
|
||||
* Arranging for additional bytes to be discarded before reloading the input
|
||||
* buffer is the application writer's problem.
|
||||
*/
|
||||
static void skip_input_data (j_decompress_ptr cinfo, long num_bytes)
|
||||
{
|
||||
my_source_mgr * src = (my_source_mgr *) cinfo->src;
|
||||
|
||||
/* Just a dumb implementation for now. Could use fseek() except
|
||||
* it doesn't work on pipes. Not clear that being smart is worth
|
||||
* any trouble anyway --- large skips are infrequent.
|
||||
*/
|
||||
if (num_bytes > 0) {
|
||||
while (num_bytes > (long) src->pub.bytes_in_buffer) {
|
||||
num_bytes -= (long) src->pub.bytes_in_buffer;
|
||||
(void) src->pub.fill_input_buffer(cinfo);
|
||||
/* note we assume that fill_input_buffer will never
|
||||
* return FALSE, so suspension need not be handled.
|
||||
*/
|
||||
}
|
||||
src->pub.next_input_byte += (size_t) num_bytes;
|
||||
src->pub.bytes_in_buffer -= (size_t) num_bytes;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Terminate source --- called by jpeg_finish_decompress
|
||||
* after all data has been read.
|
||||
*/
|
||||
static void term_source (j_decompress_ptr cinfo)
|
||||
{
|
||||
/* We don't actually need to do anything */
|
||||
(void)cinfo;
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Prepare for input from a stdio stream.
|
||||
* The caller must have already opened the stream, and is responsible
|
||||
* for closing it after finishing decompression.
|
||||
*/
|
||||
static void jpeg_SDL_RW_src (j_decompress_ptr cinfo, SDL_RWops *ctx)
|
||||
{
|
||||
my_source_mgr *src;
|
||||
|
||||
/* The source object and input buffer are made permanent so that a series
|
||||
* of JPEG images can be read from the same file by calling jpeg_stdio_src
|
||||
* only before the first one. (If we discarded the buffer at the end of
|
||||
* one image, we'd likely lose the start of the next one.)
|
||||
* This makes it unsafe to use this manager and a different source
|
||||
* manager serially with the same JPEG object. Caveat programmer.
|
||||
*/
|
||||
if (cinfo->src == NULL) { /* first time for this JPEG object? */
|
||||
cinfo->src = (struct jpeg_source_mgr *)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
|
||||
sizeof(my_source_mgr));
|
||||
src = (my_source_mgr *) cinfo->src;
|
||||
}
|
||||
|
||||
src = (my_source_mgr *) cinfo->src;
|
||||
src->pub.init_source = init_source;
|
||||
src->pub.fill_input_buffer = fill_input_buffer;
|
||||
src->pub.skip_input_data = skip_input_data;
|
||||
src->pub.resync_to_restart = lib.jpeg_resync_to_restart; /* use default method */
|
||||
src->pub.term_source = term_source;
|
||||
src->ctx = ctx;
|
||||
src->pub.bytes_in_buffer = 0; /* forces fill_input_buffer on first read */
|
||||
src->pub.next_input_byte = NULL; /* until buffer loaded */
|
||||
}
|
||||
|
||||
struct my_error_mgr {
|
||||
struct jpeg_error_mgr errmgr;
|
||||
jmp_buf escape;
|
||||
};
|
||||
|
||||
static void my_error_exit(j_common_ptr cinfo)
|
||||
{
|
||||
struct my_error_mgr *err = (struct my_error_mgr *)cinfo->err;
|
||||
longjmp(err->escape, 1);
|
||||
}
|
||||
|
||||
static void output_no_message(j_common_ptr cinfo)
|
||||
{
|
||||
/* do nothing */
|
||||
(void)cinfo;
|
||||
}
|
||||
|
||||
/* Load a JPEG type image from an SDL datasource */
|
||||
SDL_Surface *IMG_LoadJPG_RW(SDL_RWops *src)
|
||||
{
|
||||
Sint64 start;
|
||||
struct jpeg_decompress_struct cinfo;
|
||||
JSAMPROW rowptr[1];
|
||||
SDL_Surface *volatile surface = NULL;
|
||||
struct my_error_mgr jerr;
|
||||
|
||||
if ( !src ) {
|
||||
/* The error message has been set in SDL_RWFromFile */
|
||||
return NULL;
|
||||
}
|
||||
start = SDL_RWtell(src);
|
||||
|
||||
if ( (IMG_Init(IMG_INIT_JPG) & IMG_INIT_JPG) == 0 ) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Create a decompression structure and load the JPEG header */
|
||||
cinfo.err = lib.jpeg_std_error(&jerr.errmgr);
|
||||
jerr.errmgr.error_exit = my_error_exit;
|
||||
jerr.errmgr.output_message = output_no_message;
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable:4611) /* warning C4611: interaction between '_setjmp' and C++ object destruction is non-portable */
|
||||
#endif
|
||||
if(setjmp(jerr.escape)) {
|
||||
/* If we get here, libjpeg found an error */
|
||||
lib.jpeg_destroy_decompress(&cinfo);
|
||||
if ( surface != NULL ) {
|
||||
SDL_FreeSurface(surface);
|
||||
}
|
||||
SDL_RWseek(src, start, RW_SEEK_SET);
|
||||
IMG_SetError("JPEG loading error");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
lib.jpeg_create_decompress(&cinfo);
|
||||
jpeg_SDL_RW_src(&cinfo, src);
|
||||
lib.jpeg_read_header(&cinfo, TRUE);
|
||||
|
||||
if(cinfo.num_components == 4) {
|
||||
/* Set 32-bit Raw output */
|
||||
cinfo.out_color_space = JCS_CMYK;
|
||||
cinfo.quantize_colors = FALSE;
|
||||
lib.jpeg_calc_output_dimensions(&cinfo);
|
||||
|
||||
/* Allocate an output surface to hold the image */
|
||||
surface = SDL_CreateRGBSurface(SDL_SWSURFACE,
|
||||
cinfo.output_width, cinfo.output_height, 32,
|
||||
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
|
||||
0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000);
|
||||
#else
|
||||
0x0000FF00, 0x00FF0000, 0xFF000000, 0x000000FF);
|
||||
#endif
|
||||
} else {
|
||||
/* Set 24-bit RGB output */
|
||||
cinfo.out_color_space = JCS_RGB;
|
||||
cinfo.quantize_colors = FALSE;
|
||||
#ifdef FAST_JPEG
|
||||
cinfo.scale_num = 1;
|
||||
cinfo.scale_denom = 1;
|
||||
cinfo.dct_method = JDCT_FASTEST;
|
||||
cinfo.do_fancy_upsampling = FALSE;
|
||||
#endif
|
||||
lib.jpeg_calc_output_dimensions(&cinfo);
|
||||
|
||||
/* Allocate an output surface to hold the image */
|
||||
surface = SDL_CreateRGBSurface(SDL_SWSURFACE,
|
||||
cinfo.output_width, cinfo.output_height, 24,
|
||||
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
|
||||
0x0000FF, 0x00FF00, 0xFF0000,
|
||||
#else
|
||||
0xFF0000, 0x00FF00, 0x0000FF,
|
||||
#endif
|
||||
0);
|
||||
}
|
||||
|
||||
if ( surface == NULL ) {
|
||||
lib.jpeg_destroy_decompress(&cinfo);
|
||||
SDL_RWseek(src, start, RW_SEEK_SET);
|
||||
IMG_SetError("Out of memory");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Decompress the image */
|
||||
lib.jpeg_start_decompress(&cinfo);
|
||||
while ( cinfo.output_scanline < cinfo.output_height ) {
|
||||
rowptr[0] = (JSAMPROW)(Uint8 *)surface->pixels +
|
||||
cinfo.output_scanline * surface->pitch;
|
||||
lib.jpeg_read_scanlines(&cinfo, rowptr, (JDIMENSION) 1);
|
||||
}
|
||||
lib.jpeg_finish_decompress(&cinfo);
|
||||
lib.jpeg_destroy_decompress(&cinfo);
|
||||
|
||||
return(surface);
|
||||
}
|
||||
|
||||
#define OUTPUT_BUFFER_SIZE 4096
|
||||
typedef struct {
|
||||
struct jpeg_destination_mgr pub;
|
||||
|
||||
SDL_RWops *ctx;
|
||||
Uint8 buffer[OUTPUT_BUFFER_SIZE];
|
||||
} my_destination_mgr;
|
||||
|
||||
static void init_destination(j_compress_ptr cinfo)
|
||||
{
|
||||
/* We don't actually need to do anything */
|
||||
(void)cinfo;
|
||||
return;
|
||||
}
|
||||
|
||||
static boolean empty_output_buffer(j_compress_ptr cinfo)
|
||||
{
|
||||
my_destination_mgr * dest = (my_destination_mgr *)cinfo->dest;
|
||||
|
||||
/* In typical applications, it should write out the *entire* buffer */
|
||||
SDL_RWwrite(dest->ctx, dest->buffer, 1, OUTPUT_BUFFER_SIZE);
|
||||
dest->pub.next_output_byte = dest->buffer;
|
||||
dest->pub.free_in_buffer = OUTPUT_BUFFER_SIZE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void term_destination(j_compress_ptr cinfo)
|
||||
{
|
||||
my_destination_mgr * dest = (my_destination_mgr *)cinfo->dest;
|
||||
|
||||
/* In most applications, this must flush any data remaining in the buffer */
|
||||
SDL_RWwrite(dest->ctx, dest->buffer, 1, OUTPUT_BUFFER_SIZE - dest->pub.free_in_buffer);
|
||||
}
|
||||
|
||||
static void jpeg_SDL_RW_dest(j_compress_ptr cinfo, SDL_RWops *ctx)
|
||||
{
|
||||
my_destination_mgr *dest;
|
||||
|
||||
if (cinfo->dest == NULL) {
|
||||
cinfo->dest = (struct jpeg_destination_mgr *)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
|
||||
sizeof(my_destination_mgr));
|
||||
dest = (my_destination_mgr *)cinfo->dest;
|
||||
}
|
||||
|
||||
dest = (my_destination_mgr *)cinfo->dest;
|
||||
dest->pub.init_destination = init_destination;
|
||||
dest->pub.empty_output_buffer = empty_output_buffer;
|
||||
dest->pub.term_destination = term_destination;
|
||||
dest->ctx = ctx;
|
||||
dest->pub.next_output_byte = dest->buffer;
|
||||
dest->pub.free_in_buffer = OUTPUT_BUFFER_SIZE;
|
||||
}
|
||||
|
||||
static int IMG_SaveJPG_RW_jpeglib(SDL_Surface *surface, SDL_RWops *dst, int freedst, int quality)
|
||||
{
|
||||
/* The JPEG library reads bytes in R,G,B order, so this is the right
|
||||
* encoding for either endianness */
|
||||
static const Uint32 jpg_format = SDL_PIXELFORMAT_RGB24;
|
||||
struct jpeg_compress_struct cinfo;
|
||||
struct my_error_mgr jerr;
|
||||
JSAMPROW row_pointer[1];
|
||||
SDL_Surface* jpeg_surface = surface;
|
||||
int result = -1;
|
||||
|
||||
if (!dst) {
|
||||
IMG_SetError("Passed NULL dst");
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (!IMG_Init(IMG_INIT_JPG)) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Convert surface to format we can save */
|
||||
if (surface->format->format != jpg_format) {
|
||||
jpeg_surface = SDL_ConvertSurfaceFormat(surface, jpg_format, 0);
|
||||
if (!jpeg_surface) {
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
/* Create a decompression structure and load the JPEG header */
|
||||
cinfo.err = lib.jpeg_std_error(&jerr.errmgr);
|
||||
jerr.errmgr.error_exit = my_error_exit;
|
||||
jerr.errmgr.output_message = output_no_message;
|
||||
|
||||
lib.jpeg_create_compress(&cinfo);
|
||||
jpeg_SDL_RW_dest(&cinfo, dst);
|
||||
|
||||
cinfo.image_width = jpeg_surface->w;
|
||||
cinfo.image_height = jpeg_surface->h;
|
||||
cinfo.in_color_space = JCS_RGB;
|
||||
cinfo.input_components = 3;
|
||||
|
||||
lib.jpeg_set_defaults(&cinfo);
|
||||
lib.jpeg_set_quality(&cinfo, quality, TRUE);
|
||||
lib.jpeg_start_compress(&cinfo, TRUE);
|
||||
|
||||
while (cinfo.next_scanline < cinfo.image_height) {
|
||||
int offset = cinfo.next_scanline * jpeg_surface->pitch;
|
||||
row_pointer[0] = ((Uint8*)jpeg_surface->pixels) + offset;
|
||||
lib.jpeg_write_scanlines(&cinfo, row_pointer, 1);
|
||||
}
|
||||
|
||||
lib.jpeg_finish_compress(&cinfo);
|
||||
lib.jpeg_destroy_compress(&cinfo);
|
||||
|
||||
if (jpeg_surface != surface) {
|
||||
SDL_FreeSurface(jpeg_surface);
|
||||
}
|
||||
|
||||
result = 0;
|
||||
|
||||
done:
|
||||
if (freedst) {
|
||||
SDL_RWclose(dst);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
#elif defined(USE_STBIMAGE)
|
||||
|
||||
extern SDL_Surface *IMG_LoadSTB_RW(SDL_RWops *src);
|
||||
|
||||
int IMG_InitJPG()
|
||||
{
|
||||
/* Nothing to load */
|
||||
return 0;
|
||||
}
|
||||
|
||||
void IMG_QuitJPG()
|
||||
{
|
||||
/* Nothing to unload */
|
||||
}
|
||||
|
||||
/* FIXME: This is a copypaste from JPEGLIB! Pull that out of the ifdefs */
|
||||
/* Define this for quicker (but less perfect) JPEG identification */
|
||||
#define FAST_IS_JPEG
|
||||
/* See if an image is contained in a data source */
|
||||
int IMG_isJPG(SDL_RWops *src)
|
||||
{
|
||||
Sint64 start;
|
||||
int is_JPG;
|
||||
int in_scan;
|
||||
Uint8 magic[4];
|
||||
|
||||
/* This detection code is by Steaphan Greene <stea@cs.binghamton.edu> */
|
||||
/* Blame me, not Sam, if this doesn't work right. */
|
||||
/* And don't forget to report the problem to the the sdl list too! */
|
||||
|
||||
if ( !src )
|
||||
return 0;
|
||||
start = SDL_RWtell(src);
|
||||
is_JPG = 0;
|
||||
in_scan = 0;
|
||||
if ( SDL_RWread(src, magic, 2, 1) ) {
|
||||
if ( (magic[0] == 0xFF) && (magic[1] == 0xD8) ) {
|
||||
is_JPG = 1;
|
||||
while (is_JPG == 1) {
|
||||
if(SDL_RWread(src, magic, 1, 2) != 2) {
|
||||
is_JPG = 0;
|
||||
} else if( (magic[0] != 0xFF) && (in_scan == 0) ) {
|
||||
is_JPG = 0;
|
||||
} else if( (magic[0] != 0xFF) || (magic[1] == 0xFF) ) {
|
||||
/* Extra padding in JPEG (legal) */
|
||||
/* or this is data and we are scanning */
|
||||
SDL_RWseek(src, -1, RW_SEEK_CUR);
|
||||
} else if(magic[1] == 0xD9) {
|
||||
/* Got to end of good JPEG */
|
||||
break;
|
||||
} else if( (in_scan == 1) && (magic[1] == 0x00) ) {
|
||||
/* This is an encoded 0xFF within the data */
|
||||
} else if( (magic[1] >= 0xD0) && (magic[1] < 0xD9) ) {
|
||||
/* These have nothing else */
|
||||
} else if(SDL_RWread(src, magic+2, 1, 2) != 2) {
|
||||
is_JPG = 0;
|
||||
} else {
|
||||
/* Yes, it's big-endian */
|
||||
Sint64 innerStart;
|
||||
Uint32 size;
|
||||
Sint64 end;
|
||||
innerStart = SDL_RWtell(src);
|
||||
size = (magic[2] << 8) + magic[3];
|
||||
end = SDL_RWseek(src, size-2, RW_SEEK_CUR);
|
||||
if ( end != innerStart + size - 2 ) is_JPG = 0;
|
||||
if ( magic[1] == 0xDA ) {
|
||||
/* Now comes the actual JPEG meat */
|
||||
#ifdef FAST_IS_JPEG
|
||||
/* Ok, I'm convinced. It is a JPEG. */
|
||||
break;
|
||||
#else
|
||||
/* I'm not convinced. Prove it! */
|
||||
in_scan = 1;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
SDL_RWseek(src, start, RW_SEEK_SET);
|
||||
return(is_JPG);
|
||||
}
|
||||
|
||||
/* Load a JPEG type image from an SDL datasource */
|
||||
SDL_Surface *IMG_LoadJPG_RW(SDL_RWops *src)
|
||||
{
|
||||
return IMG_LoadSTB_RW(src);
|
||||
}
|
||||
|
||||
#endif /* WANT_JPEGLIB */
|
||||
|
||||
#else
|
||||
#if _MSC_VER >= 1300
|
||||
#pragma warning(disable : 4100) /* warning C4100: 'op' : unreferenced formal parameter */
|
||||
#endif
|
||||
|
||||
int IMG_InitJPG()
|
||||
{
|
||||
IMG_SetError("JPEG images are not supported");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
void IMG_QuitJPG()
|
||||
{
|
||||
}
|
||||
|
||||
/* See if an image is contained in a data source */
|
||||
int IMG_isJPG(SDL_RWops *src)
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
||||
/* Load a JPEG type image from an SDL datasource */
|
||||
SDL_Surface *IMG_LoadJPG_RW(SDL_RWops *src)
|
||||
{
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
#endif /* LOAD_JPG */
|
||||
|
||||
/* Use tinyjpeg as a fallback if we don't have a hard dependency on libjpeg */
|
||||
#if SDL_IMAGE_SAVE_JPG && (defined(LOAD_JPG_DYNAMIC) || !defined(WANT_JPEGLIB))
|
||||
|
||||
#define assert SDL_assert
|
||||
#undef memcpy
|
||||
#define memcpy SDL_memcpy
|
||||
#undef memset
|
||||
#define memset SDL_memset
|
||||
|
||||
#define ceilf SDL_ceilf
|
||||
#define floorf SDL_floorf
|
||||
#define cosf SDL_cosf
|
||||
|
||||
#define tje_log SDL_Log
|
||||
#define TJE_IMPLEMENTATION
|
||||
#include "tiny_jpeg.h"
|
||||
|
||||
static void IMG_SaveJPG_RW_tinyjpeg_callback(void* context, void* data, int size)
|
||||
{
|
||||
SDL_RWwrite((SDL_RWops*) context, data, 1, size);
|
||||
}
|
||||
|
||||
static int IMG_SaveJPG_RW_tinyjpeg(SDL_Surface *surface, SDL_RWops *dst, int freedst, int quality)
|
||||
{
|
||||
/* The JPEG library reads bytes in R,G,B order, so this is the right
|
||||
* encoding for either endianness */
|
||||
static const Uint32 jpg_format = SDL_PIXELFORMAT_RGB24;
|
||||
SDL_Surface* jpeg_surface = surface;
|
||||
int result = -1;
|
||||
|
||||
if (!dst) {
|
||||
SDL_SetError("Passed NULL dst");
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Convert surface to format we can save */
|
||||
if (surface->format->format != jpg_format) {
|
||||
jpeg_surface = SDL_ConvertSurfaceFormat(surface, jpg_format, 0);
|
||||
if (!jpeg_surface) {
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
/* Quality for tinyjpeg is from 1-3:
|
||||
* 0 - 33 - Lowest quality
|
||||
* 34 - 66 - Middle quality
|
||||
* 67 - 100 - Highest quality
|
||||
*/
|
||||
if (quality < 34) quality = 1;
|
||||
else if (quality < 67) quality = 2;
|
||||
else quality = 3;
|
||||
|
||||
result = tje_encode_with_func(
|
||||
IMG_SaveJPG_RW_tinyjpeg_callback,
|
||||
dst,
|
||||
quality,
|
||||
jpeg_surface->w,
|
||||
jpeg_surface->h,
|
||||
3,
|
||||
jpeg_surface->pixels,
|
||||
jpeg_surface->pitch
|
||||
) - 1; /* tinyjpeg returns 0 on error, 1 on success */
|
||||
|
||||
if (jpeg_surface != surface) {
|
||||
SDL_FreeSurface(jpeg_surface);
|
||||
}
|
||||
|
||||
if (result < 0) {
|
||||
SDL_SetError("tinyjpeg error");
|
||||
}
|
||||
|
||||
done:
|
||||
if (freedst) {
|
||||
SDL_RWclose(dst);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
#endif /* SDL_IMAGE_SAVE_JPG && (defined(LOAD_JPG_DYNAMIC) || !defined(WANT_JPEGLIB)) */
|
||||
|
||||
int IMG_SaveJPG(SDL_Surface *surface, const char *file, int quality)
|
||||
{
|
||||
SDL_RWops *dst = SDL_RWFromFile(file, "wb");
|
||||
if (dst) {
|
||||
return IMG_SaveJPG_RW(surface, dst, 1, quality);
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
int IMG_SaveJPG_RW(SDL_Surface *surface, SDL_RWops *dst, int freedst, int quality)
|
||||
{
|
||||
#if SDL_IMAGE_SAVE_JPG
|
||||
#ifdef USE_JPEGLIB
|
||||
if ((IMG_Init(IMG_INIT_JPG) & IMG_INIT_JPG) != 0) {
|
||||
if (IMG_SaveJPG_RW_jpeglib(surface, dst, freedst, quality) == 0) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(LOAD_JPG_DYNAMIC) || !defined(WANT_JPEGLIB)
|
||||
return IMG_SaveJPG_RW_tinyjpeg(surface, dst, freedst, quality);
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
#else
|
||||
return IMG_SetError("SDL_image built without JPEG save support");
|
||||
#endif
|
||||
}
|
||||
269
Library/SDL2_image-2.5.2/IMG_jxl.c
Normal file
269
Library/SDL2_image-2.5.2/IMG_jxl.c
Normal file
@@ -0,0 +1,269 @@
|
||||
/*
|
||||
SDL_image: An example image loading library for use with SDL
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
/* This is a JXL image file loading framework */
|
||||
|
||||
#include "SDL_image.h"
|
||||
|
||||
#ifdef LOAD_JXL
|
||||
|
||||
#include <jxl/decode.h>
|
||||
|
||||
|
||||
static struct {
|
||||
int loaded;
|
||||
void *handle;
|
||||
JxlDecoder* (*JxlDecoderCreate)(const JxlMemoryManager* memory_manager);
|
||||
JxlDecoderStatus (*JxlDecoderSubscribeEvents)(JxlDecoder* dec, int events_wanted);
|
||||
JxlDecoderStatus (*JxlDecoderSetInput)(JxlDecoder* dec, const uint8_t* data, size_t size);
|
||||
JxlDecoderStatus (*JxlDecoderProcessInput)(JxlDecoder* dec);
|
||||
JxlDecoderStatus (*JxlDecoderGetBasicInfo)(const JxlDecoder* dec, JxlBasicInfo* info);
|
||||
JxlDecoderStatus (*JxlDecoderImageOutBufferSize)(const JxlDecoder* dec, const JxlPixelFormat* format, size_t* size);
|
||||
JxlDecoderStatus (*JxlDecoderSetImageOutBuffer)(JxlDecoder* dec, const JxlPixelFormat* format, void* buffer, size_t size);
|
||||
void (*JxlDecoderDestroy)(JxlDecoder* dec);
|
||||
} lib;
|
||||
|
||||
#ifdef LOAD_JXL_DYNAMIC
|
||||
#define FUNCTION_LOADER(FUNC, SIG) \
|
||||
lib.FUNC = (SIG) SDL_LoadFunction(lib.handle, #FUNC); \
|
||||
if (lib.FUNC == NULL) { SDL_UnloadObject(lib.handle); return -1; }
|
||||
#else
|
||||
#define FUNCTION_LOADER(FUNC, SIG) \
|
||||
lib.FUNC = FUNC; \
|
||||
if (lib.FUNC == NULL) { IMG_SetError("Missing jxl.framework"); return -1; }
|
||||
#endif
|
||||
|
||||
int IMG_InitJXL()
|
||||
{
|
||||
if ( lib.loaded == 0 ) {
|
||||
#ifdef LOAD_JXL_DYNAMIC
|
||||
lib.handle = SDL_LoadObject(LOAD_JXL_DYNAMIC);
|
||||
if ( lib.handle == NULL ) {
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
FUNCTION_LOADER(JxlDecoderCreate, JxlDecoder* (*)(const JxlMemoryManager* memory_manager))
|
||||
FUNCTION_LOADER(JxlDecoderSubscribeEvents, JxlDecoderStatus (*)(JxlDecoder* dec, int events_wanted))
|
||||
FUNCTION_LOADER(JxlDecoderSetInput, JxlDecoderStatus (*)(JxlDecoder* dec, const uint8_t* data, size_t size))
|
||||
FUNCTION_LOADER(JxlDecoderProcessInput, JxlDecoderStatus (*)(JxlDecoder* dec))
|
||||
FUNCTION_LOADER(JxlDecoderGetBasicInfo, JxlDecoderStatus (*)(const JxlDecoder* dec, JxlBasicInfo* info))
|
||||
FUNCTION_LOADER(JxlDecoderImageOutBufferSize, JxlDecoderStatus (*)(const JxlDecoder* dec, const JxlPixelFormat* format, size_t* size))
|
||||
FUNCTION_LOADER(JxlDecoderSetImageOutBuffer, JxlDecoderStatus (*)(JxlDecoder* dec, const JxlPixelFormat* format, void* buffer, size_t size))
|
||||
FUNCTION_LOADER(JxlDecoderDestroy, void (*)(JxlDecoder* dec))
|
||||
}
|
||||
++lib.loaded;
|
||||
|
||||
return 0;
|
||||
}
|
||||
void IMG_QuitJXL()
|
||||
{
|
||||
if ( lib.loaded == 0 ) {
|
||||
return;
|
||||
}
|
||||
if ( lib.loaded == 1 ) {
|
||||
#ifdef LOAD_JXL_DYNAMIC
|
||||
SDL_UnloadObject(lib.handle);
|
||||
#endif
|
||||
}
|
||||
--lib.loaded;
|
||||
}
|
||||
|
||||
/* See if an image is contained in a data source */
|
||||
int IMG_isJXL(SDL_RWops *src)
|
||||
{
|
||||
Sint64 start;
|
||||
int is_JXL;
|
||||
Uint8 magic[12];
|
||||
|
||||
if ( !src )
|
||||
return 0;
|
||||
start = SDL_RWtell(src);
|
||||
is_JXL = 0;
|
||||
if ( SDL_RWread(src, magic, 2, 1) ) {
|
||||
if ( magic[0] == 0xFF && magic[1] == 0x0A ) {
|
||||
/* This is a JXL codestream */
|
||||
is_JXL = 1;
|
||||
} else {
|
||||
if ( SDL_RWread(src, &magic[2], sizeof(magic) - 2, 1) ) {
|
||||
if ( magic[0] == 0x00 && magic[1] == 0x00 &&
|
||||
magic[2] == 0x00 && magic[3] == 0x0C &&
|
||||
magic[4] == 'J' && magic[5] == 'X' &&
|
||||
magic[6] == 'L' && magic[7] == ' ' &&
|
||||
magic[8] == 0x0D && magic[9] == 0x0A &&
|
||||
magic[10] == 0x87 && magic[11] == 0x0A ) {
|
||||
/* This is a JXL container */
|
||||
is_JXL = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
SDL_RWseek(src, start, RW_SEEK_SET);
|
||||
return(is_JXL);
|
||||
}
|
||||
|
||||
/* Load a JXL type image from an SDL datasource */
|
||||
SDL_Surface *IMG_LoadJXL_RW(SDL_RWops *src)
|
||||
{
|
||||
Sint64 start;
|
||||
unsigned char *data;
|
||||
size_t datasize;
|
||||
JxlDecoder *decoder = NULL;
|
||||
JxlBasicInfo info;
|
||||
JxlPixelFormat format = { 4, JXL_TYPE_UINT8, JXL_NATIVE_ENDIAN, 0 };
|
||||
size_t outputsize;
|
||||
void *pixels = NULL;
|
||||
int pitch = 0;
|
||||
SDL_Surface *surface = NULL;
|
||||
|
||||
if (!src) {
|
||||
/* The error message has been set in SDL_RWFromFile */
|
||||
return NULL;
|
||||
}
|
||||
start = SDL_RWtell(src);
|
||||
|
||||
if ((IMG_Init(IMG_INIT_JXL) & IMG_INIT_JXL) == 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
data = (unsigned char *)SDL_LoadFile_RW(src, &datasize, SDL_FALSE);
|
||||
if (!data) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
decoder = lib.JxlDecoderCreate(NULL);
|
||||
if (!decoder) {
|
||||
IMG_SetError("Couldn't create JXL decoder");
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (lib.JxlDecoderSubscribeEvents(decoder, JXL_DEC_BASIC_INFO | JXL_DEC_FULL_IMAGE) != JXL_DEC_SUCCESS) {
|
||||
IMG_SetError("Couldn't subscribe to JXL events");
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (lib.JxlDecoderSetInput(decoder, data, datasize) != JXL_DEC_SUCCESS) {
|
||||
IMG_SetError("Couldn't set JXL input");
|
||||
goto done;
|
||||
}
|
||||
|
||||
SDL_zero(info);
|
||||
|
||||
for ( ; ; ) {
|
||||
JxlDecoderStatus status = lib.JxlDecoderProcessInput(decoder);
|
||||
|
||||
switch (status ) {
|
||||
case JXL_DEC_ERROR:
|
||||
IMG_SetError("JXL decoder error");
|
||||
goto done;
|
||||
case JXL_DEC_NEED_MORE_INPUT:
|
||||
IMG_SetError("Incomplete JXL image");
|
||||
goto done;
|
||||
case JXL_DEC_BASIC_INFO:
|
||||
if (lib.JxlDecoderGetBasicInfo(decoder, &info) != JXL_DEC_SUCCESS) {
|
||||
IMG_SetError("Couldn't get JXL image info");
|
||||
goto done;
|
||||
}
|
||||
break;
|
||||
case JXL_DEC_NEED_IMAGE_OUT_BUFFER:
|
||||
if (lib.JxlDecoderImageOutBufferSize(decoder, &format, &outputsize) != JXL_DEC_SUCCESS) {
|
||||
IMG_SetError("Couldn't get JXL image size");
|
||||
goto done;
|
||||
}
|
||||
if (info.xsize == 0 || info.ysize == 0) {
|
||||
IMG_SetError("Couldn't get pixels for %dx%d JXL image", info.xsize, info.ysize);
|
||||
goto done;
|
||||
}
|
||||
if (pixels) {
|
||||
SDL_free(pixels);
|
||||
}
|
||||
pixels = SDL_malloc(outputsize);
|
||||
if (!pixels) {
|
||||
SDL_OutOfMemory();
|
||||
goto done;
|
||||
}
|
||||
pitch = outputsize / info.ysize;
|
||||
if (lib.JxlDecoderSetImageOutBuffer(decoder, &format, pixels, outputsize) != JXL_DEC_SUCCESS) {
|
||||
IMG_SetError("Couldn't set JXL output buffer");
|
||||
goto done;
|
||||
}
|
||||
break;
|
||||
case JXL_DEC_FULL_IMAGE:
|
||||
/* We have a full image - in the case of an animation, keep decoding until the last frame */
|
||||
break;
|
||||
case JXL_DEC_SUCCESS:
|
||||
/* All done! */
|
||||
surface = SDL_CreateRGBSurfaceWithFormatFrom(pixels, info.xsize, info.ysize, 0, pitch, SDL_PIXELFORMAT_RGBA32);
|
||||
if (surface) {
|
||||
/* Let SDL manage the memory now */
|
||||
pixels = NULL;
|
||||
surface->flags &= ~SDL_PREALLOC;
|
||||
}
|
||||
goto done;
|
||||
default:
|
||||
IMG_SetError("Unknown JXL decoding status: %d", status);
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
done:
|
||||
if (decoder) {
|
||||
lib.JxlDecoderDestroy(decoder);
|
||||
}
|
||||
if (data) {
|
||||
SDL_free(data);
|
||||
}
|
||||
if (pixels) {
|
||||
SDL_free(pixels);
|
||||
}
|
||||
if (!surface) {
|
||||
SDL_RWseek(src, start, RW_SEEK_SET);
|
||||
}
|
||||
return surface;
|
||||
}
|
||||
|
||||
#else
|
||||
#if _MSC_VER >= 1300
|
||||
#pragma warning(disable : 4100) /* warning C4100: 'op' : unreferenced formal parameter */
|
||||
#endif
|
||||
|
||||
int IMG_InitJXL()
|
||||
{
|
||||
IMG_SetError("JXL images are not supported");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
void IMG_QuitJXL()
|
||||
{
|
||||
}
|
||||
|
||||
/* See if an image is contained in a data source */
|
||||
int IMG_isJXL(SDL_RWops *src)
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
||||
/* Load a JXL type image from an SDL datasource */
|
||||
SDL_Surface *IMG_LoadJXL_RW(SDL_RWops *src)
|
||||
{
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
#endif /* LOAD_JXL */
|
||||
503
Library/SDL2_image-2.5.2/IMG_lbm.c
Normal file
503
Library/SDL2_image-2.5.2/IMG_lbm.c
Normal file
@@ -0,0 +1,503 @@
|
||||
/*
|
||||
SDL_image: An example image loading library for use with SDL
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
/* This is a ILBM image file loading framework
|
||||
Load IFF pictures, PBM & ILBM packing methods, with or without stencil
|
||||
Written by Daniel Morais ( Daniel AT Morais DOT com ) in September 2001.
|
||||
24 bits ILBM files support added by Marc Le Douarain (http://www.multimania.com/mavati)
|
||||
in December 2002.
|
||||
EHB and HAM (specific Amiga graphic chip modes) support added by Marc Le Douarain
|
||||
(http://www.multimania.com/mavati) in December 2003.
|
||||
Stencil and colorkey fixes by David Raulo (david.raulo AT free DOT fr) in February 2004.
|
||||
Buffer overflow fix in RLE decompression by David Raulo in January 2008.
|
||||
*/
|
||||
|
||||
#include "SDL_endian.h"
|
||||
#include "SDL_image.h"
|
||||
|
||||
#ifdef LOAD_LBM
|
||||
|
||||
|
||||
#define MAXCOLORS 256
|
||||
|
||||
/* Structure for an IFF picture ( BMHD = Bitmap Header ) */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Uint16 w, h; /* width & height of the bitmap in pixels */
|
||||
Sint16 x, y; /* screen coordinates of the bitmap */
|
||||
Uint8 planes; /* number of planes of the bitmap */
|
||||
Uint8 mask; /* mask type ( 0 => no mask ) */
|
||||
Uint8 tcomp; /* compression type */
|
||||
Uint8 pad1; /* dummy value, for padding */
|
||||
Uint16 tcolor; /* transparent color */
|
||||
Uint8 xAspect, /* pixel aspect ratio */
|
||||
yAspect;
|
||||
Sint16 Lpage; /* width of the screen in pixels */
|
||||
Sint16 Hpage; /* height of the screen in pixels */
|
||||
} BMHD;
|
||||
|
||||
int IMG_isLBM( SDL_RWops *src )
|
||||
{
|
||||
Sint64 start;
|
||||
int is_LBM;
|
||||
Uint8 magic[4+4+4];
|
||||
|
||||
if ( !src )
|
||||
return 0;
|
||||
start = SDL_RWtell(src);
|
||||
is_LBM = 0;
|
||||
if ( SDL_RWread( src, magic, sizeof(magic), 1 ) )
|
||||
{
|
||||
if ( !SDL_memcmp( magic, "FORM", 4 ) &&
|
||||
( !SDL_memcmp( magic + 8, "PBM ", 4 ) ||
|
||||
!SDL_memcmp( magic + 8, "ILBM", 4 ) ) )
|
||||
{
|
||||
is_LBM = 1;
|
||||
}
|
||||
}
|
||||
SDL_RWseek(src, start, RW_SEEK_SET);
|
||||
return( is_LBM );
|
||||
}
|
||||
|
||||
SDL_Surface *IMG_LoadLBM_RW( SDL_RWops *src )
|
||||
{
|
||||
Sint64 start;
|
||||
SDL_Surface *Image;
|
||||
Uint8 id[4], pbm, colormap[MAXCOLORS*3], *MiniBuf, *ptr, count, color, msk;
|
||||
Uint32 size, bytesloaded, nbcolors;
|
||||
Uint32 i, j, bytesperline, nbplanes, stencil, plane, h;
|
||||
Uint32 remainingbytes;
|
||||
Uint32 width;
|
||||
BMHD bmhd;
|
||||
char *error;
|
||||
Uint8 flagHAM,flagEHB;
|
||||
|
||||
Image = NULL;
|
||||
error = NULL;
|
||||
MiniBuf = NULL;
|
||||
|
||||
if ( !src ) {
|
||||
/* The error message has been set in SDL_RWFromFile */
|
||||
return NULL;
|
||||
}
|
||||
start = SDL_RWtell(src);
|
||||
|
||||
if ( !SDL_RWread( src, id, 4, 1 ) )
|
||||
{
|
||||
error="error reading IFF chunk";
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Should be the size of the file minus 4+4 ( 'FORM'+size ) */
|
||||
if ( !SDL_RWread( src, &size, 4, 1 ) )
|
||||
{
|
||||
error="error reading IFF chunk size";
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* As size is not used here, no need to swap it */
|
||||
|
||||
if ( SDL_memcmp( id, "FORM", 4 ) != 0 )
|
||||
{
|
||||
error="not a IFF file";
|
||||
goto done;
|
||||
}
|
||||
|
||||
if ( !SDL_RWread( src, id, 4, 1 ) )
|
||||
{
|
||||
error="error reading IFF chunk";
|
||||
goto done;
|
||||
}
|
||||
|
||||
pbm = 0;
|
||||
|
||||
/* File format : PBM=Packed Bitmap, ILBM=Interleaved Bitmap */
|
||||
if ( !SDL_memcmp( id, "PBM ", 4 ) ) pbm = 1;
|
||||
else if ( SDL_memcmp( id, "ILBM", 4 ) )
|
||||
{
|
||||
error="not a IFF picture";
|
||||
goto done;
|
||||
}
|
||||
|
||||
nbcolors = 0;
|
||||
|
||||
SDL_memset( &bmhd, 0, sizeof( BMHD ) );
|
||||
flagHAM = 0;
|
||||
flagEHB = 0;
|
||||
|
||||
while ( SDL_memcmp( id, "BODY", 4 ) != 0 )
|
||||
{
|
||||
if ( !SDL_RWread( src, id, 4, 1 ) )
|
||||
{
|
||||
error="error reading IFF chunk";
|
||||
goto done;
|
||||
}
|
||||
|
||||
if ( !SDL_RWread( src, &size, 4, 1 ) )
|
||||
{
|
||||
error="error reading IFF chunk size";
|
||||
goto done;
|
||||
}
|
||||
|
||||
bytesloaded = 0;
|
||||
|
||||
size = SDL_SwapBE32( size );
|
||||
|
||||
if ( !SDL_memcmp( id, "BMHD", 4 ) ) /* Bitmap header */
|
||||
{
|
||||
if ( !SDL_RWread( src, &bmhd, sizeof( BMHD ), 1 ) )
|
||||
{
|
||||
error="error reading BMHD chunk";
|
||||
goto done;
|
||||
}
|
||||
|
||||
bytesloaded = sizeof( BMHD );
|
||||
|
||||
bmhd.w = SDL_SwapBE16( bmhd.w );
|
||||
bmhd.h = SDL_SwapBE16( bmhd.h );
|
||||
bmhd.x = SDL_SwapBE16( bmhd.x );
|
||||
bmhd.y = SDL_SwapBE16( bmhd.y );
|
||||
bmhd.tcolor = SDL_SwapBE16( bmhd.tcolor );
|
||||
bmhd.Lpage = SDL_SwapBE16( bmhd.Lpage );
|
||||
bmhd.Hpage = SDL_SwapBE16( bmhd.Hpage );
|
||||
}
|
||||
|
||||
if ( !SDL_memcmp( id, "CMAP", 4 ) ) /* palette ( Color Map ) */
|
||||
{
|
||||
if (size > sizeof (colormap)) {
|
||||
error="colormap size is too large";
|
||||
goto done;
|
||||
}
|
||||
|
||||
if ( !SDL_RWread( src, colormap, size, 1 ) )
|
||||
{
|
||||
error="error reading CMAP chunk";
|
||||
goto done;
|
||||
}
|
||||
|
||||
bytesloaded = size;
|
||||
nbcolors = size / 3;
|
||||
}
|
||||
|
||||
if ( !SDL_memcmp( id, "CAMG", 4 ) ) /* Amiga ViewMode */
|
||||
{
|
||||
Uint32 viewmodes;
|
||||
if ( !SDL_RWread( src, &viewmodes, sizeof(viewmodes), 1 ) )
|
||||
{
|
||||
error="error reading CAMG chunk";
|
||||
goto done;
|
||||
}
|
||||
|
||||
bytesloaded = size;
|
||||
viewmodes = SDL_SwapBE32( viewmodes );
|
||||
if ( viewmodes & 0x0800 )
|
||||
flagHAM = 1;
|
||||
if ( viewmodes & 0x0080 )
|
||||
flagEHB = 1;
|
||||
}
|
||||
|
||||
if ( SDL_memcmp( id, "BODY", 4 ) )
|
||||
{
|
||||
if ( size & 1 ) ++size; /* padding ! */
|
||||
size -= bytesloaded;
|
||||
/* skip the remaining bytes of this chunk */
|
||||
if ( size ) SDL_RWseek( src, size, RW_SEEK_CUR );
|
||||
}
|
||||
}
|
||||
|
||||
/* compute some usefull values, based on the bitmap header */
|
||||
|
||||
width = ( bmhd.w + 15 ) & 0xFFFFFFF0; /* Width in pixels modulo 16 */
|
||||
|
||||
bytesperline = ( ( bmhd.w + 15 ) / 16 ) * 2;
|
||||
|
||||
nbplanes = bmhd.planes;
|
||||
|
||||
if ( pbm ) /* File format : 'Packed Bitmap' */
|
||||
{
|
||||
bytesperline *= 8;
|
||||
nbplanes = 1;
|
||||
}
|
||||
|
||||
stencil = (bmhd.mask & 1); /* There is a mask ( 'stencil' ) */
|
||||
|
||||
/* Allocate memory for a temporary buffer ( used for
|
||||
decompression/deinterleaving ) */
|
||||
|
||||
MiniBuf = (Uint8 *)SDL_malloc( bytesperline * (nbplanes + stencil) );
|
||||
if ( MiniBuf == NULL )
|
||||
{
|
||||
error="not enough memory for temporary buffer";
|
||||
goto done;
|
||||
}
|
||||
|
||||
if ( ( Image = SDL_CreateRGBSurface( SDL_SWSURFACE, width, bmhd.h, (nbplanes==24 || flagHAM==1)?24:8, 0, 0, 0, 0 ) ) == NULL )
|
||||
goto done;
|
||||
|
||||
if ( bmhd.mask & 2 ) /* There is a transparent color */
|
||||
SDL_SetColorKey( Image, SDL_TRUE, bmhd.tcolor );
|
||||
|
||||
/* Update palette informations */
|
||||
|
||||
/* There is no palette in 24 bits ILBM file */
|
||||
if ( nbcolors>0 && flagHAM==0 )
|
||||
{
|
||||
/* FIXME: Should this include the stencil? See comment below */
|
||||
int nbrcolorsfinal = 1 << (nbplanes + stencil);
|
||||
ptr = &colormap[0];
|
||||
|
||||
for ( i=0; i<nbcolors; i++ )
|
||||
{
|
||||
Image->format->palette->colors[i].r = *ptr++;
|
||||
Image->format->palette->colors[i].g = *ptr++;
|
||||
Image->format->palette->colors[i].b = *ptr++;
|
||||
}
|
||||
|
||||
/* Amiga EHB mode (Extra-Half-Bright) */
|
||||
/* 6 bitplanes mode with a 32 colors palette */
|
||||
/* The 32 last colors are the same but divided by 2 */
|
||||
/* Some Amiga pictures save 64 colors with 32 last wrong colors, */
|
||||
/* they shouldn't !, and here we overwrite these 32 bad colors. */
|
||||
if ( (nbcolors==32 || flagEHB ) && (1<<nbplanes)==64 )
|
||||
{
|
||||
nbcolors = 64;
|
||||
ptr = &colormap[0];
|
||||
for ( i=32; i<64; i++ )
|
||||
{
|
||||
Image->format->palette->colors[i].r = (*ptr++)/2;
|
||||
Image->format->palette->colors[i].g = (*ptr++)/2;
|
||||
Image->format->palette->colors[i].b = (*ptr++)/2;
|
||||
}
|
||||
}
|
||||
|
||||
/* If nbcolors < 2^nbplanes, repeat the colormap */
|
||||
/* This happens when pictures have a stencil mask */
|
||||
if ( nbrcolorsfinal > (1<<nbplanes) ) {
|
||||
nbrcolorsfinal = (1<<nbplanes);
|
||||
}
|
||||
for ( i=nbcolors; i < (Uint32)nbrcolorsfinal; i++ )
|
||||
{
|
||||
Image->format->palette->colors[i].r = Image->format->palette->colors[i%nbcolors].r;
|
||||
Image->format->palette->colors[i].g = Image->format->palette->colors[i%nbcolors].g;
|
||||
Image->format->palette->colors[i].b = Image->format->palette->colors[i%nbcolors].b;
|
||||
}
|
||||
if ( !pbm )
|
||||
Image->format->palette->ncolors = nbrcolorsfinal;
|
||||
}
|
||||
|
||||
/* Get the bitmap */
|
||||
|
||||
for ( h=0; h < bmhd.h; h++ )
|
||||
{
|
||||
/* uncompress the datas of each planes */
|
||||
|
||||
for ( plane=0; plane < (nbplanes+stencil); plane++ )
|
||||
{
|
||||
ptr = MiniBuf + ( plane * bytesperline );
|
||||
|
||||
remainingbytes = bytesperline;
|
||||
|
||||
if ( bmhd.tcomp == 1 ) /* Datas are compressed */
|
||||
{
|
||||
do
|
||||
{
|
||||
if ( !SDL_RWread( src, &count, 1, 1 ) )
|
||||
{
|
||||
error="error reading BODY chunk";
|
||||
goto done;
|
||||
}
|
||||
|
||||
if ( count & 0x80 )
|
||||
{
|
||||
count ^= 0xFF;
|
||||
count += 2; /* now it */
|
||||
|
||||
if ( ( count > remainingbytes ) || !SDL_RWread( src, &color, 1, 1 ) )
|
||||
{
|
||||
error="error reading BODY chunk";
|
||||
goto done;
|
||||
}
|
||||
SDL_memset( ptr, color, count );
|
||||
}
|
||||
else
|
||||
{
|
||||
++count;
|
||||
|
||||
if ( ( count > remainingbytes ) || !SDL_RWread( src, ptr, count, 1 ) )
|
||||
{
|
||||
error="error reading BODY chunk";
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
ptr += count;
|
||||
remainingbytes -= count;
|
||||
|
||||
} while ( remainingbytes > 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( !SDL_RWread( src, ptr, bytesperline, 1 ) )
|
||||
{
|
||||
error="error reading BODY chunk";
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* One line has been read, store it ! */
|
||||
|
||||
ptr = (Uint8 *)Image->pixels;
|
||||
if ( nbplanes==24 || flagHAM==1 )
|
||||
ptr += h * width * 3;
|
||||
else
|
||||
ptr += h * width;
|
||||
|
||||
if ( pbm ) /* File format : 'Packed Bitmap' */
|
||||
{
|
||||
SDL_memcpy( ptr, MiniBuf, width );
|
||||
}
|
||||
else /* We have to un-interlace the bits ! */
|
||||
{
|
||||
if ( nbplanes!=24 && flagHAM==0 )
|
||||
{
|
||||
size = ( width + 7 ) / 8;
|
||||
|
||||
for ( i=0; i < size; i++ )
|
||||
{
|
||||
SDL_memset( ptr, 0, 8 );
|
||||
|
||||
for ( plane=0; plane < (nbplanes + stencil); plane++ )
|
||||
{
|
||||
color = *( MiniBuf + i + ( plane * bytesperline ) );
|
||||
msk = 0x80;
|
||||
|
||||
for ( j=0; j<8; j++ )
|
||||
{
|
||||
if ( ( plane + j ) <= 7 ) ptr[j] |= (Uint8)( color & msk ) >> ( 7 - plane - j );
|
||||
else ptr[j] |= (Uint8)( color & msk ) << ( plane + j - 7 );
|
||||
|
||||
msk >>= 1;
|
||||
}
|
||||
}
|
||||
ptr += 8;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Uint32 finalcolor = 0;
|
||||
size = ( width + 7 ) / 8;
|
||||
/* 24 bitplanes ILBM : R0...R7,G0...G7,B0...B7 */
|
||||
/* or HAM (6 bitplanes) or HAM8 (8 bitplanes) modes */
|
||||
for ( i=0; i<width; i=i+8 )
|
||||
{
|
||||
Uint8 maskBit = 0x80;
|
||||
for ( j=0; j<8; j++ )
|
||||
{
|
||||
Uint32 pixelcolor = 0;
|
||||
Uint32 maskColor = 1;
|
||||
Uint8 dataBody;
|
||||
for ( plane=0; plane < nbplanes; plane++ )
|
||||
{
|
||||
dataBody = MiniBuf[ plane*size+i/8 ];
|
||||
if ( dataBody&maskBit )
|
||||
pixelcolor = pixelcolor | maskColor;
|
||||
maskColor = maskColor<<1;
|
||||
}
|
||||
/* HAM : 12 bits RGB image (4 bits per color component) */
|
||||
/* HAM8 : 18 bits RGB image (6 bits per color component) */
|
||||
if ( flagHAM )
|
||||
{
|
||||
switch( pixelcolor>>(nbplanes-2) )
|
||||
{
|
||||
case 0: /* take direct color from palette */
|
||||
finalcolor = colormap[ pixelcolor*3 ] + (colormap[ pixelcolor*3+1 ]<<8) + (colormap[ pixelcolor*3+2 ]<<16);
|
||||
break;
|
||||
case 1: /* modify only blue component */
|
||||
finalcolor = finalcolor&0x00FFFF;
|
||||
finalcolor = finalcolor | (pixelcolor<<(16+(10-nbplanes)));
|
||||
break;
|
||||
case 2: /* modify only red component */
|
||||
finalcolor = finalcolor&0xFFFF00;
|
||||
finalcolor = finalcolor | pixelcolor<<(10-nbplanes);
|
||||
break;
|
||||
case 3: /* modify only green component */
|
||||
finalcolor = finalcolor&0xFF00FF;
|
||||
finalcolor = finalcolor | (pixelcolor<<(8+(10-nbplanes)));
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
finalcolor = pixelcolor;
|
||||
}
|
||||
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
|
||||
*ptr++ = (Uint8)(finalcolor>>16);
|
||||
*ptr++ = (Uint8)(finalcolor>>8);
|
||||
*ptr++ = (Uint8)(finalcolor);
|
||||
#else
|
||||
*ptr++ = (Uint8)(finalcolor);
|
||||
*ptr++ = (Uint8)(finalcolor>>8);
|
||||
*ptr++ = (Uint8)(finalcolor>>16);
|
||||
#endif
|
||||
maskBit = maskBit>>1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
done:
|
||||
|
||||
if ( MiniBuf ) SDL_free( MiniBuf );
|
||||
|
||||
if ( error )
|
||||
{
|
||||
SDL_RWseek(src, start, RW_SEEK_SET);
|
||||
if ( Image ) {
|
||||
SDL_FreeSurface( Image );
|
||||
Image = NULL;
|
||||
}
|
||||
IMG_SetError( "%s", error );
|
||||
}
|
||||
|
||||
return( Image );
|
||||
}
|
||||
|
||||
#else /* LOAD_LBM */
|
||||
#if _MSC_VER >= 1300
|
||||
#pragma warning(disable : 4100) /* warning C4100: 'op' : unreferenced formal parameter */
|
||||
#endif
|
||||
|
||||
/* See if an image is contained in a data source */
|
||||
int IMG_isLBM(SDL_RWops *src)
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
||||
/* Load an IFF type image from an SDL datasource */
|
||||
SDL_Surface *IMG_LoadLBM_RW(SDL_RWops *src)
|
||||
{
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
#endif /* LOAD_LBM */
|
||||
305
Library/SDL2_image-2.5.2/IMG_pcx.c
Normal file
305
Library/SDL2_image-2.5.2/IMG_pcx.c
Normal file
@@ -0,0 +1,305 @@
|
||||
/*
|
||||
SDL_image: An example image loading library for use with SDL
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
/*
|
||||
* PCX file reader:
|
||||
* Supports:
|
||||
* 1..4 bits/pixel in multiplanar format (1 bit/plane/pixel)
|
||||
* 8 bits/pixel in single-planar format (8 bits/plane/pixel)
|
||||
* 24 bits/pixel in 3-plane format (8 bits/plane/pixel)
|
||||
*
|
||||
* (The <8bpp formats are expanded to 8bpp surfaces)
|
||||
*
|
||||
* Doesn't support:
|
||||
* single-planar packed-pixel formats other than 8bpp
|
||||
* 4-plane 32bpp format with a fourth "intensity" plane
|
||||
*/
|
||||
|
||||
#include "SDL_endian.h"
|
||||
|
||||
#include "SDL_image.h"
|
||||
|
||||
#ifdef LOAD_PCX
|
||||
|
||||
struct PCXheader {
|
||||
Uint8 Manufacturer;
|
||||
Uint8 Version;
|
||||
Uint8 Encoding;
|
||||
Uint8 BitsPerPixel;
|
||||
Sint16 Xmin, Ymin, Xmax, Ymax;
|
||||
Sint16 HDpi, VDpi;
|
||||
Uint8 Colormap[48];
|
||||
Uint8 Reserved;
|
||||
Uint8 NPlanes;
|
||||
Sint16 BytesPerLine;
|
||||
Sint16 PaletteInfo;
|
||||
Sint16 HscreenSize;
|
||||
Sint16 VscreenSize;
|
||||
Uint8 Filler[54];
|
||||
};
|
||||
|
||||
/* See if an image is contained in a data source */
|
||||
int IMG_isPCX(SDL_RWops *src)
|
||||
{
|
||||
Sint64 start;
|
||||
int is_PCX;
|
||||
const int ZSoft_Manufacturer = 10;
|
||||
const int PC_Paintbrush_Version = 5;
|
||||
const int PCX_Uncompressed_Encoding = 0;
|
||||
const int PCX_RunLength_Encoding = 1;
|
||||
struct PCXheader pcxh;
|
||||
|
||||
if ( !src )
|
||||
return 0;
|
||||
start = SDL_RWtell(src);
|
||||
is_PCX = 0;
|
||||
if ( SDL_RWread(src, &pcxh, sizeof(pcxh), 1) == 1 ) {
|
||||
if ( (pcxh.Manufacturer == ZSoft_Manufacturer) &&
|
||||
(pcxh.Version == PC_Paintbrush_Version) &&
|
||||
(pcxh.Encoding == PCX_RunLength_Encoding ||
|
||||
pcxh.Encoding == PCX_Uncompressed_Encoding) ) {
|
||||
is_PCX = 1;
|
||||
}
|
||||
}
|
||||
SDL_RWseek(src, start, RW_SEEK_SET);
|
||||
return(is_PCX);
|
||||
}
|
||||
|
||||
/* Load a PCX type image from an SDL datasource */
|
||||
SDL_Surface *IMG_LoadPCX_RW(SDL_RWops *src)
|
||||
{
|
||||
Sint64 start;
|
||||
struct PCXheader pcxh;
|
||||
Uint32 Rmask;
|
||||
Uint32 Gmask;
|
||||
Uint32 Bmask;
|
||||
Uint32 Amask;
|
||||
SDL_Surface *surface = NULL;
|
||||
int width, height;
|
||||
int y, bpl;
|
||||
Uint8 *row, *buf = NULL;
|
||||
char *error = NULL;
|
||||
int bits, src_bits;
|
||||
int count = 0;
|
||||
Uint8 ch;
|
||||
|
||||
if ( !src ) {
|
||||
/* The error message has been set in SDL_RWFromFile */
|
||||
return NULL;
|
||||
}
|
||||
start = SDL_RWtell(src);
|
||||
|
||||
if ( !SDL_RWread(src, &pcxh, sizeof(pcxh), 1) ) {
|
||||
error = "file truncated";
|
||||
goto done;
|
||||
}
|
||||
pcxh.Xmin = SDL_SwapLE16(pcxh.Xmin);
|
||||
pcxh.Ymin = SDL_SwapLE16(pcxh.Ymin);
|
||||
pcxh.Xmax = SDL_SwapLE16(pcxh.Xmax);
|
||||
pcxh.Ymax = SDL_SwapLE16(pcxh.Ymax);
|
||||
pcxh.BytesPerLine = SDL_SwapLE16(pcxh.BytesPerLine);
|
||||
|
||||
#if 0
|
||||
printf("Manufacturer = %d\n", pcxh.Manufacturer);
|
||||
printf("Version = %d\n", pcxh.Version);
|
||||
printf("Encoding = %d\n", pcxh.Encoding);
|
||||
printf("BitsPerPixel = %d\n", pcxh.BitsPerPixel);
|
||||
printf("Xmin = %d, Ymin = %d, Xmax = %d, Ymax = %d\n", pcxh.Xmin, pcxh.Ymin, pcxh.Xmax, pcxh.Ymax);
|
||||
printf("HDpi = %d, VDpi = %d\n", pcxh.HDpi, pcxh.VDpi);
|
||||
printf("NPlanes = %d\n", pcxh.NPlanes);
|
||||
printf("BytesPerLine = %d\n", pcxh.BytesPerLine);
|
||||
printf("PaletteInfo = %d\n", pcxh.PaletteInfo);
|
||||
printf("HscreenSize = %d\n", pcxh.HscreenSize);
|
||||
printf("VscreenSize = %d\n", pcxh.VscreenSize);
|
||||
#endif
|
||||
|
||||
/* Create the surface of the appropriate type */
|
||||
width = (pcxh.Xmax - pcxh.Xmin) + 1;
|
||||
height = (pcxh.Ymax - pcxh.Ymin) + 1;
|
||||
Rmask = Gmask = Bmask = Amask = 0;
|
||||
src_bits = pcxh.BitsPerPixel * pcxh.NPlanes;
|
||||
if((pcxh.BitsPerPixel == 1 && pcxh.NPlanes >= 1 && pcxh.NPlanes <= 4)
|
||||
|| (pcxh.BitsPerPixel == 8 && pcxh.NPlanes == 1)) {
|
||||
bits = 8;
|
||||
} else if(pcxh.BitsPerPixel == 8 && pcxh.NPlanes == 3) {
|
||||
bits = 24;
|
||||
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
|
||||
Rmask = 0x000000FF;
|
||||
Gmask = 0x0000FF00;
|
||||
Bmask = 0x00FF0000;
|
||||
#else
|
||||
Rmask = 0xFF0000;
|
||||
Gmask = 0x00FF00;
|
||||
Bmask = 0x0000FF;
|
||||
#endif
|
||||
} else {
|
||||
error = "unsupported PCX format";
|
||||
goto done;
|
||||
}
|
||||
surface = SDL_CreateRGBSurface(SDL_SWSURFACE, width, height,
|
||||
bits, Rmask, Gmask, Bmask, Amask);
|
||||
if ( surface == NULL ) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
bpl = pcxh.NPlanes * pcxh.BytesPerLine;
|
||||
buf = (Uint8 *)SDL_calloc(bpl, 1);
|
||||
if ( !buf ) {
|
||||
error = "Out of memory";
|
||||
goto done;
|
||||
}
|
||||
row = (Uint8 *)surface->pixels;
|
||||
for ( y=0; y<surface->h; ++y ) {
|
||||
/* decode a scan line to a temporary buffer first */
|
||||
int i;
|
||||
if ( pcxh.Encoding == 0 ) {
|
||||
if ( !SDL_RWread(src, buf, bpl, 1) ) {
|
||||
error = "file truncated";
|
||||
goto done;
|
||||
}
|
||||
} else {
|
||||
for ( i = 0; i < bpl; i++ ) {
|
||||
if ( !count ) {
|
||||
if ( !SDL_RWread(src, &ch, 1, 1) ) {
|
||||
error = "file truncated";
|
||||
goto done;
|
||||
}
|
||||
if ( ch < 0xc0 ) {
|
||||
count = 1;
|
||||
} else {
|
||||
count = ch - 0xc0;
|
||||
if( !SDL_RWread(src, &ch, 1, 1) ) {
|
||||
error = "file truncated";
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
}
|
||||
buf[i] = ch;
|
||||
count--;
|
||||
}
|
||||
}
|
||||
|
||||
if ( src_bits <= 4 ) {
|
||||
/* expand planes to 1 byte/pixel */
|
||||
Uint8 *innerSrc = buf;
|
||||
int plane;
|
||||
for ( plane = 0; plane < pcxh.NPlanes; plane++ ) {
|
||||
int j, k, x = 0;
|
||||
for( j = 0; j < pcxh.BytesPerLine; j++ ) {
|
||||
Uint8 byte = *innerSrc++;
|
||||
for( k = 7; k >= 0; k-- ) {
|
||||
unsigned bit = (byte >> k) & 1;
|
||||
/* skip padding bits */
|
||||
if (j * 8 + k >= width)
|
||||
continue;
|
||||
row[x++] |= bit << plane;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if ( src_bits == 8 ) {
|
||||
/* Copy the row directly */
|
||||
SDL_memcpy(row, buf, SDL_min(width, bpl));
|
||||
} else if ( src_bits == 24 ) {
|
||||
/* de-interlace planes */
|
||||
Uint8 *innerSrc = buf;
|
||||
Uint8 *end1 = buf+bpl;
|
||||
int plane;
|
||||
for ( plane = 0; plane < pcxh.NPlanes; plane++ ) {
|
||||
int x;
|
||||
Uint8 *dst = row + plane;
|
||||
Uint8 *end2= row + surface->pitch;
|
||||
for ( x = 0; x < width; x++ ) {
|
||||
if ( (innerSrc + x) >= end1 || dst >= end2 ) {
|
||||
error = "decoding out of bounds (corrupt?)";
|
||||
goto done;
|
||||
}
|
||||
*dst = innerSrc[x];
|
||||
dst += pcxh.NPlanes;
|
||||
}
|
||||
innerSrc += pcxh.BytesPerLine;
|
||||
}
|
||||
}
|
||||
|
||||
row += surface->pitch;
|
||||
}
|
||||
|
||||
if ( bits == 8 ) {
|
||||
SDL_Color *colors = surface->format->palette->colors;
|
||||
int nc = 1 << src_bits;
|
||||
int i;
|
||||
|
||||
surface->format->palette->ncolors = nc;
|
||||
if ( src_bits == 8 ) {
|
||||
Uint8 ch;
|
||||
/* look for a 256-colour palette */
|
||||
do {
|
||||
if ( !SDL_RWread(src, &ch, 1, 1) ) {
|
||||
/* Couldn't find the palette, try the end of the file */
|
||||
SDL_RWseek(src, -768, RW_SEEK_END);
|
||||
break;
|
||||
}
|
||||
} while ( ch != 12 );
|
||||
|
||||
for ( i = 0; i < 256; i++ ) {
|
||||
SDL_RWread(src, &colors[i].r, 1, 1);
|
||||
SDL_RWread(src, &colors[i].g, 1, 1);
|
||||
SDL_RWread(src, &colors[i].b, 1, 1);
|
||||
}
|
||||
} else {
|
||||
for ( i = 0; i < nc; i++ ) {
|
||||
colors[i].r = pcxh.Colormap[i * 3];
|
||||
colors[i].g = pcxh.Colormap[i * 3 + 1];
|
||||
colors[i].b = pcxh.Colormap[i * 3 + 2];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
done:
|
||||
SDL_free(buf);
|
||||
if ( error ) {
|
||||
SDL_RWseek(src, start, RW_SEEK_SET);
|
||||
if ( surface ) {
|
||||
SDL_FreeSurface(surface);
|
||||
surface = NULL;
|
||||
}
|
||||
IMG_SetError("%s", error);
|
||||
}
|
||||
return(surface);
|
||||
}
|
||||
|
||||
#else
|
||||
#if _MSC_VER >= 1300
|
||||
#pragma warning(disable : 4100) /* warning C4100: 'op' : unreferenced formal parameter */
|
||||
#endif
|
||||
|
||||
/* See if an image is contained in a data source */
|
||||
int IMG_isPCX(SDL_RWops *src)
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
||||
/* Load a PCX type image from an SDL datasource */
|
||||
SDL_Surface *IMG_LoadPCX_RW(SDL_RWops *src)
|
||||
{
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
#endif /* LOAD_PCX */
|
||||
769
Library/SDL2_image-2.5.2/IMG_png.c
Normal file
769
Library/SDL2_image-2.5.2/IMG_png.c
Normal file
@@ -0,0 +1,769 @@
|
||||
/*
|
||||
SDL_image: An example image loading library for use with SDL
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
/* This is a PNG image file loading framework */
|
||||
|
||||
#include "SDL_image.h"
|
||||
|
||||
/* We'll have PNG save support by default */
|
||||
#if !defined(SDL_IMAGE_SAVE_PNG)
|
||||
# define SDL_IMAGE_SAVE_PNG 1
|
||||
#endif
|
||||
|
||||
#if defined(USE_STBIMAGE)
|
||||
#undef WANT_LIBPNG
|
||||
#elif defined(SDL_IMAGE_USE_COMMON_BACKEND)
|
||||
#define WANT_LIBPNG
|
||||
#elif defined(SDL_IMAGE_USE_WIC_BACKEND)
|
||||
#undef WANT_LIBPNG
|
||||
#elif defined(__APPLE__) && defined(PNG_USES_IMAGEIO)
|
||||
#undef WANT_LIBPNG
|
||||
#else
|
||||
#define WANT_LIBPNG
|
||||
#endif
|
||||
|
||||
#ifdef LOAD_PNG
|
||||
|
||||
#ifdef WANT_LIBPNG
|
||||
|
||||
#define USE_LIBPNG
|
||||
|
||||
/* This code was originally written by Philippe Lavoie (2 November 1998) */
|
||||
|
||||
#include "SDL_endian.h"
|
||||
|
||||
#ifdef macintosh
|
||||
#define MACOS
|
||||
#endif
|
||||
#include <png.h>
|
||||
|
||||
/* Check for the older version of libpng */
|
||||
#if (PNG_LIBPNG_VER_MAJOR == 1)
|
||||
#if (PNG_LIBPNG_VER_MINOR < 5)
|
||||
#define LIBPNG_VERSION_12
|
||||
typedef png_bytep png_const_bytep;
|
||||
typedef png_color *png_const_colorp;
|
||||
typedef png_color_16 *png_const_color_16p;
|
||||
#endif
|
||||
#if (PNG_LIBPNG_VER_MINOR < 4)
|
||||
typedef png_structp png_const_structp;
|
||||
typedef png_infop png_const_infop;
|
||||
#endif
|
||||
#if (PNG_LIBPNG_VER_MINOR < 6)
|
||||
typedef png_structp png_structrp;
|
||||
typedef png_infop png_inforp;
|
||||
typedef png_const_structp png_const_structrp;
|
||||
typedef png_const_infop png_const_inforp;
|
||||
/* noconst15: version < 1.6 doesn't have const, >= 1.6 adds it */
|
||||
/* noconst16: version < 1.6 does have const, >= 1.6 removes it */
|
||||
typedef png_structp png_noconst15_structrp;
|
||||
typedef png_inforp png_noconst15_inforp;
|
||||
typedef png_const_inforp png_noconst16_inforp;
|
||||
#else
|
||||
typedef png_const_structp png_noconst15_structrp;
|
||||
typedef png_const_inforp png_noconst15_inforp;
|
||||
typedef png_inforp png_noconst16_inforp;
|
||||
#endif
|
||||
#else
|
||||
typedef png_const_structp png_noconst15_structrp;
|
||||
typedef png_const_inforp png_noconst15_inforp;
|
||||
typedef png_inforp png_noconst16_inforp;
|
||||
#endif
|
||||
|
||||
static struct {
|
||||
int loaded;
|
||||
void *handle;
|
||||
png_infop (*png_create_info_struct) (png_noconst15_structrp png_ptr);
|
||||
png_structp (*png_create_read_struct) (png_const_charp user_png_ver, png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warn_fn);
|
||||
void (*png_destroy_read_struct) (png_structpp png_ptr_ptr, png_infopp info_ptr_ptr, png_infopp end_info_ptr_ptr);
|
||||
png_uint_32 (*png_get_IHDR) (png_noconst15_structrp png_ptr, png_noconst15_inforp info_ptr, png_uint_32 *width, png_uint_32 *height, int *bit_depth, int *color_type, int *interlace_method, int *compression_method, int *filter_method);
|
||||
png_voidp (*png_get_io_ptr) (png_noconst15_structrp png_ptr);
|
||||
png_byte (*png_get_channels) (png_const_structrp png_ptr, png_const_inforp info_ptr);
|
||||
png_uint_32 (*png_get_PLTE) (png_const_structrp png_ptr, png_noconst16_inforp info_ptr, png_colorp *palette, int *num_palette);
|
||||
png_uint_32 (*png_get_tRNS) (png_const_structrp png_ptr, png_inforp info_ptr, png_bytep *trans, int *num_trans, png_color_16p *trans_values);
|
||||
png_uint_32 (*png_get_valid) (png_const_structrp png_ptr, png_const_inforp info_ptr, png_uint_32 flag);
|
||||
void (*png_read_image) (png_structrp png_ptr, png_bytepp image);
|
||||
void (*png_read_info) (png_structrp png_ptr, png_inforp info_ptr);
|
||||
void (*png_read_update_info) (png_structrp png_ptr, png_inforp info_ptr);
|
||||
void (*png_set_expand) (png_structrp png_ptr);
|
||||
void (*png_set_gray_to_rgb) (png_structrp png_ptr);
|
||||
void (*png_set_packing) (png_structrp png_ptr);
|
||||
void (*png_set_read_fn) (png_structrp png_ptr, png_voidp io_ptr, png_rw_ptr read_data_fn);
|
||||
void (*png_set_strip_16) (png_structrp png_ptr);
|
||||
int (*png_set_interlace_handling) (png_structrp png_ptr);
|
||||
int (*png_sig_cmp) (png_const_bytep sig, png_size_t start, png_size_t num_to_check);
|
||||
#ifdef PNG_SETJMP_SUPPORTED
|
||||
#ifndef LIBPNG_VERSION_12
|
||||
jmp_buf* (*png_set_longjmp_fn) (png_structrp, png_longjmp_ptr, size_t);
|
||||
#endif
|
||||
#endif
|
||||
#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);
|
||||
void (*png_set_IHDR) (png_noconst15_structrp png_ptr, png_inforp info_ptr, png_uint_32 width, png_uint_32 height, int bit_depth, int color_type, int interlace_type, int compression_type, int filter_type);
|
||||
void (*png_write_info) (png_structrp png_ptr, png_noconst15_inforp info_ptr);
|
||||
void (*png_set_rows) (png_noconst15_structrp png_ptr, png_inforp info_ptr, png_bytepp row_pointers);
|
||||
void (*png_write_png) (png_structrp png_ptr, png_inforp info_ptr, int transforms, png_voidp params);
|
||||
void (*png_set_PLTE) (png_structrp png_ptr, png_inforp info_ptr, png_const_colorp palette, int num_palette);
|
||||
void (*png_set_tRNS) (png_structrp png_ptr, png_inforp info_ptr, png_const_bytep trans_alpha, int num_trans, png_const_color_16p trans_color);
|
||||
#endif
|
||||
} lib;
|
||||
|
||||
#ifdef LOAD_PNG_DYNAMIC
|
||||
#define FUNCTION_LOADER(FUNC, SIG) \
|
||||
lib.FUNC = (SIG) SDL_LoadFunction(lib.handle, #FUNC); \
|
||||
if (lib.FUNC == NULL) { SDL_UnloadObject(lib.handle); return -1; }
|
||||
#else
|
||||
#define FUNCTION_LOADER(FUNC, SIG) \
|
||||
lib.FUNC = FUNC;
|
||||
#endif
|
||||
|
||||
int IMG_InitPNG()
|
||||
{
|
||||
if ( lib.loaded == 0 ) {
|
||||
#ifdef LOAD_PNG_DYNAMIC
|
||||
lib.handle = SDL_LoadObject(LOAD_PNG_DYNAMIC);
|
||||
if ( lib.handle == NULL ) {
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
FUNCTION_LOADER(png_create_info_struct, png_infop (*) (png_noconst15_structrp png_ptr))
|
||||
FUNCTION_LOADER(png_create_read_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_read_struct, void (*) (png_structpp png_ptr_ptr, png_infopp info_ptr_ptr, png_infopp end_info_ptr_ptr))
|
||||
FUNCTION_LOADER(png_get_IHDR, png_uint_32 (*) (png_noconst15_structrp png_ptr, png_noconst15_inforp info_ptr, png_uint_32 *width, png_uint_32 *height, int *bit_depth, int *color_type, int *interlace_method, int *compression_method, int *filter_method))
|
||||
FUNCTION_LOADER(png_get_io_ptr, png_voidp (*) (png_noconst15_structrp png_ptr))
|
||||
FUNCTION_LOADER(png_get_channels, png_byte (*) (png_const_structrp png_ptr, png_const_inforp info_ptr))
|
||||
FUNCTION_LOADER(png_get_PLTE, png_uint_32 (*) (png_const_structrp png_ptr, png_noconst16_inforp info_ptr, png_colorp *palette, int *num_palette))
|
||||
FUNCTION_LOADER(png_get_tRNS, png_uint_32 (*) (png_const_structrp png_ptr, png_inforp info_ptr, png_bytep *trans, int *num_trans, png_color_16p *trans_values))
|
||||
FUNCTION_LOADER(png_get_valid, png_uint_32 (*) (png_const_structrp png_ptr, png_const_inforp info_ptr, png_uint_32 flag))
|
||||
FUNCTION_LOADER(png_read_image, void (*) (png_structrp png_ptr, png_bytepp image))
|
||||
FUNCTION_LOADER(png_read_info, void (*) (png_structrp png_ptr, png_inforp info_ptr))
|
||||
FUNCTION_LOADER(png_read_update_info, void (*) (png_structrp png_ptr, png_inforp info_ptr))
|
||||
FUNCTION_LOADER(png_set_expand, void (*) (png_structrp png_ptr))
|
||||
FUNCTION_LOADER(png_set_gray_to_rgb, void (*) (png_structrp png_ptr))
|
||||
FUNCTION_LOADER(png_set_packing, void (*) (png_structrp png_ptr))
|
||||
FUNCTION_LOADER(png_set_read_fn, void (*) (png_structrp png_ptr, png_voidp io_ptr, png_rw_ptr read_data_fn))
|
||||
FUNCTION_LOADER(png_set_strip_16, void (*) (png_structrp png_ptr))
|
||||
FUNCTION_LOADER(png_set_interlace_handling, int (*) (png_structrp png_ptr))
|
||||
FUNCTION_LOADER(png_sig_cmp, int (*) (png_const_bytep sig, png_size_t start, png_size_t num_to_check))
|
||||
#ifdef PNG_SETJMP_SUPPORTED
|
||||
#ifndef LIBPNG_VERSION_12
|
||||
FUNCTION_LOADER(png_set_longjmp_fn, jmp_buf* (*) (png_structrp, png_longjmp_ptr, size_t))
|
||||
#endif
|
||||
#endif
|
||||
#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))
|
||||
FUNCTION_LOADER(png_set_IHDR, void (*) (png_noconst15_structrp png_ptr, png_inforp info_ptr, png_uint_32 width, png_uint_32 height, int bit_depth, int color_type, int interlace_type, int compression_type, int filter_type))
|
||||
FUNCTION_LOADER(png_write_info, void (*) (png_structrp png_ptr, png_noconst15_inforp info_ptr))
|
||||
FUNCTION_LOADER(png_set_rows, void (*) (png_noconst15_structrp png_ptr, png_inforp info_ptr, png_bytepp row_pointers))
|
||||
FUNCTION_LOADER(png_write_png, void (*) (png_structrp png_ptr, png_inforp info_ptr, int transforms, png_voidp params))
|
||||
FUNCTION_LOADER(png_set_PLTE, void (*) (png_structrp png_ptr, png_inforp info_ptr, png_const_colorp palette, int num_palette))
|
||||
FUNCTION_LOADER(png_set_tRNS, void (*) (png_structrp png_ptr, png_inforp info_ptr, png_const_bytep trans_alpha, int num_trans, png_const_color_16p trans_color))
|
||||
#endif
|
||||
}
|
||||
++lib.loaded;
|
||||
|
||||
return 0;
|
||||
}
|
||||
void IMG_QuitPNG()
|
||||
{
|
||||
if ( lib.loaded == 0 ) {
|
||||
return;
|
||||
}
|
||||
if ( lib.loaded == 1 ) {
|
||||
#ifdef LOAD_PNG_DYNAMIC
|
||||
SDL_UnloadObject(lib.handle);
|
||||
#endif
|
||||
}
|
||||
--lib.loaded;
|
||||
}
|
||||
|
||||
/* See if an image is contained in a data source */
|
||||
int IMG_isPNG(SDL_RWops *src)
|
||||
{
|
||||
Sint64 start;
|
||||
int is_PNG;
|
||||
Uint8 magic[4];
|
||||
|
||||
if ( !src ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
start = SDL_RWtell(src);
|
||||
is_PNG = 0;
|
||||
if ( SDL_RWread(src, magic, 1, sizeof(magic)) == sizeof(magic) ) {
|
||||
if ( magic[0] == 0x89 &&
|
||||
magic[1] == 'P' &&
|
||||
magic[2] == 'N' &&
|
||||
magic[3] == 'G' ) {
|
||||
is_PNG = 1;
|
||||
}
|
||||
}
|
||||
SDL_RWseek(src, start, RW_SEEK_SET);
|
||||
return(is_PNG);
|
||||
}
|
||||
|
||||
/* Load a PNG type image from an SDL datasource */
|
||||
static void png_read_data(png_structp ctx, png_bytep area, png_size_t size)
|
||||
{
|
||||
SDL_RWops *src;
|
||||
|
||||
src = (SDL_RWops *)lib.png_get_io_ptr(ctx);
|
||||
SDL_RWread(src, area, size, 1);
|
||||
}
|
||||
SDL_Surface *IMG_LoadPNG_RW(SDL_RWops *src)
|
||||
{
|
||||
Sint64 start;
|
||||
const char *error;
|
||||
SDL_Surface *volatile surface;
|
||||
png_structp png_ptr;
|
||||
png_infop info_ptr;
|
||||
png_uint_32 width, height;
|
||||
int bit_depth, color_type, interlace_type, num_channels;
|
||||
Uint32 Rmask;
|
||||
Uint32 Gmask;
|
||||
Uint32 Bmask;
|
||||
Uint32 Amask;
|
||||
SDL_Palette *palette;
|
||||
png_bytep *volatile row_pointers;
|
||||
int row, i;
|
||||
int ckey = -1;
|
||||
png_color_16 *transv;
|
||||
|
||||
if ( !src ) {
|
||||
/* The error message has been set in SDL_RWFromFile */
|
||||
return NULL;
|
||||
}
|
||||
start = SDL_RWtell(src);
|
||||
|
||||
if ( (IMG_Init(IMG_INIT_PNG) & IMG_INIT_PNG) == 0 ) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Initialize the data we will clean up when we're done */
|
||||
error = NULL;
|
||||
png_ptr = NULL; info_ptr = NULL; row_pointers = NULL; surface = NULL;
|
||||
|
||||
/* Create the PNG loading context structure */
|
||||
png_ptr = lib.png_create_read_struct(PNG_LIBPNG_VER_STRING,
|
||||
NULL,NULL,NULL);
|
||||
if (png_ptr == NULL){
|
||||
error = "Couldn't allocate memory for PNG file or incompatible PNG dll";
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Allocate/initialize the memory for image information. REQUIRED. */
|
||||
info_ptr = lib.png_create_info_struct(png_ptr);
|
||||
if (info_ptr == NULL) {
|
||||
error = "Couldn't create image information for PNG file";
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Set error handling if you are using setjmp/longjmp method (this is
|
||||
* the normal method of doing things with libpng). REQUIRED unless you
|
||||
* set up your own error handlers in png_create_read_struct() earlier.
|
||||
*/
|
||||
|
||||
#ifdef PNG_SETJMP_SUPPORTED
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable:4611) /* warning C4611: interaction between '_setjmp' and C++ object destruction is non-portable */
|
||||
#endif
|
||||
#ifndef LIBPNG_VERSION_12
|
||||
if ( setjmp(*lib.png_set_longjmp_fn(png_ptr, longjmp, sizeof (jmp_buf))) )
|
||||
#else
|
||||
if ( setjmp(png_ptr->jmpbuf) )
|
||||
#endif
|
||||
{
|
||||
error = "Error reading the PNG file.";
|
||||
goto done;
|
||||
}
|
||||
#endif
|
||||
/* Set up the input control */
|
||||
lib.png_set_read_fn(png_ptr, src, png_read_data);
|
||||
|
||||
/* Read PNG header info */
|
||||
lib.png_read_info(png_ptr, info_ptr);
|
||||
lib.png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth,
|
||||
&color_type, &interlace_type, NULL, NULL);
|
||||
|
||||
/* tell libpng to strip 16 bit/color files down to 8 bits/color */
|
||||
lib.png_set_strip_16(png_ptr);
|
||||
|
||||
/* tell libpng to de-interlace (if the image is interlaced) */
|
||||
lib.png_set_interlace_handling(png_ptr);
|
||||
|
||||
/* Extract multiple pixels with bit depths of 1, 2, and 4 from a single
|
||||
* byte into separate bytes (useful for paletted and grayscale images).
|
||||
*/
|
||||
lib.png_set_packing(png_ptr);
|
||||
|
||||
/* scale greyscale values to the range 0..255 */
|
||||
if (color_type == PNG_COLOR_TYPE_GRAY)
|
||||
lib.png_set_expand(png_ptr);
|
||||
|
||||
/* For images with a single "transparent colour", set colour key;
|
||||
if more than one index has transparency, or if partially transparent
|
||||
entries exist, use full alpha channel */
|
||||
if (lib.png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) {
|
||||
int num_trans;
|
||||
Uint8 *trans;
|
||||
lib.png_get_tRNS(png_ptr, info_ptr, &trans, &num_trans, &transv);
|
||||
if (color_type == PNG_COLOR_TYPE_PALETTE) {
|
||||
/* Check if all tRNS entries are opaque except one */
|
||||
int j, t = -1;
|
||||
for (j = 0; j < num_trans; j++) {
|
||||
if (trans[j] == 0) {
|
||||
if (t >= 0) {
|
||||
break;
|
||||
}
|
||||
t = j;
|
||||
} else if (trans[j] != 255) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (j == num_trans) {
|
||||
/* exactly one transparent index */
|
||||
ckey = t;
|
||||
} else {
|
||||
/* more than one transparent index, or translucency */
|
||||
lib.png_set_expand(png_ptr);
|
||||
}
|
||||
} else {
|
||||
ckey = 0; /* actual value will be set later */
|
||||
}
|
||||
}
|
||||
|
||||
if ( color_type == PNG_COLOR_TYPE_GRAY_ALPHA )
|
||||
lib.png_set_gray_to_rgb(png_ptr);
|
||||
|
||||
lib.png_read_update_info(png_ptr, info_ptr);
|
||||
|
||||
lib.png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth,
|
||||
&color_type, &interlace_type, NULL, NULL);
|
||||
|
||||
/* Allocate the SDL surface to hold the image */
|
||||
Rmask = Gmask = Bmask = Amask = 0 ;
|
||||
num_channels = lib.png_get_channels(png_ptr, info_ptr);
|
||||
if ( num_channels >= 3 ) {
|
||||
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
|
||||
Rmask = 0x000000FF;
|
||||
Gmask = 0x0000FF00;
|
||||
Bmask = 0x00FF0000;
|
||||
Amask = (num_channels == 4) ? 0xFF000000 : 0;
|
||||
#else
|
||||
int s = (num_channels == 4) ? 0 : 8;
|
||||
Rmask = 0xFF000000 >> s;
|
||||
Gmask = 0x00FF0000 >> s;
|
||||
Bmask = 0x0000FF00 >> s;
|
||||
Amask = 0x000000FF >> s;
|
||||
#endif
|
||||
}
|
||||
surface = SDL_CreateRGBSurface(SDL_SWSURFACE, width, height,
|
||||
bit_depth*num_channels, Rmask,Gmask,Bmask,Amask);
|
||||
if ( surface == NULL ) {
|
||||
error = SDL_GetError();
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (ckey != -1) {
|
||||
if (color_type != PNG_COLOR_TYPE_PALETTE) {
|
||||
/* FIXME: Should these be truncated or shifted down? */
|
||||
ckey = SDL_MapRGB(surface->format,
|
||||
(Uint8)transv->red,
|
||||
(Uint8)transv->green,
|
||||
(Uint8)transv->blue);
|
||||
}
|
||||
SDL_SetColorKey(surface, SDL_TRUE, ckey);
|
||||
}
|
||||
|
||||
/* Create the array of pointers to image data */
|
||||
row_pointers = (png_bytep*) SDL_malloc(sizeof(png_bytep)*height);
|
||||
if (!row_pointers) {
|
||||
error = "Out of memory";
|
||||
goto done;
|
||||
}
|
||||
for (row = 0; row < (int)height; row++) {
|
||||
row_pointers[row] = (png_bytep)
|
||||
(Uint8 *)surface->pixels + row*surface->pitch;
|
||||
}
|
||||
|
||||
/* Read the entire image in one go */
|
||||
lib.png_read_image(png_ptr, row_pointers);
|
||||
|
||||
/* and we're done! (png_read_end() can be omitted if no processing of
|
||||
* post-IDAT text/time/etc. is desired)
|
||||
* In some cases it can't read PNG's created by some popular programs (ACDSEE),
|
||||
* we do not want to process comments, so we omit png_read_end
|
||||
|
||||
lib.png_read_end(png_ptr, info_ptr);
|
||||
*/
|
||||
|
||||
/* Load the palette, if any */
|
||||
palette = surface->format->palette;
|
||||
if ( palette ) {
|
||||
int png_num_palette;
|
||||
png_colorp png_palette;
|
||||
lib.png_get_PLTE(png_ptr, info_ptr, &png_palette, &png_num_palette);
|
||||
if (color_type == PNG_COLOR_TYPE_GRAY) {
|
||||
palette->ncolors = 256;
|
||||
for (i = 0; i < 256; i++) {
|
||||
palette->colors[i].r = (Uint8)i;
|
||||
palette->colors[i].g = (Uint8)i;
|
||||
palette->colors[i].b = (Uint8)i;
|
||||
}
|
||||
} else if (png_num_palette > 0 ) {
|
||||
palette->ncolors = png_num_palette;
|
||||
for ( i=0; i<png_num_palette; ++i ) {
|
||||
palette->colors[i].b = png_palette[i].blue;
|
||||
palette->colors[i].g = png_palette[i].green;
|
||||
palette->colors[i].r = png_palette[i].red;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
done: /* Clean up and return */
|
||||
if ( png_ptr ) {
|
||||
lib.png_destroy_read_struct(&png_ptr,
|
||||
info_ptr ? &info_ptr : (png_infopp)0,
|
||||
(png_infopp)0);
|
||||
}
|
||||
if ( row_pointers ) {
|
||||
SDL_free(row_pointers);
|
||||
}
|
||||
if ( error ) {
|
||||
SDL_RWseek(src, start, RW_SEEK_SET);
|
||||
if ( surface ) {
|
||||
SDL_FreeSurface(surface);
|
||||
surface = NULL;
|
||||
}
|
||||
IMG_SetError("%s", error);
|
||||
}
|
||||
return(surface);
|
||||
}
|
||||
|
||||
#elif defined(USE_STBIMAGE)
|
||||
|
||||
extern SDL_Surface *IMG_LoadSTB_RW(SDL_RWops *src);
|
||||
|
||||
int IMG_InitPNG()
|
||||
{
|
||||
/* Nothing to load */
|
||||
return 0;
|
||||
}
|
||||
|
||||
void IMG_QuitPNG()
|
||||
{
|
||||
/* Nothing to unload */
|
||||
}
|
||||
|
||||
/* FIXME: This is a copypaste from LIBPNG! Pull that out of the ifdefs */
|
||||
/* See if an image is contained in a data source */
|
||||
int IMG_isPNG(SDL_RWops *src)
|
||||
{
|
||||
Sint64 start;
|
||||
int is_PNG;
|
||||
Uint8 magic[4];
|
||||
|
||||
if ( !src ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
start = SDL_RWtell(src);
|
||||
is_PNG = 0;
|
||||
if ( SDL_RWread(src, magic, 1, sizeof(magic)) == sizeof(magic) ) {
|
||||
if ( magic[0] == 0x89 &&
|
||||
magic[1] == 'P' &&
|
||||
magic[2] == 'N' &&
|
||||
magic[3] == 'G' ) {
|
||||
is_PNG = 1;
|
||||
}
|
||||
}
|
||||
SDL_RWseek(src, start, RW_SEEK_SET);
|
||||
return(is_PNG);
|
||||
}
|
||||
|
||||
/* Load a PNG type image from an SDL datasource */
|
||||
SDL_Surface *IMG_LoadPNG_RW(SDL_RWops *src)
|
||||
{
|
||||
return IMG_LoadSTB_RW(src);
|
||||
}
|
||||
|
||||
#endif /* WANT_LIBPNG */
|
||||
|
||||
#else
|
||||
#if _MSC_VER >= 1300
|
||||
#pragma warning(disable : 4100) /* warning C4100: 'op' : unreferenced formal parameter */
|
||||
#endif
|
||||
|
||||
int IMG_InitPNG()
|
||||
{
|
||||
IMG_SetError("PNG images are not supported");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
void IMG_QuitPNG()
|
||||
{
|
||||
}
|
||||
|
||||
/* See if an image is contained in a data source */
|
||||
int IMG_isPNG(SDL_RWops *src)
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
||||
/* Load a PNG type image from an SDL datasource */
|
||||
SDL_Surface *IMG_LoadPNG_RW(SDL_RWops *src)
|
||||
{
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
#endif /* LOAD_PNG */
|
||||
|
||||
#if SDL_IMAGE_SAVE_PNG
|
||||
|
||||
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
|
||||
static const Uint32 png_format = SDL_PIXELFORMAT_ABGR8888;
|
||||
#else
|
||||
static const Uint32 png_format = SDL_PIXELFORMAT_RGBA8888;
|
||||
#endif
|
||||
|
||||
#ifdef USE_LIBPNG
|
||||
|
||||
static void png_write_data(png_structp png_ptr, png_bytep src, png_size_t size)
|
||||
{
|
||||
SDL_RWops *dst = (SDL_RWops *)lib.png_get_io_ptr(png_ptr);
|
||||
SDL_RWwrite(dst, src, size, 1);
|
||||
}
|
||||
|
||||
static void png_flush_data(png_structp png_ptr)
|
||||
{
|
||||
(void)png_ptr;
|
||||
}
|
||||
|
||||
static int IMG_SavePNG_RW_libpng(SDL_Surface *surface, SDL_RWops *dst, int freedst)
|
||||
{
|
||||
if (dst) {
|
||||
png_structp png_ptr;
|
||||
png_infop info_ptr;
|
||||
png_colorp color_ptr = NULL;
|
||||
Uint8 transparent_table[256];
|
||||
SDL_Surface *source = surface;
|
||||
SDL_Palette *palette;
|
||||
int png_color_type = PNG_COLOR_TYPE_RGB_ALPHA;
|
||||
|
||||
png_ptr = lib.png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
|
||||
if (png_ptr == NULL) {
|
||||
IMG_SetError("Couldn't allocate memory for PNG file or incompatible PNG dll");
|
||||
return -1;
|
||||
}
|
||||
|
||||
info_ptr = lib.png_create_info_struct(png_ptr);
|
||||
if (info_ptr == NULL) {
|
||||
lib.png_destroy_write_struct(&png_ptr, NULL);
|
||||
IMG_SetError("Couldn't create image information for PNG file");
|
||||
return -1;
|
||||
}
|
||||
#ifdef PNG_SETJMP_SUPPORTED
|
||||
#ifndef LIBPNG_VERSION_12
|
||||
if (setjmp(*lib.png_set_longjmp_fn(png_ptr, longjmp, sizeof (jmp_buf))))
|
||||
#else
|
||||
if (setjmp(png_ptr->jmpbuf))
|
||||
#endif
|
||||
#endif
|
||||
{
|
||||
lib.png_destroy_write_struct(&png_ptr, &info_ptr);
|
||||
IMG_SetError("Error writing the PNG file.");
|
||||
return -1;
|
||||
}
|
||||
|
||||
palette = surface->format->palette;
|
||||
if (palette) {
|
||||
const int ncolors = palette->ncolors;
|
||||
int i;
|
||||
int last_transparent = -1;
|
||||
|
||||
color_ptr = (png_colorp)SDL_malloc(sizeof(png_colorp) * ncolors);
|
||||
if (color_ptr == NULL)
|
||||
{
|
||||
lib.png_destroy_write_struct(&png_ptr, &info_ptr);
|
||||
IMG_SetError("Couldn't create palette for PNG file");
|
||||
return -1;
|
||||
}
|
||||
for (i = 0; i < ncolors; i++) {
|
||||
color_ptr[i].red = palette->colors[i].r;
|
||||
color_ptr[i].green = palette->colors[i].g;
|
||||
color_ptr[i].blue = palette->colors[i].b;
|
||||
if (palette->colors[i].a != 255) {
|
||||
last_transparent = i;
|
||||
}
|
||||
}
|
||||
lib.png_set_PLTE(png_ptr, info_ptr, color_ptr, ncolors);
|
||||
png_color_type = PNG_COLOR_TYPE_PALETTE;
|
||||
|
||||
if (last_transparent >= 0) {
|
||||
for (i = 0; i <= last_transparent; ++i) {
|
||||
transparent_table[i] = palette->colors[i].a;
|
||||
}
|
||||
lib.png_set_tRNS(png_ptr, info_ptr, transparent_table, last_transparent + 1, NULL);
|
||||
}
|
||||
}
|
||||
else if (surface->format->format == SDL_PIXELFORMAT_RGB24) {
|
||||
png_color_type = PNG_COLOR_TYPE_RGB;
|
||||
}
|
||||
else if (surface->format->format != png_format) {
|
||||
source = SDL_ConvertSurfaceFormat(surface, png_format, 0);
|
||||
}
|
||||
|
||||
lib.png_set_write_fn(png_ptr, dst, png_write_data, png_flush_data);
|
||||
|
||||
lib.png_set_IHDR(png_ptr, info_ptr, surface->w, surface->h,
|
||||
8, png_color_type, PNG_INTERLACE_NONE,
|
||||
PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
|
||||
|
||||
if (source) {
|
||||
png_bytep *row_pointers;
|
||||
int row;
|
||||
|
||||
row_pointers = (png_bytep *) SDL_malloc(sizeof(png_bytep) * source->h);
|
||||
if (!row_pointers) {
|
||||
lib.png_destroy_write_struct(&png_ptr, &info_ptr);
|
||||
IMG_SetError("Out of memory");
|
||||
return -1;
|
||||
}
|
||||
for (row = 0; row < (int)source->h; row++) {
|
||||
row_pointers[row] = (png_bytep) (Uint8 *) source->pixels + row * source->pitch;
|
||||
}
|
||||
|
||||
lib.png_set_rows(png_ptr, info_ptr, row_pointers);
|
||||
lib.png_write_png(png_ptr, info_ptr, PNG_TRANSFORM_IDENTITY, NULL);
|
||||
|
||||
SDL_free(row_pointers);
|
||||
if (source != surface) {
|
||||
SDL_FreeSurface(source);
|
||||
}
|
||||
}
|
||||
lib.png_destroy_write_struct(&png_ptr, &info_ptr);
|
||||
if (color_ptr) {
|
||||
SDL_free(color_ptr);
|
||||
}
|
||||
if (freedst) {
|
||||
SDL_RWclose(dst);
|
||||
}
|
||||
} else {
|
||||
IMG_SetError("Passed NULL dst");
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* USE_LIBPNG */
|
||||
|
||||
#if defined(LOAD_PNG_DYNAMIC) || !defined(WANT_LIBPNG)
|
||||
/* Replace C runtime functions with SDL C runtime functions for building on Windows */
|
||||
#define MINIZ_NO_STDIO
|
||||
#define MINIZ_NO_TIME
|
||||
#define MINIZ_SDL_MALLOC
|
||||
#define MZ_ASSERT(x) SDL_assert(x)
|
||||
#undef memcpy
|
||||
#define memcpy SDL_memcpy
|
||||
#undef memset
|
||||
#define memset SDL_memset
|
||||
#define strlen SDL_strlen
|
||||
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
|
||||
#define MINIZ_LITTLE_ENDIAN 1
|
||||
#else
|
||||
#define MINIZ_LITTLE_ENDIAN 0
|
||||
#endif
|
||||
#define MINIZ_USE_UNALIGNED_LOADS_AND_STORES 0
|
||||
#define MINIZ_SDL_NOUNUSED
|
||||
#include "miniz.h"
|
||||
|
||||
static int IMG_SavePNG_RW_miniz(SDL_Surface *surface, SDL_RWops *dst, int freedst)
|
||||
{
|
||||
int result = -1;
|
||||
|
||||
if (dst) {
|
||||
size_t size = 0;
|
||||
void *png = NULL;
|
||||
|
||||
if (surface->format->format == png_format) {
|
||||
png = tdefl_write_image_to_png_file_in_memory(surface->pixels, surface->w, surface->h, surface->format->BytesPerPixel, surface->pitch, &size);
|
||||
} else {
|
||||
SDL_Surface *cvt = SDL_ConvertSurfaceFormat(surface, png_format, 0);
|
||||
if (cvt) {
|
||||
png = tdefl_write_image_to_png_file_in_memory(cvt->pixels, cvt->w, cvt->h, cvt->format->BytesPerPixel, cvt->pitch, &size);
|
||||
SDL_FreeSurface(cvt);
|
||||
}
|
||||
}
|
||||
if (png) {
|
||||
if (SDL_RWwrite(dst, png, size, 1)) {
|
||||
result = 0;
|
||||
}
|
||||
mz_free(png); /* calls SDL_free() */
|
||||
} else {
|
||||
IMG_SetError("Failed to convert and save image");
|
||||
}
|
||||
if (freedst) {
|
||||
SDL_RWclose(dst);
|
||||
}
|
||||
} else {
|
||||
IMG_SetError("Passed NULL dst");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#endif /* LOAD_PNG_DYNAMIC || !WANT_LIBPNG */
|
||||
|
||||
#endif /* SDL_IMAGE_SAVE_PNG */
|
||||
|
||||
int IMG_SavePNG(SDL_Surface *surface, const char *file)
|
||||
{
|
||||
SDL_RWops *dst = SDL_RWFromFile(file, "wb");
|
||||
if (dst) {
|
||||
return IMG_SavePNG_RW(surface, dst, 1);
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
int IMG_SavePNG_RW(SDL_Surface *surface, SDL_RWops *dst, int freedst)
|
||||
{
|
||||
#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) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if defined(LOAD_PNG_DYNAMIC) || !defined(WANT_LIBPNG)
|
||||
return IMG_SavePNG_RW_miniz(surface, dst, freedst);
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
#else
|
||||
return IMG_SetError("SDL_image built without PNG save support");
|
||||
|
||||
#endif /* SDL_IMAGE_SAVE_PNG */
|
||||
}
|
||||
263
Library/SDL2_image-2.5.2/IMG_pnm.c
Normal file
263
Library/SDL2_image-2.5.2/IMG_pnm.c
Normal file
@@ -0,0 +1,263 @@
|
||||
/*
|
||||
SDL_image: An example image loading library for use with SDL
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
/*
|
||||
* PNM (portable anymap) image loader:
|
||||
*
|
||||
* Supports: PBM, PGM and PPM, ASCII and binary formats
|
||||
* (PBM and PGM are loaded as 8bpp surfaces)
|
||||
* Does not support: maximum component value > 255
|
||||
*/
|
||||
|
||||
#include "SDL_image.h"
|
||||
|
||||
#ifdef LOAD_PNM
|
||||
|
||||
/* See if an image is contained in a data source */
|
||||
int IMG_isPNM(SDL_RWops *src)
|
||||
{
|
||||
Sint64 start;
|
||||
int is_PNM;
|
||||
char magic[2];
|
||||
|
||||
if ( !src )
|
||||
return 0;
|
||||
start = SDL_RWtell(src);
|
||||
is_PNM = 0;
|
||||
if ( SDL_RWread(src, magic, sizeof(magic), 1) ) {
|
||||
/*
|
||||
* PNM magic signatures:
|
||||
* P1 PBM, ascii format
|
||||
* P2 PGM, ascii format
|
||||
* P3 PPM, ascii format
|
||||
* P4 PBM, binary format
|
||||
* P5 PGM, binary format
|
||||
* P6 PPM, binary format
|
||||
* P7 PAM, a general wrapper for PNM data
|
||||
*/
|
||||
if ( magic[0] == 'P' && magic[1] >= '1' && magic[1] <= '6' ) {
|
||||
is_PNM = 1;
|
||||
}
|
||||
}
|
||||
SDL_RWseek(src, start, RW_SEEK_SET);
|
||||
return(is_PNM);
|
||||
}
|
||||
|
||||
/* read a non-negative integer from the source. return -1 upon error */
|
||||
static int ReadNumber(SDL_RWops *src)
|
||||
{
|
||||
int number;
|
||||
unsigned char ch;
|
||||
|
||||
/* Initialize return value */
|
||||
number = 0;
|
||||
|
||||
/* Skip leading whitespace */
|
||||
do {
|
||||
if ( ! SDL_RWread(src, &ch, 1, 1) ) {
|
||||
return(-1);
|
||||
}
|
||||
/* Eat comments as whitespace */
|
||||
if ( ch == '#' ) { /* Comment is '#' to end of line */
|
||||
do {
|
||||
if ( ! SDL_RWread(src, &ch, 1, 1) ) {
|
||||
return -1;
|
||||
}
|
||||
} while ( (ch != '\r') && (ch != '\n') );
|
||||
}
|
||||
} while ( SDL_isspace(ch) );
|
||||
|
||||
/* Add up the number */
|
||||
if (!SDL_isdigit(ch)) {
|
||||
return -1;
|
||||
}
|
||||
do {
|
||||
/* Protect from possible overflow */
|
||||
if (number >= (SDL_MAX_SINT32 / 10)) {
|
||||
return -1;
|
||||
}
|
||||
number *= 10;
|
||||
number += ch-'0';
|
||||
|
||||
if ( !SDL_RWread(src, &ch, 1, 1) ) {
|
||||
return -1;
|
||||
}
|
||||
} while ( SDL_isdigit(ch) );
|
||||
|
||||
return(number);
|
||||
}
|
||||
|
||||
SDL_Surface *IMG_LoadPNM_RW(SDL_RWops *src)
|
||||
{
|
||||
Sint64 start;
|
||||
SDL_Surface *surface = NULL;
|
||||
int width, height;
|
||||
int maxval, y, bpl;
|
||||
Uint8 *row;
|
||||
Uint8 *buf = NULL;
|
||||
char *error = NULL;
|
||||
Uint8 magic[2];
|
||||
int ascii;
|
||||
enum { PBM, PGM, PPM, PAM } kind;
|
||||
|
||||
#define ERROR(s) do { error = (s); goto done; } while(0)
|
||||
|
||||
if ( !src ) {
|
||||
/* The error message has been set in SDL_RWFromFile */
|
||||
return NULL;
|
||||
}
|
||||
start = SDL_RWtell(src);
|
||||
|
||||
SDL_RWread(src, magic, 2, 1);
|
||||
kind = magic[1] - '1';
|
||||
ascii = 1;
|
||||
if(kind >= 3) {
|
||||
ascii = 0;
|
||||
kind -= 3;
|
||||
}
|
||||
|
||||
width = ReadNumber(src);
|
||||
height = ReadNumber(src);
|
||||
if(width <= 0 || height <= 0)
|
||||
ERROR("Unable to read image width and height");
|
||||
|
||||
if(kind != PBM) {
|
||||
maxval = ReadNumber(src);
|
||||
if(maxval <= 0 || maxval > 255)
|
||||
ERROR("unsupported PNM format");
|
||||
} else
|
||||
maxval = 255; /* never scale PBMs */
|
||||
|
||||
/* binary PNM allows just a single character of whitespace after
|
||||
the last parameter, and we've already consumed it */
|
||||
|
||||
if(kind == PPM) {
|
||||
/* 24-bit surface in R,G,B byte order */
|
||||
surface = SDL_CreateRGBSurface(SDL_SWSURFACE, width, height, 24,
|
||||
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
|
||||
0x000000ff, 0x0000ff00, 0x00ff0000,
|
||||
#else
|
||||
0x00ff0000, 0x0000ff00, 0x000000ff,
|
||||
#endif
|
||||
0);
|
||||
} else {
|
||||
/* load PBM/PGM as 8-bit indexed images */
|
||||
surface = SDL_CreateRGBSurface(SDL_SWSURFACE, width, height, 8,
|
||||
0, 0, 0, 0);
|
||||
}
|
||||
if ( surface == NULL )
|
||||
ERROR("Out of memory");
|
||||
bpl = width * surface->format->BytesPerPixel;
|
||||
if(kind == PGM) {
|
||||
SDL_Color *c = surface->format->palette->colors;
|
||||
int i;
|
||||
for(i = 0; i < 256; i++)
|
||||
c[i].r = c[i].g = c[i].b = i;
|
||||
surface->format->palette->ncolors = 256;
|
||||
} else if(kind == PBM) {
|
||||
/* for some reason PBM has 1=black, 0=white */
|
||||
SDL_Color *c = surface->format->palette->colors;
|
||||
c[0].r = c[0].g = c[0].b = 255;
|
||||
c[1].r = c[1].g = c[1].b = 0;
|
||||
surface->format->palette->ncolors = 2;
|
||||
bpl = (width + 7) >> 3;
|
||||
buf = (Uint8 *)SDL_malloc(bpl);
|
||||
if(buf == NULL)
|
||||
ERROR("Out of memory");
|
||||
}
|
||||
|
||||
/* Read the image into the surface */
|
||||
row = (Uint8 *)surface->pixels;
|
||||
for(y = 0; y < height; y++) {
|
||||
if(ascii) {
|
||||
int i;
|
||||
if(kind == PBM) {
|
||||
for(i = 0; i < width; i++) {
|
||||
Uint8 ch;
|
||||
do {
|
||||
if(!SDL_RWread(src, &ch,
|
||||
1, 1))
|
||||
ERROR("file truncated");
|
||||
ch -= '0';
|
||||
} while(ch > 1);
|
||||
row[i] = ch;
|
||||
}
|
||||
} else {
|
||||
for(i = 0; i < bpl; i++) {
|
||||
int c;
|
||||
c = ReadNumber(src);
|
||||
if(c < 0)
|
||||
ERROR("file truncated");
|
||||
row[i] = c;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Uint8 *dst = (kind == PBM) ? buf : row;
|
||||
if(!SDL_RWread(src, dst, bpl, 1))
|
||||
ERROR("file truncated");
|
||||
if(kind == PBM) {
|
||||
/* expand bitmap to 8bpp */
|
||||
int i;
|
||||
for(i = 0; i < width; i++) {
|
||||
int bit = 7 - (i & 7);
|
||||
row[i] = (buf[i >> 3] >> bit) & 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(maxval < 255) {
|
||||
/* scale up to full dynamic range (slow) */
|
||||
int i;
|
||||
for(i = 0; i < bpl; i++)
|
||||
row[i] = row[i] * 255 / maxval;
|
||||
}
|
||||
row += surface->pitch;
|
||||
}
|
||||
done:
|
||||
SDL_free(buf);
|
||||
if(error) {
|
||||
SDL_RWseek(src, start, RW_SEEK_SET);
|
||||
if ( surface ) {
|
||||
SDL_FreeSurface(surface);
|
||||
surface = NULL;
|
||||
}
|
||||
IMG_SetError("%s", error);
|
||||
}
|
||||
return(surface);
|
||||
}
|
||||
|
||||
#else
|
||||
#if _MSC_VER >= 1300
|
||||
#pragma warning(disable : 4100) /* warning C4100: 'op' : unreferenced formal parameter */
|
||||
#endif
|
||||
|
||||
/* See if an image is contained in a data source */
|
||||
int IMG_isPNM(SDL_RWops *src)
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
||||
/* Load a PNM type image from an SDL datasource */
|
||||
SDL_Surface *IMG_LoadPNM_RW(SDL_RWops *src)
|
||||
{
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
#endif /* LOAD_PNM */
|
||||
126
Library/SDL2_image-2.5.2/IMG_qoi.c
Normal file
126
Library/SDL2_image-2.5.2/IMG_qoi.c
Normal file
@@ -0,0 +1,126 @@
|
||||
/*
|
||||
SDL_image: An example image loading library for use with SDL
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
/* This file use QOI library:
|
||||
* https://github.com/phoboslab/qoi
|
||||
*/
|
||||
|
||||
#include "SDL_image.h"
|
||||
#include <limits.h> /* for INT_MAX */
|
||||
|
||||
#ifdef LOAD_QOI
|
||||
|
||||
/* SDL < 2.0.12 compatibility */
|
||||
#ifndef SDL_zeroa
|
||||
#define SDL_zeroa(x) SDL_memset((x), 0, sizeof((x)))
|
||||
#endif
|
||||
|
||||
#define QOI_MALLOC(sz) SDL_malloc(sz)
|
||||
#define QOI_FREE(p) SDL_free(p)
|
||||
#define QOI_ZEROARR(a) SDL_zeroa(a)
|
||||
|
||||
#define QOI_NO_STDIO
|
||||
#define QOI_IMPLEMENTATION
|
||||
#include "qoi.h"
|
||||
|
||||
/* See if an image is contained in a data source */
|
||||
int IMG_isQOI(SDL_RWops *src)
|
||||
{
|
||||
Sint64 start;
|
||||
int is_QOI;
|
||||
char magic[4];
|
||||
|
||||
if ( !src )
|
||||
return 0;
|
||||
start = SDL_RWtell(src);
|
||||
is_QOI = 0;
|
||||
if ( SDL_RWread(src, magic, sizeof(magic), 1) ) {
|
||||
if ( SDL_strncmp(magic, "qoif", 4) == 0 ) {
|
||||
is_QOI = 1;
|
||||
}
|
||||
}
|
||||
SDL_RWseek(src, start, RW_SEEK_SET);
|
||||
return(is_QOI);
|
||||
}
|
||||
|
||||
/* Load a QOI type image from an SDL datasource */
|
||||
SDL_Surface *IMG_LoadQOI_RW(SDL_RWops *src)
|
||||
{
|
||||
void *data;
|
||||
size_t size;
|
||||
void *pixel_data;
|
||||
qoi_desc image_info;
|
||||
SDL_Surface *surface = NULL;
|
||||
|
||||
data = (void *)SDL_LoadFile_RW(src, &size, SDL_FALSE);
|
||||
if ( !data ) {
|
||||
return NULL;
|
||||
}
|
||||
if ( size > INT_MAX ) {
|
||||
SDL_free(data);
|
||||
IMG_SetError("QOI image is too big.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pixel_data = qoi_decode(data, (int)size, &image_info, 4);
|
||||
/* pixel_data is in R,G,B,A order regardless of endianness */
|
||||
SDL_free(data);
|
||||
if ( !pixel_data ) {
|
||||
IMG_SetError("Couldn't parse QOI image");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
surface = SDL_CreateRGBSurfaceWithFormatFrom(pixel_data,
|
||||
image_info.width,
|
||||
image_info.height,
|
||||
32,
|
||||
(image_info.width * 4),
|
||||
SDL_PIXELFORMAT_RGBA32);
|
||||
if ( !surface ) {
|
||||
SDL_free(pixel_data);
|
||||
IMG_SetError("Couldn't create SDL_Surface");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Let SDL manage the memory now */
|
||||
surface->flags &= ~SDL_PREALLOC;
|
||||
|
||||
return surface;
|
||||
}
|
||||
|
||||
#else
|
||||
#if _MSC_VER >= 1300
|
||||
#pragma warning(disable : 4100) /* warning C4100: 'op' : unreferenced formal parameter */
|
||||
#endif
|
||||
|
||||
/* See if an image is contained in a data source */
|
||||
int IMG_isQOI(SDL_RWops *src)
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
||||
/* Load a QOI type image from an SDL datasource */
|
||||
SDL_Surface *IMG_LoadQOI_RW(SDL_RWops *src)
|
||||
{
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
#endif /* LOAD_QOI */
|
||||
162
Library/SDL2_image-2.5.2/IMG_stb.c
Normal file
162
Library/SDL2_image-2.5.2/IMG_stb.c
Normal file
@@ -0,0 +1,162 @@
|
||||
/*
|
||||
SDL_image: An example image loading library for use with SDL
|
||||
Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#include "SDL_image.h"
|
||||
|
||||
#ifdef USE_STBIMAGE
|
||||
|
||||
#ifndef INT_MAX
|
||||
#define INT_MAX 0x7FFFFFFF
|
||||
#endif
|
||||
|
||||
#define malloc SDL_malloc
|
||||
#define realloc SDL_realloc
|
||||
#define free SDL_free
|
||||
#undef memcpy
|
||||
#define memcpy SDL_memcpy
|
||||
#undef memset
|
||||
#define memset SDL_memset
|
||||
#undef strcmp
|
||||
#define strcmp SDL_strcmp
|
||||
#undef strncmp
|
||||
#define strncmp SDL_strncmp
|
||||
#define strtol SDL_strtol
|
||||
|
||||
#define pow SDL_pow
|
||||
#define ldexp SDL_scalbn
|
||||
|
||||
#define STB_IMAGE_STATIC
|
||||
#define STBI_NO_THREAD_LOCALS
|
||||
#define STBI_FAILURE_USERMSG
|
||||
#if defined(__ARM_NEON)
|
||||
#define STBI_NEON
|
||||
#endif
|
||||
#define STBI_NO_STDIO
|
||||
#define STBI_ONLY_PNG
|
||||
#define STBI_ONLY_JPEG
|
||||
#define STBI_NO_GIF
|
||||
#define STBI_NO_HDR
|
||||
#define STBI_NO_LINEAR
|
||||
#define STBI_ASSERT SDL_assert
|
||||
#define STB_IMAGE_IMPLEMENTATION
|
||||
#include "stb_image.h"
|
||||
|
||||
static int IMG_LoadSTB_RW_read(void *user, char *data, int size)
|
||||
{
|
||||
return (int) SDL_RWread((SDL_RWops*) user, data, 1, size);
|
||||
}
|
||||
|
||||
static void IMG_LoadSTB_RW_skip(void *user, int n)
|
||||
{
|
||||
SDL_RWseek((SDL_RWops*) user, n, RW_SEEK_CUR);
|
||||
}
|
||||
|
||||
static int IMG_LoadSTB_RW_eof(void *user)
|
||||
{
|
||||
/* FIXME: Do we not have a way to detect EOF? -flibit */
|
||||
size_t bytes, filler;
|
||||
SDL_RWops *src = (SDL_RWops*) user;
|
||||
bytes = SDL_RWread(src, &filler, 1, 1);
|
||||
if (bytes != 1) { /* FIXME: Could also be an error... */
|
||||
return 1;
|
||||
}
|
||||
SDL_RWseek(src, -1, RW_SEEK_CUR);
|
||||
return 0;
|
||||
}
|
||||
|
||||
SDL_Surface *IMG_LoadSTB_RW(SDL_RWops *src)
|
||||
{
|
||||
Sint64 start;
|
||||
int w, h, format;
|
||||
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
|
||||
int shift;
|
||||
#endif
|
||||
Uint32 rmask, gmask, bmask, amask;
|
||||
stbi_uc *pixels;
|
||||
stbi_io_callbacks rw_callbacks;
|
||||
SDL_Surface *surface = NULL;
|
||||
|
||||
if ( !src ) {
|
||||
/* The error message has been set in SDL_RWFromFile */
|
||||
return NULL;
|
||||
}
|
||||
start = SDL_RWtell(src);
|
||||
|
||||
/* Load the image data */
|
||||
rw_callbacks.read = IMG_LoadSTB_RW_read;
|
||||
rw_callbacks.skip = IMG_LoadSTB_RW_skip;
|
||||
rw_callbacks.eof = IMG_LoadSTB_RW_eof;
|
||||
pixels = stbi_load_from_callbacks(
|
||||
&rw_callbacks,
|
||||
src,
|
||||
&w,
|
||||
&h,
|
||||
&format,
|
||||
STBI_default
|
||||
);
|
||||
if ( !pixels ) {
|
||||
SDL_RWseek(src, start, RW_SEEK_SET);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Determine the surface format */
|
||||
SDL_assert(format == STBI_rgb || format == STBI_rgb_alpha);
|
||||
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
|
||||
shift = (format == STBI_rgb) ? 8 : 0;
|
||||
rmask = 0xFF000000 >> shift;
|
||||
gmask = 0x00FF0000 >> shift;
|
||||
bmask = 0x0000FF00 >> shift;
|
||||
amask = 0x000000FF >> shift;
|
||||
#else /* little endian, like x86 */
|
||||
rmask = 0x000000FF;
|
||||
gmask = 0x0000FF00;
|
||||
bmask = 0x00FF0000;
|
||||
amask = (format == STBI_rgb) ? 0 : 0xFF000000;
|
||||
#endif
|
||||
|
||||
/* Allocate the surface */
|
||||
surface = SDL_CreateRGBSurfaceFrom(
|
||||
pixels,
|
||||
w,
|
||||
h,
|
||||
8 * format,
|
||||
w * format,
|
||||
rmask,
|
||||
gmask,
|
||||
bmask,
|
||||
amask
|
||||
);
|
||||
if ( !surface ) {
|
||||
/* The error message should already be set */
|
||||
stbi_image_free(pixels); /* calls SDL_free() */
|
||||
SDL_RWseek(src, start, RW_SEEK_SET);
|
||||
} else {
|
||||
/* FIXME: This sucks. It'd be better to allocate the surface first, then
|
||||
* write directly to the pixel buffer:
|
||||
* https://github.com/nothings/stb/issues/58
|
||||
* -flibit
|
||||
*/
|
||||
surface->flags &= ~SDL_PREALLOC;
|
||||
}
|
||||
return surface;
|
||||
}
|
||||
|
||||
#endif /* USE_STBIMAGE */
|
||||
192
Library/SDL2_image-2.5.2/IMG_svg.c
Normal file
192
Library/SDL2_image-2.5.2/IMG_svg.c
Normal file
@@ -0,0 +1,192 @@
|
||||
/*
|
||||
SDL_image: An example image loading library for use with SDL
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
/* This is an SVG image file loading framework, based on Nano SVG:
|
||||
* https://github.com/memononen/nanosvg
|
||||
*/
|
||||
|
||||
#include "SDL_image.h"
|
||||
|
||||
#ifdef LOAD_SVG
|
||||
|
||||
#if !SDL_VERSION_ATLEAST(2, 0, 16)
|
||||
/* SDL_roundf() is available starting with 2.0.16 */
|
||||
static float SDLCALL SDL_roundf(float x)
|
||||
{
|
||||
return (x >= 0.0f) ? SDL_floorf(x + 0.5f) : SDL_ceilf(x - 0.5f);
|
||||
}
|
||||
#endif /* SDL 2.0.16 */
|
||||
|
||||
/* Replace C runtime functions with SDL C runtime functions for building on Windows */
|
||||
#define free SDL_free
|
||||
#define malloc SDL_malloc
|
||||
#undef memcpy
|
||||
#define memcpy SDL_memcpy
|
||||
#undef memset
|
||||
#define memset SDL_memset
|
||||
#define qsort SDL_qsort
|
||||
#define realloc SDL_realloc
|
||||
#define sscanf SDL_sscanf
|
||||
#undef strchr
|
||||
#define strchr SDL_strchr
|
||||
#undef strcmp
|
||||
#define strcmp SDL_strcmp
|
||||
#undef strncmp
|
||||
#define strncmp SDL_strncmp
|
||||
#undef strncpy
|
||||
#define strncpy SDL_strlcpy
|
||||
#define strlen SDL_strlen
|
||||
#define strstr SDL_strstr
|
||||
#define strtol SDL_strtol
|
||||
#define strtoll SDL_strtoll
|
||||
|
||||
#define acosf SDL_acosf
|
||||
#define atan2f SDL_atan2f
|
||||
#define cosf SDL_cosf
|
||||
#define ceilf SDL_ceilf
|
||||
#define fabs SDL_fabs
|
||||
#define fabsf SDL_fabsf
|
||||
#define floorf SDL_floorf
|
||||
#define fmodf SDL_fmodf
|
||||
#define pow SDL_pow
|
||||
#define sinf SDL_sinf
|
||||
#define sqrt SDL_sqrt
|
||||
#define sqrtf SDL_sqrtf
|
||||
#define tanf SDL_tanf
|
||||
#define roundf SDL_roundf
|
||||
#ifndef FLT_MAX
|
||||
#define FLT_MAX 3.402823466e+38F
|
||||
#endif
|
||||
#undef HAVE_STDIO_H
|
||||
|
||||
#define NSVG_EXPORT static
|
||||
#define NANOSVG_IMPLEMENTATION
|
||||
#include "nanosvg.h"
|
||||
#define NANOSVGRAST_IMPLEMENTATION
|
||||
#include "nanosvgrast.h"
|
||||
|
||||
/* See if an image is contained in a data source */
|
||||
int IMG_isSVG(SDL_RWops *src)
|
||||
{
|
||||
Sint64 start;
|
||||
int is_SVG;
|
||||
char magic[4096];
|
||||
size_t magic_len;
|
||||
|
||||
if (!src)
|
||||
return 0;
|
||||
start = SDL_RWtell(src);
|
||||
is_SVG = 0;
|
||||
magic_len = SDL_RWread(src, magic, 1, sizeof(magic) - 1);
|
||||
magic[magic_len] = '\0';
|
||||
if (SDL_strstr(magic, "<svg")) {
|
||||
is_SVG = 1;
|
||||
}
|
||||
SDL_RWseek(src, start, RW_SEEK_SET);
|
||||
return(is_SVG);
|
||||
}
|
||||
|
||||
/* Load a SVG type image from an SDL datasource */
|
||||
SDL_Surface *IMG_LoadSizedSVG_RW(SDL_RWops *src, int width, int height)
|
||||
{
|
||||
char *data;
|
||||
struct NSVGimage *image;
|
||||
struct NSVGrasterizer *rasterizer;
|
||||
SDL_Surface *surface = NULL;
|
||||
float scale = 1.0f;
|
||||
|
||||
data = (char *)SDL_LoadFile_RW(src, NULL, SDL_FALSE);
|
||||
if (!data) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* For now just use default units of pixels at 96 DPI */
|
||||
image = nsvgParse(data, "px", 96.0f);
|
||||
SDL_free(data);
|
||||
if (!image || image->width <= 0.0f || image->height <= 0.0f) {
|
||||
IMG_SetError("Couldn't parse SVG image");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
rasterizer = nsvgCreateRasterizer();
|
||||
if (!rasterizer) {
|
||||
IMG_SetError("Couldn't create SVG rasterizer");
|
||||
nsvgDelete(image);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (width > 0 && height > 0) {
|
||||
float scale_x = (float)width / image->width;
|
||||
float scale_y = (float)height / image->height;
|
||||
|
||||
scale = SDL_min(scale_x, scale_y);
|
||||
} else if (width > 0) {
|
||||
scale = (float)width / image->width;
|
||||
} else if (height > 0) {
|
||||
scale = (float)height / image->height;
|
||||
} else {
|
||||
scale = 1.0f;
|
||||
}
|
||||
|
||||
surface = SDL_CreateRGBSurfaceWithFormat(0,
|
||||
(int)SDL_ceilf(image->width * scale),
|
||||
(int)SDL_ceilf(image->height * scale),
|
||||
32,
|
||||
SDL_PIXELFORMAT_RGBA32);
|
||||
|
||||
if (!surface) {
|
||||
nsvgDeleteRasterizer(rasterizer);
|
||||
nsvgDelete(image);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
nsvgRasterize(rasterizer, image, 0.0f, 0.0f, scale, (unsigned char *)surface->pixels, surface->w, surface->h, surface->pitch);
|
||||
nsvgDeleteRasterizer(rasterizer);
|
||||
nsvgDelete(image);
|
||||
|
||||
return surface;
|
||||
}
|
||||
|
||||
#else
|
||||
#if _MSC_VER >= 1300
|
||||
#pragma warning(disable : 4100) /* warning C4100: 'op' : unreferenced formal parameter */
|
||||
#endif
|
||||
|
||||
/* See if an image is contained in a data source */
|
||||
int IMG_isSVG(SDL_RWops *src)
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
||||
/* Load a SVG type image from an SDL datasource */
|
||||
SDL_Surface *IMG_LoadSizedSVG_RW(SDL_RWops *src, int width, int height)
|
||||
{
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
#endif /* LOAD_SVG */
|
||||
|
||||
/* Load a SVG type image from an SDL datasource */
|
||||
SDL_Surface *IMG_LoadSVG_RW(SDL_RWops *src)
|
||||
{
|
||||
return IMG_LoadSizedSVG_RW(src, 0, 0);
|
||||
}
|
||||
|
||||
338
Library/SDL2_image-2.5.2/IMG_tga.c
Normal file
338
Library/SDL2_image-2.5.2/IMG_tga.c
Normal file
@@ -0,0 +1,338 @@
|
||||
/*
|
||||
SDL_image: An example image loading library for use with SDL
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#if !defined(__APPLE__) || defined(SDL_IMAGE_USE_COMMON_BACKEND)
|
||||
|
||||
/* This is a Targa image file loading framework */
|
||||
|
||||
#include "SDL_endian.h"
|
||||
|
||||
#include "SDL_image.h"
|
||||
|
||||
#ifdef LOAD_TGA
|
||||
|
||||
/*
|
||||
* A TGA loader for the SDL library
|
||||
* Supports: Reading 8, 15, 16, 24 and 32bpp images, with alpha or colourkey,
|
||||
* uncompressed or RLE encoded.
|
||||
*
|
||||
* 2000-06-10 Mattias Engdegård <f91-men@nada.kth.se>: initial version
|
||||
* 2000-06-26 Mattias Engdegård <f91-men@nada.kth.se>: read greyscale TGAs
|
||||
* 2000-08-09 Mattias Engdegård <f91-men@nada.kth.se>: alpha inversion removed
|
||||
*/
|
||||
|
||||
struct TGAheader {
|
||||
Uint8 infolen; /* length of info field */
|
||||
Uint8 has_cmap; /* 1 if image has colormap, 0 otherwise */
|
||||
Uint8 type;
|
||||
|
||||
Uint8 cmap_start[2]; /* index of first colormap entry */
|
||||
Uint8 cmap_len[2]; /* number of entries in colormap */
|
||||
Uint8 cmap_bits; /* bits per colormap entry */
|
||||
|
||||
Uint8 yorigin[2]; /* image origin (ignored here) */
|
||||
Uint8 xorigin[2];
|
||||
Uint8 width[2]; /* image size */
|
||||
Uint8 height[2];
|
||||
Uint8 pixel_bits; /* bits/pixel */
|
||||
Uint8 flags;
|
||||
};
|
||||
|
||||
enum tga_type {
|
||||
TGA_TYPE_INDEXED = 1,
|
||||
TGA_TYPE_RGB = 2,
|
||||
TGA_TYPE_BW = 3,
|
||||
TGA_TYPE_RLE_INDEXED = 9,
|
||||
TGA_TYPE_RLE_RGB = 10,
|
||||
TGA_TYPE_RLE_BW = 11
|
||||
};
|
||||
|
||||
#define TGA_INTERLEAVE_MASK 0xc0
|
||||
#define TGA_INTERLEAVE_NONE 0x00
|
||||
#define TGA_INTERLEAVE_2WAY 0x40
|
||||
#define TGA_INTERLEAVE_4WAY 0x80
|
||||
|
||||
#define TGA_ORIGIN_MASK 0x30
|
||||
#define TGA_ORIGIN_LEFT 0x00
|
||||
#define TGA_ORIGIN_RIGHT 0x10
|
||||
#define TGA_ORIGIN_LOWER 0x00
|
||||
#define TGA_ORIGIN_UPPER 0x20
|
||||
|
||||
/* read/write unaligned little-endian 16-bit ints */
|
||||
#define LE16(p) ((p)[0] + ((p)[1] << 8))
|
||||
#define SETLE16(p, v) ((p)[0] = (v), (p)[1] = (v) >> 8)
|
||||
|
||||
/* Load a TGA type image from an SDL datasource */
|
||||
SDL_Surface *IMG_LoadTGA_RW(SDL_RWops *src)
|
||||
{
|
||||
Sint64 start;
|
||||
const char *error = NULL;
|
||||
struct TGAheader hdr;
|
||||
int rle = 0;
|
||||
int alpha = 0;
|
||||
int indexed = 0;
|
||||
int grey = 0;
|
||||
int ckey = -1;
|
||||
int ncols, w, h;
|
||||
SDL_Surface *img = NULL;
|
||||
Uint32 rmask, gmask, bmask, amask;
|
||||
Uint8 *dst;
|
||||
int i;
|
||||
int bpp;
|
||||
int lstep;
|
||||
Uint32 pixel;
|
||||
int count, rep;
|
||||
|
||||
if ( !src ) {
|
||||
/* The error message has been set in SDL_RWFromFile */
|
||||
return NULL;
|
||||
}
|
||||
start = SDL_RWtell(src);
|
||||
|
||||
if (!SDL_RWread(src, &hdr, sizeof(hdr), 1)) {
|
||||
error = "Error reading TGA data";
|
||||
goto error;
|
||||
}
|
||||
ncols = LE16(hdr.cmap_len);
|
||||
switch(hdr.type) {
|
||||
case TGA_TYPE_RLE_INDEXED:
|
||||
rle = 1;
|
||||
/* fallthrough */
|
||||
case TGA_TYPE_INDEXED:
|
||||
if (!hdr.has_cmap || hdr.pixel_bits != 8 || ncols > 256)
|
||||
goto unsupported;
|
||||
indexed = 1;
|
||||
break;
|
||||
|
||||
case TGA_TYPE_RLE_RGB:
|
||||
rle = 1;
|
||||
/* fallthrough */
|
||||
case TGA_TYPE_RGB:
|
||||
indexed = 0;
|
||||
break;
|
||||
|
||||
case TGA_TYPE_RLE_BW:
|
||||
rle = 1;
|
||||
/* fallthrough */
|
||||
case TGA_TYPE_BW:
|
||||
if (hdr.pixel_bits != 8)
|
||||
goto unsupported;
|
||||
/* Treat greyscale as 8bpp indexed images */
|
||||
indexed = grey = 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
goto unsupported;
|
||||
}
|
||||
|
||||
bpp = (hdr.pixel_bits + 7) >> 3;
|
||||
rmask = gmask = bmask = amask = 0;
|
||||
switch(hdr.pixel_bits) {
|
||||
case 8:
|
||||
if (!indexed) {
|
||||
goto unsupported;
|
||||
}
|
||||
break;
|
||||
|
||||
case 15:
|
||||
case 16:
|
||||
/* 15 and 16bpp both seem to use 5 bits/plane. The extra alpha bit
|
||||
is ignored for now. */
|
||||
rmask = 0x7c00;
|
||||
gmask = 0x03e0;
|
||||
bmask = 0x001f;
|
||||
break;
|
||||
|
||||
case 32:
|
||||
alpha = 1;
|
||||
/* fallthrough */
|
||||
case 24:
|
||||
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
|
||||
{
|
||||
int s = alpha ? 0 : 8;
|
||||
amask = 0x000000ff >> s;
|
||||
rmask = 0x0000ff00 >> s;
|
||||
gmask = 0x00ff0000 >> s;
|
||||
bmask = 0xff000000 >> s;
|
||||
}
|
||||
#else
|
||||
amask = alpha ? 0xff000000 : 0;
|
||||
rmask = 0x00ff0000;
|
||||
gmask = 0x0000ff00;
|
||||
bmask = 0x000000ff;
|
||||
#endif
|
||||
break;
|
||||
|
||||
default:
|
||||
goto unsupported;
|
||||
}
|
||||
|
||||
if ((hdr.flags & TGA_INTERLEAVE_MASK) != TGA_INTERLEAVE_NONE
|
||||
|| hdr.flags & TGA_ORIGIN_RIGHT) {
|
||||
goto unsupported;
|
||||
}
|
||||
|
||||
SDL_RWseek(src, hdr.infolen, RW_SEEK_CUR); /* skip info field */
|
||||
|
||||
w = LE16(hdr.width);
|
||||
h = LE16(hdr.height);
|
||||
img = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h,
|
||||
bpp * 8,
|
||||
rmask, gmask, bmask, amask);
|
||||
if (img == NULL) {
|
||||
error = "Out of memory";
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (hdr.has_cmap) {
|
||||
int palsiz = ncols * ((hdr.cmap_bits + 7) >> 3);
|
||||
if (indexed && !grey) {
|
||||
Uint8 *pal = (Uint8 *)SDL_malloc(palsiz), *p = pal;
|
||||
SDL_Color *colors = img->format->palette->colors;
|
||||
img->format->palette->ncolors = ncols;
|
||||
SDL_RWread(src, pal, palsiz, 1);
|
||||
for(i = 0; i < ncols; i++) {
|
||||
switch(hdr.cmap_bits) {
|
||||
case 15:
|
||||
case 16:
|
||||
{
|
||||
Uint16 c = p[0] + (p[1] << 8);
|
||||
p += 2;
|
||||
colors[i].r = (c >> 7) & 0xf8;
|
||||
colors[i].g = (c >> 2) & 0xf8;
|
||||
colors[i].b = c << 3;
|
||||
}
|
||||
break;
|
||||
case 24:
|
||||
case 32:
|
||||
colors[i].b = *p++;
|
||||
colors[i].g = *p++;
|
||||
colors[i].r = *p++;
|
||||
if (hdr.cmap_bits == 32 && *p++ < 128)
|
||||
ckey = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
SDL_free(pal);
|
||||
if (ckey >= 0)
|
||||
SDL_SetColorKey(img, SDL_TRUE, ckey);
|
||||
} else {
|
||||
/* skip unneeded colormap */
|
||||
SDL_RWseek(src, palsiz, RW_SEEK_CUR);
|
||||
}
|
||||
}
|
||||
|
||||
if (grey) {
|
||||
SDL_Color *colors = img->format->palette->colors;
|
||||
for(i = 0; i < 256; i++)
|
||||
colors[i].r = colors[i].g = colors[i].b = i;
|
||||
img->format->palette->ncolors = 256;
|
||||
}
|
||||
|
||||
if (hdr.flags & TGA_ORIGIN_UPPER) {
|
||||
lstep = img->pitch;
|
||||
dst = (Uint8 *)img->pixels;
|
||||
} else {
|
||||
lstep = -img->pitch;
|
||||
dst = (Uint8 *)img->pixels + (h - 1) * img->pitch;
|
||||
}
|
||||
|
||||
/* The RLE decoding code is slightly convoluted since we can't rely on
|
||||
spans not to wrap across scan lines */
|
||||
count = rep = 0;
|
||||
for(i = 0; i < h; i++) {
|
||||
if (rle) {
|
||||
int x = 0;
|
||||
for(;;) {
|
||||
Uint8 c;
|
||||
|
||||
if (count) {
|
||||
int n = count;
|
||||
if (n > w - x)
|
||||
n = w - x;
|
||||
SDL_RWread(src, dst + x * bpp, n * bpp, 1);
|
||||
count -= n;
|
||||
x += n;
|
||||
if (x == w)
|
||||
break;
|
||||
} else if (rep) {
|
||||
int n = rep;
|
||||
if (n > w - x)
|
||||
n = w - x;
|
||||
rep -= n;
|
||||
while (n--) {
|
||||
SDL_memcpy(dst + x * bpp, &pixel, bpp);
|
||||
x++;
|
||||
}
|
||||
if (x == w)
|
||||
break;
|
||||
}
|
||||
|
||||
SDL_RWread(src, &c, 1, 1);
|
||||
if (c & 0x80) {
|
||||
SDL_RWread(src, &pixel, bpp, 1);
|
||||
rep = (c & 0x7f) + 1;
|
||||
} else {
|
||||
count = c + 1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
SDL_RWread(src, dst, w * bpp, 1);
|
||||
}
|
||||
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
|
||||
if (bpp == 2) {
|
||||
/* swap byte order */
|
||||
int x;
|
||||
Uint16 *p = (Uint16 *)dst;
|
||||
for(x = 0; x < w; x++)
|
||||
p[x] = SDL_Swap16(p[x]);
|
||||
}
|
||||
#endif
|
||||
dst += lstep;
|
||||
}
|
||||
return img;
|
||||
|
||||
unsupported:
|
||||
error = "Unsupported TGA format";
|
||||
|
||||
error:
|
||||
SDL_RWseek(src, start, RW_SEEK_SET);
|
||||
if ( img ) {
|
||||
SDL_FreeSurface(img);
|
||||
}
|
||||
IMG_SetError("%s", error);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#else
|
||||
#if _MSC_VER >= 1300
|
||||
#pragma warning(disable : 4100) /* warning C4100: 'op' : unreferenced formal parameter */
|
||||
#endif
|
||||
|
||||
/* dummy TGA load routine */
|
||||
SDL_Surface *IMG_LoadTGA_RW(SDL_RWops *src)
|
||||
{
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
#endif /* LOAD_TGA */
|
||||
|
||||
#endif /* !defined(__APPLE__) || defined(SDL_IMAGE_USE_COMMON_BACKEND) */
|
||||
244
Library/SDL2_image-2.5.2/IMG_tif.c
Normal file
244
Library/SDL2_image-2.5.2/IMG_tif.c
Normal file
@@ -0,0 +1,244 @@
|
||||
/*
|
||||
SDL_image: An example image loading library for use with SDL
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#if !(defined(__APPLE__) || defined(SDL_IMAGE_USE_WIC_BACKEND)) || defined(SDL_IMAGE_USE_COMMON_BACKEND)
|
||||
|
||||
/* This is a TIFF image file loading framework */
|
||||
|
||||
#include "SDL_image.h"
|
||||
|
||||
#ifdef LOAD_TIF
|
||||
|
||||
#include <tiffio.h>
|
||||
|
||||
static struct {
|
||||
int loaded;
|
||||
void *handle;
|
||||
TIFF* (*TIFFClientOpen)(const char*, const char*, thandle_t, TIFFReadWriteProc, TIFFReadWriteProc, TIFFSeekProc, TIFFCloseProc, TIFFSizeProc, TIFFMapFileProc, TIFFUnmapFileProc);
|
||||
void (*TIFFClose)(TIFF*);
|
||||
int (*TIFFGetField)(TIFF*, ttag_t, ...);
|
||||
int (*TIFFReadRGBAImageOriented)(TIFF*, Uint32, Uint32, Uint32*, int, int);
|
||||
TIFFErrorHandler (*TIFFSetErrorHandler)(TIFFErrorHandler);
|
||||
} lib;
|
||||
|
||||
#ifdef LOAD_TIF_DYNAMIC
|
||||
#define FUNCTION_LOADER(FUNC, SIG) \
|
||||
lib.FUNC = (SIG) SDL_LoadFunction(lib.handle, #FUNC); \
|
||||
if (lib.FUNC == NULL) { SDL_UnloadObject(lib.handle); return -1; }
|
||||
#else
|
||||
#define FUNCTION_LOADER(FUNC, SIG) \
|
||||
lib.FUNC = FUNC;
|
||||
#endif
|
||||
|
||||
int IMG_InitTIF()
|
||||
{
|
||||
if ( lib.loaded == 0 ) {
|
||||
#ifdef LOAD_TIF_DYNAMIC
|
||||
lib.handle = SDL_LoadObject(LOAD_TIF_DYNAMIC);
|
||||
if ( lib.handle == NULL ) {
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
FUNCTION_LOADER(TIFFClientOpen, TIFF * (*)(const char*, const char*, thandle_t, TIFFReadWriteProc, TIFFReadWriteProc, TIFFSeekProc, TIFFCloseProc, TIFFSizeProc, TIFFMapFileProc, TIFFUnmapFileProc))
|
||||
FUNCTION_LOADER(TIFFClose, void (*)(TIFF*))
|
||||
FUNCTION_LOADER(TIFFGetField, int (*)(TIFF*, ttag_t, ...))
|
||||
FUNCTION_LOADER(TIFFReadRGBAImageOriented, int (*)(TIFF*, Uint32, Uint32, Uint32*, int, int))
|
||||
FUNCTION_LOADER(TIFFSetErrorHandler, TIFFErrorHandler (*)(TIFFErrorHandler))
|
||||
}
|
||||
++lib.loaded;
|
||||
|
||||
return 0;
|
||||
}
|
||||
void IMG_QuitTIF()
|
||||
{
|
||||
if ( lib.loaded == 0 ) {
|
||||
return;
|
||||
}
|
||||
if ( lib.loaded == 1 ) {
|
||||
#ifdef LOAD_TIF_DYNAMIC
|
||||
SDL_UnloadObject(lib.handle);
|
||||
#endif
|
||||
}
|
||||
--lib.loaded;
|
||||
}
|
||||
|
||||
/*
|
||||
* These are the thunking routine to use the SDL_RWops* routines from
|
||||
* libtiff's internals.
|
||||
*/
|
||||
|
||||
static tsize_t tiff_read(thandle_t fd, tdata_t buf, tsize_t size)
|
||||
{
|
||||
return (tsize_t)SDL_RWread((SDL_RWops*)fd, buf, 1, size);
|
||||
}
|
||||
|
||||
static toff_t tiff_seek(thandle_t fd, toff_t offset, int origin)
|
||||
{
|
||||
return SDL_RWseek((SDL_RWops*)fd, offset, origin);
|
||||
}
|
||||
|
||||
static tsize_t tiff_write(thandle_t fd, tdata_t buf, tsize_t size)
|
||||
{
|
||||
return (tsize_t)SDL_RWwrite((SDL_RWops*)fd, buf, 1, size);
|
||||
}
|
||||
|
||||
static int tiff_close(thandle_t fd)
|
||||
{
|
||||
/*
|
||||
* We don't want libtiff closing our SDL_RWops*, but if it's not given
|
||||
* a routine to try, and if the image isn't a TIFF, it'll segfault.
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tiff_map(thandle_t fd, tdata_t* pbase, toff_t* psize)
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
|
||||
static void tiff_unmap(thandle_t fd, tdata_t base, toff_t size)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
static toff_t tiff_size(thandle_t fd)
|
||||
{
|
||||
Sint64 save_pos;
|
||||
toff_t size;
|
||||
|
||||
save_pos = SDL_RWtell((SDL_RWops*)fd);
|
||||
SDL_RWseek((SDL_RWops*)fd, 0, RW_SEEK_END);
|
||||
size = SDL_RWtell((SDL_RWops*)fd);
|
||||
SDL_RWseek((SDL_RWops*)fd, save_pos, RW_SEEK_SET);
|
||||
return size;
|
||||
}
|
||||
|
||||
int IMG_isTIF(SDL_RWops* src)
|
||||
{
|
||||
Sint64 start;
|
||||
int is_TIF;
|
||||
Uint8 magic[4];
|
||||
|
||||
if ( !src )
|
||||
return 0;
|
||||
start = SDL_RWtell(src);
|
||||
is_TIF = 0;
|
||||
if ( SDL_RWread(src, magic, 1, sizeof(magic)) == sizeof(magic) ) {
|
||||
if ( (magic[0] == 'I' &&
|
||||
magic[1] == 'I' &&
|
||||
magic[2] == 0x2a &&
|
||||
magic[3] == 0x00) ||
|
||||
(magic[0] == 'M' &&
|
||||
magic[1] == 'M' &&
|
||||
magic[2] == 0x00 &&
|
||||
magic[3] == 0x2a) ) {
|
||||
is_TIF = 1;
|
||||
}
|
||||
}
|
||||
SDL_RWseek(src, start, RW_SEEK_SET);
|
||||
return(is_TIF);
|
||||
}
|
||||
|
||||
SDL_Surface* IMG_LoadTIF_RW(SDL_RWops* src)
|
||||
{
|
||||
Sint64 start;
|
||||
TIFF* tiff = NULL;
|
||||
SDL_Surface* surface = NULL;
|
||||
Uint32 img_width, img_height;
|
||||
Uint32 Rmask, Gmask, Bmask, Amask;
|
||||
|
||||
if ( !src ) {
|
||||
/* The error message has been set in SDL_RWFromFile */
|
||||
return NULL;
|
||||
}
|
||||
start = SDL_RWtell(src);
|
||||
|
||||
if ( (IMG_Init(IMG_INIT_TIF) & IMG_INIT_TIF) == 0 ) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* turn off memory mapped access with the m flag */
|
||||
tiff = lib.TIFFClientOpen("SDL_image", "rm", (thandle_t)src,
|
||||
tiff_read, tiff_write, tiff_seek, tiff_close, tiff_size, tiff_map, tiff_unmap);
|
||||
if(!tiff)
|
||||
goto error;
|
||||
|
||||
/* Retrieve the dimensions of the image from the TIFF tags */
|
||||
lib.TIFFGetField(tiff, TIFFTAG_IMAGEWIDTH, &img_width);
|
||||
lib.TIFFGetField(tiff, TIFFTAG_IMAGELENGTH, &img_height);
|
||||
|
||||
Rmask = 0x000000FF;
|
||||
Gmask = 0x0000FF00;
|
||||
Bmask = 0x00FF0000;
|
||||
Amask = 0xFF000000;
|
||||
surface = SDL_CreateRGBSurface(SDL_SWSURFACE, img_width, img_height, 32,
|
||||
Rmask, Gmask, Bmask, Amask);
|
||||
if(!surface)
|
||||
goto error;
|
||||
|
||||
if(!lib.TIFFReadRGBAImageOriented(tiff, img_width, img_height, (Uint32 *)surface->pixels, ORIENTATION_TOPLEFT, 0))
|
||||
goto error;
|
||||
|
||||
lib.TIFFClose(tiff);
|
||||
|
||||
return surface;
|
||||
|
||||
error:
|
||||
SDL_RWseek(src, start, RW_SEEK_SET);
|
||||
if (surface) {
|
||||
SDL_FreeSurface(surface);
|
||||
}
|
||||
if (tiff) {
|
||||
lib.TIFFClose(tiff);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#else
|
||||
#if _MSC_VER >= 1300
|
||||
#pragma warning(disable : 4100) /* warning C4100: 'op' : unreferenced formal parameter */
|
||||
#endif
|
||||
|
||||
int IMG_InitTIF()
|
||||
{
|
||||
IMG_SetError("TIFF images are not supported");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
void IMG_QuitTIF()
|
||||
{
|
||||
}
|
||||
|
||||
/* See if an image is contained in a data source */
|
||||
int IMG_isTIF(SDL_RWops *src)
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
||||
/* Load a TIFF type image from an SDL datasource */
|
||||
SDL_Surface *IMG_LoadTIF_RW(SDL_RWops *src)
|
||||
{
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
#endif /* LOAD_TIF */
|
||||
|
||||
#endif /* !defined(__APPLE__) || defined(SDL_IMAGE_USE_COMMON_BACKEND) */
|
||||
295
Library/SDL2_image-2.5.2/IMG_webp.c
Normal file
295
Library/SDL2_image-2.5.2/IMG_webp.c
Normal file
@@ -0,0 +1,295 @@
|
||||
/*
|
||||
SDL_image: An example image loading library for use with SDL
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
/* This is a WEBP image file loading framework */
|
||||
|
||||
#include "SDL_image.h"
|
||||
|
||||
#ifdef LOAD_WEBP
|
||||
|
||||
/*=============================================================================
|
||||
File: SDL_webp.c
|
||||
Purpose: A WEBP loader for the SDL library
|
||||
Revision:
|
||||
Created by: Michael Bonfils (Murlock) (26 November 2011)
|
||||
murlock42@gmail.com
|
||||
|
||||
=============================================================================*/
|
||||
|
||||
#include "SDL_endian.h"
|
||||
|
||||
#ifdef macintosh
|
||||
#define MACOS
|
||||
#endif
|
||||
#include <webp/decode.h>
|
||||
|
||||
static struct {
|
||||
int loaded;
|
||||
void *handle;
|
||||
#if WEBP_DECODER_ABI_VERSION < 0x0100
|
||||
VP8StatusCode (*WebPGetFeaturesInternal) (const uint8_t *data, uint32_t data_size, WebPBitstreamFeatures* const features, int decoder_abi_version);
|
||||
uint8_t* (*WebPDecodeRGBInto) (const uint8_t* data, uint32_t data_size, uint8_t* output_buffer, int output_buffer_size, int output_stride);
|
||||
uint8_t* (*WebPDecodeRGBAInto) (const uint8_t* data, uint32_t data_size, uint8_t* output_buffer, int output_buffer_size, int output_stride);
|
||||
#else
|
||||
VP8StatusCode (*WebPGetFeaturesInternal) (const uint8_t *data, size_t data_size, WebPBitstreamFeatures* features, int decoder_abi_version);
|
||||
uint8_t* (*WebPDecodeRGBInto) (const uint8_t* data, size_t data_size, uint8_t* output_buffer, size_t output_buffer_size, int output_stride);
|
||||
uint8_t* (*WebPDecodeRGBAInto) (const uint8_t* data, size_t data_size, uint8_t* output_buffer, size_t output_buffer_size, int output_stride);
|
||||
#endif
|
||||
} lib;
|
||||
|
||||
#ifdef LOAD_WEBP_DYNAMIC
|
||||
#define FUNCTION_LOADER(FUNC, SIG) \
|
||||
lib.FUNC = (SIG) SDL_LoadFunction(lib.handle, #FUNC); \
|
||||
if (lib.FUNC == NULL) { SDL_UnloadObject(lib.handle); return -1; }
|
||||
#else
|
||||
#define FUNCTION_LOADER(FUNC, SIG) \
|
||||
lib.FUNC = FUNC; \
|
||||
if (lib.FUNC == NULL) { IMG_SetError("Missing webp.framework"); return -1; }
|
||||
#endif
|
||||
|
||||
int IMG_InitWEBP()
|
||||
{
|
||||
if ( lib.loaded == 0 ) {
|
||||
#ifdef LOAD_WEBP_DYNAMIC
|
||||
lib.handle = SDL_LoadObject(LOAD_WEBP_DYNAMIC);
|
||||
if ( lib.handle == NULL ) {
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
#if WEBP_DECODER_ABI_VERSION < 0x0100
|
||||
FUNCTION_LOADER(WebPGetFeaturesInternal, VP8StatusCode (*) (const uint8_t *data, uint32_t data_size, WebPBitstreamFeatures* const features, int decoder_abi_version))
|
||||
FUNCTION_LOADER(WebPDecodeRGBInto, uint8_t * (*) (const uint8_t* data, uint32_t data_size, uint8_t* output_buffer, int output_buffer_size, int output_stride))
|
||||
FUNCTION_LOADER(WebPDecodeRGBAInto, uint8_t * (*) (const uint8_t* data, uint32_t data_size, uint8_t* output_buffer, int output_buffer_size, int output_stride))
|
||||
#else
|
||||
FUNCTION_LOADER(WebPGetFeaturesInternal, VP8StatusCode (*) (const uint8_t *data, size_t data_size, WebPBitstreamFeatures* features, int decoder_abi_version))
|
||||
FUNCTION_LOADER(WebPDecodeRGBInto, uint8_t * (*) (const uint8_t* data, size_t data_size, uint8_t* output_buffer, size_t output_buffer_size, int output_stride))
|
||||
FUNCTION_LOADER(WebPDecodeRGBAInto, uint8_t * (*) (const uint8_t* data, size_t data_size, uint8_t* output_buffer, size_t output_buffer_size, int output_stride))
|
||||
#endif
|
||||
}
|
||||
++lib.loaded;
|
||||
|
||||
return 0;
|
||||
}
|
||||
void IMG_QuitWEBP()
|
||||
{
|
||||
if ( lib.loaded == 0 ) {
|
||||
return;
|
||||
}
|
||||
if ( lib.loaded == 1 ) {
|
||||
#ifdef LOAD_WEBP_DYNAMIC
|
||||
SDL_UnloadObject(lib.handle);
|
||||
#endif
|
||||
}
|
||||
--lib.loaded;
|
||||
}
|
||||
|
||||
static int webp_getinfo( SDL_RWops *src, int *datasize ) {
|
||||
Sint64 start;
|
||||
int is_WEBP;
|
||||
Uint8 magic[20];
|
||||
|
||||
if ( !src ) {
|
||||
return 0;
|
||||
}
|
||||
start = SDL_RWtell(src);
|
||||
is_WEBP = 0;
|
||||
if ( SDL_RWread(src, magic, 1, sizeof(magic)) == sizeof(magic) ) {
|
||||
if ( magic[ 0] == 'R' &&
|
||||
magic[ 1] == 'I' &&
|
||||
magic[ 2] == 'F' &&
|
||||
magic[ 3] == 'F' &&
|
||||
magic[ 8] == 'W' &&
|
||||
magic[ 9] == 'E' &&
|
||||
magic[10] == 'B' &&
|
||||
magic[11] == 'P' &&
|
||||
magic[12] == 'V' &&
|
||||
magic[13] == 'P' &&
|
||||
magic[14] == '8' &&
|
||||
/* old versions don't support VP8X and VP8L */
|
||||
#if (WEBP_DECODER_ABI_VERSION < 0x0003)
|
||||
magic[15] == ' '
|
||||
#else
|
||||
(magic[15] == ' ' || magic[15] == 'X' || magic[15] == 'L')
|
||||
#endif
|
||||
) {
|
||||
is_WEBP = 1;
|
||||
if ( datasize ) {
|
||||
*datasize = (int)(SDL_RWseek(src, 0, RW_SEEK_END) - start);
|
||||
}
|
||||
}
|
||||
}
|
||||
SDL_RWseek(src, start, RW_SEEK_SET);
|
||||
return(is_WEBP);
|
||||
}
|
||||
|
||||
/* See if an image is contained in a data source */
|
||||
int IMG_isWEBP(SDL_RWops *src)
|
||||
{
|
||||
return webp_getinfo( src, NULL );
|
||||
}
|
||||
|
||||
SDL_Surface *IMG_LoadWEBP_RW(SDL_RWops *src)
|
||||
{
|
||||
Sint64 start;
|
||||
const char *error = NULL;
|
||||
SDL_Surface *volatile surface = NULL;
|
||||
Uint32 Rmask;
|
||||
Uint32 Gmask;
|
||||
Uint32 Bmask;
|
||||
Uint32 Amask;
|
||||
WebPBitstreamFeatures features;
|
||||
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";
|
||||
goto error;
|
||||
}
|
||||
|
||||
raw_data = (uint8_t*) SDL_malloc( raw_data_size );
|
||||
if ( raw_data == NULL ) {
|
||||
error = "Failed to allocate enough buffer for WEBP";
|
||||
goto error;
|
||||
}
|
||||
|
||||
r = (int)SDL_RWread(src, raw_data, 1, raw_data_size );
|
||||
if ( r != raw_data_size ) {
|
||||
error = "Failed to read WEBP";
|
||||
goto error;
|
||||
}
|
||||
|
||||
#if 0
|
||||
// extract size of picture, not interesting since we don't know about alpha channel
|
||||
int width = -1, height = -1;
|
||||
if ( !WebPGetInfo( raw_data, raw_data_size, &width, &height ) ) {
|
||||
printf("WebPGetInfo has failed\n" );
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
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
|
||||
|
||||
surface = SDL_CreateRGBSurface(SDL_SWSURFACE,
|
||||
features.width, features.height,
|
||||
features.has_alpha?32:24, Rmask,Gmask,Bmask,Amask);
|
||||
|
||||
if ( surface == NULL ) {
|
||||
error = "Failed to allocate SDL_Surface";
|
||||
goto error;
|
||||
}
|
||||
|
||||
if ( features.has_alpha ) {
|
||||
ret = lib.WebPDecodeRGBAInto( raw_data, raw_data_size, (uint8_t *)surface->pixels, surface->pitch * surface->h, surface->pitch );
|
||||
} else {
|
||||
ret = lib.WebPDecodeRGBInto( raw_data, raw_data_size, (uint8_t *)surface->pixels, surface->pitch * surface->h, surface->pitch );
|
||||
}
|
||||
|
||||
if ( !ret ) {
|
||||
error = "Failed to decode WEBP";
|
||||
goto error;
|
||||
}
|
||||
|
||||
if ( raw_data ) {
|
||||
SDL_free( raw_data );
|
||||
}
|
||||
|
||||
return surface;
|
||||
|
||||
|
||||
error:
|
||||
|
||||
if ( raw_data ) {
|
||||
SDL_free( raw_data );
|
||||
}
|
||||
|
||||
if ( surface ) {
|
||||
SDL_FreeSurface( surface );
|
||||
}
|
||||
|
||||
if ( error ) {
|
||||
IMG_SetError( "%s", error );
|
||||
}
|
||||
|
||||
SDL_RWseek(src, start, RW_SEEK_SET);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
#else
|
||||
#if _MSC_VER >= 1300
|
||||
#pragma warning(disable : 4100) /* warning C4100: 'op' : unreferenced formal parameter */
|
||||
#endif
|
||||
|
||||
int IMG_InitWEBP()
|
||||
{
|
||||
IMG_SetError("WEBP images are not supported");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
void IMG_QuitWEBP()
|
||||
{
|
||||
}
|
||||
|
||||
/* See if an image is contained in a data source */
|
||||
int IMG_isWEBP(SDL_RWops *src)
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
||||
/* Load a WEBP type image from an SDL datasource */
|
||||
SDL_Surface *IMG_LoadWEBP_RW(SDL_RWops *src)
|
||||
{
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
#endif /* LOAD_WEBP */
|
||||
952
Library/SDL2_image-2.5.2/IMG_xcf.c
Normal file
952
Library/SDL2_image-2.5.2/IMG_xcf.c
Normal file
@@ -0,0 +1,952 @@
|
||||
/*
|
||||
SDL_image: An example image loading library for use with SDL
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
/* This is a XCF image file loading framework */
|
||||
|
||||
#include "SDL_endian.h"
|
||||
#include "SDL_image.h"
|
||||
|
||||
#ifdef LOAD_XCF
|
||||
|
||||
#if DEBUG
|
||||
static char prop_names [][30] = {
|
||||
"end",
|
||||
"colormap",
|
||||
"active_layer",
|
||||
"active_channel",
|
||||
"selection",
|
||||
"floating_selection",
|
||||
"opacity",
|
||||
"mode",
|
||||
"visible",
|
||||
"linked",
|
||||
"preserve_transparency",
|
||||
"apply_mask",
|
||||
"edit_mask",
|
||||
"show_mask",
|
||||
"show_masked",
|
||||
"offsets",
|
||||
"color",
|
||||
"compression",
|
||||
"guides",
|
||||
"resolution",
|
||||
"tattoo",
|
||||
"parasites",
|
||||
"unit",
|
||||
"paths",
|
||||
"user_unit"
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
PROP_END = 0,
|
||||
PROP_COLORMAP = 1,
|
||||
PROP_ACTIVE_LAYER = 2,
|
||||
PROP_ACTIVE_CHANNEL = 3,
|
||||
PROP_SELECTION = 4,
|
||||
PROP_FLOATING_SELECTION = 5,
|
||||
PROP_OPACITY = 6,
|
||||
PROP_MODE = 7,
|
||||
PROP_VISIBLE = 8,
|
||||
PROP_LINKED = 9,
|
||||
PROP_PRESERVE_TRANSPARENCY = 10,
|
||||
PROP_APPLY_MASK = 11,
|
||||
PROP_EDIT_MASK = 12,
|
||||
PROP_SHOW_MASK = 13,
|
||||
PROP_SHOW_MASKED = 14,
|
||||
PROP_OFFSETS = 15,
|
||||
PROP_COLOR = 16,
|
||||
PROP_COMPRESSION = 17,
|
||||
PROP_GUIDES = 18,
|
||||
PROP_RESOLUTION = 19,
|
||||
PROP_TATTOO = 20,
|
||||
PROP_PARASITES = 21,
|
||||
PROP_UNIT = 22,
|
||||
PROP_PATHS = 23,
|
||||
PROP_USER_UNIT = 24
|
||||
} xcf_prop_type;
|
||||
|
||||
typedef enum {
|
||||
COMPR_NONE = 0,
|
||||
COMPR_RLE = 1,
|
||||
COMPR_ZLIB = 2,
|
||||
COMPR_FRACTAL = 3
|
||||
} xcf_compr_type;
|
||||
|
||||
typedef enum {
|
||||
IMAGE_RGB = 0,
|
||||
IMAGE_GREYSCALE = 1,
|
||||
IMAGE_INDEXED = 2
|
||||
} xcf_image_type;
|
||||
|
||||
typedef struct {
|
||||
Uint32 id;
|
||||
Uint32 length;
|
||||
union {
|
||||
struct {
|
||||
Uint32 num;
|
||||
char * cmap;
|
||||
} colormap; // 1
|
||||
struct {
|
||||
Uint32 drawable_offset;
|
||||
} floating_selection; // 5
|
||||
Sint32 opacity;
|
||||
Sint32 mode;
|
||||
int visible;
|
||||
int linked;
|
||||
int preserve_transparency;
|
||||
int apply_mask;
|
||||
int show_mask;
|
||||
struct {
|
||||
Sint32 x;
|
||||
Sint32 y;
|
||||
} offset;
|
||||
unsigned char color [3];
|
||||
Uint8 compression;
|
||||
struct {
|
||||
Sint32 x;
|
||||
Sint32 y;
|
||||
} resolution;
|
||||
struct {
|
||||
char * name;
|
||||
Uint32 flags;
|
||||
Uint32 size;
|
||||
char * data;
|
||||
} parasite;
|
||||
} data;
|
||||
} xcf_prop;
|
||||
|
||||
typedef struct {
|
||||
char sign [14];
|
||||
Uint32 file_version;
|
||||
Uint32 width;
|
||||
Uint32 height;
|
||||
Sint32 image_type;
|
||||
Uint32 precision;
|
||||
xcf_prop * properties;
|
||||
|
||||
Uint32 * layer_file_offsets;
|
||||
Uint32 * channel_file_offsets;
|
||||
|
||||
xcf_compr_type compr;
|
||||
Uint32 cm_num;
|
||||
unsigned char * cm_map;
|
||||
} xcf_header;
|
||||
|
||||
typedef struct {
|
||||
Uint32 width;
|
||||
Uint32 height;
|
||||
Sint32 layer_type;
|
||||
char * name;
|
||||
xcf_prop * properties;
|
||||
|
||||
Uint32 hierarchy_file_offset;
|
||||
Uint32 layer_mask_offset;
|
||||
|
||||
Uint32 offset_x;
|
||||
Uint32 offset_y;
|
||||
int visible;
|
||||
} xcf_layer;
|
||||
|
||||
typedef struct {
|
||||
Uint32 width;
|
||||
Uint32 height;
|
||||
char * name;
|
||||
xcf_prop * properties;
|
||||
|
||||
Uint32 hierarchy_file_offset;
|
||||
|
||||
Uint32 color;
|
||||
Uint32 opacity;
|
||||
int selection;
|
||||
int visible;
|
||||
} xcf_channel;
|
||||
|
||||
typedef struct {
|
||||
Uint32 width;
|
||||
Uint32 height;
|
||||
Uint32 bpp;
|
||||
|
||||
Uint32 * level_file_offsets;
|
||||
} xcf_hierarchy;
|
||||
|
||||
typedef struct {
|
||||
Uint32 width;
|
||||
Uint32 height;
|
||||
|
||||
Uint32 * tile_file_offsets;
|
||||
} xcf_level;
|
||||
|
||||
typedef unsigned char * xcf_tile;
|
||||
|
||||
typedef unsigned char * (* load_tile_type) (SDL_RWops *, Uint32, int, int, int);
|
||||
|
||||
|
||||
/* See if an image is contained in a data source */
|
||||
int IMG_isXCF(SDL_RWops *src)
|
||||
{
|
||||
Sint64 start;
|
||||
int is_XCF;
|
||||
char magic[14];
|
||||
|
||||
if ( !src )
|
||||
return 0;
|
||||
start = SDL_RWtell(src);
|
||||
is_XCF = 0;
|
||||
if ( SDL_RWread(src, magic, sizeof(magic), 1) ) {
|
||||
if (SDL_strncmp(magic, "gimp xcf ", 9) == 0) {
|
||||
is_XCF = 1;
|
||||
}
|
||||
}
|
||||
SDL_RWseek(src, start, RW_SEEK_SET);
|
||||
return(is_XCF);
|
||||
}
|
||||
|
||||
static char * read_string (SDL_RWops * src) {
|
||||
Sint64 remaining;
|
||||
Uint32 tmp;
|
||||
char * data;
|
||||
|
||||
tmp = SDL_ReadBE32(src);
|
||||
remaining = SDL_RWsize(src) - SDL_RWtell(src);
|
||||
if (tmp > 0 && (Sint32)tmp <= remaining) {
|
||||
data = (char *) SDL_malloc (sizeof (char) * tmp);
|
||||
if (data) {
|
||||
SDL_RWread(src, data, tmp, 1);
|
||||
data[tmp - 1] = '\0';
|
||||
}
|
||||
}
|
||||
else {
|
||||
data = NULL;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
static Uint64 read_offset (SDL_RWops * src, const xcf_header * h) {
|
||||
Uint64 offset; // starting with version 11, offsets are 64 bits
|
||||
offset = (h->file_version >= 11) ? (Uint64)SDL_ReadBE32 (src) << 32 : 0;
|
||||
offset |= SDL_ReadBE32 (src);
|
||||
return offset;
|
||||
}
|
||||
|
||||
|
||||
static Uint32 Swap32 (Uint32 v) {
|
||||
return
|
||||
((v & 0x000000FF) << 16)
|
||||
| ((v & 0x0000FF00))
|
||||
| ((v & 0x00FF0000) >> 16)
|
||||
| ((v & 0xFF000000));
|
||||
}
|
||||
|
||||
static int xcf_read_property (SDL_RWops * src, xcf_prop * prop) {
|
||||
Uint32 len;
|
||||
prop->id = SDL_ReadBE32 (src);
|
||||
prop->length = SDL_ReadBE32 (src);
|
||||
|
||||
#if DEBUG
|
||||
printf ("%.8X: %s(%u): %u\n", SDL_RWtell (src), prop->id < 25 ? prop_names [prop->id] : "unknown", prop->id, prop->length);
|
||||
#endif
|
||||
|
||||
switch (prop->id) {
|
||||
case PROP_COLORMAP:
|
||||
prop->data.colormap.num = SDL_ReadBE32 (src);
|
||||
prop->data.colormap.cmap = (char *) SDL_malloc (sizeof (char) * prop->data.colormap.num * 3);
|
||||
SDL_RWread (src, prop->data.colormap.cmap, prop->data.colormap.num*3, 1);
|
||||
break;
|
||||
|
||||
case PROP_OFFSETS:
|
||||
prop->data.offset.x = SDL_ReadBE32 (src);
|
||||
prop->data.offset.y = SDL_ReadBE32 (src);
|
||||
break;
|
||||
case PROP_OPACITY:
|
||||
prop->data.opacity = SDL_ReadBE32 (src);
|
||||
break;
|
||||
case PROP_COMPRESSION:
|
||||
case PROP_COLOR:
|
||||
if (prop->length > sizeof(prop->data)) {
|
||||
len = sizeof(prop->data);
|
||||
} else {
|
||||
len = prop->length;
|
||||
}
|
||||
SDL_RWread(src, &prop->data, len, 1);
|
||||
break;
|
||||
case PROP_VISIBLE:
|
||||
prop->data.visible = SDL_ReadBE32 (src);
|
||||
break;
|
||||
default:
|
||||
// SDL_RWread (src, &prop->data, prop->length, 1);
|
||||
if (SDL_RWseek (src, prop->length, RW_SEEK_CUR) < 0)
|
||||
return 0; // ERROR
|
||||
}
|
||||
return 1; // OK
|
||||
}
|
||||
|
||||
static void free_xcf_header (xcf_header * h) {
|
||||
if (h->cm_num)
|
||||
SDL_free (h->cm_map);
|
||||
if (h->layer_file_offsets)
|
||||
SDL_free (h->layer_file_offsets);
|
||||
SDL_free (h);
|
||||
}
|
||||
|
||||
static xcf_header * read_xcf_header (SDL_RWops * src) {
|
||||
xcf_header * h;
|
||||
xcf_prop prop;
|
||||
|
||||
h = (xcf_header *) SDL_malloc (sizeof (xcf_header));
|
||||
if (!h) {
|
||||
return NULL;
|
||||
}
|
||||
SDL_RWread (src, h->sign, 14, 1);
|
||||
h->width = SDL_ReadBE32 (src);
|
||||
h->height = SDL_ReadBE32 (src);
|
||||
h->image_type = SDL_ReadBE32 (src);
|
||||
if (h->sign[9] == 'v' && h->sign[10] >= '0' && h->sign[10] <= '9' && h->sign[11] >= '0' && h->sign[11] <= '9' && h->sign[12] >= '0' && h->sign[12] <= '9')
|
||||
h->file_version = (h->sign[10] - '0') * 100 + (h->sign[11] - '0') * 10 + (h->sign[12] - '0');
|
||||
else
|
||||
h->file_version = 0;
|
||||
#ifdef DEBUG
|
||||
printf ("XCF signature : %.14s (version %u)\n", h->sign, h->file_version);
|
||||
printf (" (%u,%u) type=%u\n", h->width, h->height, h->image_type);
|
||||
#endif
|
||||
if (h->file_version >= 4)
|
||||
h->precision = SDL_ReadBE32 (src);
|
||||
else
|
||||
h->precision = 150;
|
||||
|
||||
h->properties = NULL;
|
||||
h->layer_file_offsets = NULL;
|
||||
h->compr = COMPR_NONE;
|
||||
h->cm_num = 0;
|
||||
h->cm_map = NULL;
|
||||
|
||||
// Just read, don't save
|
||||
do {
|
||||
if (!xcf_read_property (src, &prop)) {
|
||||
free_xcf_header (h);
|
||||
return NULL;
|
||||
}
|
||||
if (prop.id == PROP_COMPRESSION)
|
||||
h->compr = (xcf_compr_type)prop.data.compression;
|
||||
else if (prop.id == PROP_COLORMAP) {
|
||||
// unused var: int i;
|
||||
Uint32 cm_num;
|
||||
unsigned char *cm_map;
|
||||
|
||||
cm_num = prop.data.colormap.num;
|
||||
cm_map = (unsigned char *) SDL_realloc(h->cm_map, sizeof (unsigned char) * 3 * cm_num);
|
||||
if (cm_map) {
|
||||
h->cm_num = cm_num;
|
||||
h->cm_map = cm_map;
|
||||
SDL_memcpy (h->cm_map, prop.data.colormap.cmap, 3*sizeof (char)*h->cm_num);
|
||||
}
|
||||
SDL_free (prop.data.colormap.cmap);
|
||||
|
||||
if (!cm_map) {
|
||||
free_xcf_header(h);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
} while (prop.id != PROP_END);
|
||||
|
||||
return h;
|
||||
}
|
||||
|
||||
static void free_xcf_layer (xcf_layer * l) {
|
||||
SDL_free (l->name);
|
||||
SDL_free (l);
|
||||
}
|
||||
|
||||
static xcf_layer * read_xcf_layer (SDL_RWops * src, const xcf_header * h) {
|
||||
xcf_layer * l;
|
||||
xcf_prop prop;
|
||||
|
||||
l = (xcf_layer *) SDL_malloc (sizeof (xcf_layer));
|
||||
l->width = SDL_ReadBE32 (src);
|
||||
l->height = SDL_ReadBE32 (src);
|
||||
l->layer_type = SDL_ReadBE32 (src);
|
||||
|
||||
l->name = read_string (src);
|
||||
#ifdef DEBUG
|
||||
printf ("layer (%d,%d) type=%d '%s'\n", l->width, l->height, l->layer_type, l->name);
|
||||
#endif
|
||||
|
||||
do {
|
||||
if (!xcf_read_property (src, &prop)) {
|
||||
free_xcf_layer (l);
|
||||
return NULL;
|
||||
}
|
||||
if (prop.id == PROP_OFFSETS) {
|
||||
l->offset_x = prop.data.offset.x;
|
||||
l->offset_y = prop.data.offset.y;
|
||||
} else if (prop.id == PROP_VISIBLE) {
|
||||
l->visible = prop.data.visible ? 1 : 0;
|
||||
} else if (prop.id == PROP_COLORMAP) {
|
||||
SDL_free (prop.data.colormap.cmap);
|
||||
}
|
||||
} while (prop.id != PROP_END);
|
||||
|
||||
l->hierarchy_file_offset = read_offset (src, h);
|
||||
l->layer_mask_offset = read_offset (src, h);
|
||||
|
||||
return l;
|
||||
}
|
||||
|
||||
static void free_xcf_channel (xcf_channel * c) {
|
||||
SDL_free (c->name);
|
||||
SDL_free (c);
|
||||
}
|
||||
|
||||
static xcf_channel * read_xcf_channel (SDL_RWops * src, const xcf_header * h) {
|
||||
xcf_channel * l;
|
||||
xcf_prop prop;
|
||||
|
||||
l = (xcf_channel *) SDL_malloc (sizeof (xcf_channel));
|
||||
l->width = SDL_ReadBE32 (src);
|
||||
l->height = SDL_ReadBE32 (src);
|
||||
|
||||
l->name = read_string (src);
|
||||
#ifdef DEBUG
|
||||
printf ("channel (%u,%u) '%s'\n", l->width, l->height, l->name);
|
||||
#endif
|
||||
|
||||
l->selection = 0;
|
||||
do {
|
||||
if (!xcf_read_property (src, &prop)) {
|
||||
free_xcf_channel (l);
|
||||
return NULL;
|
||||
}
|
||||
switch (prop.id) {
|
||||
case PROP_OPACITY:
|
||||
l->opacity = prop.data.opacity << 24;
|
||||
break;
|
||||
case PROP_COLOR:
|
||||
l->color = ((Uint32) prop.data.color[0] << 16)
|
||||
| ((Uint32) prop.data.color[1] << 8)
|
||||
| ((Uint32) prop.data.color[2]);
|
||||
break;
|
||||
case PROP_SELECTION:
|
||||
l->selection = 1;
|
||||
break;
|
||||
case PROP_VISIBLE:
|
||||
l->visible = prop.data.visible ? 1 : 0;
|
||||
break;
|
||||
default:
|
||||
;
|
||||
}
|
||||
} while (prop.id != PROP_END);
|
||||
|
||||
l->hierarchy_file_offset = read_offset (src, h);
|
||||
|
||||
return l;
|
||||
}
|
||||
|
||||
static void free_xcf_hierarchy (xcf_hierarchy * h) {
|
||||
SDL_free (h->level_file_offsets);
|
||||
SDL_free (h);
|
||||
}
|
||||
|
||||
static xcf_hierarchy * read_xcf_hierarchy (SDL_RWops * src, const xcf_header * head) {
|
||||
xcf_hierarchy * h;
|
||||
int i;
|
||||
|
||||
h = (xcf_hierarchy *) SDL_malloc (sizeof (xcf_hierarchy));
|
||||
h->width = SDL_ReadBE32 (src);
|
||||
h->height = SDL_ReadBE32 (src);
|
||||
h->bpp = SDL_ReadBE32 (src);
|
||||
|
||||
h->level_file_offsets = NULL;
|
||||
i = 0;
|
||||
do {
|
||||
h->level_file_offsets = (Uint32 *) SDL_realloc (h->level_file_offsets, sizeof (Uint32) * (i+1));
|
||||
h->level_file_offsets [i] = read_offset (src, head);
|
||||
} while (h->level_file_offsets [i++]);
|
||||
|
||||
return h;
|
||||
}
|
||||
|
||||
static void free_xcf_level (xcf_level * l) {
|
||||
SDL_free (l->tile_file_offsets);
|
||||
SDL_free (l);
|
||||
}
|
||||
|
||||
static xcf_level * read_xcf_level (SDL_RWops * src, const xcf_header * h) {
|
||||
xcf_level * l;
|
||||
int i;
|
||||
|
||||
l = (xcf_level *) SDL_malloc (sizeof (xcf_level));
|
||||
l->width = SDL_ReadBE32 (src);
|
||||
l->height = SDL_ReadBE32 (src);
|
||||
|
||||
l->tile_file_offsets = NULL;
|
||||
i = 0;
|
||||
do {
|
||||
l->tile_file_offsets = (Uint32 *) SDL_realloc (l->tile_file_offsets, sizeof (Uint32) * (i+1));
|
||||
l->tile_file_offsets [i] = read_offset (src, h);
|
||||
} while (l->tile_file_offsets [i++]);
|
||||
|
||||
return l;
|
||||
}
|
||||
|
||||
static void free_xcf_tile (unsigned char * t) {
|
||||
SDL_free (t);
|
||||
}
|
||||
|
||||
static unsigned char * load_xcf_tile_none (SDL_RWops * src, Uint32 len, int bpp, int x, int y) {
|
||||
unsigned char * load;
|
||||
|
||||
load = (unsigned char *) SDL_malloc (len); // expect this is okay
|
||||
if (load != NULL)
|
||||
SDL_RWread (src, load, len, 1);
|
||||
|
||||
return load;
|
||||
}
|
||||
|
||||
static unsigned char * load_xcf_tile_rle (SDL_RWops * src, Uint32 len, int bpp, int x, int y) {
|
||||
unsigned char * load, * t, * data, * d;
|
||||
int i, size, count, j, length;
|
||||
unsigned char val;
|
||||
|
||||
if (len == 0) { /* probably bogus data. */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
t = load = (unsigned char *) SDL_malloc (len);
|
||||
if (load == NULL)
|
||||
return NULL;
|
||||
|
||||
SDL_RWread (src, t, 1, len); /* reallen */
|
||||
|
||||
data = (unsigned char *) SDL_calloc (1, x*y*bpp);
|
||||
for (i = 0; i < bpp; i++) {
|
||||
d = data + i;
|
||||
size = x*y;
|
||||
count = 0;
|
||||
|
||||
while (size > 0) {
|
||||
val = *t++;
|
||||
|
||||
length = val;
|
||||
if (length >= 128) {
|
||||
length = 255 - (length - 1);
|
||||
if (length == 128) {
|
||||
length = (*t << 8) + t[1];
|
||||
t += 2;
|
||||
}
|
||||
|
||||
if (((size_t) (t - load) + length) >= len) {
|
||||
break; /* bogus data */
|
||||
} else if (length > size) {
|
||||
break; /* bogus data */
|
||||
}
|
||||
|
||||
count += length;
|
||||
size -= length;
|
||||
|
||||
while (length-- > 0) {
|
||||
*d = *t++;
|
||||
d += bpp;
|
||||
}
|
||||
} else {
|
||||
length += 1;
|
||||
if (length == 128) {
|
||||
length = (*t << 8) + t[1];
|
||||
t += 2;
|
||||
}
|
||||
|
||||
if (((size_t) (t - load)) >= len) {
|
||||
break; /* bogus data */
|
||||
} else if (length > size) {
|
||||
break; /* bogus data */
|
||||
}
|
||||
|
||||
count += length;
|
||||
size -= length;
|
||||
|
||||
val = *t++;
|
||||
|
||||
for (j = 0; j < length; j++) {
|
||||
*d = val;
|
||||
d += bpp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (size > 0) {
|
||||
break; /* just drop out, untouched data initialized to zero. */
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
SDL_free (load);
|
||||
return (data);
|
||||
}
|
||||
|
||||
static Uint32 rgb2grey (Uint32 a) {
|
||||
Uint8 l;
|
||||
l = (Uint8)(0.2990 * ((a & 0x00FF0000) >> 16)
|
||||
+ 0.5870 * ((a & 0x0000FF00) >> 8)
|
||||
+ 0.1140 * ((a & 0x000000FF)));
|
||||
|
||||
return (l << 16) | (l << 8) | l;
|
||||
}
|
||||
|
||||
static void create_channel_surface (SDL_Surface * surf, xcf_image_type itype, Uint32 color, Uint32 opacity) {
|
||||
Uint32 c = 0;
|
||||
|
||||
switch (itype) {
|
||||
case IMAGE_RGB:
|
||||
case IMAGE_INDEXED:
|
||||
c = opacity | color;
|
||||
break;
|
||||
case IMAGE_GREYSCALE:
|
||||
c = opacity | rgb2grey (color);
|
||||
break;
|
||||
}
|
||||
SDL_FillRect (surf, NULL, c);
|
||||
}
|
||||
|
||||
static int
|
||||
do_layer_surface(SDL_Surface * surface, SDL_RWops * src, xcf_header * head, xcf_layer * layer, load_tile_type load_tile)
|
||||
{
|
||||
xcf_hierarchy *hierarchy;
|
||||
xcf_level *level;
|
||||
unsigned char *tile;
|
||||
Uint8 *p8;
|
||||
Uint32 *p;
|
||||
int i, j;
|
||||
Uint32 x, y, tx, ty, ox, oy;
|
||||
Uint32 *row;
|
||||
Uint32 length;
|
||||
|
||||
SDL_RWseek(src, layer->hierarchy_file_offset, RW_SEEK_SET);
|
||||
hierarchy = read_xcf_hierarchy(src, head);
|
||||
|
||||
if (hierarchy->bpp > 4) { /* unsupported. */
|
||||
SDL_Log("Unknown Gimp image bpp (%u)\n", (unsigned int) hierarchy->bpp);
|
||||
free_xcf_hierarchy(hierarchy);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ((hierarchy->width > 20000) || (hierarchy->height > 20000)) { /* arbitrary limit to avoid integer overflow. */
|
||||
SDL_Log("Gimp image too large (%ux%u)\n", (unsigned int) hierarchy->width, (unsigned int) hierarchy->height);
|
||||
free_xcf_hierarchy(hierarchy);
|
||||
return 1;
|
||||
}
|
||||
|
||||
level = NULL;
|
||||
for (i = 0; hierarchy->level_file_offsets[i]; i++) {
|
||||
if (SDL_RWseek(src, hierarchy->level_file_offsets[i], RW_SEEK_SET) < 0)
|
||||
break;
|
||||
if (i > 0) // skip level except the 1st one, just like GIMP does
|
||||
continue;
|
||||
level = read_xcf_level(src, head);
|
||||
|
||||
ty = tx = 0;
|
||||
for (j = 0; level->tile_file_offsets[j]; j++) {
|
||||
SDL_RWseek(src, level->tile_file_offsets[j], RW_SEEK_SET);
|
||||
ox = tx + 64 > level->width ? level->width % 64 : 64;
|
||||
oy = ty + 64 > level->height ? level->height % 64 : 64;
|
||||
length = ox*oy*6;
|
||||
|
||||
if (level->tile_file_offsets[j + 1] > level->tile_file_offsets[j]) {
|
||||
length = level->tile_file_offsets[j + 1] - level->tile_file_offsets[j];
|
||||
}
|
||||
tile = load_tile(src, length, hierarchy->bpp, ox, oy);
|
||||
|
||||
if (!tile) {
|
||||
if (hierarchy) {
|
||||
free_xcf_hierarchy(hierarchy);
|
||||
}
|
||||
if (level) {
|
||||
free_xcf_level(level);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
p8 = tile;
|
||||
p = (Uint32 *) p8;
|
||||
for (y = ty; y < ty + oy; y++) {
|
||||
if ((y >= surface->h) || ((tx+ox) > surface->w)) {
|
||||
break;
|
||||
}
|
||||
row = (Uint32 *) ((Uint8 *) surface->pixels + y * surface->pitch + tx * 4);
|
||||
switch (hierarchy->bpp) {
|
||||
case 4:
|
||||
for (x = tx; x < tx + ox; x++)
|
||||
*row++ = Swap32(*p++);
|
||||
break;
|
||||
case 3:
|
||||
for (x = tx; x < tx + ox; x++) {
|
||||
*row = 0xFF000000;
|
||||
*row |= ((Uint32)*p8++ << 16);
|
||||
*row |= ((Uint32)*p8++ << 8);
|
||||
*row |= ((Uint32)*p8++ << 0);
|
||||
row++;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
/* Indexed / Greyscale + Alpha */
|
||||
switch (head->image_type) {
|
||||
case IMAGE_INDEXED:
|
||||
for (x = tx; x < tx + ox; x++) {
|
||||
*row = ((Uint32)(head->cm_map[*p8 * 3]) << 16);
|
||||
*row |= ((Uint32)(head->cm_map[*p8 * 3 + 1]) << 8);
|
||||
*row |= ((Uint32)(head->cm_map[*p8++ * 3 + 2]) << 0);
|
||||
*row |= ((Uint32)*p8++ << 24);
|
||||
row++;
|
||||
}
|
||||
break;
|
||||
case IMAGE_GREYSCALE:
|
||||
for (x = tx; x < tx + ox; x++) {
|
||||
*row = ((Uint32)*p8 << 16);
|
||||
*row |= ((Uint32)*p8 << 8);
|
||||
*row |= ((Uint32)*p8++ << 0);
|
||||
*row |= ((Uint32)*p8++ << 24);
|
||||
row++;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
SDL_Log("Unknown Gimp image type (%d)\n", head->image_type);
|
||||
if (hierarchy) {
|
||||
free_xcf_hierarchy(hierarchy);
|
||||
}
|
||||
if (level)
|
||||
free_xcf_level(level);
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
/* Indexed / Greyscale */
|
||||
switch (head->image_type) {
|
||||
case IMAGE_INDEXED:
|
||||
for (x = tx; x < tx + ox; x++) {
|
||||
*row++ = 0xFF000000
|
||||
| ((Uint32)(head->cm_map[*p8 * 3]) << 16)
|
||||
| ((Uint32)(head->cm_map[*p8 * 3 + 1]) << 8)
|
||||
| ((Uint32)(head->cm_map[*p8 * 3 + 2]) << 0);
|
||||
p8++;
|
||||
}
|
||||
break;
|
||||
case IMAGE_GREYSCALE:
|
||||
for (x = tx; x < tx + ox; x++) {
|
||||
*row++ = 0xFF000000
|
||||
| (((Uint32)(*p8)) << 16)
|
||||
| (((Uint32)(*p8)) << 8)
|
||||
| (((Uint32)(*p8)) << 0);
|
||||
++p8;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
SDL_Log("Unknown Gimp image type (%d)\n", head->image_type);
|
||||
if (tile)
|
||||
free_xcf_tile(tile);
|
||||
if (level)
|
||||
free_xcf_level(level);
|
||||
if (hierarchy)
|
||||
free_xcf_hierarchy(hierarchy);
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
free_xcf_tile(tile);
|
||||
|
||||
tx += 64;
|
||||
if (tx >= level->width) {
|
||||
tx = 0;
|
||||
ty += 64;
|
||||
}
|
||||
if (ty >= level->height) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
free_xcf_level(level);
|
||||
}
|
||||
|
||||
free_xcf_hierarchy(hierarchy);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
SDL_Surface *IMG_LoadXCF_RW(SDL_RWops *src)
|
||||
{
|
||||
Sint64 start;
|
||||
const char *error = NULL;
|
||||
SDL_Surface *surface, *lays;
|
||||
xcf_header * head;
|
||||
xcf_layer * layer;
|
||||
xcf_channel ** channel;
|
||||
int chnls, i, offsets;
|
||||
Sint64 offset, fp;
|
||||
|
||||
unsigned char * (* load_tile) (SDL_RWops *, Uint32, int, int, int);
|
||||
|
||||
if (!src) {
|
||||
/* The error message has been set in SDL_RWFromFile */
|
||||
return NULL;
|
||||
}
|
||||
start = SDL_RWtell(src);
|
||||
|
||||
/* Initialize the data we will clean up when we're done */
|
||||
surface = NULL;
|
||||
|
||||
head = read_xcf_header(src);
|
||||
if (!head) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
switch (head->compr) {
|
||||
case COMPR_NONE:
|
||||
load_tile = load_xcf_tile_none;
|
||||
break;
|
||||
case COMPR_RLE:
|
||||
load_tile = load_xcf_tile_rle;
|
||||
break;
|
||||
default:
|
||||
SDL_Log("Unsupported Compression.\n");
|
||||
free_xcf_header (head);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Create the surface of the appropriate type */
|
||||
surface = SDL_CreateRGBSurface(SDL_SWSURFACE, head->width, head->height, 32,
|
||||
0x00FF0000,0x0000FF00,0x000000FF,0xFF000000);
|
||||
|
||||
if ( surface == NULL ) {
|
||||
error = "Out of memory";
|
||||
goto done;
|
||||
}
|
||||
|
||||
offsets = 0;
|
||||
|
||||
while ((offset = read_offset (src, head))) {
|
||||
head->layer_file_offsets = (Uint32 *) SDL_realloc (head->layer_file_offsets, sizeof (Uint32) * (offsets+1));
|
||||
head->layer_file_offsets [offsets] = (Uint32)offset;
|
||||
offsets++;
|
||||
}
|
||||
fp = SDL_RWtell (src);
|
||||
|
||||
lays = SDL_CreateRGBSurface(SDL_SWSURFACE, head->width, head->height, 32,
|
||||
0x00FF0000,0x0000FF00,0x000000FF,0xFF000000);
|
||||
|
||||
if ( lays == NULL ) {
|
||||
error = "Out of memory";
|
||||
goto done;
|
||||
}
|
||||
|
||||
// Blit layers backwards, because Gimp saves them highest first
|
||||
for (i = offsets; i > 0; i--) {
|
||||
SDL_Rect rs, rd;
|
||||
SDL_RWseek (src, head->layer_file_offsets [i-1], RW_SEEK_SET);
|
||||
|
||||
layer = read_xcf_layer (src, head);
|
||||
if (layer != NULL) {
|
||||
do_layer_surface (lays, src, head, layer, load_tile);
|
||||
rs.x = 0;
|
||||
rs.y = 0;
|
||||
rs.w = layer->width;
|
||||
rs.h = layer->height;
|
||||
rd.x = layer->offset_x;
|
||||
rd.y = layer->offset_y;
|
||||
rd.w = layer->width;
|
||||
rd.h = layer->height;
|
||||
|
||||
if (layer->visible)
|
||||
SDL_BlitSurface (lays, &rs, surface, &rd);
|
||||
free_xcf_layer (layer);
|
||||
}
|
||||
}
|
||||
|
||||
SDL_FreeSurface (lays);
|
||||
|
||||
SDL_RWseek (src, fp, RW_SEEK_SET);
|
||||
|
||||
// read channels
|
||||
channel = NULL;
|
||||
chnls = 0;
|
||||
while ((offset = read_offset (src, head))) {
|
||||
channel = (xcf_channel **) SDL_realloc (channel, sizeof (xcf_channel *) * (chnls+1));
|
||||
fp = SDL_RWtell (src);
|
||||
SDL_RWseek (src, offset, RW_SEEK_SET);
|
||||
channel [chnls] = (read_xcf_channel (src, head));
|
||||
if (channel [chnls] != NULL)
|
||||
chnls++;
|
||||
SDL_RWseek (src, fp, RW_SEEK_SET);
|
||||
}
|
||||
|
||||
if (chnls) {
|
||||
SDL_Surface * chs;
|
||||
|
||||
chs = SDL_CreateRGBSurface(SDL_SWSURFACE, head->width, head->height, 32,
|
||||
0x00FF0000,0x0000FF00,0x000000FF,0xFF000000);
|
||||
|
||||
if (chs == NULL) {
|
||||
error = "Out of memory";
|
||||
goto done;
|
||||
}
|
||||
for (i = 0; i < chnls; i++) {
|
||||
// printf ("CNLBLT %i\n", i);
|
||||
if (!channel [i]->selection && channel [i]->visible) {
|
||||
create_channel_surface (chs, (xcf_image_type)head->image_type, channel [i]->color, channel [i]->opacity);
|
||||
SDL_BlitSurface (chs, NULL, surface, NULL);
|
||||
}
|
||||
free_xcf_channel (channel [i]);
|
||||
}
|
||||
SDL_free(channel);
|
||||
|
||||
SDL_FreeSurface (chs);
|
||||
}
|
||||
|
||||
done:
|
||||
free_xcf_header (head);
|
||||
if ( error ) {
|
||||
SDL_RWseek(src, start, RW_SEEK_SET);
|
||||
if ( surface ) {
|
||||
SDL_FreeSurface(surface);
|
||||
surface = NULL;
|
||||
}
|
||||
IMG_SetError("%s", error);
|
||||
}
|
||||
|
||||
return(surface);
|
||||
}
|
||||
|
||||
#else
|
||||
#if _MSC_VER >= 1300
|
||||
#pragma warning(disable : 4100) /* warning C4100: 'op' : unreferenced formal parameter */
|
||||
#endif
|
||||
|
||||
/* See if an image is contained in a data source */
|
||||
int IMG_isXCF(SDL_RWops *src)
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
||||
/* Load a XCF type image from an SDL datasource */
|
||||
SDL_Surface *IMG_LoadXCF_RW(SDL_RWops *src)
|
||||
{
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
#endif /* LOAD_XCF */
|
||||
1228
Library/SDL2_image-2.5.2/IMG_xpm.c
Normal file
1228
Library/SDL2_image-2.5.2/IMG_xpm.c
Normal file
File diff suppressed because it is too large
Load Diff
165
Library/SDL2_image-2.5.2/IMG_xv.c
Normal file
165
Library/SDL2_image-2.5.2/IMG_xv.c
Normal file
@@ -0,0 +1,165 @@
|
||||
/*
|
||||
SDL_image: An example image loading library for use with SDL
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
/* This is a XV thumbnail image file loading framework */
|
||||
|
||||
#include "SDL_image.h"
|
||||
|
||||
#ifdef LOAD_XV
|
||||
|
||||
static int get_line(SDL_RWops *src, char *line, int size)
|
||||
{
|
||||
while ( size > 0 ) {
|
||||
if ( !SDL_RWread(src, line, 1, 1) ) {
|
||||
return -1;
|
||||
}
|
||||
if ( *line == '\r' ) {
|
||||
continue;
|
||||
}
|
||||
if ( *line == '\n' ) {
|
||||
*line = '\0';
|
||||
return 0;
|
||||
}
|
||||
++line;
|
||||
--size;
|
||||
}
|
||||
/* Out of space for the line */
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int get_header(SDL_RWops *src, int *w, int *h)
|
||||
{
|
||||
char line[1024];
|
||||
|
||||
*w = 0;
|
||||
*h = 0;
|
||||
|
||||
/* Check the header magic */
|
||||
if ( (get_line(src, line, sizeof(line)) < 0) ||
|
||||
(SDL_memcmp(line, "P7 332", 6) != 0) ) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Read the header */
|
||||
while ( get_line(src, line, sizeof(line)) == 0 ) {
|
||||
if ( SDL_memcmp(line, "#BUILTIN:", 9) == 0 ) {
|
||||
/* Builtin image, no data */
|
||||
break;
|
||||
}
|
||||
if ( SDL_memcmp(line, "#END_OF_COMMENTS", 16) == 0 ) {
|
||||
if ( get_line(src, line, sizeof(line)) == 0 ) {
|
||||
SDL_sscanf(line, "%d %d", w, h);
|
||||
if ( *w >= 0 && *h >= 0 ) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* No image data */
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* See if an image is contained in a data source */
|
||||
int IMG_isXV(SDL_RWops *src)
|
||||
{
|
||||
Sint64 start;
|
||||
int is_XV;
|
||||
int w, h;
|
||||
|
||||
if ( !src )
|
||||
return 0;
|
||||
start = SDL_RWtell(src);
|
||||
is_XV = 0;
|
||||
if ( get_header(src, &w, &h) == 0 ) {
|
||||
is_XV = 1;
|
||||
}
|
||||
SDL_RWseek(src, start, RW_SEEK_SET);
|
||||
return(is_XV);
|
||||
}
|
||||
|
||||
/* Load a XV thumbnail image from an SDL datasource */
|
||||
SDL_Surface *IMG_LoadXV_RW(SDL_RWops *src)
|
||||
{
|
||||
Sint64 start;
|
||||
const char *error = NULL;
|
||||
SDL_Surface *surface = NULL;
|
||||
int w, h;
|
||||
Uint8 *pixels;
|
||||
|
||||
if ( !src ) {
|
||||
/* The error message has been set in SDL_RWFromFile */
|
||||
return NULL;
|
||||
}
|
||||
start = SDL_RWtell(src);
|
||||
|
||||
/* Read the header */
|
||||
if ( get_header(src, &w, &h) < 0 ) {
|
||||
error = "Unsupported image format";
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Create the 3-3-2 indexed palette surface */
|
||||
surface = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, 8, 0xe0, 0x1c, 0x03, 0);
|
||||
if ( surface == NULL ) {
|
||||
error = "Out of memory";
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Load the image data */
|
||||
for ( pixels = (Uint8 *)surface->pixels; h > 0; --h ) {
|
||||
if ( !SDL_RWread(src, pixels, w, 1) ) {
|
||||
error = "Couldn't read image data";
|
||||
goto done;
|
||||
}
|
||||
pixels += surface->pitch;
|
||||
}
|
||||
|
||||
done:
|
||||
if ( error ) {
|
||||
SDL_RWseek(src, start, RW_SEEK_SET);
|
||||
if ( surface ) {
|
||||
SDL_FreeSurface(surface);
|
||||
surface = NULL;
|
||||
}
|
||||
IMG_SetError("%s", error);
|
||||
}
|
||||
return surface;
|
||||
}
|
||||
|
||||
#else
|
||||
#if _MSC_VER >= 1300
|
||||
#pragma warning(disable : 4100) /* warning C4100: 'op' : unreferenced formal parameter */
|
||||
#endif
|
||||
|
||||
/* See if an image is contained in a data source */
|
||||
int IMG_isXV(SDL_RWops *src)
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
||||
/* Load a XXX type image from an SDL datasource */
|
||||
SDL_Surface *IMG_LoadXV_RW(SDL_RWops *src)
|
||||
{
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
#endif /* LOAD_XV */
|
||||
88
Library/SDL2_image-2.5.2/IMG_xxx.c
Normal file
88
Library/SDL2_image-2.5.2/IMG_xxx.c
Normal file
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
SDL_image: An example image loading library for use with SDL
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
/* This is a generic "format not supported" image framework */
|
||||
|
||||
#include "SDL_image.h"
|
||||
|
||||
#ifdef LOAD_XXX
|
||||
|
||||
/* See if an image is contained in a data source */
|
||||
int IMG_isXXX(SDL_RWops *src)
|
||||
{
|
||||
int start;
|
||||
int is_XXX;
|
||||
|
||||
if ( !src )
|
||||
return 0;
|
||||
start = SDL_RWtell(src);
|
||||
is_XXX = 0;
|
||||
|
||||
/* Detect the image here */
|
||||
|
||||
SDL_RWseek(src, start, RW_SEEK_SET);
|
||||
return(is_XXX);
|
||||
}
|
||||
|
||||
/* Load a XXX type image from an SDL datasource */
|
||||
SDL_Surface *IMG_LoadXXX_RW(SDL_RWops *src)
|
||||
{
|
||||
int start;
|
||||
const char *error = NULL;
|
||||
SDL_Surface *surface = NULL;
|
||||
|
||||
if ( !src ) {
|
||||
/* The error message has been set in SDL_RWFromFile */
|
||||
return NULL;
|
||||
}
|
||||
start = SDL_RWtell(src);
|
||||
|
||||
/* Load the image here */
|
||||
|
||||
if ( error ) {
|
||||
SDL_RWseek(src, start, RW_SEEK_SET);
|
||||
if ( surface ) {
|
||||
SDL_FreeSurface(surface);
|
||||
surface = NULL;
|
||||
}
|
||||
IMG_SetError("%s", error);
|
||||
}
|
||||
return surface;
|
||||
}
|
||||
|
||||
#else
|
||||
#if _MSC_VER >= 1300
|
||||
#pragma warning(disable : 4100) /* warning C4100: 'op' : unreferenced formal parameter */
|
||||
#endif
|
||||
|
||||
/* See if an image is contained in a data source */
|
||||
int IMG_isXXX(SDL_RWops *src)
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
||||
/* Load a XXX type image from an SDL datasource */
|
||||
SDL_Surface *IMG_LoadXXX_RW(SDL_RWops *src)
|
||||
{
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
#endif /* LOAD_XXX */
|
||||
17
Library/SDL2_image-2.5.2/LICENSE.txt
Normal file
17
Library/SDL2_image-2.5.2/LICENSE.txt
Normal file
@@ -0,0 +1,17 @@
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
110
Library/SDL2_image-2.5.2/Makefile.am
Normal file
110
Library/SDL2_image-2.5.2/Makefile.am
Normal file
@@ -0,0 +1,110 @@
|
||||
# Makefile.am for the SDL sample image loading library and viewer
|
||||
ACLOCAL_AMFLAGS = -I acinclude
|
||||
|
||||
lib_LTLIBRARIES = libSDL2_image.la
|
||||
|
||||
libSDL2_imageincludedir = $(includedir)/SDL2
|
||||
libSDL2_imageinclude_HEADERS = \
|
||||
SDL_image.h
|
||||
|
||||
if USE_IMAGEIO
|
||||
IMAGEIO_SOURCE = IMG_ImageIO.m
|
||||
endif
|
||||
|
||||
libSDL2_image_la_SOURCES = \
|
||||
IMG.c \
|
||||
IMG_avif.c \
|
||||
IMG_bmp.c \
|
||||
IMG_gif.c \
|
||||
IMG_jpg.c \
|
||||
IMG_jxl.c \
|
||||
IMG_lbm.c \
|
||||
IMG_pcx.c \
|
||||
IMG_png.c \
|
||||
IMG_pnm.c \
|
||||
IMG_qoi.c \
|
||||
IMG_svg.c \
|
||||
IMG_stb.c \
|
||||
IMG_tga.c \
|
||||
IMG_tif.c \
|
||||
IMG_xcf.c \
|
||||
IMG_xpm.c \
|
||||
IMG_xv.c \
|
||||
IMG_webp.c \
|
||||
IMG_WIC.c \
|
||||
$(IMAGEIO_SOURCE) \
|
||||
miniz.h \
|
||||
nanosvg.h \
|
||||
nanosvgrast.h \
|
||||
qoi.h \
|
||||
stb_image.h \
|
||||
tiny_jpeg.h
|
||||
|
||||
EXTRA_DIST = \
|
||||
.gitmodules \
|
||||
Android.mk \
|
||||
CHANGES.txt \
|
||||
CMakeLists.txt \
|
||||
cmake \
|
||||
SDL2_imageConfig.cmake.in \
|
||||
IMG_ImageIO.m \
|
||||
IMG_xxx.c \
|
||||
LICENSE.txt \
|
||||
Makefile.os2 \
|
||||
mingw \
|
||||
README-emscripten.txt \
|
||||
README.txt \
|
||||
SDL2_image.spec \
|
||||
VisualC \
|
||||
VisualC-WinRT \
|
||||
Xcode \
|
||||
autogen.sh \
|
||||
external \
|
||||
version.rc
|
||||
|
||||
|
||||
libSDL2_image_la_LDFLAGS = \
|
||||
-no-undefined \
|
||||
-release $(LT_RELEASE) \
|
||||
-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) $(LT_EXTRA)
|
||||
libSDL2_image_la_LIBADD = $(IMG_LIBS)
|
||||
if USE_VERSION_RC
|
||||
libSDL2_image_la_DEPENDENCIES = version.o
|
||||
endif
|
||||
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = SDL2_image.pc
|
||||
|
||||
.rc.o:
|
||||
$(RC) $< $@
|
||||
|
||||
noinst_PROGRAMS = showimage showanim
|
||||
|
||||
showimage_LDADD = libSDL2_image.la
|
||||
showanim_LDADD = libSDL2_image.la
|
||||
|
||||
SUBDIRS = .
|
||||
|
||||
if BUILD_TESTS
|
||||
SUBDIRS += test
|
||||
endif
|
||||
|
||||
# Rule to build tar-gzipped distribution package
|
||||
$(PACKAGE)-$(VERSION).tar.gz: distcheck
|
||||
|
||||
# Rule to build RPM distribution package
|
||||
rpm: $(PACKAGE)-$(VERSION).tar.gz
|
||||
rpmbuild -ta $(PACKAGE)-$(VERSION).tar.gz
|
||||
|
||||
dist-hook:
|
||||
ls $(distdir)/external | fgrep -v download.sh | while read dir; do rm -rf "$(distdir)/external/$$dir"; done
|
||||
|
||||
install-data-local:
|
||||
$(MKDIR_P) $(DESTDIR)$(libdir)/cmake/SDL2_image
|
||||
$(INSTALL) -m 644 sdl2_image-config.cmake $(DESTDIR)$(libdir)/cmake/SDL2_image
|
||||
$(INSTALL) -m 644 sdl2_image-config-version.cmake $(DESTDIR)$(libdir)/cmake/SDL2_image
|
||||
|
||||
uninstall-hook:
|
||||
rm $(DESTDIR)$(libdir)/cmake/SDL2_image/sdl2_image-config.cmake
|
||||
rm $(DESTDIR)$(libdir)/cmake/SDL2_image/sdl2_image-config-version.cmake
|
||||
rm -r $(DESTDIR)$(libdir)/cmake/SDL2_image
|
||||
1326
Library/SDL2_image-2.5.2/Makefile.in
Normal file
1326
Library/SDL2_image-2.5.2/Makefile.in
Normal file
File diff suppressed because it is too large
Load Diff
107
Library/SDL2_image-2.5.2/Makefile.os2
Normal file
107
Library/SDL2_image-2.5.2/Makefile.os2
Normal file
@@ -0,0 +1,107 @@
|
||||
# Open Watcom makefile to build SDL2img.dll for OS/2
|
||||
# wmake -f Makefile.os2
|
||||
#
|
||||
# Remember to edit DEPS_INC and DEPS_LIB below to meet
|
||||
# your own environment!.
|
||||
|
||||
LIBNAME = SDL2img
|
||||
MAJOR_VERSION = 2
|
||||
MINOR_VERSION = 5
|
||||
MICRO_VERSION = 2
|
||||
VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION)
|
||||
|
||||
TITLENAME = $(LIBNAME) $(VERSION)
|
||||
|
||||
LIBFILE = $(LIBNAME).lib
|
||||
DLLFILE = $(LIBNAME).dll
|
||||
LNKFILE = $(LIBNAME).lnk
|
||||
# change DEPS_INC in order to point to the dependency headers.
|
||||
DEPS_INC=-IC:\SDL2DEV\h\SDL2 -IC:\SDL2DEV\h
|
||||
# change DEPS_LIB in order to point to the dependency libraries.
|
||||
DEPS_LIB=C:\SDL2DEV\lib
|
||||
|
||||
SRCS = IMG.c IMG_bmp.c IMG_gif.c IMG_jpg.c IMG_lbm.c IMG_pcx.c IMG_png.c &
|
||||
IMG_pnm.c IMG_svg.c IMG_tga.c IMG_tif.c IMG_xcf.c IMG_xpm.c IMG_xv.c &
|
||||
IMG_webp.c IMG_qoi.c IMG_avif.c IMG_jxl.c IMG_stb.c
|
||||
|
||||
LIBS = libpng.lib libtiff.lib zlib.lib jpeg.lib webpdec.lib SDL2.lib
|
||||
|
||||
CFLAGS_BASE = -bt=os2 -ei -d0 -q -5s -fp5 -fpi87 -sg -oeatxh
|
||||
# warnings:
|
||||
CFLAGS_BASE+= -wx -wcd=202
|
||||
# newer OpenWatcom versions enable W303 by default
|
||||
CFLAGS_BASE+= -wcd=303
|
||||
# include paths:
|
||||
CFLAGS_BASE+= -I"$(%WATCOM)/h/os2" -I"$(%WATCOM)/h"
|
||||
CFLAGS_BASE+= -I. $(DEPS_INC)
|
||||
CFLAGS =$(CFLAGS_BASE)
|
||||
# to build a dll:
|
||||
CFLAGS+= -bd
|
||||
# for DECLSPEC:
|
||||
CFLAGS+= -DBUILD_SDL
|
||||
|
||||
# wanted formats:
|
||||
CFLAGS+= -DLOAD_JPG -DLOAD_PNG -DLOAD_BMP -DLOAD_GIF -DLOAD_LBM &
|
||||
-DLOAD_PCX -DLOAD_PNM -DLOAD_TGA -DLOAD_XCF -DLOAD_XPM &
|
||||
-DLOAD_XV -DLOAD_SVG -DLOAD_TIF -DLOAD_WEBP -DLOAD_QOI
|
||||
|
||||
#CFLAGS+= -DLOAD_AVIF
|
||||
#CFLAGS+= -DLOAD_JXL
|
||||
#CFLAGS+= -DUSE_STBIMAGE -DSTBI_NO_SIMD
|
||||
CFLAGS+= -DSDL_IMAGE_SAVE_JPG=1
|
||||
CFLAGS+= -DSDL_IMAGE_SAVE_PNG=1
|
||||
|
||||
CFLAGS+= -DSDL_BUILD_MAJOR_VERSION=$(MAJOR_VERSION)
|
||||
CFLAGS+= -DSDL_BUILD_MINOR_VERSION=$(MINOR_VERSION)
|
||||
CFLAGS+= -DSDL_BUILD_MICRO_VERSION=$(MICRO_VERSION)
|
||||
|
||||
.extensions:
|
||||
.extensions: .lib .dll .obj .c
|
||||
|
||||
OBJS = $(SRCS:.c=.obj)
|
||||
|
||||
all: $(LIBFILE) showimage.exe
|
||||
|
||||
$(LIBFILE): $(DLLFILE)
|
||||
@echo * Create library: $@...
|
||||
wlib -b -n -q -c -pa -s -t -zld -ii -io $@ $(DLLFILE)
|
||||
|
||||
$(DLLFILE): $(OBJS) $(LNKFILE)
|
||||
@echo * Link: $@
|
||||
wlink @$(LNKFILE)
|
||||
|
||||
$(LNKFILE):
|
||||
@%create $@
|
||||
@%append $@ SYSTEM os2v2_dll INITINSTANCE TERMINSTANCE
|
||||
@%append $@ NAME $(LIBNAME)
|
||||
@for %i in ($(OBJS)) do @%append $@ FILE %i
|
||||
@%append $@ OPTION QUIET
|
||||
@%append $@ OPTION DESCRIPTION '@$#libsdl org:$(VERSION)$#@Simple DirectMedia Layer Image Library'
|
||||
@%append $@ LIBPATH $(DEPS_LIB)
|
||||
@for %i in ($(LIBS)) do @%append $@ LIB %i
|
||||
@%append $@ OPTION MAP=$*
|
||||
@%append $@ OPTION ELIMINATE
|
||||
@%append $@ OPTION MANYAUTODATA
|
||||
@%append $@ OPTION OSNAME='OS/2 and eComStation'
|
||||
@%append $@ OPTION SHOWDEAD
|
||||
|
||||
.c.obj:
|
||||
wcc386 $(CFLAGS) -fo=$^@ $<
|
||||
|
||||
showimage.obj: showimage.c
|
||||
wcc386 $(CFLAGS_BASE) -fo=$^@ $<
|
||||
|
||||
showimage.exe: $(LIBFILE) showimage.obj
|
||||
wlink SYS os2v2 OP q LIBPATH $(DEPS_LIB) LIBR {$(LIBFILE) SDL2.lib} F {showimage.obj} N showimage.exe
|
||||
|
||||
clean: .SYMBOLIC
|
||||
@echo * Clean: $(TITLENAME)
|
||||
@if exist *.obj rm *.obj
|
||||
@if exist *.err rm *.err
|
||||
@if exist $(LNKFILE) rm $(LNKFILE)
|
||||
|
||||
distclean: .SYMBOLIC clean
|
||||
@if exist $(DLLFILE) rm $(DLLFILE)
|
||||
@if exist $(LIBFILE) rm $(LIBFILE)
|
||||
@if exist *.exe rm *.exe
|
||||
@if exist *.map rm *.map
|
||||
20
Library/SDL2_image-2.5.2/README-emscripten.txt
Normal file
20
Library/SDL2_image-2.5.2/README-emscripten.txt
Normal file
@@ -0,0 +1,20 @@
|
||||
Building SDL2_image
|
||||
-------------------
|
||||
|
||||
The easiest way to use SDL2_image with Emscripten is to use Emscripten ports (https://kripken.github.io/emscripten-site/docs/compiling/Building-Projects.html#emscripten-ports) (-s USE_SDL_IMAGE=2).
|
||||
|
||||
If you want to build it yourself instead you can use these instructions:
|
||||
|
||||
Step 0 - get emscripten
|
||||
|
||||
Step 1 - get sdl2-emscripten
|
||||
* clone https://github.com/emscripten-ports/SDL2.git
|
||||
* follow the build instructions in SDL2/docs/README-emscripten.md (make sure to pass a --prefix to configure)
|
||||
* make install
|
||||
|
||||
Step 2 - get sdl_image
|
||||
* emconfigure ./configure --disable-sdltest --with-sdl-prefix=/path/to/sdl --prefix=/path/to/install
|
||||
* (where /path/to/sdl is the path you passed as --prefix to SDL2 configure)
|
||||
* emmake make
|
||||
* make install
|
||||
|
||||
36
Library/SDL2_image-2.5.2/README.txt
Normal file
36
Library/SDL2_image-2.5.2/README.txt
Normal file
@@ -0,0 +1,36 @@
|
||||
|
||||
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.
|
||||
It can load BMP, GIF, JPEG, LBM, PCX, PNG, PNM (PPM/PGM/PBM), QOI, TGA, XCF, XPM, and simple SVG format images. It can also load AVIF, JPEG-XL, TIFF, and WebP images, depending on build options (see the note below for details.)
|
||||
|
||||
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
|
||||
|
||||
This library is under the zlib License, see the file "LICENSE.txt" for details.
|
||||
|
||||
Note:
|
||||
Support for AVIF, JPEG-XL, TIFF, and WebP are not included by default because of the size of the decode libraries, but you can get them by running external/download.sh
|
||||
- When building with CMake, you can enable the appropriate SUPPORT_* options defined in CMakeLists.txt.
|
||||
- When building with configure/make, you can build and install them normally and the configure script will detect and use them.
|
||||
- When building with Visual Studio, you will need to build the libraries and then add the appropriate LOAD_* preprocessor define to the Visual Studio project.
|
||||
- When building with Xcode, you can edit the config at the top of the project to enable them, and you will need to include the appropriate framework in your application.
|
||||
- For Android, you can edit the config at the top of Android.mk to enable them.
|
||||
14
Library/SDL2_image-2.5.2/SDL2_image.pc.in
Normal file
14
Library/SDL2_image-2.5.2/SDL2_image.pc.in
Normal file
@@ -0,0 +1,14 @@
|
||||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
libdir=@libdir@
|
||||
includedir=@includedir@
|
||||
|
||||
Name: @PACKAGE@
|
||||
Description: image loading library for Simple DirectMedia Layer
|
||||
Version: @VERSION@
|
||||
Requires: sdl2 >= @SDL_VERSION@
|
||||
Libs: -L${libdir} -lSDL2_image
|
||||
Requires.private: @PC_REQUIRES@
|
||||
Libs.private: @PC_LIBS@
|
||||
Cflags: -I${includedir}/SDL2
|
||||
|
||||
69
Library/SDL2_image-2.5.2/SDL2_image.spec
Normal file
69
Library/SDL2_image-2.5.2/SDL2_image.spec
Normal file
@@ -0,0 +1,69 @@
|
||||
%define name SDL2_image
|
||||
%define version 2.5.2
|
||||
%define release 1
|
||||
|
||||
Summary: Simple DirectMedia Layer - Sample Image Loading Library
|
||||
Name: %{name}
|
||||
Version: %{version}
|
||||
Release: %{release}
|
||||
Source0: %{name}-%{version}.tar.gz
|
||||
License: LGPL
|
||||
Group: System Environment/Libraries
|
||||
BuildRoot: /var/tmp/%{name}-buildroot
|
||||
Prefix: %{_prefix}
|
||||
Packager: Hakan Tandogan <hakan@iconsult.com>
|
||||
#BuildRequires: SDL2-devel
|
||||
#BuildRequires: libjpeg-devel
|
||||
#BuildRequires: libpng-devel
|
||||
#BuildRequires: libtiff-devel
|
||||
|
||||
%description
|
||||
This is a simple library to load images of various formats as SDL surfaces.
|
||||
This library supports BMP, PPM, PCX, GIF, JPEG, PNG, and TIFF formats.
|
||||
|
||||
%package devel
|
||||
Summary: Libraries, includes and more to develop SDL applications.
|
||||
Group: Development/Libraries
|
||||
Requires: %{name}
|
||||
Requires: SDL2-devel
|
||||
|
||||
%description devel
|
||||
This is a simple library to load images of various formats as SDL surfaces.
|
||||
This library supports BMP, PPM, PCX, GIF, JPEG, PNG, and TIFF formats.
|
||||
|
||||
%prep
|
||||
rm -rf ${RPM_BUILD_ROOT}
|
||||
|
||||
%setup
|
||||
|
||||
%build
|
||||
CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%{prefix}
|
||||
make
|
||||
|
||||
%install
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
make install prefix=$RPM_BUILD_ROOT/%{prefix}
|
||||
|
||||
%clean
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
%files
|
||||
%defattr(-,root,root)
|
||||
%doc README.txt CHANGES.txt LICENSE.txt
|
||||
%{prefix}/lib/lib*.so.*
|
||||
|
||||
%files devel
|
||||
%defattr(-,root,root)
|
||||
%{prefix}/lib/lib*.a
|
||||
%{prefix}/lib/lib*.la
|
||||
%{prefix}/lib/lib*.so
|
||||
%{prefix}/include/*/
|
||||
%{prefix}/lib/pkgconfig/*.pc
|
||||
|
||||
%changelog
|
||||
* Wed Jan 19 2000 Sam Lantinga
|
||||
- converted to get package information from configure
|
||||
* Tue Jan 18 2000 Hakan Tandogan <hakan@iconsult.com>
|
||||
- initial spec file
|
||||
|
||||
|
||||
69
Library/SDL2_image-2.5.2/SDL2_image.spec.in
Normal file
69
Library/SDL2_image-2.5.2/SDL2_image.spec.in
Normal file
@@ -0,0 +1,69 @@
|
||||
%define name @PACKAGE@
|
||||
%define version @VERSION@
|
||||
%define release 1
|
||||
|
||||
Summary: Simple DirectMedia Layer - Sample Image Loading Library
|
||||
Name: %{name}
|
||||
Version: %{version}
|
||||
Release: %{release}
|
||||
Source0: %{name}-%{version}.tar.gz
|
||||
License: LGPL
|
||||
Group: System Environment/Libraries
|
||||
BuildRoot: /var/tmp/%{name}-buildroot
|
||||
Prefix: %{_prefix}
|
||||
Packager: Hakan Tandogan <hakan@iconsult.com>
|
||||
#BuildRequires: SDL2-devel
|
||||
#BuildRequires: libjpeg-devel
|
||||
#BuildRequires: libpng-devel
|
||||
#BuildRequires: libtiff-devel
|
||||
|
||||
%description
|
||||
This is a simple library to load images of various formats as SDL surfaces.
|
||||
This library supports BMP, PPM, PCX, GIF, JPEG, PNG, and TIFF formats.
|
||||
|
||||
%package devel
|
||||
Summary: Libraries, includes and more to develop SDL applications.
|
||||
Group: Development/Libraries
|
||||
Requires: %{name}
|
||||
Requires: SDL2-devel
|
||||
|
||||
%description devel
|
||||
This is a simple library to load images of various formats as SDL surfaces.
|
||||
This library supports BMP, PPM, PCX, GIF, JPEG, PNG, and TIFF formats.
|
||||
|
||||
%prep
|
||||
rm -rf ${RPM_BUILD_ROOT}
|
||||
|
||||
%setup
|
||||
|
||||
%build
|
||||
CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%{prefix}
|
||||
make
|
||||
|
||||
%install
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
make install prefix=$RPM_BUILD_ROOT/%{prefix}
|
||||
|
||||
%clean
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
%files
|
||||
%defattr(-,root,root)
|
||||
%doc README.txt CHANGES.txt LICENSE.txt
|
||||
%{prefix}/lib/lib*.so.*
|
||||
|
||||
%files devel
|
||||
%defattr(-,root,root)
|
||||
%{prefix}/lib/lib*.a
|
||||
%{prefix}/lib/lib*.la
|
||||
%{prefix}/lib/lib*.so
|
||||
%{prefix}/include/*/
|
||||
%{prefix}/lib/pkgconfig/*.pc
|
||||
|
||||
%changelog
|
||||
* Wed Jan 19 2000 Sam Lantinga
|
||||
- converted to get package information from configure
|
||||
* Tue Jan 18 2000 Hakan Tandogan <hakan@iconsult.com>
|
||||
- initial spec file
|
||||
|
||||
|
||||
90
Library/SDL2_image-2.5.2/SDL2_imageConfig.cmake.in
Normal file
90
Library/SDL2_image-2.5.2/SDL2_imageConfig.cmake.in
Normal file
@@ -0,0 +1,90 @@
|
||||
# sdl2_image cmake project-config input for CMakeLists.txt script
|
||||
|
||||
include(FeatureSummary)
|
||||
set_package_properties(SDL2_image PROPERTIES
|
||||
URL "https://www.libsdl.org/projects/SDL_image/"
|
||||
DESCRIPTION "SDL_image is an image file loading library"
|
||||
)
|
||||
|
||||
set(SDL2_image_FOUND ON)
|
||||
|
||||
set(SDL2IMAGE_AVIF @SDL2IMAGE_AVIF@)
|
||||
set(SDL2IMAGE_BMP @SDL2IMAGE_BMP@)
|
||||
set(SDL2IMAGE_GIF @SDL2IMAGE_GIF@)
|
||||
set(SDL2IMAGE_JPG @SDL2IMAGE_JPG@)
|
||||
set(SDL2IMAGE_JXL @SDL2IMAGE_JXL@)
|
||||
set(SDL2IMAGE_LBM @SDL2IMAGE_LBM@)
|
||||
set(SDL2IMAGE_PCX @SDL2IMAGE_PCX@)
|
||||
set(SDL2IMAGE_PNG @SDL2IMAGE_PNG@)
|
||||
set(SDL2IMAGE_PNM @SDL2IMAGE_PNM@)
|
||||
set(SDL2IMAGE_QOI @SDL2IMAGE_QOI@)
|
||||
set(SDL2IMAGE_SVG @SDL2IMAGE_SVG@)
|
||||
set(SDL2IMAGE_TGA @SDL2IMAGE_TGA@)
|
||||
set(SDL2IMAGE_TIF @SDL2IMAGE_TIF@)
|
||||
set(SDL2IMAGE_XCF @SDL2IMAGE_XCF@)
|
||||
set(SDL2IMAGE_XPM @SDL2IMAGE_XPM@)
|
||||
set(SDL2IMAGE_XV @SDL2IMAGE_XV@)
|
||||
set(SDL2IMAGE_WEBP @SDL2IMAGE_WEBP@)
|
||||
|
||||
set(SDL2IMAGE_JPG_SAVE @SDL2IMAGE_JPG_SAVE@)
|
||||
set(SDL2IMAGE_PNG_SAVE @SDL2IMAGE_PNG_SAVE@)
|
||||
|
||||
set(SDL2IMAGE_VENDORED @SDL2IMAGE_VENDORED@)
|
||||
|
||||
set(SDL2IMAGE_BACKEND_IMAGEIO @SDL2IMAGE_BACKEND_IMAGEIO@)
|
||||
set(SDL2IMAGE_BACKEND_STB @SDL2IMAGE_BACKEND_STB@)
|
||||
set(SDL2IMAGE_BACKEND_WIC @SDL2IMAGE_BACKEND_WIC@)
|
||||
|
||||
set(SDL2IMAGE_SDL2_REQUIRED_VERSION @SDL_REQUIRED_VERSION@)
|
||||
|
||||
if(NOT SDL2IMAGE_VENDORED)
|
||||
set(_sdl_cmake_module_path "${CMAKE_MODULE_PATH}")
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")
|
||||
endif()
|
||||
|
||||
include(CMakeFindDependencyMacro)
|
||||
|
||||
if(SDL2IMAGE_AVIF AND NOT SDL2IMAGE_VENDORED AND NOT TARGET avif)
|
||||
find_dependency(libavif @LIBAVIF_MINIMUM_VERSION@)
|
||||
endif()
|
||||
|
||||
if(SDL2IMAGE_JPG AND NOT SDL2IMAGE_VENDORED AND NOT TARGET JPEG::JPEG)
|
||||
find_dependency(JPEG)
|
||||
endif()
|
||||
|
||||
if(SDL2IMAGE_JXL AND NOT SDL2IMAGE_VENDORED AND NOT TARGET libjxl::libjxl)
|
||||
list(APPEND libjxl_ROOT "${CMAKE_CURRENT_LIST_DIR}")
|
||||
find_dependency(libjxl)
|
||||
endif()
|
||||
|
||||
if(SDL2IMAGE_PNG AND NOT SDL2IMAGE_VENDORED AND NOT TARGET PNG::PNG)
|
||||
find_dependency(PNG)
|
||||
endif()
|
||||
|
||||
if(SDL2IMAGE_TIF AND NOT SDL2IMAGE_VENDORED AND NOT TARGET TIFF::TIFF)
|
||||
find_dependency(TIFF)
|
||||
endif()
|
||||
|
||||
if(SDL2IMAGE_WEBP AND NOT SDL2IMAGE_VENDORED AND NOT TARGET WebP::webp)
|
||||
list(APPEND webp_ROOT "${CMAKE_CURRENT_LIST_DIR}")
|
||||
find_dependency(webp)
|
||||
endif()
|
||||
|
||||
#FIXME: can't add SDL2IMAGE_SDL2_REQUIRED_VERSION since not all SDL2 installs ship SDL2ConfigVersion.cmake
|
||||
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/SDL2_image-shared-targets.cmake")
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/SDL2_image-shared-targets.cmake")
|
||||
endif()
|
||||
|
||||
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/SDL2_image-static-targets.cmake")
|
||||
include(CheckLanguage)
|
||||
check_language(CXX)
|
||||
if(SDL2IMAGE_VENDORED AND NOT CMAKE_CXX_COMPILER AND NOT _sdl2image_nowarning)
|
||||
message(WARNING "CXX language not enabled. Linking to SDL2_image::SDL2_image-static might fail.")
|
||||
endif()
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/SDL2_image-static-targets.cmake")
|
||||
endif()
|
||||
|
||||
if(NOT SDL2IMAGE_VENDORED)
|
||||
set(CMAKE_MODULE_PATH "${_sdl_cmake_module_path}")
|
||||
unset(_sdl_cmake_module_path)
|
||||
endif()
|
||||
204
Library/SDL2_image-2.5.2/SDL_image.h
Normal file
204
Library/SDL2_image-2.5.2/SDL_image.h
Normal file
@@ -0,0 +1,204 @@
|
||||
/*
|
||||
SDL_image: An example image loading library for use with SDL
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
/* A simple library to load images of various formats as SDL surfaces */
|
||||
|
||||
#ifndef SDL_IMAGE_H_
|
||||
#define SDL_IMAGE_H_
|
||||
|
||||
#include "SDL.h"
|
||||
#include "SDL_version.h"
|
||||
#include "begin_code.h"
|
||||
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL
|
||||
*/
|
||||
#define SDL_IMAGE_MAJOR_VERSION 2
|
||||
#define SDL_IMAGE_MINOR_VERSION 5
|
||||
#define SDL_IMAGE_PATCHLEVEL 2
|
||||
|
||||
/* This macro can be used to fill a version structure with the compile-time
|
||||
* version of the SDL_image library.
|
||||
*/
|
||||
#define SDL_IMAGE_VERSION(X) \
|
||||
{ \
|
||||
(X)->major = SDL_IMAGE_MAJOR_VERSION; \
|
||||
(X)->minor = SDL_IMAGE_MINOR_VERSION; \
|
||||
(X)->patch = SDL_IMAGE_PATCHLEVEL; \
|
||||
}
|
||||
|
||||
#if SDL_IMAGE_MAJOR_VERSION < 3 && SDL_MAJOR_VERSION < 3
|
||||
/**
|
||||
* This is the version number macro for the current SDL_image version.
|
||||
*
|
||||
* In versions higher than 2.9.0, the minor version overflows into
|
||||
* the thousands digit: for example, 2.23.0 is encoded as 4300.
|
||||
* This macro will not be available in SDL 3.x or SDL_image 3.x.
|
||||
*
|
||||
* Deprecated, use SDL_IMAGE_VERSION_ATLEAST or SDL_IMAGE_VERSION instead.
|
||||
*/
|
||||
#define SDL_IMAGE_COMPILEDVERSION \
|
||||
SDL_VERSIONNUM(SDL_IMAGE_MAJOR_VERSION, SDL_IMAGE_MINOR_VERSION, SDL_IMAGE_PATCHLEVEL)
|
||||
#endif /* SDL_IMAGE_MAJOR_VERSION < 3 && SDL_MAJOR_VERSION < 3 */
|
||||
|
||||
/**
|
||||
* This macro will evaluate to true if compiled with SDL_image at least X.Y.Z.
|
||||
*/
|
||||
#define SDL_IMAGE_VERSION_ATLEAST(X, Y, Z) \
|
||||
((SDL_IMAGE_MAJOR_VERSION >= X) && \
|
||||
(SDL_IMAGE_MAJOR_VERSION > X || SDL_IMAGE_MINOR_VERSION >= Y) && \
|
||||
(SDL_IMAGE_MAJOR_VERSION > X || SDL_IMAGE_MINOR_VERSION > Y || SDL_IMAGE_PATCHLEVEL >= Z))
|
||||
|
||||
/* This function gets the version of the dynamically linked SDL_image library.
|
||||
it should NOT be used to fill a version structure, instead you should
|
||||
use the SDL_IMAGE_VERSION() macro.
|
||||
*/
|
||||
extern DECLSPEC const SDL_version * SDLCALL IMG_Linked_Version(void);
|
||||
|
||||
typedef enum
|
||||
{
|
||||
IMG_INIT_JPG = 0x00000001,
|
||||
IMG_INIT_PNG = 0x00000002,
|
||||
IMG_INIT_TIF = 0x00000004,
|
||||
IMG_INIT_WEBP = 0x00000008,
|
||||
IMG_INIT_JXL = 0x00000010,
|
||||
IMG_INIT_AVIF = 0x00000020
|
||||
} IMG_InitFlags;
|
||||
|
||||
/* Loads dynamic libraries and prepares them for use. Flags should be
|
||||
one or more flags from IMG_InitFlags OR'd together.
|
||||
It returns the flags successfully initialized, or 0 on failure.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL IMG_Init(int flags);
|
||||
|
||||
/* Unloads libraries loaded with IMG_Init */
|
||||
extern DECLSPEC void SDLCALL IMG_Quit(void);
|
||||
|
||||
/* Load an image from an SDL data source.
|
||||
The 'type' may be one of: "BMP", "GIF", "PNG", etc.
|
||||
|
||||
If the image format supports a transparent pixel, SDL will set the
|
||||
colorkey for the surface. You can enable RLE acceleration on the
|
||||
surface afterwards by calling:
|
||||
SDL_SetColorKey(image, SDL_RLEACCEL, image->format->colorkey);
|
||||
*/
|
||||
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadTyped_RW(SDL_RWops *src, int freesrc, const char *type);
|
||||
/* Convenience functions */
|
||||
extern DECLSPEC SDL_Surface * SDLCALL IMG_Load(const char *file);
|
||||
extern DECLSPEC SDL_Surface * SDLCALL IMG_Load_RW(SDL_RWops *src, int freesrc);
|
||||
|
||||
#if SDL_VERSION_ATLEAST(2,0,0)
|
||||
/* Load an image directly into a render texture.
|
||||
*/
|
||||
extern DECLSPEC SDL_Texture * SDLCALL IMG_LoadTexture(SDL_Renderer *renderer, const char *file);
|
||||
extern DECLSPEC SDL_Texture * SDLCALL IMG_LoadTexture_RW(SDL_Renderer *renderer, SDL_RWops *src, int freesrc);
|
||||
extern DECLSPEC SDL_Texture * SDLCALL IMG_LoadTextureTyped_RW(SDL_Renderer *renderer, SDL_RWops *src, int freesrc, const char *type);
|
||||
#endif /* SDL 2.0 */
|
||||
|
||||
/* Functions to detect a file type, given a seekable source */
|
||||
extern DECLSPEC int SDLCALL IMG_isAVIF(SDL_RWops *src);
|
||||
extern DECLSPEC int SDLCALL IMG_isICO(SDL_RWops *src);
|
||||
extern DECLSPEC int SDLCALL IMG_isCUR(SDL_RWops *src);
|
||||
extern DECLSPEC int SDLCALL IMG_isBMP(SDL_RWops *src);
|
||||
extern DECLSPEC int SDLCALL IMG_isGIF(SDL_RWops *src);
|
||||
extern DECLSPEC int SDLCALL IMG_isJPG(SDL_RWops *src);
|
||||
extern DECLSPEC int SDLCALL IMG_isJXL(SDL_RWops *src);
|
||||
extern DECLSPEC int SDLCALL IMG_isLBM(SDL_RWops *src);
|
||||
extern DECLSPEC int SDLCALL IMG_isPCX(SDL_RWops *src);
|
||||
extern DECLSPEC int SDLCALL IMG_isPNG(SDL_RWops *src);
|
||||
extern DECLSPEC int SDLCALL IMG_isPNM(SDL_RWops *src);
|
||||
extern DECLSPEC int SDLCALL IMG_isSVG(SDL_RWops *src);
|
||||
extern DECLSPEC int SDLCALL IMG_isQOI(SDL_RWops *src);
|
||||
extern DECLSPEC int SDLCALL IMG_isTIF(SDL_RWops *src);
|
||||
extern DECLSPEC int SDLCALL IMG_isXCF(SDL_RWops *src);
|
||||
extern DECLSPEC int SDLCALL IMG_isXPM(SDL_RWops *src);
|
||||
extern DECLSPEC int SDLCALL IMG_isXV(SDL_RWops *src);
|
||||
extern DECLSPEC int SDLCALL IMG_isWEBP(SDL_RWops *src);
|
||||
|
||||
/* Individual loading functions */
|
||||
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadAVIF_RW(SDL_RWops *src);
|
||||
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadICO_RW(SDL_RWops *src);
|
||||
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadCUR_RW(SDL_RWops *src);
|
||||
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadBMP_RW(SDL_RWops *src);
|
||||
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadGIF_RW(SDL_RWops *src);
|
||||
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadJPG_RW(SDL_RWops *src);
|
||||
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadJXL_RW(SDL_RWops *src);
|
||||
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadLBM_RW(SDL_RWops *src);
|
||||
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadPCX_RW(SDL_RWops *src);
|
||||
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadPNG_RW(SDL_RWops *src);
|
||||
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadPNM_RW(SDL_RWops *src);
|
||||
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadSVG_RW(SDL_RWops *src);
|
||||
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadQOI_RW(SDL_RWops *src);
|
||||
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadTGA_RW(SDL_RWops *src);
|
||||
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadTIF_RW(SDL_RWops *src);
|
||||
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadXCF_RW(SDL_RWops *src);
|
||||
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadXPM_RW(SDL_RWops *src);
|
||||
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadXV_RW(SDL_RWops *src);
|
||||
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadWEBP_RW(SDL_RWops *src);
|
||||
|
||||
/* Load an SVG scaled to a specific size
|
||||
Either width or height may be 0 and will be auto-sized to preserve aspect ratio.
|
||||
*/
|
||||
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadSizedSVG_RW(SDL_RWops *src, int width, int height);
|
||||
|
||||
extern DECLSPEC SDL_Surface * SDLCALL IMG_ReadXPMFromArray(char **xpm);
|
||||
extern DECLSPEC SDL_Surface * SDLCALL IMG_ReadXPMFromArrayToRGB888(char **xpm);
|
||||
|
||||
/* Individual saving functions */
|
||||
extern DECLSPEC int SDLCALL IMG_SavePNG(SDL_Surface *surface, const char *file);
|
||||
extern DECLSPEC int SDLCALL IMG_SavePNG_RW(SDL_Surface *surface, SDL_RWops *dst, int freedst);
|
||||
extern DECLSPEC int SDLCALL IMG_SaveJPG(SDL_Surface *surface, const char *file, int quality);
|
||||
extern DECLSPEC int SDLCALL IMG_SaveJPG_RW(SDL_Surface *surface, SDL_RWops *dst, int freedst, int quality);
|
||||
|
||||
/* Animated image support
|
||||
Currently only animated GIFs are supported.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
int w, h;
|
||||
int count;
|
||||
SDL_Surface **frames;
|
||||
int *delays;
|
||||
} IMG_Animation;
|
||||
|
||||
extern DECLSPEC IMG_Animation * SDLCALL IMG_LoadAnimation(const char *file);
|
||||
extern DECLSPEC IMG_Animation * SDLCALL IMG_LoadAnimation_RW(SDL_RWops *src, int freesrc);
|
||||
extern DECLSPEC IMG_Animation * SDLCALL IMG_LoadAnimationTyped_RW(SDL_RWops *src, int freesrc, const char *type);
|
||||
extern DECLSPEC void SDLCALL IMG_FreeAnimation(IMG_Animation *anim);
|
||||
|
||||
/* Individual loading functions */
|
||||
extern DECLSPEC IMG_Animation * SDLCALL IMG_LoadGIFAnimation_RW(SDL_RWops *src);
|
||||
|
||||
/* We'll use SDL for reporting errors */
|
||||
#define IMG_SetError SDL_SetError
|
||||
#define IMG_GetError SDL_GetError
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
#endif /* SDL_IMAGE_H_ */
|
||||
37
Library/SDL2_image-2.5.2/VisualC-WinRT/SDL_image-UWP.sln
Normal file
37
Library/SDL2_image-2.5.2/VisualC-WinRT/SDL_image-UWP.sln
Normal file
@@ -0,0 +1,37 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.31911.196
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL2_image-UWP", "SDL_image-UWP.vcxproj", "{18665277-E558-4484-93F4-E4DC7BB614CB}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|ARM = Debug|ARM
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|ARM = Release|ARM
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{18665277-E558-4484-93F4-E4DC7BB614CB}.Debug|ARM.ActiveCfg = Debug|ARM
|
||||
{18665277-E558-4484-93F4-E4DC7BB614CB}.Debug|ARM.Build.0 = Debug|ARM
|
||||
{18665277-E558-4484-93F4-E4DC7BB614CB}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{18665277-E558-4484-93F4-E4DC7BB614CB}.Debug|x64.Build.0 = Debug|x64
|
||||
{18665277-E558-4484-93F4-E4DC7BB614CB}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{18665277-E558-4484-93F4-E4DC7BB614CB}.Debug|x86.Build.0 = Debug|Win32
|
||||
{18665277-E558-4484-93F4-E4DC7BB614CB}.Release|ARM.ActiveCfg = Release|ARM
|
||||
{18665277-E558-4484-93F4-E4DC7BB614CB}.Release|ARM.Build.0 = Release|ARM
|
||||
{18665277-E558-4484-93F4-E4DC7BB614CB}.Release|x64.ActiveCfg = Release|x64
|
||||
{18665277-E558-4484-93F4-E4DC7BB614CB}.Release|x64.Build.0 = Release|x64
|
||||
{18665277-E558-4484-93F4-E4DC7BB614CB}.Release|x86.ActiveCfg = Release|Win32
|
||||
{18665277-E558-4484-93F4-E4DC7BB614CB}.Release|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {D933852A-2B04-47A9-8684-18570D927154}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
238
Library/SDL2_image-2.5.2/VisualC-WinRT/SDL_image-UWP.vcxproj
Normal file
238
Library/SDL2_image-2.5.2/VisualC-WinRT/SDL_image-UWP.vcxproj
Normal file
@@ -0,0 +1,238 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|ARM">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>ARM</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|ARM">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>ARM</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\SDL_image.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\SDL\VisualC-WinRT\SDL-UWP.vcxproj">
|
||||
<Project>{89e9b32e-a86a-47c3-a948-d2b1622925ce}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\IMG.c" />
|
||||
<ClCompile Include="..\IMG_avif.c" />
|
||||
<ClCompile Include="..\IMG_bmp.c" />
|
||||
<ClCompile Include="..\IMG_gif.c" />
|
||||
<ClCompile Include="..\IMG_jpg.c" />
|
||||
<ClCompile Include="..\IMG_jxl.c" />
|
||||
<ClCompile Include="..\IMG_lbm.c" />
|
||||
<ClCompile Include="..\IMG_pcx.c" />
|
||||
<ClCompile Include="..\IMG_png.c" />
|
||||
<ClCompile Include="..\IMG_pnm.c" />
|
||||
<ClCompile Include="..\IMG_qoi.c" />
|
||||
<ClCompile Include="..\IMG_stb.c" />
|
||||
<ClCompile Include="..\IMG_svg.c" />
|
||||
<ClCompile Include="..\IMG_tga.c" />
|
||||
<ClCompile Include="..\IMG_tif.c" />
|
||||
<ClCompile Include="..\IMG_webp.c" />
|
||||
<ClCompile Include="..\IMG_WIC.c" />
|
||||
<ClCompile Include="..\IMG_xcf.c" />
|
||||
<ClCompile Include="..\IMG_xpm.c" />
|
||||
<ClCompile Include="..\IMG_xv.c" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{18665277-e558-4484-93f4-e4dc7bb614cb}</ProjectGuid>
|
||||
<Keyword>DynamicLibrary</Keyword>
|
||||
<ProjectName>SDL2_image-UWP</ProjectName>
|
||||
<RootNamespace>SDL2_image_UWP</RootNamespace>
|
||||
<DefaultLanguage>en-US</DefaultLanguage>
|
||||
<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
|
||||
<AppContainerApplication>true</AppContainerApplication>
|
||||
<ApplicationType>Windows Store</ApplicationType>
|
||||
<ApplicationTypeRevision>8.2</ApplicationTypeRevision>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
<WindowsTargetPlatformMinVersion>10.0.0.0</WindowsTargetPlatformMinVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<GenerateManifest>false</GenerateManifest>
|
||||
<IgnoreImportLibrary>false</IgnoreImportLibrary>
|
||||
<IntDir>Objs\$(Platform)\$(Configuration)\$(MSBuildProjectName)\</IntDir>
|
||||
<TargetName>SDL2_image</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<GenerateManifest>false</GenerateManifest>
|
||||
<IgnoreImportLibrary>false</IgnoreImportLibrary>
|
||||
<IntDir>Objs\$(Platform)\$(Configuration)\$(MSBuildProjectName)\</IntDir>
|
||||
<TargetName>SDL2_image</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
|
||||
<GenerateManifest>false</GenerateManifest>
|
||||
<IgnoreImportLibrary>false</IgnoreImportLibrary>
|
||||
<IntDir>Objs\$(Platform)\$(Configuration)\$(MSBuildProjectName)\</IntDir>
|
||||
<TargetName>SDL2_image</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
|
||||
<GenerateManifest>false</GenerateManifest>
|
||||
<IgnoreImportLibrary>false</IgnoreImportLibrary>
|
||||
<IntDir>Objs\$(Platform)\$(Configuration)\$(MSBuildProjectName)\</IntDir>
|
||||
<TargetName>SDL2_image</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<GenerateManifest>false</GenerateManifest>
|
||||
<IgnoreImportLibrary>false</IgnoreImportLibrary>
|
||||
<IntDir>Objs\$(Platform)\$(Configuration)\$(MSBuildProjectName)\</IntDir>
|
||||
<TargetName>SDL2_image</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<GenerateManifest>false</GenerateManifest>
|
||||
<IgnoreImportLibrary>false</IgnoreImportLibrary>
|
||||
<IntDir>Objs\$(Platform)\$(Configuration)\$(MSBuildProjectName)\</IntDir>
|
||||
<TargetName>SDL2_image</TargetName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<CompileAsWinRT>false</CompileAsWinRT>
|
||||
<AdditionalIncludeDirectories>..\include;..\src;..\src\codecs;..\src\codecs\timidity;..\external\ogg\include;..\external\vorbis\include;..\..\SDL\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>USE_STBIMAGE;LOAD_BMP;LOAD_GIF;LOAD_JPG;LOAD_LBM;LOAD_PCX;LOAD_PNG;LOAD_PNM;LOAD_QOI;LOAD_SVG;LOAD_TGA;LOAD_XPM;LOAD_XV;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
|
||||
<GenerateWindowsMetadata>false</GenerateWindowsMetadata>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<CompileAsWinRT>false</CompileAsWinRT>
|
||||
<AdditionalIncludeDirectories>..\include;..\src;..\src\codecs;..\src\codecs\timidity;..\external\ogg\include;..\external\vorbis\include;..\..\SDL\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>NDEBUG;USE_STBIMAGE;LOAD_BMP;LOAD_GIF;LOAD_JPG;LOAD_LBM;LOAD_PCX;LOAD_PNG;LOAD_PNM;LOAD_QOI;LOAD_SVG;LOAD_TGA;LOAD_XPM;LOAD_XV;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
|
||||
<GenerateWindowsMetadata>false</GenerateWindowsMetadata>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|arm'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<CompileAsWinRT>false</CompileAsWinRT>
|
||||
<AdditionalIncludeDirectories>..\include;..\src;..\src\codecs;..\src\codecs\timidity;..\external\ogg\include;..\external\vorbis\include;..\..\SDL\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>USE_STBIMAGE;LOAD_BMP;LOAD_GIF;LOAD_JPG;LOAD_LBM;LOAD_PCX;LOAD_PNG;LOAD_PNM;LOAD_QOI;LOAD_SVG;LOAD_TGA;LOAD_XPM;LOAD_XV;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
|
||||
<GenerateWindowsMetadata>false</GenerateWindowsMetadata>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|arm'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<CompileAsWinRT>false</CompileAsWinRT>
|
||||
<AdditionalIncludeDirectories>..\include;..\src;..\src\codecs;..\src\codecs\timidity;..\external\ogg\include;..\external\vorbis\include;..\..\SDL\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>NDEBUG;USE_STBIMAGE;LOAD_BMP;LOAD_GIF;LOAD_JPG;LOAD_LBM;LOAD_PCX;LOAD_PNG;LOAD_PNM;LOAD_QOI;LOAD_SVG;LOAD_TGA;LOAD_XPM;LOAD_XV;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
|
||||
<GenerateWindowsMetadata>false</GenerateWindowsMetadata>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<CompileAsWinRT>false</CompileAsWinRT>
|
||||
<AdditionalIncludeDirectories>..\include;..\src;..\src\codecs;..\src\codecs\timidity;..\external\ogg\include;..\external\vorbis\include;..\..\SDL\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>USE_STBIMAGE;LOAD_BMP;LOAD_GIF;LOAD_JPG;LOAD_LBM;LOAD_PCX;LOAD_PNG;LOAD_PNM;LOAD_QOI;LOAD_SVG;LOAD_TGA;LOAD_XPM;LOAD_XV;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
|
||||
<GenerateWindowsMetadata>false</GenerateWindowsMetadata>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<CompileAsWinRT>false</CompileAsWinRT>
|
||||
<AdditionalIncludeDirectories>..\include;..\src;..\src\codecs;..\src\codecs\timidity;..\external\ogg\include;..\external\vorbis\include;..\..\SDL\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>NDEBUG;USE_STBIMAGE;LOAD_BMP;LOAD_GIF;LOAD_JPG;LOAD_LBM;LOAD_PCX;LOAD_PNG;LOAD_PNM;LOAD_QOI;LOAD_SVG;LOAD_TGA;LOAD_XPM;LOAD_XV;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
|
||||
<GenerateWindowsMetadata>false</GenerateWindowsMetadata>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,78 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\SDL_image.h">
|
||||
<Filter>Public Headers</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Filter Include="Sources">
|
||||
<UniqueIdentifier>{e074d5df-046d-48ae-b45a-f472f0bdd965}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Public Headers">
|
||||
<UniqueIdentifier>{9c43d0b0-edae-4dea-bb19-5bd7972e58bc}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\IMG.c">
|
||||
<Filter>Sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\IMG_avif.c">
|
||||
<Filter>Sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\IMG_bmp.c">
|
||||
<Filter>Sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\IMG_gif.c">
|
||||
<Filter>Sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\IMG_jpg.c">
|
||||
<Filter>Sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\IMG_jxl.c">
|
||||
<Filter>Sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\IMG_lbm.c">
|
||||
<Filter>Sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\IMG_pcx.c">
|
||||
<Filter>Sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\IMG_png.c">
|
||||
<Filter>Sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\IMG_pnm.c">
|
||||
<Filter>Sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\IMG_qoi.c">
|
||||
<Filter>Sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\IMG_stb.c">
|
||||
<Filter>Sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\IMG_svg.c">
|
||||
<Filter>Sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\IMG_tga.c">
|
||||
<Filter>Sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\IMG_tif.c">
|
||||
<Filter>Sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\IMG_webp.c">
|
||||
<Filter>Sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\IMG_WIC.c">
|
||||
<Filter>Sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\IMG_xcf.c">
|
||||
<Filter>Sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\IMG_xpm.c">
|
||||
<Filter>Sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\IMG_xv.c">
|
||||
<Filter>Sources</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
36
Library/SDL2_image-2.5.2/VisualC/SDL_image.sln
Normal file
36
Library/SDL2_image-2.5.2/VisualC/SDL_image.sln
Normal file
@@ -0,0 +1,36 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2010
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL2_image", "SDL_image.vcxproj", "{2BD5534E-00E2-4BEA-AC96-D9A92EA24696}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "showimage", "showimage\showimage.vcxproj", "{FEE80C5D-762E-4E57-9BCB-928749E8203F}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Debug|x64 = Debug|x64
|
||||
Release|Win32 = Release|Win32
|
||||
Release|x64 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{2BD5534E-00E2-4BEA-AC96-D9A92EA24696}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{2BD5534E-00E2-4BEA-AC96-D9A92EA24696}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{2BD5534E-00E2-4BEA-AC96-D9A92EA24696}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{2BD5534E-00E2-4BEA-AC96-D9A92EA24696}.Debug|x64.Build.0 = Debug|x64
|
||||
{2BD5534E-00E2-4BEA-AC96-D9A92EA24696}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{2BD5534E-00E2-4BEA-AC96-D9A92EA24696}.Release|Win32.Build.0 = Release|Win32
|
||||
{2BD5534E-00E2-4BEA-AC96-D9A92EA24696}.Release|x64.ActiveCfg = Release|x64
|
||||
{2BD5534E-00E2-4BEA-AC96-D9A92EA24696}.Release|x64.Build.0 = Release|x64
|
||||
{FEE80C5D-762E-4E57-9BCB-928749E8203F}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{FEE80C5D-762E-4E57-9BCB-928749E8203F}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{FEE80C5D-762E-4E57-9BCB-928749E8203F}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{FEE80C5D-762E-4E57-9BCB-928749E8203F}.Debug|x64.Build.0 = Debug|x64
|
||||
{FEE80C5D-762E-4E57-9BCB-928749E8203F}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{FEE80C5D-762E-4E57-9BCB-928749E8203F}.Release|Win32.Build.0 = Release|Win32
|
||||
{FEE80C5D-762E-4E57-9BCB-928749E8203F}.Release|x64.ActiveCfg = Release|x64
|
||||
{FEE80C5D-762E-4E57-9BCB-928749E8203F}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
240
Library/SDL2_image-2.5.2/VisualC/SDL_image.vcxproj
Normal file
240
Library/SDL2_image-2.5.2/VisualC/SDL_image.vcxproj
Normal file
@@ -0,0 +1,240 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectName>SDL2_image</ProjectName>
|
||||
<ProjectGuid>{2BD5534E-00E2-4BEA-AC96-D9A92EA24696}</ProjectGuid>
|
||||
<RootNamespace>SDL2_image</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)\$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)\$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)\$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)\$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<IncludePath>$(SolutionDir)..\..\SDL\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(SolutionDir)..\..\SDL\VisualC\$(PlatformName)\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<IncludePath>$(SolutionDir)..\..\SDL\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(SolutionDir)..\..\SDL\VisualC\$(PlatformName)\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<IncludePath>$(SolutionDir)..\..\SDL\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(SolutionDir)..\..\SDL\VisualC\$(PlatformName)\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<IncludePath>$(SolutionDir)..\..\SDL\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(SolutionDir)..\..\SDL\VisualC\$(PlatformName)\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>Win32</TargetEnvironment>
|
||||
<TypeLibraryName>.\Debug/SDL2_image.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>external\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>DLL_EXPORT;_DEBUG;WIN32;_WINDOWS;USE_STBIMAGE;LOAD_BMP;LOAD_GIF;LOAD_JPG;LOAD_LBM;LOAD_PCX;LOAD_PNG;LOAD_PNM;LOAD_SVG;LOAD_SVG;LOAD_TGA;LOAD_XPM;LOAD_XV;LOAD_QOI;PNG_USE_DLL;ZLIB_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
<EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>SDL2.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
</Link>
|
||||
<Bscmake />
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
<TypeLibraryName>.\Debug/SDL2_image.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>external\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>DLL_EXPORT;_DEBUG;WIN32;_WINDOWS;USE_STBIMAGE;LOAD_BMP;LOAD_GIF;LOAD_JPG;LOAD_LBM;LOAD_PCX;LOAD_PNG;LOAD_PNM;LOAD_SVG;LOAD_TGA;LOAD_XPM;LOAD_XV;LOAD_QOI;PNG_USE_DLL;ZLIB_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
<EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>SDL2.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
</Link>
|
||||
<Bscmake />
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>Win32</TargetEnvironment>
|
||||
<TypeLibraryName>.\Release/SDL2_image.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>external\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>DLL_EXPORT;NDEBUG;WIN32;_WINDOWS;USE_STBIMAGE;LOAD_BMP;LOAD_GIF;LOAD_JPG;LOAD_LBM;LOAD_PCX;LOAD_PNG;LOAD_PNM;LOAD_SVG;LOAD_TGA;LOAD_XPM;LOAD_XV;LOAD_QOI;PNG_USE_DLL;ZLIB_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>SDL2.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
</Link>
|
||||
<Bscmake />
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
<TypeLibraryName>.\Release/SDL2_image.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>external\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>DLL_EXPORT;NDEBUG;WIN32;_WINDOWS;USE_STBIMAGE;LOAD_BMP;LOAD_GIF;LOAD_JPG;LOAD_LBM;LOAD_PCX;LOAD_PNG;LOAD_PNM;LOAD_SVG;LOAD_TGA;LOAD_XPM;LOAD_XV;LOAD_QOI;PNG_USE_DLL;ZLIB_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<AdditionalDependencies>SDL2.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
<Bscmake />
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\IMG.c" />
|
||||
<ClCompile Include="..\IMG_avif.c" />
|
||||
<ClCompile Include="..\IMG_bmp.c" />
|
||||
<ClCompile Include="..\IMG_gif.c" />
|
||||
<ClCompile Include="..\IMG_jpg.c" />
|
||||
<ClCompile Include="..\IMG_jxl.c" />
|
||||
<ClCompile Include="..\IMG_lbm.c" />
|
||||
<ClCompile Include="..\IMG_pcx.c" />
|
||||
<ClCompile Include="..\IMG_png.c" />
|
||||
<ClCompile Include="..\IMG_pnm.c" />
|
||||
<ClCompile Include="..\IMG_qoi.c" />
|
||||
<ClCompile Include="..\IMG_stb.c" />
|
||||
<ClCompile Include="..\IMG_svg.c" />
|
||||
<ClCompile Include="..\IMG_tga.c" />
|
||||
<ClCompile Include="..\IMG_tif.c" />
|
||||
<ClCompile Include="..\IMG_webp.c" />
|
||||
<ClCompile Include="..\IMG_WIC.c" />
|
||||
<ClCompile Include="..\IMG_xcf.c" />
|
||||
<ClCompile Include="..\IMG_xpm.c" />
|
||||
<ClCompile Include="..\IMG_xv.c" />
|
||||
<ClCompile Include="..\IMG_xxx.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="Version.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\SDL_image.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
130
Library/SDL2_image-2.5.2/VisualC/SDL_image.vcxproj.filters
Normal file
130
Library/SDL2_image-2.5.2/VisualC/SDL_image.vcxproj.filters
Normal file
@@ -0,0 +1,130 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\IMG.c">
|
||||
<Filter>Sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\IMG_bmp.c">
|
||||
<Filter>Sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\IMG_gif.c">
|
||||
<Filter>Sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\IMG_jpg.c">
|
||||
<Filter>Sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\IMG_lbm.c">
|
||||
<Filter>Sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\IMG_pcx.c">
|
||||
<Filter>Sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\IMG_png.c">
|
||||
<Filter>Sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\IMG_pnm.c">
|
||||
<Filter>Sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\IMG_tga.c">
|
||||
<Filter>Sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\IMG_tif.c">
|
||||
<Filter>Sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\IMG_webp.c">
|
||||
<Filter>Sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\IMG_xcf.c">
|
||||
<Filter>Sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\IMG_xpm.c">
|
||||
<Filter>Sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\IMG_xv.c">
|
||||
<Filter>Sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\IMG_xxx.c">
|
||||
<Filter>Sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\IMG_svg.c">
|
||||
<Filter>Sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\IMG_qoi.c">
|
||||
<Filter>Sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\IMG_WIC.c">
|
||||
<Filter>Sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\IMG_avif.c">
|
||||
<Filter>Sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\IMG_jxl.c">
|
||||
<Filter>Sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\IMG_stb.c">
|
||||
<Filter>Sources</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Filter Include="Sources">
|
||||
<UniqueIdentifier>{5637eea3-915c-4451-8db1-ea75e89d664a}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Public Headers">
|
||||
<UniqueIdentifier>{0255e6e4-e99b-4247-832b-195b30522bb1}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="x64">
|
||||
<UniqueIdentifier>{60daf3c1-64a6-411e-9f2f-83897f7deeb7}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="x86">
|
||||
<UniqueIdentifier>{fb6a5d77-4b7c-48da-a3b7-71eada47ca5a}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\SDL_image.h">
|
||||
<Filter>Public Headers</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="Version.rc">
|
||||
<Filter>Sources</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CustomBuild Include="external\lib\x64\LICENSE.zlib.txt">
|
||||
<Filter>x64</Filter>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="external\lib\x64\LICENSE.webp.txt">
|
||||
<Filter>x64</Filter>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="external\lib\x64\LICENSE.tiff.txt">
|
||||
<Filter>x64</Filter>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="external\lib\x64\libwebp-7.dll">
|
||||
<Filter>x64</Filter>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="external\lib\x64\libtiff-5.dll">
|
||||
<Filter>x64</Filter>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="external\lib\x64\zlib1.dll">
|
||||
<Filter>x64</Filter>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="external\lib\x86\LICENSE.zlib.txt">
|
||||
<Filter>x86</Filter>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="external\lib\x86\LICENSE.webp.txt">
|
||||
<Filter>x86</Filter>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="external\lib\x86\LICENSE.tiff.txt">
|
||||
<Filter>x86</Filter>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="external\lib\x86\libwebp-7.dll">
|
||||
<Filter>x86</Filter>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="external\lib\x86\libtiff-5.dll">
|
||||
<Filter>x86</Filter>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="external\lib\x86\zlib1.dll">
|
||||
<Filter>x86</Filter>
|
||||
</CustomBuild>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
105
Library/SDL2_image-2.5.2/VisualC/Version.rc
Normal file
105
Library/SDL2_image-2.5.2/VisualC/Version.rc
Normal file
@@ -0,0 +1,105 @@
|
||||
//Microsoft Developer Studio generated resource script.
|
||||
//
|
||||
#include "resource.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include "winresrc.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (U.S.) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
#ifndef _MAC
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Version
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 2,5,2,0
|
||||
PRODUCTVERSION 2,5,2,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS 0x40004L
|
||||
FILETYPE 0x2L
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904b0"
|
||||
BEGIN
|
||||
VALUE "CompanyName", "\0"
|
||||
VALUE "FileDescription", "SDL_image\0"
|
||||
VALUE "FileVersion", "2, 5, 2, 0\0"
|
||||
VALUE "InternalName", "SDL_image\0"
|
||||
VALUE "LegalCopyright", "Copyright © 2022 Sam Lantinga\0"
|
||||
VALUE "OriginalFilename", "SDL_image.dll\0"
|
||||
VALUE "ProductName", "Simple DirectMedia Layer\0"
|
||||
VALUE "ProductVersion", "2, 5, 2, 0\0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1200
|
||||
END
|
||||
END
|
||||
|
||||
#endif // !_MAC
|
||||
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"#include ""afxres.h""\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
||||
3
Library/SDL2_image-2.5.2/VisualC/clean.sh
Normal file
3
Library/SDL2_image-2.5.2/VisualC/clean.sh
Normal file
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
find . -type f \( -name '*.user' -o -name '*.sdf' -o -name '*.ncb' -o -name '*.suo' \) -print -delete
|
||||
rm -rvf Win32 */Win32 x64 */x64
|
||||
@@ -0,0 +1,54 @@
|
||||
# based on the files generated by CMake's write_basic_package_version_file
|
||||
|
||||
# SDL2_image CMake version configuration file:
|
||||
# This file is meant to be placed in a cmake subfolder of SDL2_image-devel-2.x.y-VC
|
||||
|
||||
if(NOT EXISTS "${CMAKE_CURRENT_LIST_DIR}/../include/SDL_image.h")
|
||||
message(AUTHOR_WARNING "Could not find SDL_image.h. This script is meant to be placed in a CMake subfolder of SDL2_image-devel-2.x.y-VC")
|
||||
return()
|
||||
endif()
|
||||
|
||||
file(READ "${CMAKE_CURRENT_LIST_DIR}/../SDL_image.h" _sdl_image_h)
|
||||
string(REGEX MATCH "#define[ \t]+SDL_IMAGE_MAJOR_VERSION[ \t]+([0-9]+)" _sdl_major_re "${_sdl_image_h}")
|
||||
set(_sdl_major "${CMAKE_MATCH_1}")
|
||||
string(REGEX MATCH "#define[ \t]+SDL_IMAGE_MINOR_VERSION[ \t]+([0-9]+)" _sdl_minor_re "${_sdl_image_h}")
|
||||
set(_sdl_minor "${CMAKE_MATCH_1}")
|
||||
string(REGEX MATCH "#define[ \t]+SDL_IMAGE_PATCHLEVEL[ \t]+([0-9]+)" _sdl_patch_re "${_sdl_image_h}")
|
||||
set(_sdl_patch "${CMAKE_MATCH_1}")
|
||||
if(_sdl_major_re AND _sdl_minor_re AND _sdl_patch_re)
|
||||
set(PACKAGE_VERSION "${_sdl_major}.${_sdl_minor}.${_sdl_patch}")
|
||||
else()
|
||||
message(AUTHOR_WARNING "Could not extract version from SDL_image.h.")
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(PACKAGE_FIND_VERSION_RANGE)
|
||||
# Package version must be in the requested version range
|
||||
if ((PACKAGE_FIND_VERSION_RANGE_MIN STREQUAL "INCLUDE" AND PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION_MIN)
|
||||
OR ((PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE" AND PACKAGE_VERSION VERSION_GREATER PACKAGE_FIND_VERSION_MAX)
|
||||
OR (PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE" AND PACKAGE_VERSION VERSION_GREATER_EQUAL PACKAGE_FIND_VERSION_MAX)))
|
||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
else()
|
||||
set(PACKAGE_VERSION_COMPATIBLE TRUE)
|
||||
endif()
|
||||
else()
|
||||
if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
|
||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
else()
|
||||
set(PACKAGE_VERSION_COMPATIBLE TRUE)
|
||||
if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
|
||||
set(PACKAGE_VERSION_EXACT TRUE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# if the using project doesn't have CMAKE_SIZEOF_VOID_P set, fail.
|
||||
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "")
|
||||
set(PACKAGE_VERSION_UNSUITABLE TRUE)
|
||||
endif()
|
||||
|
||||
# check that the installed version has the same 32/64bit-ness as the one which is currently searching:
|
||||
if(NOT (CMAKE_SIZEOF_VOID_P STREQUAL "8" OR CMAKE_SIZEOF_VOID_P STREQUAL "4"))
|
||||
set(PACKAGE_VERSION "${PACKAGE_VERSION} (32+64bit)")
|
||||
set(PACKAGE_VERSION_UNSUITABLE TRUE)
|
||||
endif()
|
||||
@@ -0,0 +1,73 @@
|
||||
# SDL2_image CMake configuration file:
|
||||
# This file is meant to be placed in a cmake subfolder of SDL2_image-devel-2.x.y-VC
|
||||
|
||||
include(FeatureSummary)
|
||||
set_package_properties(SDL2_image PROPERTIES
|
||||
URL "https://www.libsdl.org/projects/SDL_image/"
|
||||
DESCRIPTION "SDL_image is an image file loading library"
|
||||
)
|
||||
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
|
||||
set(SDL2_image_FOUND TRUE)
|
||||
|
||||
set(SDL2IMAGE_AVIF FALSE)
|
||||
set(SDL2IMAGE_BMP TRUE)
|
||||
set(SDL2IMAGE_GIF TRUE)
|
||||
set(SDL2IMAGE_JPG TRUE)
|
||||
set(SDL2IMAGE_JXL FALSE)
|
||||
set(SDL2IMAGE_LBM TRUE)
|
||||
set(SDL2IMAGE_PCX TRUE)
|
||||
set(SDL2IMAGE_PNG TRUE)
|
||||
set(SDL2IMAGE_PNM TRUE)
|
||||
set(SDL2IMAGE_QOI TRUE)
|
||||
set(SDL2IMAGE_SVG TRUE)
|
||||
set(SDL2IMAGE_TGA TRUE)
|
||||
set(SDL2IMAGE_TIF FALSE)
|
||||
set(SDL2IMAGE_XCF FALSE)
|
||||
set(SDL2IMAGE_XPM TRUE)
|
||||
set(SDL2IMAGE_XV TRUE)
|
||||
set(SDL2IMAGE_WEBP FALSE)
|
||||
|
||||
set(SDL2IMAGE_JPG_SAVE FALSE)
|
||||
set(SDL2IMAGE_PNG_SAVE FALSE)
|
||||
|
||||
set(SDL2IMAGE_VENDORED FALSE)
|
||||
|
||||
set(SDL2IMAGE_BACKEND_IMAGEIO FALSE)
|
||||
set(SDL2IMAGE_BACKEND_STB TRUE)
|
||||
set(SDL2IMAGE_BACKEND_WIC FALSE)
|
||||
|
||||
if(CMAKE_SIZEOF_VOID_P STREQUAL "4")
|
||||
set(_sdl_arch_subdir "x86")
|
||||
elseif(CMAKE_SIZEOF_VOID_P STREQUAL "8")
|
||||
set(_sdl_arch_subdir "x64")
|
||||
else()
|
||||
unset(_sdl_arch_subdir)
|
||||
set(SDL2_image_FOUND FALSE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(_sdl2image_incdir "${CMAKE_CURRENT_LIST_DIR}/../include/SDL2")
|
||||
set(_sdl2image_library "${CMAKE_CURRENT_LIST_DIR}/../lib/${_sdl_arch_subdir}/SDL2_image.lib")
|
||||
set(_sdl2image_dll "${CMAKE_CURRENT_LIST_DIR}/../lib/${_sdl_arch_subdir}/SDL2_image.dll")
|
||||
|
||||
# All targets are created, even when some might not be requested though COMPONENTS.
|
||||
# This is done for compatibility with CMake generated SDL2_image-target.cmake files.
|
||||
|
||||
if(NOT TARGET SDL2_image::SDL2_image)
|
||||
add_library(SDL2_image::SDL2_image SHARED IMPORTED)
|
||||
set_target_properties(SDL2_image::SDL2_image
|
||||
PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${_sdl2image_incdir}"
|
||||
IMPORTED_IMPLIB "${_sdl2image_library}"
|
||||
IMPORTED_LOCATION "${_sdl2image_dll}"
|
||||
COMPATIBLE_INTERFACE_BOOL "SDL2_SHARED"
|
||||
INTERFACE_SDL2_SHARED "ON"
|
||||
)
|
||||
endif()
|
||||
|
||||
unset(_sdl_arch_subdir)
|
||||
unset(_sdl2image_incdir)
|
||||
unset(_sdl2image_library)
|
||||
unset(_sdl2image_dll)
|
||||
15
Library/SDL2_image-2.5.2/VisualC/resource.h
Normal file
15
Library/SDL2_image-2.5.2/VisualC/resource.h
Normal file
@@ -0,0 +1,15 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Developer Studio generated include file.
|
||||
// Used by Version.rc
|
||||
//
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 101
|
||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||
#define _APS_NEXT_CONTROL_VALUE 1000
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
||||
258
Library/SDL2_image-2.5.2/VisualC/showimage/showimage.vcxproj
Normal file
258
Library/SDL2_image-2.5.2/VisualC/showimage/showimage.vcxproj
Normal file
@@ -0,0 +1,258 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectName>showimage</ProjectName>
|
||||
<ProjectGuid>{FEE80C5D-762E-4E57-9BCB-928749E8203F}</ProjectGuid>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)\$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)\$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)\$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)\$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<IncludePath>$(SolutionDir)..\..\SDL\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(SolutionDir)..\..\SDL\VisualC\$(PlatformName)\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<IncludePath>$(SolutionDir)..\..\SDL\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(SolutionDir)..\..\SDL\VisualC\$(PlatformName)\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<IncludePath>$(SolutionDir)..\..\SDL\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(SolutionDir)..\..\SDL\VisualC\$(PlatformName)\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<IncludePath>$(SolutionDir)..\..\SDL\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(SolutionDir)..\..\SDL\VisualC\$(PlatformName)\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>Win32</TargetEnvironment>
|
||||
<TypeLibraryName>.\Debug/showimage.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>SDL2.lib;SDL2main.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
</Link>
|
||||
<Bscmake />
|
||||
<PostBuildEvent>
|
||||
<Command>
|
||||
</Command>
|
||||
<Message>
|
||||
</Message>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
<TypeLibraryName>.\Debug/showimage.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>SDL2.lib;SDL2main.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
<Bscmake />
|
||||
<PostBuildEvent>
|
||||
<Command>
|
||||
</Command>
|
||||
<Message>
|
||||
</Message>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>Win32</TargetEnvironment>
|
||||
<TypeLibraryName>.\Release/showimage.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>..\..\..\SDL\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<PrecompiledHeaderOutputFile>.\Release/showimage.pch</PrecompiledHeaderOutputFile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<CompileAs>Default</CompileAs>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>SDL2.lib;SDL2main.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<ProgramDatabaseFile>.\Release/showimage.pdb</ProgramDatabaseFile>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
</Link>
|
||||
<Bscmake>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<OutputFile>.\Release/showimage.bsc</OutputFile>
|
||||
</Bscmake>
|
||||
<PostBuildEvent>
|
||||
<Command>
|
||||
</Command>
|
||||
<Message>
|
||||
</Message>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
<TypeLibraryName>.\Release/showimage.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>SDL2.lib;SDL2main.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
</Link>
|
||||
<Bscmake />
|
||||
<PostBuildEvent>
|
||||
<Command>
|
||||
</Command>
|
||||
<Message>
|
||||
</Message>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\showimage.c">
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SDL_image.vcxproj">
|
||||
<Project>{2bd5534e-00e2-4bea-ac96-d9a92ea24696}</Project>
|
||||
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\showimage.c" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
22
Library/SDL2_image-2.5.2/Xcode/Info-Framework.plist
Normal file
22
Library/SDL2_image-2.5.2/Xcode/Info-Framework.plist
Normal file
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>SDL2_image</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>org.libsdl.SDL2-image</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>SDL2_image</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>2.5.2</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>2.5.2</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,846 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 55;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
007288A80F0DA79800C302A9 /* ApplicationServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 007288A60F0DA79800C302A9 /* ApplicationServices.framework */; };
|
||||
6313BF532785566D00F268AD /* IMG_qoi.c in Sources */ = {isa = PBXBuildFile; fileRef = 6313BF522785566D00F268AD /* IMG_qoi.c */; };
|
||||
6313BF542785566D00F268AD /* IMG_qoi.c in Sources */ = {isa = PBXBuildFile; fileRef = 6313BF522785566D00F268AD /* IMG_qoi.c */; };
|
||||
AA23FC7D20A2A1B90017DFB9 /* IMG_svg.c in Sources */ = {isa = PBXBuildFile; fileRef = AA50AA461F9C7C50003B9C0C /* IMG_svg.c */; };
|
||||
AA50AA471F9C7C50003B9C0C /* IMG_svg.c in Sources */ = {isa = PBXBuildFile; fileRef = AA50AA461F9C7C50003B9C0C /* IMG_svg.c */; };
|
||||
AA579DF2161C07E6005F809B /* IMG_bmp.c in Sources */ = {isa = PBXBuildFile; fileRef = AA579DE2161C07E6005F809B /* IMG_bmp.c */; };
|
||||
AA579DF3161C07E7005F809B /* IMG_bmp.c in Sources */ = {isa = PBXBuildFile; fileRef = AA579DE2161C07E6005F809B /* IMG_bmp.c */; };
|
||||
AA579DF4161C07E7005F809B /* IMG_gif.c in Sources */ = {isa = PBXBuildFile; fileRef = AA579DE3161C07E6005F809B /* IMG_gif.c */; };
|
||||
AA579DF5161C07E7005F809B /* IMG_gif.c in Sources */ = {isa = PBXBuildFile; fileRef = AA579DE3161C07E6005F809B /* IMG_gif.c */; };
|
||||
AA579DF6161C07E7005F809B /* IMG_ImageIO.m in Sources */ = {isa = PBXBuildFile; fileRef = AA579DE4161C07E6005F809B /* IMG_ImageIO.m */; };
|
||||
AA579DF7161C07E7005F809B /* IMG_ImageIO.m in Sources */ = {isa = PBXBuildFile; fileRef = AA579DE4161C07E6005F809B /* IMG_ImageIO.m */; };
|
||||
AA579DF8161C07E7005F809B /* IMG_jpg.c in Sources */ = {isa = PBXBuildFile; fileRef = AA579DE5161C07E6005F809B /* IMG_jpg.c */; };
|
||||
AA579DF9161C07E7005F809B /* IMG_jpg.c in Sources */ = {isa = PBXBuildFile; fileRef = AA579DE5161C07E6005F809B /* IMG_jpg.c */; };
|
||||
AA579DFA161C07E7005F809B /* IMG_lbm.c in Sources */ = {isa = PBXBuildFile; fileRef = AA579DE6161C07E6005F809B /* IMG_lbm.c */; };
|
||||
AA579DFB161C07E7005F809B /* IMG_lbm.c in Sources */ = {isa = PBXBuildFile; fileRef = AA579DE6161C07E6005F809B /* IMG_lbm.c */; };
|
||||
AA579DFC161C07E7005F809B /* IMG_pcx.c in Sources */ = {isa = PBXBuildFile; fileRef = AA579DE7161C07E6005F809B /* IMG_pcx.c */; };
|
||||
AA579DFD161C07E7005F809B /* IMG_pcx.c in Sources */ = {isa = PBXBuildFile; fileRef = AA579DE7161C07E6005F809B /* IMG_pcx.c */; };
|
||||
AA579DFE161C07E7005F809B /* IMG_png.c in Sources */ = {isa = PBXBuildFile; fileRef = AA579DE8161C07E6005F809B /* IMG_png.c */; };
|
||||
AA579DFF161C07E7005F809B /* IMG_png.c in Sources */ = {isa = PBXBuildFile; fileRef = AA579DE8161C07E6005F809B /* IMG_png.c */; };
|
||||
AA579E00161C07E7005F809B /* IMG_pnm.c in Sources */ = {isa = PBXBuildFile; fileRef = AA579DE9161C07E6005F809B /* IMG_pnm.c */; };
|
||||
AA579E01161C07E7005F809B /* IMG_pnm.c in Sources */ = {isa = PBXBuildFile; fileRef = AA579DE9161C07E6005F809B /* IMG_pnm.c */; };
|
||||
AA579E02161C07E7005F809B /* IMG_tga.c in Sources */ = {isa = PBXBuildFile; fileRef = AA579DEA161C07E6005F809B /* IMG_tga.c */; };
|
||||
AA579E03161C07E7005F809B /* IMG_tga.c in Sources */ = {isa = PBXBuildFile; fileRef = AA579DEA161C07E6005F809B /* IMG_tga.c */; };
|
||||
AA579E04161C07E7005F809B /* IMG_tif.c in Sources */ = {isa = PBXBuildFile; fileRef = AA579DEB161C07E6005F809B /* IMG_tif.c */; };
|
||||
AA579E05161C07E7005F809B /* IMG_tif.c in Sources */ = {isa = PBXBuildFile; fileRef = AA579DEB161C07E6005F809B /* IMG_tif.c */; };
|
||||
AA579E06161C07E7005F809B /* IMG_webp.c in Sources */ = {isa = PBXBuildFile; fileRef = AA579DEC161C07E6005F809B /* IMG_webp.c */; };
|
||||
AA579E07161C07E7005F809B /* IMG_webp.c in Sources */ = {isa = PBXBuildFile; fileRef = AA579DEC161C07E6005F809B /* IMG_webp.c */; };
|
||||
AA579E08161C07E7005F809B /* IMG_xcf.c in Sources */ = {isa = PBXBuildFile; fileRef = AA579DED161C07E6005F809B /* IMG_xcf.c */; };
|
||||
AA579E09161C07E7005F809B /* IMG_xcf.c in Sources */ = {isa = PBXBuildFile; fileRef = AA579DED161C07E6005F809B /* IMG_xcf.c */; };
|
||||
AA579E0A161C07E7005F809B /* IMG_xpm.c in Sources */ = {isa = PBXBuildFile; fileRef = AA579DEE161C07E6005F809B /* IMG_xpm.c */; };
|
||||
AA579E0B161C07E7005F809B /* IMG_xpm.c in Sources */ = {isa = PBXBuildFile; fileRef = AA579DEE161C07E6005F809B /* IMG_xpm.c */; };
|
||||
AA579E0C161C07E7005F809B /* IMG_xv.c in Sources */ = {isa = PBXBuildFile; fileRef = AA579DEF161C07E6005F809B /* IMG_xv.c */; };
|
||||
AA579E0D161C07E7005F809B /* IMG_xv.c in Sources */ = {isa = PBXBuildFile; fileRef = AA579DEF161C07E6005F809B /* IMG_xv.c */; };
|
||||
AA579E0E161C07E7005F809B /* IMG_xxx.c in Sources */ = {isa = PBXBuildFile; fileRef = AA579DF0161C07E6005F809B /* IMG_xxx.c */; };
|
||||
AA579E0F161C07E7005F809B /* IMG_xxx.c in Sources */ = {isa = PBXBuildFile; fileRef = AA579DF0161C07E6005F809B /* IMG_xxx.c */; };
|
||||
AA579E10161C07E7005F809B /* IMG.c in Sources */ = {isa = PBXBuildFile; fileRef = AA579DF1161C07E6005F809B /* IMG.c */; };
|
||||
AA579E11161C07E7005F809B /* IMG.c in Sources */ = {isa = PBXBuildFile; fileRef = AA579DF1161C07E6005F809B /* IMG.c */; };
|
||||
AADBAC89175C6B4C004F8ED2 /* ApplicationServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 007288A60F0DA79800C302A9 /* ApplicationServices.framework */; platformFilters = (macos, ); };
|
||||
AADBAC8A175C6B4F004F8ED2 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 61F85449145A19BC002CA294 /* Foundation.framework */; };
|
||||
BE1FA71A07AF4C44004B6283 /* SDL_image.h in Headers */ = {isa = PBXBuildFile; fileRef = 1014BAEA010A4B677F000001 /* SDL_image.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
F31094C3282AE42D008EF641 /* IMG_stb.c in Sources */ = {isa = PBXBuildFile; fileRef = F31094C2282AE42D008EF641 /* IMG_stb.c */; };
|
||||
F31094C4282AE42D008EF641 /* IMG_stb.c in Sources */ = {isa = PBXBuildFile; fileRef = F31094C2282AE42D008EF641 /* IMG_stb.c */; };
|
||||
F354743E2828CA66007E9EDA /* IMG_jxl.c in Sources */ = {isa = PBXBuildFile; fileRef = F354743B2828CA66007E9EDA /* IMG_jxl.c */; };
|
||||
F354743F2828CA66007E9EDA /* IMG_jxl.c in Sources */ = {isa = PBXBuildFile; fileRef = F354743B2828CA66007E9EDA /* IMG_jxl.c */; };
|
||||
F35475FD2829BAF9007E9EDA /* IMG_avif.c in Sources */ = {isa = PBXBuildFile; fileRef = F35475FC2829BAF9007E9EDA /* IMG_avif.c */; };
|
||||
F35475FE2829BAF9007E9EDA /* IMG_avif.c in Sources */ = {isa = PBXBuildFile; fileRef = F35475FC2829BAF9007E9EDA /* IMG_avif.c */; };
|
||||
F382070E284EF58C004DD584 /* CMake in Resources */ = {isa = PBXBuildFile; fileRef = F3820707284EF58C004DD584 /* CMake */; };
|
||||
F3D87C04281DF8FC005DA540 /* SDL2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F3D87C03281DF8FC005DA540 /* SDL2.framework */; };
|
||||
F3E1AAEB281CBABD00740E39 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F3E1AAEA281CBABD00740E39 /* CoreGraphics.framework */; platformFilters = (ios, tvos, ); };
|
||||
F3E1AAEC281CBB1F00740E39 /* ImageIO.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F3E1AAE8281CBA7B00740E39 /* ImageIO.framework */; platformFilters = (ios, tvos, ); };
|
||||
F3E1AAEE281CBD9F00740E39 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F3E1AAED281CBD9F00740E39 /* UIKit.framework */; platformFilters = (ios, tvos, ); };
|
||||
F3E1AAF0281CBDD100740E39 /* MobileCoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F3E1AAEF281CBDD100740E39 /* MobileCoreServices.framework */; platformFilters = (ios, tvos, ); };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
BE1FA74C07AF4C45004B6283 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = BE1FA71807AF4C44004B6283;
|
||||
remoteInfo = Framework;
|
||||
};
|
||||
F307EFAC2828C8FA003915D7 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = F307EFA82828C8FA003915D7 /* jxl.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = F307EEDC28288CCF003915D7;
|
||||
remoteInfo = jxl;
|
||||
};
|
||||
F35475DB2829BA80007E9EDA /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = F35475D42829BA80007E9EDA /* avif.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = F35474682829A8B3007E9EDA;
|
||||
remoteInfo = avif;
|
||||
};
|
||||
F35475DD2829BA80007E9EDA /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = F35475D42829BA80007E9EDA /* avif.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = F354757D2829B82B007E9EDA;
|
||||
remoteInfo = dav1d;
|
||||
};
|
||||
F35475DF2829BA80007E9EDA /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = F35475D42829BA80007E9EDA /* avif.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = F354758A2829B839007E9EDA;
|
||||
remoteInfo = "dav1d-8bit";
|
||||
};
|
||||
F35475E12829BA80007E9EDA /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = F35475D42829BA80007E9EDA /* avif.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = F35475972829B847007E9EDA;
|
||||
remoteInfo = "dav1d-16bit";
|
||||
};
|
||||
F3D87D23281EA9D8005DA540 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = F3D87D15281EA88F005DA540 /* webp.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = F3D87D21281EA9C3005DA540;
|
||||
remoteInfo = webp;
|
||||
};
|
||||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
AA9EE77214B27810008773C0 /* Copy Frameworks */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = "";
|
||||
dstSubfolderSpec = 10;
|
||||
files = (
|
||||
);
|
||||
name = "Copy Frameworks";
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
007288A60F0DA79800C302A9 /* ApplicationServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ApplicationServices.framework; path = /System/Library/Frameworks/ApplicationServices.framework; sourceTree = "<absolute>"; };
|
||||
1014BAEA010A4B677F000001 /* SDL_image.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = SDL_image.h; path = ../SDL_image.h; sourceTree = SOURCE_ROOT; };
|
||||
61F85449145A19BC002CA294 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
|
||||
6313BF522785566D00F268AD /* IMG_qoi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = IMG_qoi.c; path = ../IMG_qoi.c; sourceTree = "<group>"; };
|
||||
AA50AA461F9C7C50003B9C0C /* IMG_svg.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = IMG_svg.c; path = ../IMG_svg.c; sourceTree = "<group>"; };
|
||||
AA579DE2161C07E6005F809B /* IMG_bmp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = IMG_bmp.c; path = ../IMG_bmp.c; sourceTree = "<group>"; };
|
||||
AA579DE3161C07E6005F809B /* IMG_gif.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = IMG_gif.c; path = ../IMG_gif.c; sourceTree = "<group>"; };
|
||||
AA579DE4161C07E6005F809B /* IMG_ImageIO.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = IMG_ImageIO.m; path = ../IMG_ImageIO.m; sourceTree = "<group>"; };
|
||||
AA579DE5161C07E6005F809B /* IMG_jpg.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = IMG_jpg.c; path = ../IMG_jpg.c; sourceTree = "<group>"; };
|
||||
AA579DE6161C07E6005F809B /* IMG_lbm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = IMG_lbm.c; path = ../IMG_lbm.c; sourceTree = "<group>"; };
|
||||
AA579DE7161C07E6005F809B /* IMG_pcx.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = IMG_pcx.c; path = ../IMG_pcx.c; sourceTree = "<group>"; };
|
||||
AA579DE8161C07E6005F809B /* IMG_png.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = IMG_png.c; path = ../IMG_png.c; sourceTree = "<group>"; };
|
||||
AA579DE9161C07E6005F809B /* IMG_pnm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = IMG_pnm.c; path = ../IMG_pnm.c; sourceTree = "<group>"; };
|
||||
AA579DEA161C07E6005F809B /* IMG_tga.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = IMG_tga.c; path = ../IMG_tga.c; sourceTree = "<group>"; };
|
||||
AA579DEB161C07E6005F809B /* IMG_tif.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = IMG_tif.c; path = ../IMG_tif.c; sourceTree = "<group>"; };
|
||||
AA579DEC161C07E6005F809B /* IMG_webp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = IMG_webp.c; path = ../IMG_webp.c; sourceTree = "<group>"; };
|
||||
AA579DED161C07E6005F809B /* IMG_xcf.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = IMG_xcf.c; path = ../IMG_xcf.c; sourceTree = "<group>"; };
|
||||
AA579DEE161C07E6005F809B /* IMG_xpm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = IMG_xpm.c; path = ../IMG_xpm.c; sourceTree = "<group>"; };
|
||||
AA579DEF161C07E6005F809B /* IMG_xv.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = IMG_xv.c; path = ../IMG_xv.c; sourceTree = "<group>"; };
|
||||
AA579DF0161C07E6005F809B /* IMG_xxx.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = IMG_xxx.c; path = ../IMG_xxx.c; sourceTree = "<group>"; };
|
||||
AA579DF1161C07E6005F809B /* IMG.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = IMG.c; path = ../IMG.c; sourceTree = "<group>"; };
|
||||
BE1FA72D07AF4C44004B6283 /* Info-Framework.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Info-Framework.plist"; sourceTree = "<group>"; };
|
||||
BE1FA72E07AF4C45004B6283 /* SDL2_image.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SDL2_image.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
BE1FA74107AF4C45004B6283 /* libSDL2_image.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libSDL2_image.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
BE1FA74507AF4C45004B6283 /* Create DMG */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "Create DMG"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
F307EFA82828C8FA003915D7 /* jxl.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = jxl.xcodeproj; path = jxl/jxl.xcodeproj; sourceTree = "<group>"; };
|
||||
F31094C2282AE42D008EF641 /* IMG_stb.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = IMG_stb.c; path = ../IMG_stb.c; sourceTree = "<group>"; };
|
||||
F354743B2828CA66007E9EDA /* IMG_jxl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = IMG_jxl.c; path = ../IMG_jxl.c; sourceTree = "<group>"; };
|
||||
F35475D42829BA80007E9EDA /* avif.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = avif.xcodeproj; path = avif/avif.xcodeproj; sourceTree = "<group>"; };
|
||||
F35475FC2829BAF9007E9EDA /* IMG_avif.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = IMG_avif.c; path = ../IMG_avif.c; sourceTree = "<group>"; };
|
||||
F3547625282AE1C6007E9EDA /* config.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = config.xcconfig; sourceTree = "<group>"; };
|
||||
F3820707284EF58C004DD584 /* CMake */ = {isa = PBXFileReference; lastKnownFileType = folder; path = CMake; sourceTree = "<group>"; };
|
||||
F3D87C03281DF8FC005DA540 /* SDL2.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDL2.framework; path = macOS/SDL2.framework; sourceTree = "<group>"; };
|
||||
F3D87D15281EA88F005DA540 /* webp.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = webp.xcodeproj; path = webp/webp.xcodeproj; sourceTree = "<group>"; };
|
||||
F3E1AAE8281CBA7B00740E39 /* ImageIO.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ImageIO.framework; path = System/Library/Frameworks/ImageIO.framework; sourceTree = SDKROOT; };
|
||||
F3E1AAEA281CBABD00740E39 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
|
||||
F3E1AAED281CBD9F00740E39 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/System/iOSSupport/System/Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; };
|
||||
F3E1AAEF281CBDD100740E39 /* MobileCoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MobileCoreServices.framework; path = System/iOSSupport/System/Library/Frameworks/MobileCoreServices.framework; sourceTree = SDKROOT; };
|
||||
F59C710300D5CB5801000001 /* ReadMe.txt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = ReadMe.txt; sourceTree = "<group>"; };
|
||||
F59C710400D5CB5801000001 /* Welcome.txt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = Welcome.txt; sourceTree = "<group>"; };
|
||||
F59C710600D5CB5801000001 /* SDL_image.info */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = SDL_image.info; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
BE1FA72A07AF4C44004B6283 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
AADBAC89175C6B4C004F8ED2 /* ApplicationServices.framework in Frameworks */,
|
||||
F3E1AAEB281CBABD00740E39 /* CoreGraphics.framework in Frameworks */,
|
||||
AADBAC8A175C6B4F004F8ED2 /* Foundation.framework in Frameworks */,
|
||||
F3E1AAEC281CBB1F00740E39 /* ImageIO.framework in Frameworks */,
|
||||
F3E1AAF0281CBDD100740E39 /* MobileCoreServices.framework in Frameworks */,
|
||||
F3E1AAEE281CBD9F00740E39 /* UIKit.framework in Frameworks */,
|
||||
F3D87C04281DF8FC005DA540 /* SDL2.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
BE1FA73F07AF4C45004B6283 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
007288A80F0DA79800C302A9 /* ApplicationServices.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
0153844A006D81B07F000001 /* Public Headers */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
1014BAEA010A4B677F000001 /* SDL_image.h */,
|
||||
);
|
||||
name = "Public Headers";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
034768DDFF38A45A11DB9C8B /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
089C1665FE841158C02AAC07 /* Resources */,
|
||||
BE1FA72E07AF4C45004B6283 /* SDL2_image.framework */,
|
||||
BE1FA74107AF4C45004B6283 /* libSDL2_image.a */,
|
||||
BE1FA74507AF4C45004B6283 /* Create DMG */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
0867D691FE84028FC02AAC07 /* SDL_imageFramework */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
F3547625282AE1C6007E9EDA /* config.xcconfig */,
|
||||
F35475D42829BA80007E9EDA /* avif.xcodeproj */,
|
||||
F307EFA82828C8FA003915D7 /* jxl.xcodeproj */,
|
||||
F3D87D15281EA88F005DA540 /* webp.xcodeproj */,
|
||||
F59C70FC00D5CB5801000001 /* pkg-support */,
|
||||
0153844A006D81B07F000001 /* Public Headers */,
|
||||
08FB77ACFE841707C02AAC07 /* Library Source */,
|
||||
BE1FA76107AF72F5004B6283 /* Frameworks */,
|
||||
034768DDFF38A45A11DB9C8B /* Products */,
|
||||
BE1FA72D07AF4C44004B6283 /* Info-Framework.plist */,
|
||||
);
|
||||
name = SDL_imageFramework;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
089C1665FE841158C02AAC07 /* Resources */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
);
|
||||
name = Resources;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
08FB77ACFE841707C02AAC07 /* Library Source */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
AA579DF1161C07E6005F809B /* IMG.c */,
|
||||
AA579DE4161C07E6005F809B /* IMG_ImageIO.m */,
|
||||
F35475FC2829BAF9007E9EDA /* IMG_avif.c */,
|
||||
AA579DE2161C07E6005F809B /* IMG_bmp.c */,
|
||||
AA579DE3161C07E6005F809B /* IMG_gif.c */,
|
||||
AA579DE5161C07E6005F809B /* IMG_jpg.c */,
|
||||
F354743B2828CA66007E9EDA /* IMG_jxl.c */,
|
||||
AA579DE6161C07E6005F809B /* IMG_lbm.c */,
|
||||
AA579DE7161C07E6005F809B /* IMG_pcx.c */,
|
||||
AA579DE8161C07E6005F809B /* IMG_png.c */,
|
||||
AA579DE9161C07E6005F809B /* IMG_pnm.c */,
|
||||
6313BF522785566D00F268AD /* IMG_qoi.c */,
|
||||
F31094C2282AE42D008EF641 /* IMG_stb.c */,
|
||||
AA50AA461F9C7C50003B9C0C /* IMG_svg.c */,
|
||||
AA579DEA161C07E6005F809B /* IMG_tga.c */,
|
||||
AA579DEB161C07E6005F809B /* IMG_tif.c */,
|
||||
AA579DEC161C07E6005F809B /* IMG_webp.c */,
|
||||
AA579DED161C07E6005F809B /* IMG_xcf.c */,
|
||||
AA579DEE161C07E6005F809B /* IMG_xpm.c */,
|
||||
AA579DEF161C07E6005F809B /* IMG_xv.c */,
|
||||
AA579DF0161C07E6005F809B /* IMG_xxx.c */,
|
||||
);
|
||||
name = "Library Source";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
BE1FA76007AF72B1004B6283 /* Linked Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
007288A60F0DA79800C302A9 /* ApplicationServices.framework */,
|
||||
61F85449145A19BC002CA294 /* Foundation.framework */,
|
||||
F3D87C03281DF8FC005DA540 /* SDL2.framework */,
|
||||
);
|
||||
name = "Linked Frameworks";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
BE1FA76107AF72F5004B6283 /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
F3E1AAEF281CBDD100740E39 /* MobileCoreServices.framework */,
|
||||
F3E1AAED281CBD9F00740E39 /* UIKit.framework */,
|
||||
F3E1AAEA281CBABD00740E39 /* CoreGraphics.framework */,
|
||||
F3E1AAE8281CBA7B00740E39 /* ImageIO.framework */,
|
||||
BE1FA76007AF72B1004B6283 /* Linked Frameworks */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
F307EFA92828C8FA003915D7 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
F307EFAD2828C8FA003915D7 /* jxl.framework */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
F35475D52829BA80007E9EDA /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
F35475DC2829BA80007E9EDA /* avif.framework */,
|
||||
F35475DE2829BA80007E9EDA /* libdav1d.a */,
|
||||
F35475E02829BA80007E9EDA /* libdav1d-8bit.a */,
|
||||
F35475E22829BA80007E9EDA /* libdav1d-16bit.a */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
F3D87D16281EA88F005DA540 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
F3D87D24281EA9D8005DA540 /* webp.framework */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
F59C70FC00D5CB5801000001 /* pkg-support */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
F59C710100D5CB5801000001 /* resources */,
|
||||
F59C710600D5CB5801000001 /* SDL_image.info */,
|
||||
);
|
||||
path = "pkg-support";
|
||||
sourceTree = SOURCE_ROOT;
|
||||
};
|
||||
F59C710100D5CB5801000001 /* resources */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
F3820707284EF58C004DD584 /* CMake */,
|
||||
F59C710300D5CB5801000001 /* ReadMe.txt */,
|
||||
F59C710400D5CB5801000001 /* Welcome.txt */,
|
||||
);
|
||||
path = resources;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXHeadersBuildPhase section */
|
||||
BE1FA71907AF4C44004B6283 /* Headers */ = {
|
||||
isa = PBXHeadersBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
BE1FA71A07AF4C44004B6283 /* SDL_image.h in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
BE1FA73007AF4C45004B6283 /* Headers */ = {
|
||||
isa = PBXHeadersBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXHeadersBuildPhase section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
BE1FA71807AF4C44004B6283 /* Framework */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 00B7E3AA097EB73D00826121 /* Build configuration list for PBXNativeTarget "Framework" */;
|
||||
buildPhases = (
|
||||
BE1FA71907AF4C44004B6283 /* Headers */,
|
||||
BE1FA71B07AF4C44004B6283 /* Resources */,
|
||||
BE1FA71C07AF4C44004B6283 /* Sources */,
|
||||
BE1FA72A07AF4C44004B6283 /* Frameworks */,
|
||||
BE1FA72B07AF4C44004B6283 /* Rez */,
|
||||
AA9EE77214B27810008773C0 /* Copy Frameworks */,
|
||||
AA9EE77414B27854008773C0 /* Convert SDL includes to SDL Framework includes */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
comments = "Installed into ~/Library/Frameworks/SDL_image.framework\n\nAdd -framework SDL_image to your linker flags\nAdd ~/Library/Frameworks/SDL_image.framework/Headers to your header search path\nAdd ~/Library/Frameworks to your library search path";
|
||||
dependencies = (
|
||||
);
|
||||
name = Framework;
|
||||
productInstallPath = "@executable_path/../Frameworks";
|
||||
productName = SDL_image;
|
||||
productReference = BE1FA72E07AF4C45004B6283 /* SDL2_image.framework */;
|
||||
productType = "com.apple.product-type.framework";
|
||||
};
|
||||
BE1FA72F07AF4C45004B6283 /* Static Library */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 00B7E3AE097EB73D00826121 /* Build configuration list for PBXNativeTarget "Static Library" */;
|
||||
buildPhases = (
|
||||
BE1FA73007AF4C45004B6283 /* Headers */,
|
||||
BE1FA73107AF4C45004B6283 /* Sources */,
|
||||
BE1FA73F07AF4C45004B6283 /* Frameworks */,
|
||||
BE1FA74007AF4C45004B6283 /* Rez */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = "Static Library";
|
||||
productInstallPath = /usr/local/lib;
|
||||
productName = "Static Library";
|
||||
productReference = BE1FA74107AF4C45004B6283 /* libSDL2_image.a */;
|
||||
productType = "com.apple.product-type.library.static";
|
||||
};
|
||||
BE1FA74207AF4C45004B6283 /* Create DMG */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 00B7E3B2097EB73D00826121 /* Build configuration list for PBXNativeTarget "Create DMG" */;
|
||||
buildPhases = (
|
||||
BE1FA74407AF4C45004B6283 /* ShellScript */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
BE1FA74D07AF4C45004B6283 /* PBXTargetDependency */,
|
||||
);
|
||||
name = "Create DMG";
|
||||
productInstallPath = /usr/local/bin;
|
||||
productName = "Standard Package";
|
||||
productReference = BE1FA74507AF4C45004B6283 /* Create DMG */;
|
||||
productType = "com.apple.product-type.tool";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
0867D690FE84028FC02AAC07 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0630;
|
||||
};
|
||||
buildConfigurationList = 00B7E3B6097EB73D00826121 /* Build configuration list for PBXProject "SDL_image" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 1;
|
||||
knownRegions = (
|
||||
English,
|
||||
Japanese,
|
||||
French,
|
||||
German,
|
||||
);
|
||||
mainGroup = 0867D691FE84028FC02AAC07 /* SDL_imageFramework */;
|
||||
productRefGroup = 034768DDFF38A45A11DB9C8B /* Products */;
|
||||
projectDirPath = "";
|
||||
projectReferences = (
|
||||
{
|
||||
ProductGroup = F35475D52829BA80007E9EDA /* Products */;
|
||||
ProjectRef = F35475D42829BA80007E9EDA /* avif.xcodeproj */;
|
||||
},
|
||||
{
|
||||
ProductGroup = F307EFA92828C8FA003915D7 /* Products */;
|
||||
ProjectRef = F307EFA82828C8FA003915D7 /* jxl.xcodeproj */;
|
||||
},
|
||||
{
|
||||
ProductGroup = F3D87D16281EA88F005DA540 /* Products */;
|
||||
ProjectRef = F3D87D15281EA88F005DA540 /* webp.xcodeproj */;
|
||||
},
|
||||
);
|
||||
projectRoot = ..;
|
||||
targets = (
|
||||
BE1FA71807AF4C44004B6283 /* Framework */,
|
||||
BE1FA72F07AF4C45004B6283 /* Static Library */,
|
||||
BE1FA74207AF4C45004B6283 /* Create DMG */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXReferenceProxy section */
|
||||
F307EFAD2828C8FA003915D7 /* jxl.framework */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = wrapper.framework;
|
||||
path = jxl.framework;
|
||||
remoteRef = F307EFAC2828C8FA003915D7 /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
F35475DC2829BA80007E9EDA /* avif.framework */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = wrapper.framework;
|
||||
path = avif.framework;
|
||||
remoteRef = F35475DB2829BA80007E9EDA /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
F35475DE2829BA80007E9EDA /* libdav1d.a */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = archive.ar;
|
||||
path = libdav1d.a;
|
||||
remoteRef = F35475DD2829BA80007E9EDA /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
F35475E02829BA80007E9EDA /* libdav1d-8bit.a */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = archive.ar;
|
||||
path = "libdav1d-8bit.a";
|
||||
remoteRef = F35475DF2829BA80007E9EDA /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
F35475E22829BA80007E9EDA /* libdav1d-16bit.a */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = archive.ar;
|
||||
path = "libdav1d-16bit.a";
|
||||
remoteRef = F35475E12829BA80007E9EDA /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
F3D87D24281EA9D8005DA540 /* webp.framework */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = wrapper.framework;
|
||||
path = webp.framework;
|
||||
remoteRef = F3D87D23281EA9D8005DA540 /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
/* End PBXReferenceProxy section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
BE1FA71B07AF4C44004B6283 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
F382070E284EF58C004DD584 /* CMake in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXRezBuildPhase section */
|
||||
BE1FA72B07AF4C44004B6283 /* Rez */ = {
|
||||
isa = PBXRezBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
BE1FA74007AF4C45004B6283 /* Rez */ = {
|
||||
isa = PBXRezBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXRezBuildPhase section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
AA9EE77414B27854008773C0 /* Convert SDL includes to SDL Framework includes */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "Convert SDL includes to SDL Framework includes";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "cd \"$BUILT_PRODUCTS_DIR/$PUBLIC_HEADERS_FOLDER_PATH\"\nsed -i '' -e 's,#include \"\\(.*\\)\",#include <SDL2/\\1>,' *.h\n";
|
||||
};
|
||||
BE1FA74407AF4C45004B6283 /* ShellScript */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "PRODUCT_NAME=SDL2_image\n\n# Sign framework\nif [ \"$SDL_CODESIGN_IDENTITY\" != \"\" ]; then\n codesign --force --deep --sign \"$SDL_CODESIGN_IDENTITY\" $TARGET_BUILD_DIR/$PRODUCT_NAME.framework/Versions/A || exit $?\nfi\n\n# clean up the framework, remove headers, extra files\nmkdir -p build/dmg-tmp\ncp -a $TARGET_BUILD_DIR/$PRODUCT_NAME.framework build/dmg-tmp/\ncp pkg-support/resources/ReadMe.txt build/dmg-tmp\n\n# remove the .DS_Store files if any (we may want to provide one in the future for fancy .dmgs)\nrm -rf build/dmg-tmp/.DS_Store\n\n# create the dmg\nhdiutil create -ov -fs HFS+ -volname $PRODUCT_NAME -srcfolder build/dmg-tmp build/$PRODUCT_NAME.dmg\n\n# clean up\nrm -rf build/dmg-tmp\n";
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
BE1FA71C07AF4C44004B6283 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
AA579DF2161C07E6005F809B /* IMG_bmp.c in Sources */,
|
||||
AA579DF4161C07E7005F809B /* IMG_gif.c in Sources */,
|
||||
AA579DF6161C07E7005F809B /* IMG_ImageIO.m in Sources */,
|
||||
AA579DF8161C07E7005F809B /* IMG_jpg.c in Sources */,
|
||||
AA579DFA161C07E7005F809B /* IMG_lbm.c in Sources */,
|
||||
AA579DFC161C07E7005F809B /* IMG_pcx.c in Sources */,
|
||||
AA579DFE161C07E7005F809B /* IMG_png.c in Sources */,
|
||||
AA579E00161C07E7005F809B /* IMG_pnm.c in Sources */,
|
||||
AA579E02161C07E7005F809B /* IMG_tga.c in Sources */,
|
||||
F35475FD2829BAF9007E9EDA /* IMG_avif.c in Sources */,
|
||||
AA579E04161C07E7005F809B /* IMG_tif.c in Sources */,
|
||||
AA579E06161C07E7005F809B /* IMG_webp.c in Sources */,
|
||||
AA579E08161C07E7005F809B /* IMG_xcf.c in Sources */,
|
||||
AA579E0A161C07E7005F809B /* IMG_xpm.c in Sources */,
|
||||
F354743E2828CA66007E9EDA /* IMG_jxl.c in Sources */,
|
||||
AA579E0C161C07E7005F809B /* IMG_xv.c in Sources */,
|
||||
AA579E0E161C07E7005F809B /* IMG_xxx.c in Sources */,
|
||||
AA579E10161C07E7005F809B /* IMG.c in Sources */,
|
||||
AA50AA471F9C7C50003B9C0C /* IMG_svg.c in Sources */,
|
||||
F31094C3282AE42D008EF641 /* IMG_stb.c in Sources */,
|
||||
6313BF532785566D00F268AD /* IMG_qoi.c in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
BE1FA73107AF4C45004B6283 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
AA579DF3161C07E7005F809B /* IMG_bmp.c in Sources */,
|
||||
AA579DF5161C07E7005F809B /* IMG_gif.c in Sources */,
|
||||
AA579DF7161C07E7005F809B /* IMG_ImageIO.m in Sources */,
|
||||
AA579DF9161C07E7005F809B /* IMG_jpg.c in Sources */,
|
||||
AA579DFB161C07E7005F809B /* IMG_lbm.c in Sources */,
|
||||
AA579DFD161C07E7005F809B /* IMG_pcx.c in Sources */,
|
||||
AA579DFF161C07E7005F809B /* IMG_png.c in Sources */,
|
||||
AA579E01161C07E7005F809B /* IMG_pnm.c in Sources */,
|
||||
AA579E03161C07E7005F809B /* IMG_tga.c in Sources */,
|
||||
F35475FE2829BAF9007E9EDA /* IMG_avif.c in Sources */,
|
||||
AA579E05161C07E7005F809B /* IMG_tif.c in Sources */,
|
||||
AA579E07161C07E7005F809B /* IMG_webp.c in Sources */,
|
||||
AA579E09161C07E7005F809B /* IMG_xcf.c in Sources */,
|
||||
AA579E0B161C07E7005F809B /* IMG_xpm.c in Sources */,
|
||||
F354743F2828CA66007E9EDA /* IMG_jxl.c in Sources */,
|
||||
AA579E0D161C07E7005F809B /* IMG_xv.c in Sources */,
|
||||
AA579E0F161C07E7005F809B /* IMG_xxx.c in Sources */,
|
||||
AA579E11161C07E7005F809B /* IMG.c in Sources */,
|
||||
AA23FC7D20A2A1B90017DFB9 /* IMG_svg.c in Sources */,
|
||||
F31094C4282AE42D008EF641 /* IMG_stb.c in Sources */,
|
||||
6313BF542785566D00F268AD /* IMG_qoi.c in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXTargetDependency section */
|
||||
BE1FA74D07AF4C45004B6283 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = BE1FA71807AF4C44004B6283 /* Framework */;
|
||||
targetProxy = BE1FA74C07AF4C45004B6283 /* PBXContainerItemProxy */;
|
||||
};
|
||||
/* End PBXTargetDependency section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
007288110F0DA5BA00C302A9 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = F3547625282AE1C6007E9EDA /* config.xcconfig */;
|
||||
buildSettings = {
|
||||
ALLOW_TARGET_PLATFORM_SPECIALIZATION = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DYLIB_COMPATIBILITY_VERSION = 3.0.0;
|
||||
DYLIB_CURRENT_VERSION = 503.0.0;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
ENABLE_TESTABILITY = YES;
|
||||
FRAMEWORK_SEARCH_PATHS = "\"$(SRCROOT)/$(PLATFORM)\"";
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
USE_STBIMAGE,
|
||||
LOAD_BMP,
|
||||
LOAD_GIF,
|
||||
LOAD_JPG,
|
||||
LOAD_LBM,
|
||||
LOAD_PCX,
|
||||
LOAD_PNG,
|
||||
LOAD_PNM,
|
||||
LOAD_QOI,
|
||||
LOAD_SVG,
|
||||
LOAD_TGA,
|
||||
LOAD_TIF,
|
||||
LOAD_XCF,
|
||||
LOAD_XPM,
|
||||
LOAD_XV,
|
||||
"$(CONFIG_PREPROCESSOR_DEFINITIONS)",
|
||||
);
|
||||
GCC_SYMBOLS_PRIVATE_EXTERN = YES;
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"\"$(SRCROOT)/$(PLATFORM)/SDL2.framework/Headers\"",
|
||||
"\"$(SRCROOT)/../external/jpeg\"",
|
||||
);
|
||||
INFOPLIST_FILE = "Info-Framework.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
"@loader_path/Frameworks",
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.7;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
PLATFORM = "";
|
||||
"PLATFORM[sdk=appletvos*]" = tvOS;
|
||||
"PLATFORM[sdk=iphoneos*]" = iOS;
|
||||
"PLATFORM[sdk=macosx*]" = macOS;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "org.libsdl.SDL2-image";
|
||||
PRODUCT_NAME = SDL2_image;
|
||||
SUPPORTED_PLATFORMS = "watchsimulator watchos macosx iphonesimulator iphoneos driverkit appletvsimulator appletvos";
|
||||
SUPPORTS_MACCATALYST = YES;
|
||||
TVOS_DEPLOYMENT_TARGET = 9.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
007288120F0DA5BA00C302A9 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
OTHER_LDFLAGS = "$(CONFIG_FRAMEWORK_LDFLAGS)";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
007288130F0DA5BA00C302A9 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
007288140F0DA5BA00C302A9 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
OTHER_CFLAGS = "";
|
||||
OTHER_LDFLAGS = "";
|
||||
OTHER_REZFLAGS = "";
|
||||
PRODUCT_NAME = "Create DMG";
|
||||
REZ_EXECUTABLE = YES;
|
||||
SECTORDER_FLAGS = "";
|
||||
WARNING_CFLAGS = (
|
||||
"-Wmost",
|
||||
"-Wno-four-char-constants",
|
||||
"-Wno-unknown-pragmas",
|
||||
);
|
||||
ZERO_LINK = YES;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
007288150F0DA5C400C302A9 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = F3547625282AE1C6007E9EDA /* config.xcconfig */;
|
||||
buildSettings = {
|
||||
ALLOW_TARGET_PLATFORM_SPECIALIZATION = YES;
|
||||
DEPLOYMENT_POSTPROCESSING = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 3.0.0;
|
||||
DYLIB_CURRENT_VERSION = 503.0.0;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
FRAMEWORK_SEARCH_PATHS = "\"$(SRCROOT)/$(PLATFORM)\"";
|
||||
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
USE_STBIMAGE,
|
||||
LOAD_BMP,
|
||||
LOAD_GIF,
|
||||
LOAD_JPG,
|
||||
LOAD_LBM,
|
||||
LOAD_PCX,
|
||||
LOAD_PNG,
|
||||
LOAD_PNM,
|
||||
LOAD_QOI,
|
||||
LOAD_SVG,
|
||||
LOAD_TGA,
|
||||
LOAD_TIF,
|
||||
LOAD_XCF,
|
||||
LOAD_XPM,
|
||||
LOAD_XV,
|
||||
"$(CONFIG_PREPROCESSOR_DEFINITIONS)",
|
||||
);
|
||||
GCC_SYMBOLS_PRIVATE_EXTERN = YES;
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"\"$(SRCROOT)/$(PLATFORM)/SDL2.framework/Headers\"",
|
||||
"\"$(SRCROOT)/../external/jpeg\"",
|
||||
);
|
||||
INFOPLIST_FILE = "Info-Framework.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
"@loader_path/Frameworks",
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.7;
|
||||
PLATFORM = "";
|
||||
"PLATFORM[sdk=appletvos*]" = tvOS;
|
||||
"PLATFORM[sdk=iphoneos*]" = iOS;
|
||||
"PLATFORM[sdk=macosx*]" = macOS;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "org.libsdl.SDL2-image";
|
||||
PRODUCT_NAME = SDL2_image;
|
||||
SUPPORTED_PLATFORMS = "watchsimulator watchos macosx iphonesimulator iphoneos driverkit appletvsimulator appletvos";
|
||||
SUPPORTS_MACCATALYST = YES;
|
||||
TVOS_DEPLOYMENT_TARGET = 9.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
007288160F0DA5C400C302A9 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
OTHER_LDFLAGS = "$(CONFIG_FRAMEWORK_LDFLAGS)";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
007288170F0DA5C400C302A9 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
007288180F0DA5C400C302A9 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
OTHER_CFLAGS = "";
|
||||
OTHER_LDFLAGS = "";
|
||||
OTHER_REZFLAGS = "";
|
||||
PRODUCT_NAME = "Create DMG";
|
||||
REZ_EXECUTABLE = YES;
|
||||
SECTORDER_FLAGS = "";
|
||||
WARNING_CFLAGS = (
|
||||
"-Wmost",
|
||||
"-Wno-four-char-constants",
|
||||
"-Wno-unknown-pragmas",
|
||||
);
|
||||
ZERO_LINK = NO;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
00B7E3AA097EB73D00826121 /* Build configuration list for PBXNativeTarget "Framework" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
007288160F0DA5C400C302A9 /* Release */,
|
||||
007288120F0DA5BA00C302A9 /* Debug */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
00B7E3AE097EB73D00826121 /* Build configuration list for PBXNativeTarget "Static Library" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
007288170F0DA5C400C302A9 /* Release */,
|
||||
007288130F0DA5BA00C302A9 /* Debug */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
00B7E3B2097EB73D00826121 /* Build configuration list for PBXNativeTarget "Create DMG" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
007288180F0DA5C400C302A9 /* Release */,
|
||||
007288140F0DA5BA00C302A9 /* Debug */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
00B7E3B6097EB73D00826121 /* Build configuration list for PBXProject "SDL_image" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
007288150F0DA5C400C302A9 /* Release */,
|
||||
007288110F0DA5BA00C302A9 /* Debug */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 0867D690FE84028FC02AAC07 /* Project object */;
|
||||
}
|
||||
@@ -0,0 +1,862 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 55;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
F35474862829A9CB007E9EDA /* alpha.c in Sources */ = {isa = PBXBuildFile; fileRef = F35474772829A9CB007E9EDA /* alpha.c */; };
|
||||
F35474872829A9CB007E9EDA /* avif.c in Sources */ = {isa = PBXBuildFile; fileRef = F35474782829A9CB007E9EDA /* avif.c */; };
|
||||
F35474882829A9CB007E9EDA /* scale.c in Sources */ = {isa = PBXBuildFile; fileRef = F35474792829A9CB007E9EDA /* scale.c */; };
|
||||
F35474892829A9CB007E9EDA /* colr.c in Sources */ = {isa = PBXBuildFile; fileRef = F354747A2829A9CB007E9EDA /* colr.c */; };
|
||||
F354748A2829A9CB007E9EDA /* diag.c in Sources */ = {isa = PBXBuildFile; fileRef = F354747B2829A9CB007E9EDA /* diag.c */; };
|
||||
F354748B2829A9CB007E9EDA /* rawdata.c in Sources */ = {isa = PBXBuildFile; fileRef = F354747C2829A9CB007E9EDA /* rawdata.c */; };
|
||||
F354748C2829A9CB007E9EDA /* reformat.c in Sources */ = {isa = PBXBuildFile; fileRef = F354747D2829A9CB007E9EDA /* reformat.c */; };
|
||||
F354748D2829A9CB007E9EDA /* reformat_libyuv.c in Sources */ = {isa = PBXBuildFile; fileRef = F354747E2829A9CB007E9EDA /* reformat_libyuv.c */; };
|
||||
F354748E2829A9CB007E9EDA /* io.c in Sources */ = {isa = PBXBuildFile; fileRef = F354747F2829A9CB007E9EDA /* io.c */; };
|
||||
F354748F2829A9CB007E9EDA /* utils.c in Sources */ = {isa = PBXBuildFile; fileRef = F35474802829A9CB007E9EDA /* utils.c */; };
|
||||
F35474902829A9CB007E9EDA /* obu.c in Sources */ = {isa = PBXBuildFile; fileRef = F35474812829A9CB007E9EDA /* obu.c */; };
|
||||
F35474912829A9CB007E9EDA /* write.c in Sources */ = {isa = PBXBuildFile; fileRef = F35474822829A9CB007E9EDA /* write.c */; };
|
||||
F35474922829A9CB007E9EDA /* mem.c in Sources */ = {isa = PBXBuildFile; fileRef = F35474832829A9CB007E9EDA /* mem.c */; };
|
||||
F35474932829A9CB007E9EDA /* stream.c in Sources */ = {isa = PBXBuildFile; fileRef = F35474842829A9CB007E9EDA /* stream.c */; };
|
||||
F35474942829A9CB007E9EDA /* read.c in Sources */ = {isa = PBXBuildFile; fileRef = F35474852829A9CB007E9EDA /* read.c */; };
|
||||
F35474962829A9E0007E9EDA /* codec_dav1d.c in Sources */ = {isa = PBXBuildFile; fileRef = F35474952829A9E0007E9EDA /* codec_dav1d.c */; };
|
||||
F35474C02829ABC5007E9EDA /* avif.h in Headers */ = {isa = PBXBuildFile; fileRef = F35474BF2829ABC5007E9EDA /* avif.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
F35475A02829B867007E9EDA /* cdef_apply_tmpl.c in Sources */ = {isa = PBXBuildFile; fileRef = F35475332829B08D007E9EDA /* cdef_apply_tmpl.c */; };
|
||||
F35475A12829B867007E9EDA /* cdef_apply_tmpl.c in Sources */ = {isa = PBXBuildFile; fileRef = F35475332829B08D007E9EDA /* cdef_apply_tmpl.c */; };
|
||||
F35475A22829B86C007E9EDA /* cdef_tmpl.c in Sources */ = {isa = PBXBuildFile; fileRef = F35475352829B08D007E9EDA /* cdef_tmpl.c */; };
|
||||
F35475A32829B86C007E9EDA /* cdef_tmpl.c in Sources */ = {isa = PBXBuildFile; fileRef = F35475352829B08D007E9EDA /* cdef_tmpl.c */; };
|
||||
F35475A42829B876007E9EDA /* cdf.c in Sources */ = {isa = PBXBuildFile; fileRef = F35474D02829AF7D007E9EDA /* cdf.c */; };
|
||||
F35475A52829B87B007E9EDA /* cpu.c in Sources */ = {isa = PBXBuildFile; fileRef = F35474C72829AF7D007E9EDA /* cpu.c */; };
|
||||
F35475A62829B87D007E9EDA /* data.c in Sources */ = {isa = PBXBuildFile; fileRef = F35474C22829AF7D007E9EDA /* data.c */; };
|
||||
F35475A72829B880007E9EDA /* decode.c in Sources */ = {isa = PBXBuildFile; fileRef = F35474CB2829AF7D007E9EDA /* decode.c */; };
|
||||
F35475A82829B883007E9EDA /* dequant_tables.c in Sources */ = {isa = PBXBuildFile; fileRef = F35474C82829AF7D007E9EDA /* dequant_tables.c */; };
|
||||
F35475A92829B886007E9EDA /* fg_apply_tmpl.c in Sources */ = {isa = PBXBuildFile; fileRef = F35475302829B08D007E9EDA /* fg_apply_tmpl.c */; };
|
||||
F35475AA2829B886007E9EDA /* fg_apply_tmpl.c in Sources */ = {isa = PBXBuildFile; fileRef = F35475302829B08D007E9EDA /* fg_apply_tmpl.c */; };
|
||||
F35475AB2829B889007E9EDA /* filmgrain_tmpl.c in Sources */ = {isa = PBXBuildFile; fileRef = F35475372829B08D007E9EDA /* filmgrain_tmpl.c */; };
|
||||
F35475AC2829B88A007E9EDA /* filmgrain_tmpl.c in Sources */ = {isa = PBXBuildFile; fileRef = F35475372829B08D007E9EDA /* filmgrain_tmpl.c */; };
|
||||
F35475AD2829B88C007E9EDA /* getbits.c in Sources */ = {isa = PBXBuildFile; fileRef = F35474CF2829AF7D007E9EDA /* getbits.c */; };
|
||||
F35475AE2829B890007E9EDA /* intra_edge.c in Sources */ = {isa = PBXBuildFile; fileRef = F35474C92829AF7D007E9EDA /* intra_edge.c */; };
|
||||
F35475AF2829B893007E9EDA /* ipred_prepare_tmpl.c in Sources */ = {isa = PBXBuildFile; fileRef = F354753C2829B08D007E9EDA /* ipred_prepare_tmpl.c */; };
|
||||
F35475B02829B893007E9EDA /* ipred_prepare_tmpl.c in Sources */ = {isa = PBXBuildFile; fileRef = F354753C2829B08D007E9EDA /* ipred_prepare_tmpl.c */; };
|
||||
F35475B12829B897007E9EDA /* ipred_tmpl.c in Sources */ = {isa = PBXBuildFile; fileRef = F35475322829B08D007E9EDA /* ipred_tmpl.c */; };
|
||||
F35475B22829B897007E9EDA /* ipred_tmpl.c in Sources */ = {isa = PBXBuildFile; fileRef = F35475322829B08D007E9EDA /* ipred_tmpl.c */; };
|
||||
F35475B32829B89A007E9EDA /* itx_1d.c in Sources */ = {isa = PBXBuildFile; fileRef = F35474CA2829AF7D007E9EDA /* itx_1d.c */; };
|
||||
F35475B42829B89D007E9EDA /* itx_tmpl.c in Sources */ = {isa = PBXBuildFile; fileRef = F354753A2829B08D007E9EDA /* itx_tmpl.c */; };
|
||||
F35475B52829B89E007E9EDA /* itx_tmpl.c in Sources */ = {isa = PBXBuildFile; fileRef = F354753A2829B08D007E9EDA /* itx_tmpl.c */; };
|
||||
F35475B62829B8A3007E9EDA /* lf_apply_tmpl.c in Sources */ = {isa = PBXBuildFile; fileRef = F35475392829B08D007E9EDA /* lf_apply_tmpl.c */; };
|
||||
F35475B72829B8A3007E9EDA /* lf_apply_tmpl.c in Sources */ = {isa = PBXBuildFile; fileRef = F35475392829B08D007E9EDA /* lf_apply_tmpl.c */; };
|
||||
F35475B82829B8A6007E9EDA /* lf_mask.c in Sources */ = {isa = PBXBuildFile; fileRef = F35474C42829AF7D007E9EDA /* lf_mask.c */; };
|
||||
F35475B92829B8A8007E9EDA /* lib.c in Sources */ = {isa = PBXBuildFile; fileRef = F35474EC2829AFB0007E9EDA /* lib.c */; };
|
||||
F35475BA2829B8AB007E9EDA /* log.c in Sources */ = {isa = PBXBuildFile; fileRef = F35474C12829AF7D007E9EDA /* log.c */; };
|
||||
F35475BB2829B8AD007E9EDA /* loopfilter_tmpl.c in Sources */ = {isa = PBXBuildFile; fileRef = F35475382829B08D007E9EDA /* loopfilter_tmpl.c */; };
|
||||
F35475BC2829B8AE007E9EDA /* loopfilter_tmpl.c in Sources */ = {isa = PBXBuildFile; fileRef = F35475382829B08D007E9EDA /* loopfilter_tmpl.c */; };
|
||||
F35475BD2829B8B0007E9EDA /* looprestoration_tmpl.c in Sources */ = {isa = PBXBuildFile; fileRef = F35475312829B08D007E9EDA /* looprestoration_tmpl.c */; };
|
||||
F35475BE2829B8B1007E9EDA /* looprestoration_tmpl.c in Sources */ = {isa = PBXBuildFile; fileRef = F35475312829B08D007E9EDA /* looprestoration_tmpl.c */; };
|
||||
F35475BF2829B8B4007E9EDA /* lr_apply_tmpl.c in Sources */ = {isa = PBXBuildFile; fileRef = F35475362829B08D007E9EDA /* lr_apply_tmpl.c */; };
|
||||
F35475C02829B8B5007E9EDA /* lr_apply_tmpl.c in Sources */ = {isa = PBXBuildFile; fileRef = F35475362829B08D007E9EDA /* lr_apply_tmpl.c */; };
|
||||
F35475C12829B8B7007E9EDA /* mc_tmpl.c in Sources */ = {isa = PBXBuildFile; fileRef = F354753B2829B08D007E9EDA /* mc_tmpl.c */; };
|
||||
F35475C22829B8B8007E9EDA /* mc_tmpl.c in Sources */ = {isa = PBXBuildFile; fileRef = F354753B2829B08D007E9EDA /* mc_tmpl.c */; };
|
||||
F35475C32829B8BA007E9EDA /* mem.c in Sources */ = {isa = PBXBuildFile; fileRef = F35474C52829AF7D007E9EDA /* mem.c */; };
|
||||
F35475C42829B8BC007E9EDA /* msac.c in Sources */ = {isa = PBXBuildFile; fileRef = F35474D22829AF7D007E9EDA /* msac.c */; };
|
||||
F35475C52829B8BE007E9EDA /* obu.c in Sources */ = {isa = PBXBuildFile; fileRef = F35474CC2829AF7D007E9EDA /* obu.c */; };
|
||||
F35475C62829B8C0007E9EDA /* picture.c in Sources */ = {isa = PBXBuildFile; fileRef = F35474D52829AF7D007E9EDA /* picture.c */; };
|
||||
F35475C72829B8C3007E9EDA /* qm.c in Sources */ = {isa = PBXBuildFile; fileRef = F35474CD2829AF7D007E9EDA /* qm.c */; };
|
||||
F35475C82829B8C6007E9EDA /* recon_tmpl.c in Sources */ = {isa = PBXBuildFile; fileRef = F35475342829B08D007E9EDA /* recon_tmpl.c */; };
|
||||
F35475C92829B8C6007E9EDA /* recon_tmpl.c in Sources */ = {isa = PBXBuildFile; fileRef = F35475342829B08D007E9EDA /* recon_tmpl.c */; };
|
||||
F35475CA2829B8C9007E9EDA /* ref.c in Sources */ = {isa = PBXBuildFile; fileRef = F35474CE2829AF7D007E9EDA /* ref.c */; };
|
||||
F35475CB2829B8CC007E9EDA /* refmvs.c in Sources */ = {isa = PBXBuildFile; fileRef = F35474D12829AF7D007E9EDA /* refmvs.c */; };
|
||||
F35475CC2829B8CE007E9EDA /* scan.c in Sources */ = {isa = PBXBuildFile; fileRef = F35474C32829AF7D007E9EDA /* scan.c */; };
|
||||
F35475CD2829B8D1007E9EDA /* tables.c in Sources */ = {isa = PBXBuildFile; fileRef = F35474C62829AF7D007E9EDA /* tables.c */; };
|
||||
F35475CE2829B8D3007E9EDA /* thread_task.c in Sources */ = {isa = PBXBuildFile; fileRef = F35474EB2829AFB0007E9EDA /* thread_task.c */; };
|
||||
F35475CF2829B8D6007E9EDA /* warpmv.c in Sources */ = {isa = PBXBuildFile; fileRef = F35474D32829AF7D007E9EDA /* warpmv.c */; };
|
||||
F35475D02829B8D9007E9EDA /* wedge.c in Sources */ = {isa = PBXBuildFile; fileRef = F35474D42829AF7D007E9EDA /* wedge.c */; };
|
||||
F35475D12829B956007E9EDA /* libdav1d.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F354757D2829B82B007E9EDA /* libdav1d.a */; };
|
||||
F35475D22829B958007E9EDA /* libdav1d-8bit.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F354758A2829B839007E9EDA /* libdav1d-8bit.a */; };
|
||||
F35475D32829B95A007E9EDA /* libdav1d-16bit.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F35475972829B847007E9EDA /* libdav1d-16bit.a */; };
|
||||
F354761D282A29E8007E9EDA /* LICENSE in Resources */ = {isa = PBXBuildFile; fileRef = F354761B282A29E8007E9EDA /* LICENSE */; };
|
||||
F354761E282A29E8007E9EDA /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = F354761C282A29E8007E9EDA /* README.md */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
F354757B2829B82B007E9EDA /* CopyFiles */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = "include/$(PRODUCT_NAME)";
|
||||
dstSubfolderSpec = 16;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
F35475882829B839007E9EDA /* CopyFiles */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = "include/$(PRODUCT_NAME)";
|
||||
dstSubfolderSpec = 16;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
F35475952829B847007E9EDA /* CopyFiles */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = "include/$(PRODUCT_NAME)";
|
||||
dstSubfolderSpec = 16;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
F35474682829A8B3007E9EDA /* avif.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = avif.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
F35474772829A9CB007E9EDA /* alpha.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = alpha.c; path = ../../external/libavif/src/alpha.c; sourceTree = "<group>"; };
|
||||
F35474782829A9CB007E9EDA /* avif.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = avif.c; path = ../../external/libavif/src/avif.c; sourceTree = "<group>"; };
|
||||
F35474792829A9CB007E9EDA /* scale.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = scale.c; path = ../../external/libavif/src/scale.c; sourceTree = "<group>"; };
|
||||
F354747A2829A9CB007E9EDA /* colr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = colr.c; path = ../../external/libavif/src/colr.c; sourceTree = "<group>"; };
|
||||
F354747B2829A9CB007E9EDA /* diag.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = diag.c; path = ../../external/libavif/src/diag.c; sourceTree = "<group>"; };
|
||||
F354747C2829A9CB007E9EDA /* rawdata.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = rawdata.c; path = ../../external/libavif/src/rawdata.c; sourceTree = "<group>"; };
|
||||
F354747D2829A9CB007E9EDA /* reformat.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = reformat.c; path = ../../external/libavif/src/reformat.c; sourceTree = "<group>"; };
|
||||
F354747E2829A9CB007E9EDA /* reformat_libyuv.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = reformat_libyuv.c; path = ../../external/libavif/src/reformat_libyuv.c; sourceTree = "<group>"; };
|
||||
F354747F2829A9CB007E9EDA /* io.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = io.c; path = ../../external/libavif/src/io.c; sourceTree = "<group>"; };
|
||||
F35474802829A9CB007E9EDA /* utils.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = utils.c; path = ../../external/libavif/src/utils.c; sourceTree = "<group>"; };
|
||||
F35474812829A9CB007E9EDA /* obu.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = obu.c; path = ../../external/libavif/src/obu.c; sourceTree = "<group>"; };
|
||||
F35474822829A9CB007E9EDA /* write.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = write.c; path = ../../external/libavif/src/write.c; sourceTree = "<group>"; };
|
||||
F35474832829A9CB007E9EDA /* mem.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = mem.c; path = ../../external/libavif/src/mem.c; sourceTree = "<group>"; };
|
||||
F35474842829A9CB007E9EDA /* stream.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = stream.c; path = ../../external/libavif/src/stream.c; sourceTree = "<group>"; };
|
||||
F35474852829A9CB007E9EDA /* read.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = read.c; path = ../../external/libavif/src/read.c; sourceTree = "<group>"; };
|
||||
F35474952829A9E0007E9EDA /* codec_dav1d.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = codec_dav1d.c; path = ../../external/libavif/src/codec_dav1d.c; sourceTree = "<group>"; };
|
||||
F35474BF2829ABC5007E9EDA /* avif.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = avif.h; path = ../../external/libavif/include/avif/avif.h; sourceTree = "<group>"; };
|
||||
F35474C12829AF7D007E9EDA /* log.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = log.c; path = ../../../external/dav1d/src/log.c; sourceTree = "<group>"; };
|
||||
F35474C22829AF7D007E9EDA /* data.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = data.c; path = ../../../external/dav1d/src/data.c; sourceTree = "<group>"; };
|
||||
F35474C32829AF7D007E9EDA /* scan.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = scan.c; path = ../../../external/dav1d/src/scan.c; sourceTree = "<group>"; };
|
||||
F35474C42829AF7D007E9EDA /* lf_mask.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lf_mask.c; path = ../../../external/dav1d/src/lf_mask.c; sourceTree = "<group>"; };
|
||||
F35474C52829AF7D007E9EDA /* mem.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = mem.c; path = ../../../external/dav1d/src/mem.c; sourceTree = "<group>"; };
|
||||
F35474C62829AF7D007E9EDA /* tables.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = tables.c; path = ../../../external/dav1d/src/tables.c; sourceTree = "<group>"; };
|
||||
F35474C72829AF7D007E9EDA /* cpu.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = cpu.c; path = ../../../external/dav1d/src/cpu.c; sourceTree = "<group>"; };
|
||||
F35474C82829AF7D007E9EDA /* dequant_tables.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = dequant_tables.c; path = ../../../external/dav1d/src/dequant_tables.c; sourceTree = "<group>"; };
|
||||
F35474C92829AF7D007E9EDA /* intra_edge.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = intra_edge.c; path = ../../../external/dav1d/src/intra_edge.c; sourceTree = "<group>"; };
|
||||
F35474CA2829AF7D007E9EDA /* itx_1d.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = itx_1d.c; path = ../../../external/dav1d/src/itx_1d.c; sourceTree = "<group>"; };
|
||||
F35474CB2829AF7D007E9EDA /* decode.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = decode.c; path = ../../../external/dav1d/src/decode.c; sourceTree = "<group>"; };
|
||||
F35474CC2829AF7D007E9EDA /* obu.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = obu.c; path = ../../../external/dav1d/src/obu.c; sourceTree = "<group>"; };
|
||||
F35474CD2829AF7D007E9EDA /* qm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = qm.c; path = ../../../external/dav1d/src/qm.c; sourceTree = "<group>"; };
|
||||
F35474CE2829AF7D007E9EDA /* ref.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ref.c; path = ../../../external/dav1d/src/ref.c; sourceTree = "<group>"; };
|
||||
F35474CF2829AF7D007E9EDA /* getbits.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = getbits.c; path = ../../../external/dav1d/src/getbits.c; sourceTree = "<group>"; };
|
||||
F35474D02829AF7D007E9EDA /* cdf.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = cdf.c; path = ../../../external/dav1d/src/cdf.c; sourceTree = "<group>"; };
|
||||
F35474D12829AF7D007E9EDA /* refmvs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = refmvs.c; path = ../../../external/dav1d/src/refmvs.c; sourceTree = "<group>"; };
|
||||
F35474D22829AF7D007E9EDA /* msac.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = msac.c; path = ../../../external/dav1d/src/msac.c; sourceTree = "<group>"; };
|
||||
F35474D32829AF7D007E9EDA /* warpmv.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = warpmv.c; path = ../../../external/dav1d/src/warpmv.c; sourceTree = "<group>"; };
|
||||
F35474D42829AF7D007E9EDA /* wedge.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = wedge.c; path = ../../../external/dav1d/src/wedge.c; sourceTree = "<group>"; };
|
||||
F35474D52829AF7D007E9EDA /* picture.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = picture.c; path = ../../../external/dav1d/src/picture.c; sourceTree = "<group>"; };
|
||||
F35474EB2829AFB0007E9EDA /* thread_task.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = thread_task.c; path = ../../../external/dav1d/src/thread_task.c; sourceTree = "<group>"; };
|
||||
F35474EC2829AFB0007E9EDA /* lib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lib.c; path = ../../../external/dav1d/src/lib.c; sourceTree = "<group>"; };
|
||||
F35475302829B08D007E9EDA /* fg_apply_tmpl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = fg_apply_tmpl.c; path = ../../../external/dav1d/src/fg_apply_tmpl.c; sourceTree = "<group>"; };
|
||||
F35475312829B08D007E9EDA /* looprestoration_tmpl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = looprestoration_tmpl.c; path = ../../../external/dav1d/src/looprestoration_tmpl.c; sourceTree = "<group>"; };
|
||||
F35475322829B08D007E9EDA /* ipred_tmpl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ipred_tmpl.c; path = ../../../external/dav1d/src/ipred_tmpl.c; sourceTree = "<group>"; };
|
||||
F35475332829B08D007E9EDA /* cdef_apply_tmpl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = cdef_apply_tmpl.c; path = ../../../external/dav1d/src/cdef_apply_tmpl.c; sourceTree = "<group>"; };
|
||||
F35475342829B08D007E9EDA /* recon_tmpl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = recon_tmpl.c; path = ../../../external/dav1d/src/recon_tmpl.c; sourceTree = "<group>"; };
|
||||
F35475352829B08D007E9EDA /* cdef_tmpl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = cdef_tmpl.c; path = ../../../external/dav1d/src/cdef_tmpl.c; sourceTree = "<group>"; };
|
||||
F35475362829B08D007E9EDA /* lr_apply_tmpl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lr_apply_tmpl.c; path = ../../../external/dav1d/src/lr_apply_tmpl.c; sourceTree = "<group>"; };
|
||||
F35475372829B08D007E9EDA /* filmgrain_tmpl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = filmgrain_tmpl.c; path = ../../../external/dav1d/src/filmgrain_tmpl.c; sourceTree = "<group>"; };
|
||||
F35475382829B08D007E9EDA /* loopfilter_tmpl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = loopfilter_tmpl.c; path = ../../../external/dav1d/src/loopfilter_tmpl.c; sourceTree = "<group>"; };
|
||||
F35475392829B08D007E9EDA /* lf_apply_tmpl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lf_apply_tmpl.c; path = ../../../external/dav1d/src/lf_apply_tmpl.c; sourceTree = "<group>"; };
|
||||
F354753A2829B08D007E9EDA /* itx_tmpl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = itx_tmpl.c; path = ../../../external/dav1d/src/itx_tmpl.c; sourceTree = "<group>"; };
|
||||
F354753B2829B08D007E9EDA /* mc_tmpl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = mc_tmpl.c; path = ../../../external/dav1d/src/mc_tmpl.c; sourceTree = "<group>"; };
|
||||
F354753C2829B08D007E9EDA /* ipred_prepare_tmpl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ipred_prepare_tmpl.c; path = ../../../external/dav1d/src/ipred_prepare_tmpl.c; sourceTree = "<group>"; };
|
||||
F354757D2829B82B007E9EDA /* libdav1d.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libdav1d.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
F354758A2829B839007E9EDA /* libdav1d-8bit.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libdav1d-8bit.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
F35475972829B847007E9EDA /* libdav1d-16bit.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libdav1d-16bit.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
F354761B282A29E8007E9EDA /* LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = LICENSE; path = ../../external/libavif/LICENSE; sourceTree = "<group>"; };
|
||||
F354761C282A29E8007E9EDA /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../../external/libavif/README.md; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
F35474652829A8B3007E9EDA /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
F35475D12829B956007E9EDA /* libdav1d.a in Frameworks */,
|
||||
F35475D22829B958007E9EDA /* libdav1d-8bit.a in Frameworks */,
|
||||
F35475D32829B95A007E9EDA /* libdav1d-16bit.a in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
F354757A2829B82B007E9EDA /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
F35475872829B839007E9EDA /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
F35475942829B847007E9EDA /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
F354745E2829A8B3007E9EDA = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
F354749D2829AAB0007E9EDA /* dav1d */,
|
||||
F35474692829A8B3007E9EDA /* Products */,
|
||||
F35474762829A8F5007E9EDA /* Resources */,
|
||||
F35474752829A8EF007E9EDA /* Headers */,
|
||||
F35474742829A8E6007E9EDA /* Source */,
|
||||
F35475572829B18A007E9EDA /* Frameworks */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
F35474692829A8B3007E9EDA /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
F35474682829A8B3007E9EDA /* avif.framework */,
|
||||
F354757D2829B82B007E9EDA /* libdav1d.a */,
|
||||
F354758A2829B839007E9EDA /* libdav1d-8bit.a */,
|
||||
F35475972829B847007E9EDA /* libdav1d-16bit.a */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
F35474742829A8E6007E9EDA /* Source */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
F35474772829A9CB007E9EDA /* alpha.c */,
|
||||
F35474782829A9CB007E9EDA /* avif.c */,
|
||||
F35474952829A9E0007E9EDA /* codec_dav1d.c */,
|
||||
F354747A2829A9CB007E9EDA /* colr.c */,
|
||||
F354747B2829A9CB007E9EDA /* diag.c */,
|
||||
F354747F2829A9CB007E9EDA /* io.c */,
|
||||
F35474832829A9CB007E9EDA /* mem.c */,
|
||||
F35474812829A9CB007E9EDA /* obu.c */,
|
||||
F354747C2829A9CB007E9EDA /* rawdata.c */,
|
||||
F35474852829A9CB007E9EDA /* read.c */,
|
||||
F354747E2829A9CB007E9EDA /* reformat_libyuv.c */,
|
||||
F354747D2829A9CB007E9EDA /* reformat.c */,
|
||||
F35474792829A9CB007E9EDA /* scale.c */,
|
||||
F35474842829A9CB007E9EDA /* stream.c */,
|
||||
F35474802829A9CB007E9EDA /* utils.c */,
|
||||
F35474822829A9CB007E9EDA /* write.c */,
|
||||
);
|
||||
name = Source;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
F35474752829A8EF007E9EDA /* Headers */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
F35474BF2829ABC5007E9EDA /* avif.h */,
|
||||
);
|
||||
name = Headers;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
F35474762829A8F5007E9EDA /* Resources */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
F354761B282A29E8007E9EDA /* LICENSE */,
|
||||
F354761C282A29E8007E9EDA /* README.md */,
|
||||
);
|
||||
name = Resources;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
F354749D2829AAB0007E9EDA /* dav1d */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
F35475332829B08D007E9EDA /* cdef_apply_tmpl.c */,
|
||||
F35475352829B08D007E9EDA /* cdef_tmpl.c */,
|
||||
F35474D02829AF7D007E9EDA /* cdf.c */,
|
||||
F35474C72829AF7D007E9EDA /* cpu.c */,
|
||||
F35474C22829AF7D007E9EDA /* data.c */,
|
||||
F35474CB2829AF7D007E9EDA /* decode.c */,
|
||||
F35474C82829AF7D007E9EDA /* dequant_tables.c */,
|
||||
F35475302829B08D007E9EDA /* fg_apply_tmpl.c */,
|
||||
F35475372829B08D007E9EDA /* filmgrain_tmpl.c */,
|
||||
F35474CF2829AF7D007E9EDA /* getbits.c */,
|
||||
F35474C92829AF7D007E9EDA /* intra_edge.c */,
|
||||
F354753C2829B08D007E9EDA /* ipred_prepare_tmpl.c */,
|
||||
F35475322829B08D007E9EDA /* ipred_tmpl.c */,
|
||||
F35474CA2829AF7D007E9EDA /* itx_1d.c */,
|
||||
F354753A2829B08D007E9EDA /* itx_tmpl.c */,
|
||||
F35475392829B08D007E9EDA /* lf_apply_tmpl.c */,
|
||||
F35474C42829AF7D007E9EDA /* lf_mask.c */,
|
||||
F35474EC2829AFB0007E9EDA /* lib.c */,
|
||||
F35474C12829AF7D007E9EDA /* log.c */,
|
||||
F35475382829B08D007E9EDA /* loopfilter_tmpl.c */,
|
||||
F35475312829B08D007E9EDA /* looprestoration_tmpl.c */,
|
||||
F35475362829B08D007E9EDA /* lr_apply_tmpl.c */,
|
||||
F354753B2829B08D007E9EDA /* mc_tmpl.c */,
|
||||
F35474C52829AF7D007E9EDA /* mem.c */,
|
||||
F35474D22829AF7D007E9EDA /* msac.c */,
|
||||
F35474CC2829AF7D007E9EDA /* obu.c */,
|
||||
F35474D52829AF7D007E9EDA /* picture.c */,
|
||||
F35474CD2829AF7D007E9EDA /* qm.c */,
|
||||
F35475342829B08D007E9EDA /* recon_tmpl.c */,
|
||||
F35474CE2829AF7D007E9EDA /* ref.c */,
|
||||
F35474D12829AF7D007E9EDA /* refmvs.c */,
|
||||
F35474C32829AF7D007E9EDA /* scan.c */,
|
||||
F35474C62829AF7D007E9EDA /* tables.c */,
|
||||
F35474EB2829AFB0007E9EDA /* thread_task.c */,
|
||||
F35474D32829AF7D007E9EDA /* warpmv.c */,
|
||||
F35474D42829AF7D007E9EDA /* wedge.c */,
|
||||
);
|
||||
path = dav1d;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
F35475572829B18A007E9EDA /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXHeadersBuildPhase section */
|
||||
F35474632829A8B3007E9EDA /* Headers */ = {
|
||||
isa = PBXHeadersBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
F35474C02829ABC5007E9EDA /* avif.h in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXHeadersBuildPhase section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
F35474672829A8B3007E9EDA /* avif */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = F354746F2829A8B3007E9EDA /* Build configuration list for PBXNativeTarget "avif" */;
|
||||
buildPhases = (
|
||||
F35474632829A8B3007E9EDA /* Headers */,
|
||||
F35474642829A8B3007E9EDA /* Sources */,
|
||||
F35474652829A8B3007E9EDA /* Frameworks */,
|
||||
F35474662829A8B3007E9EDA /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = avif;
|
||||
productName = avif;
|
||||
productReference = F35474682829A8B3007E9EDA /* avif.framework */;
|
||||
productType = "com.apple.product-type.framework";
|
||||
};
|
||||
F354757C2829B82B007E9EDA /* dav1d */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = F35475832829B82B007E9EDA /* Build configuration list for PBXNativeTarget "dav1d" */;
|
||||
buildPhases = (
|
||||
F35475792829B82B007E9EDA /* Sources */,
|
||||
F354757A2829B82B007E9EDA /* Frameworks */,
|
||||
F354757B2829B82B007E9EDA /* CopyFiles */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = dav1d;
|
||||
productName = dav1d;
|
||||
productReference = F354757D2829B82B007E9EDA /* libdav1d.a */;
|
||||
productType = "com.apple.product-type.library.static";
|
||||
};
|
||||
F35475892829B839007E9EDA /* dav1d-8bit */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = F35475902829B839007E9EDA /* Build configuration list for PBXNativeTarget "dav1d-8bit" */;
|
||||
buildPhases = (
|
||||
F35475862829B839007E9EDA /* Sources */,
|
||||
F35475872829B839007E9EDA /* Frameworks */,
|
||||
F35475882829B839007E9EDA /* CopyFiles */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = "dav1d-8bit";
|
||||
productName = "dav1d-8bit";
|
||||
productReference = F354758A2829B839007E9EDA /* libdav1d-8bit.a */;
|
||||
productType = "com.apple.product-type.library.static";
|
||||
};
|
||||
F35475962829B847007E9EDA /* dav1d-16bit */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = F354759D2829B848007E9EDA /* Build configuration list for PBXNativeTarget "dav1d-16bit" */;
|
||||
buildPhases = (
|
||||
F35475932829B847007E9EDA /* Sources */,
|
||||
F35475942829B847007E9EDA /* Frameworks */,
|
||||
F35475952829B847007E9EDA /* CopyFiles */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = "dav1d-16bit";
|
||||
productName = "dav1d-16bit";
|
||||
productReference = F35475972829B847007E9EDA /* libdav1d-16bit.a */;
|
||||
productType = "com.apple.product-type.library.static";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
F354745F2829A8B3007E9EDA /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
BuildIndependentTargetsInParallel = 1;
|
||||
LastUpgradeCheck = 1330;
|
||||
TargetAttributes = {
|
||||
F35474672829A8B3007E9EDA = {
|
||||
CreatedOnToolsVersion = 13.3.1;
|
||||
};
|
||||
F354757C2829B82B007E9EDA = {
|
||||
CreatedOnToolsVersion = 13.3.1;
|
||||
};
|
||||
F35475892829B839007E9EDA = {
|
||||
CreatedOnToolsVersion = 13.3.1;
|
||||
};
|
||||
F35475962829B847007E9EDA = {
|
||||
CreatedOnToolsVersion = 13.3.1;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = F35474622829A8B3007E9EDA /* Build configuration list for PBXProject "avif" */;
|
||||
compatibilityVersion = "Xcode 13.0";
|
||||
developmentRegion = en;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
Base,
|
||||
);
|
||||
mainGroup = F354745E2829A8B3007E9EDA;
|
||||
productRefGroup = F35474692829A8B3007E9EDA /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
F35474672829A8B3007E9EDA /* avif */,
|
||||
F354757C2829B82B007E9EDA /* dav1d */,
|
||||
F35475892829B839007E9EDA /* dav1d-8bit */,
|
||||
F35475962829B847007E9EDA /* dav1d-16bit */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
F35474662829A8B3007E9EDA /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
F354761E282A29E8007E9EDA /* README.md in Resources */,
|
||||
F354761D282A29E8007E9EDA /* LICENSE in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
F35474642829A8B3007E9EDA /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
F35474902829A9CB007E9EDA /* obu.c in Sources */,
|
||||
F354748A2829A9CB007E9EDA /* diag.c in Sources */,
|
||||
F35474882829A9CB007E9EDA /* scale.c in Sources */,
|
||||
F35474912829A9CB007E9EDA /* write.c in Sources */,
|
||||
F35474862829A9CB007E9EDA /* alpha.c in Sources */,
|
||||
F35474942829A9CB007E9EDA /* read.c in Sources */,
|
||||
F35474922829A9CB007E9EDA /* mem.c in Sources */,
|
||||
F35474872829A9CB007E9EDA /* avif.c in Sources */,
|
||||
F354748D2829A9CB007E9EDA /* reformat_libyuv.c in Sources */,
|
||||
F354748F2829A9CB007E9EDA /* utils.c in Sources */,
|
||||
F35474932829A9CB007E9EDA /* stream.c in Sources */,
|
||||
F35474962829A9E0007E9EDA /* codec_dav1d.c in Sources */,
|
||||
F354748B2829A9CB007E9EDA /* rawdata.c in Sources */,
|
||||
F354748C2829A9CB007E9EDA /* reformat.c in Sources */,
|
||||
F354748E2829A9CB007E9EDA /* io.c in Sources */,
|
||||
F35474892829A9CB007E9EDA /* colr.c in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
F35475792829B82B007E9EDA /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
F35475CE2829B8D3007E9EDA /* thread_task.c in Sources */,
|
||||
F35475C42829B8BC007E9EDA /* msac.c in Sources */,
|
||||
F35475BA2829B8AB007E9EDA /* log.c in Sources */,
|
||||
F35475CA2829B8C9007E9EDA /* ref.c in Sources */,
|
||||
F35475A52829B87B007E9EDA /* cpu.c in Sources */,
|
||||
F35475C72829B8C3007E9EDA /* qm.c in Sources */,
|
||||
F35475A72829B880007E9EDA /* decode.c in Sources */,
|
||||
F35475B82829B8A6007E9EDA /* lf_mask.c in Sources */,
|
||||
F35475B92829B8A8007E9EDA /* lib.c in Sources */,
|
||||
F35475D02829B8D9007E9EDA /* wedge.c in Sources */,
|
||||
F35475CC2829B8CE007E9EDA /* scan.c in Sources */,
|
||||
F35475CB2829B8CC007E9EDA /* refmvs.c in Sources */,
|
||||
F35475B32829B89A007E9EDA /* itx_1d.c in Sources */,
|
||||
F35475A42829B876007E9EDA /* cdf.c in Sources */,
|
||||
F35475C52829B8BE007E9EDA /* obu.c in Sources */,
|
||||
F35475A82829B883007E9EDA /* dequant_tables.c in Sources */,
|
||||
F35475AD2829B88C007E9EDA /* getbits.c in Sources */,
|
||||
F35475C32829B8BA007E9EDA /* mem.c in Sources */,
|
||||
F35475CD2829B8D1007E9EDA /* tables.c in Sources */,
|
||||
F35475AE2829B890007E9EDA /* intra_edge.c in Sources */,
|
||||
F35475A62829B87D007E9EDA /* data.c in Sources */,
|
||||
F35475CF2829B8D6007E9EDA /* warpmv.c in Sources */,
|
||||
F35475C62829B8C0007E9EDA /* picture.c in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
F35475862829B839007E9EDA /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
F35475BB2829B8AD007E9EDA /* loopfilter_tmpl.c in Sources */,
|
||||
F35475A92829B886007E9EDA /* fg_apply_tmpl.c in Sources */,
|
||||
F35475BF2829B8B4007E9EDA /* lr_apply_tmpl.c in Sources */,
|
||||
F35475AF2829B893007E9EDA /* ipred_prepare_tmpl.c in Sources */,
|
||||
F35475A22829B86C007E9EDA /* cdef_tmpl.c in Sources */,
|
||||
F35475B62829B8A3007E9EDA /* lf_apply_tmpl.c in Sources */,
|
||||
F35475C82829B8C6007E9EDA /* recon_tmpl.c in Sources */,
|
||||
F35475C12829B8B7007E9EDA /* mc_tmpl.c in Sources */,
|
||||
F35475AB2829B889007E9EDA /* filmgrain_tmpl.c in Sources */,
|
||||
F35475A02829B867007E9EDA /* cdef_apply_tmpl.c in Sources */,
|
||||
F35475BD2829B8B0007E9EDA /* looprestoration_tmpl.c in Sources */,
|
||||
F35475B42829B89D007E9EDA /* itx_tmpl.c in Sources */,
|
||||
F35475B12829B897007E9EDA /* ipred_tmpl.c in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
F35475932829B847007E9EDA /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
F35475BC2829B8AE007E9EDA /* loopfilter_tmpl.c in Sources */,
|
||||
F35475AA2829B886007E9EDA /* fg_apply_tmpl.c in Sources */,
|
||||
F35475C02829B8B5007E9EDA /* lr_apply_tmpl.c in Sources */,
|
||||
F35475B02829B893007E9EDA /* ipred_prepare_tmpl.c in Sources */,
|
||||
F35475A32829B86C007E9EDA /* cdef_tmpl.c in Sources */,
|
||||
F35475B72829B8A3007E9EDA /* lf_apply_tmpl.c in Sources */,
|
||||
F35475C92829B8C6007E9EDA /* recon_tmpl.c in Sources */,
|
||||
F35475C22829B8B8007E9EDA /* mc_tmpl.c in Sources */,
|
||||
F35475AC2829B88A007E9EDA /* filmgrain_tmpl.c in Sources */,
|
||||
F35475A12829B867007E9EDA /* cdef_apply_tmpl.c in Sources */,
|
||||
F35475BE2829B8B1007E9EDA /* looprestoration_tmpl.c in Sources */,
|
||||
F35475B52829B89E007E9EDA /* itx_tmpl.c in Sources */,
|
||||
F35475B22829B897007E9EDA /* ipred_tmpl.c in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
F354746D2829A8B3007E9EDA /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALLOW_TARGET_PLATFORM_SPECIALIZATION = YES;
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = AVIF_CODEC_DAV1D;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.7;
|
||||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||
MTL_FAST_MATH = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SUPPORTED_PLATFORMS = "watchsimulator watchos macosx iphonesimulator iphoneos driverkit appletvsimulator appletvos";
|
||||
SUPPORTS_MACCATALYST = YES;
|
||||
TVOS_DEPLOYMENT_TARGET = 9.0;
|
||||
USER_HEADER_SEARCH_PATHS = (
|
||||
"\"$(SRCROOT)/dav1d\"",
|
||||
"\"$(SRCROOT)/dav1d/$(CURRENT_ARCH)\"",
|
||||
"\"$(SRCROOT)/../../external/libavif/include\"",
|
||||
"\"$(SRCROOT)/../../external/dav1d\"",
|
||||
"\"$(SRCROOT)/../../external/dav1d/include\"",
|
||||
);
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
VERSION_INFO_PREFIX = "";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
F354746E2829A8B3007E9EDA /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALLOW_TARGET_PLATFORM_SPECIALIZATION = YES;
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = AVIF_CODEC_DAV1D;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.7;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
MTL_FAST_MATH = YES;
|
||||
SUPPORTED_PLATFORMS = "watchsimulator watchos macosx iphonesimulator iphoneos driverkit appletvsimulator appletvos";
|
||||
SUPPORTS_MACCATALYST = YES;
|
||||
TVOS_DEPLOYMENT_TARGET = 9.0;
|
||||
USER_HEADER_SEARCH_PATHS = (
|
||||
"\"$(SRCROOT)/dav1d\"",
|
||||
"\"$(SRCROOT)/dav1d/$(CURRENT_ARCH)\"",
|
||||
"\"$(SRCROOT)/../../external/libavif/include\"",
|
||||
"\"$(SRCROOT)/../../external/dav1d\"",
|
||||
"\"$(SRCROOT)/../../external/dav1d/include\"",
|
||||
);
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
VERSION_INFO_PREFIX = "";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
F35474702829A8B3007E9EDA /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEFINES_MODULE = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
"@loader_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 0.10.1;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.libsdl.avif;
|
||||
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
|
||||
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
F35474712829A8B3007E9EDA /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEFINES_MODULE = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
"@loader_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 0.10.1;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.libsdl.avif;
|
||||
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
|
||||
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
F35475842829B82B007E9EDA /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
F35475852829B82B007E9EDA /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
VALIDATE_PRODUCT = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
F35475912829B839007E9EDA /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = "BITDEPTH=8";
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
F35475922829B839007E9EDA /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = "BITDEPTH=8";
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
VALIDATE_PRODUCT = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
F354759E2829B848007E9EDA /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = "BITDEPTH=16";
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
F354759F2829B848007E9EDA /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = "BITDEPTH=16";
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
VALIDATE_PRODUCT = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
F35474622829A8B3007E9EDA /* Build configuration list for PBXProject "avif" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
F354746D2829A8B3007E9EDA /* Debug */,
|
||||
F354746E2829A8B3007E9EDA /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
F354746F2829A8B3007E9EDA /* Build configuration list for PBXNativeTarget "avif" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
F35474702829A8B3007E9EDA /* Debug */,
|
||||
F35474712829A8B3007E9EDA /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
F35475832829B82B007E9EDA /* Build configuration list for PBXNativeTarget "dav1d" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
F35475842829B82B007E9EDA /* Debug */,
|
||||
F35475852829B82B007E9EDA /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
F35475902829B839007E9EDA /* Build configuration list for PBXNativeTarget "dav1d-8bit" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
F35475912829B839007E9EDA /* Debug */,
|
||||
F35475922829B839007E9EDA /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
F354759D2829B848007E9EDA /* Build configuration list for PBXNativeTarget "dav1d-16bit" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
F354759E2829B848007E9EDA /* Debug */,
|
||||
F354759F2829B848007E9EDA /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = F354745F2829A8B3007E9EDA /* Project object */;
|
||||
}
|
||||
41
Library/SDL2_image-2.5.2/Xcode/avif/dav1d/arm64/config.h
Normal file
41
Library/SDL2_image-2.5.2/Xcode/avif/dav1d/arm64/config.h
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Autogenerated by the Meson build system.
|
||||
* Do not edit, your changes will be lost.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#define ARCH_AARCH64 1
|
||||
|
||||
#define ARCH_ARM 0
|
||||
|
||||
#define ARCH_PPC64LE 0
|
||||
|
||||
#define ARCH_X86 0
|
||||
|
||||
#define ARCH_X86_32 0
|
||||
|
||||
#define ARCH_X86_64 0
|
||||
|
||||
#define CONFIG_16BPC 1
|
||||
|
||||
#define CONFIG_8BPC 1
|
||||
|
||||
#define CONFIG_LOG 1
|
||||
|
||||
#define ENDIANNESS_BIG 0
|
||||
|
||||
#define HAVE_ASM 0
|
||||
|
||||
#define HAVE_AS_FUNC 0
|
||||
|
||||
#define HAVE_CLOCK_GETTIME 1
|
||||
|
||||
#define HAVE_POSIX_MEMALIGN 1
|
||||
|
||||
#define HAVE_UNISTD_H 1
|
||||
|
||||
#define PIC 3
|
||||
|
||||
#define PREFIX 1
|
||||
|
||||
41
Library/SDL2_image-2.5.2/Xcode/avif/dav1d/armv7/config.h
Normal file
41
Library/SDL2_image-2.5.2/Xcode/avif/dav1d/armv7/config.h
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Autogenerated by the Meson build system.
|
||||
* Do not edit, your changes will be lost.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#define ARCH_AARCH64 0
|
||||
|
||||
#define ARCH_ARM 1
|
||||
|
||||
#define ARCH_PPC64LE 0
|
||||
|
||||
#define ARCH_X86 0
|
||||
|
||||
#define ARCH_X86_32 0
|
||||
|
||||
#define ARCH_X86_64 0
|
||||
|
||||
#define CONFIG_16BPC 1
|
||||
|
||||
#define CONFIG_8BPC 1
|
||||
|
||||
#define CONFIG_LOG 1
|
||||
|
||||
#define ENDIANNESS_BIG 0
|
||||
|
||||
#define HAVE_ASM 0
|
||||
|
||||
#define HAVE_AS_FUNC 0
|
||||
|
||||
#define HAVE_CLOCK_GETTIME 1
|
||||
|
||||
#define HAVE_POSIX_MEMALIGN 1
|
||||
|
||||
#define HAVE_UNISTD_H 1
|
||||
|
||||
#define PIC 3
|
||||
|
||||
#define PREFIX 1
|
||||
|
||||
2
Library/SDL2_image-2.5.2/Xcode/avif/dav1d/vcs_version.h
Normal file
2
Library/SDL2_image-2.5.2/Xcode/avif/dav1d/vcs_version.h
Normal file
@@ -0,0 +1,2 @@
|
||||
/* auto-generated, do not edit */
|
||||
#define DAV1D_VERSION "1.0.0-0-g99172b1"
|
||||
34
Library/SDL2_image-2.5.2/Xcode/avif/dav1d/version.h
Normal file
34
Library/SDL2_image-2.5.2/Xcode/avif/dav1d/version.h
Normal file
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright © 2019, VideoLAN and dav1d authors
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef DAV1D_VERSION_H
|
||||
#define DAV1D_VERSION_H
|
||||
|
||||
#define DAV1D_API_VERSION_MAJOR 6
|
||||
#define DAV1D_API_VERSION_MINOR 6
|
||||
#define DAV1D_API_VERSION_PATCH 0
|
||||
|
||||
#endif /* DAV1D_VERSION_H */
|
||||
39
Library/SDL2_image-2.5.2/Xcode/avif/dav1d/x86_64/config.h
Normal file
39
Library/SDL2_image-2.5.2/Xcode/avif/dav1d/x86_64/config.h
Normal file
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Autogenerated by the Meson build system.
|
||||
* Do not edit, your changes will be lost.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#define ARCH_AARCH64 0
|
||||
|
||||
#define ARCH_ARM 0
|
||||
|
||||
#define ARCH_PPC64LE 0
|
||||
|
||||
#define ARCH_X86 1
|
||||
|
||||
#define ARCH_X86_32 0
|
||||
|
||||
#define ARCH_X86_64 1
|
||||
|
||||
#define CONFIG_16BPC 1
|
||||
|
||||
#define CONFIG_8BPC 1
|
||||
|
||||
#define CONFIG_LOG 1
|
||||
|
||||
#define ENDIANNESS_BIG 0
|
||||
|
||||
#define HAVE_ASM 0
|
||||
|
||||
#define HAVE_CLOCK_GETTIME 1
|
||||
|
||||
#define HAVE_POSIX_MEMALIGN 1
|
||||
|
||||
#define HAVE_UNISTD_H 1
|
||||
|
||||
#define PREFIX 1
|
||||
|
||||
#define STACK_ALIGNMENT 32
|
||||
|
||||
22
Library/SDL2_image-2.5.2/Xcode/config.xcconfig
Normal file
22
Library/SDL2_image-2.5.2/Xcode/config.xcconfig
Normal file
@@ -0,0 +1,22 @@
|
||||
//
|
||||
// config.xcconfig
|
||||
// SDL_image
|
||||
//
|
||||
|
||||
// Configuration settings file format documentation can be found at:
|
||||
// https://help.apple.com/xcode/#/dev745c5c974
|
||||
|
||||
// Uncomment these lines to enable AVIF support
|
||||
// If you do this, you should run external/download.sh to download the decode libraries and add avif.framework to your application bundle.
|
||||
//CONFIG_PREPROCESSOR_DEFINITIONS = $(inherited) LOAD_AVIF
|
||||
//CONFIG_FRAMEWORK_LDFLAGS = $(inherited) -weak_framework avif
|
||||
|
||||
// Uncomment these lines to enable JPEG-XL support
|
||||
// If you do this, you should run external/download.sh to download the decode libraries and add jxl.framework to your application bundle.
|
||||
//CONFIG_PREPROCESSOR_DEFINITIONS = $(inherited) LOAD_JXL
|
||||
//CONFIG_FRAMEWORK_LDFLAGS = $(inherited) -weak_framework jxl
|
||||
|
||||
// Uncomment these lines to enable WebP support
|
||||
// If you do this, you should run external/download.sh to download the decode libraries and add webp.framework to your application bundle.
|
||||
//CONFIG_PREPROCESSOR_DEFINITIONS = $(inherited) LOAD_WEBP
|
||||
//CONFIG_FRAMEWORK_LDFLAGS = $(inherited) -weak_framework webp
|
||||
232
Library/SDL2_image-2.5.2/Xcode/iOS/SDL2.framework/Headers/SDL.h
Normal file
232
Library/SDL2_image-2.5.2/Xcode/iOS/SDL2.framework/Headers/SDL.h
Normal file
@@ -0,0 +1,232 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file SDL.h
|
||||
*
|
||||
* Main include header for the SDL library
|
||||
*/
|
||||
|
||||
|
||||
#ifndef SDL_h_
|
||||
#define SDL_h_
|
||||
|
||||
#include <SDL2/SDL_main.h>
|
||||
#include <SDL2/SDL_stdinc.h>
|
||||
#include <SDL2/SDL_assert.h>
|
||||
#include <SDL2/SDL_atomic.h>
|
||||
#include <SDL2/SDL_audio.h>
|
||||
#include <SDL2/SDL_clipboard.h>
|
||||
#include <SDL2/SDL_cpuinfo.h>
|
||||
#include <SDL2/SDL_endian.h>
|
||||
#include <SDL2/SDL_error.h>
|
||||
#include <SDL2/SDL_events.h>
|
||||
#include <SDL2/SDL_filesystem.h>
|
||||
#include <SDL2/SDL_gamecontroller.h>
|
||||
#include <SDL2/SDL_haptic.h>
|
||||
#include <SDL2/SDL_hidapi.h>
|
||||
#include <SDL2/SDL_hints.h>
|
||||
#include <SDL2/SDL_joystick.h>
|
||||
#include <SDL2/SDL_loadso.h>
|
||||
#include <SDL2/SDL_log.h>
|
||||
#include <SDL2/SDL_messagebox.h>
|
||||
#include <SDL2/SDL_metal.h>
|
||||
#include <SDL2/SDL_mutex.h>
|
||||
#include <SDL2/SDL_power.h>
|
||||
#include <SDL2/SDL_render.h>
|
||||
#include <SDL2/SDL_rwops.h>
|
||||
#include <SDL2/SDL_sensor.h>
|
||||
#include <SDL2/SDL_shape.h>
|
||||
#include <SDL2/SDL_system.h>
|
||||
#include <SDL2/SDL_thread.h>
|
||||
#include <SDL2/SDL_timer.h>
|
||||
#include <SDL2/SDL_version.h>
|
||||
#include <SDL2/SDL_video.h>
|
||||
#include <SDL2/SDL_locale.h>
|
||||
#include <SDL2/SDL_misc.h>
|
||||
|
||||
#include <SDL2/begin_code.h>
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* As of version 0.5, SDL is loaded dynamically into the application */
|
||||
|
||||
/**
|
||||
* \name SDL_INIT_*
|
||||
*
|
||||
* These are the flags which may be passed to SDL_Init(). You should
|
||||
* specify the subsystems which you will be using in your application.
|
||||
*/
|
||||
/* @{ */
|
||||
#define SDL_INIT_TIMER 0x00000001u
|
||||
#define SDL_INIT_AUDIO 0x00000010u
|
||||
#define SDL_INIT_VIDEO 0x00000020u /**< SDL_INIT_VIDEO implies SDL_INIT_EVENTS */
|
||||
#define SDL_INIT_JOYSTICK 0x00000200u /**< SDL_INIT_JOYSTICK implies SDL_INIT_EVENTS */
|
||||
#define SDL_INIT_HAPTIC 0x00001000u
|
||||
#define SDL_INIT_GAMECONTROLLER 0x00002000u /**< SDL_INIT_GAMECONTROLLER implies SDL_INIT_JOYSTICK */
|
||||
#define SDL_INIT_EVENTS 0x00004000u
|
||||
#define SDL_INIT_SENSOR 0x00008000u
|
||||
#define SDL_INIT_NOPARACHUTE 0x00100000u /**< compatibility; this flag is ignored. */
|
||||
#define SDL_INIT_EVERYTHING ( \
|
||||
SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_VIDEO | SDL_INIT_EVENTS | \
|
||||
SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC | SDL_INIT_GAMECONTROLLER | SDL_INIT_SENSOR \
|
||||
)
|
||||
/* @} */
|
||||
|
||||
/**
|
||||
* Initialize the SDL library.
|
||||
*
|
||||
* SDL_Init() simply forwards to calling SDL_InitSubSystem(). Therefore, the
|
||||
* two may be used interchangeably. Though for readability of your code
|
||||
* SDL_InitSubSystem() might be preferred.
|
||||
*
|
||||
* The file I/O (for example: SDL_RWFromFile) and threading (SDL_CreateThread)
|
||||
* subsystems are initialized by default. Message boxes
|
||||
* (SDL_ShowSimpleMessageBox) also attempt to work without initializing the
|
||||
* video subsystem, in hopes of being useful in showing an error dialog when
|
||||
* SDL_Init fails. You must specifically initialize other subsystems if you
|
||||
* use them in your application.
|
||||
*
|
||||
* Logging (such as SDL_Log) works without initialization, too.
|
||||
*
|
||||
* `flags` may be any of the following OR'd together:
|
||||
*
|
||||
* - `SDL_INIT_TIMER`: timer subsystem
|
||||
* - `SDL_INIT_AUDIO`: audio subsystem
|
||||
* - `SDL_INIT_VIDEO`: video subsystem; automatically initializes the events
|
||||
* subsystem
|
||||
* - `SDL_INIT_JOYSTICK`: joystick subsystem; automatically initializes the
|
||||
* events subsystem
|
||||
* - `SDL_INIT_HAPTIC`: haptic (force feedback) subsystem
|
||||
* - `SDL_INIT_GAMECONTROLLER`: controller subsystem; automatically
|
||||
* initializes the joystick subsystem
|
||||
* - `SDL_INIT_EVENTS`: events subsystem
|
||||
* - `SDL_INIT_EVERYTHING`: all of the above subsystems
|
||||
* - `SDL_INIT_NOPARACHUTE`: compatibility; this flag is ignored
|
||||
*
|
||||
* Subsystem initialization is ref-counted, you must call SDL_QuitSubSystem()
|
||||
* for each SDL_InitSubSystem() to correctly shutdown a subsystem manually (or
|
||||
* call SDL_Quit() to force shutdown). If a subsystem is already loaded then
|
||||
* this call will increase the ref-count and return.
|
||||
*
|
||||
* \param flags subsystem initialization flags
|
||||
* \returns 0 on success or a negative error code on failure; call
|
||||
* SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_InitSubSystem
|
||||
* \sa SDL_Quit
|
||||
* \sa SDL_SetMainReady
|
||||
* \sa SDL_WasInit
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_Init(Uint32 flags);
|
||||
|
||||
/**
|
||||
* Compatibility function to initialize the SDL library.
|
||||
*
|
||||
* In SDL2, this function and SDL_Init() are interchangeable.
|
||||
*
|
||||
* \param flags any of the flags used by SDL_Init(); see SDL_Init for details.
|
||||
* \returns 0 on success or a negative error code on failure; call
|
||||
* SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_Init
|
||||
* \sa SDL_Quit
|
||||
* \sa SDL_QuitSubSystem
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_InitSubSystem(Uint32 flags);
|
||||
|
||||
/**
|
||||
* Shut down specific SDL subsystems.
|
||||
*
|
||||
* If you start a subsystem using a call to that subsystem's init function
|
||||
* (for example SDL_VideoInit()) instead of SDL_Init() or SDL_InitSubSystem(),
|
||||
* SDL_QuitSubSystem() and SDL_WasInit() will not work. You will need to use
|
||||
* that subsystem's quit function (SDL_VideoQuit()) directly instead. But
|
||||
* generally, you should not be using those functions directly anyhow; use
|
||||
* SDL_Init() instead.
|
||||
*
|
||||
* You still need to call SDL_Quit() even if you close all open subsystems
|
||||
* with SDL_QuitSubSystem().
|
||||
*
|
||||
* \param flags any of the flags used by SDL_Init(); see SDL_Init for details.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_InitSubSystem
|
||||
* \sa SDL_Quit
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_QuitSubSystem(Uint32 flags);
|
||||
|
||||
/**
|
||||
* Get a mask of the specified subsystems which are currently initialized.
|
||||
*
|
||||
* \param flags any of the flags used by SDL_Init(); see SDL_Init for details.
|
||||
* \returns a mask of all initialized subsystems if `flags` is 0, otherwise it
|
||||
* returns the initialization status of the specified subsystems.
|
||||
*
|
||||
* The return value does not include SDL_INIT_NOPARACHUTE.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_Init
|
||||
* \sa SDL_InitSubSystem
|
||||
*/
|
||||
extern DECLSPEC Uint32 SDLCALL SDL_WasInit(Uint32 flags);
|
||||
|
||||
/**
|
||||
* Clean up all initialized subsystems.
|
||||
*
|
||||
* You should call this function even if you have already shutdown each
|
||||
* initialized subsystem with SDL_QuitSubSystem(). It is safe to call this
|
||||
* function even in the case of errors in initialization.
|
||||
*
|
||||
* If you start a subsystem using a call to that subsystem's init function
|
||||
* (for example SDL_VideoInit()) instead of SDL_Init() or SDL_InitSubSystem(),
|
||||
* then you must use that subsystem's quit function (SDL_VideoQuit()) to shut
|
||||
* it down before calling SDL_Quit(). But generally, you should not be using
|
||||
* those functions directly anyhow; use SDL_Init() instead.
|
||||
*
|
||||
* You can use this function with atexit() to ensure that it is run when your
|
||||
* application is shutdown, but it is not wise to do this from a library or
|
||||
* other dynamically loaded code.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_Init
|
||||
* \sa SDL_QuitSubSystem
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_Quit(void);
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include <SDL2/close_code.h>
|
||||
|
||||
#endif /* SDL_h_ */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
@@ -0,0 +1,324 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef SDL_assert_h_
|
||||
#define SDL_assert_h_
|
||||
|
||||
#include <SDL2/SDL_config.h>
|
||||
|
||||
#include <SDL2/begin_code.h>
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef SDL_ASSERT_LEVEL
|
||||
#ifdef SDL_DEFAULT_ASSERT_LEVEL
|
||||
#define SDL_ASSERT_LEVEL SDL_DEFAULT_ASSERT_LEVEL
|
||||
#elif defined(_DEBUG) || defined(DEBUG) || \
|
||||
(defined(__GNUC__) && !defined(__OPTIMIZE__))
|
||||
#define SDL_ASSERT_LEVEL 2
|
||||
#else
|
||||
#define SDL_ASSERT_LEVEL 1
|
||||
#endif
|
||||
#endif /* SDL_ASSERT_LEVEL */
|
||||
|
||||
/*
|
||||
These are macros and not first class functions so that the debugger breaks
|
||||
on the assertion line and not in some random guts of SDL, and so each
|
||||
assert can have unique static variables associated with it.
|
||||
*/
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
/* Don't include intrin.h here because it contains C++ code */
|
||||
extern void __cdecl __debugbreak(void);
|
||||
#define SDL_TriggerBreakpoint() __debugbreak()
|
||||
#elif ( (!defined(__NACL__)) && ((defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(__x86_64__))) )
|
||||
#define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "int $3\n\t" )
|
||||
#elif ( defined(__APPLE__) && (defined(__arm64__) || defined(__aarch64__)) ) /* this might work on other ARM targets, but this is a known quantity... */
|
||||
#define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "brk #22\n\t" )
|
||||
#elif defined(__APPLE__) && defined(__arm__)
|
||||
#define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "bkpt #22\n\t" )
|
||||
#elif defined(__386__) && defined(__WATCOMC__)
|
||||
#define SDL_TriggerBreakpoint() { _asm { int 0x03 } }
|
||||
#elif defined(HAVE_SIGNAL_H) && !defined(__WATCOMC__)
|
||||
#include <signal.h>
|
||||
#define SDL_TriggerBreakpoint() raise(SIGTRAP)
|
||||
#else
|
||||
/* How do we trigger breakpoints on this platform? */
|
||||
#define SDL_TriggerBreakpoint()
|
||||
#endif
|
||||
|
||||
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 supports __func__ as a standard. */
|
||||
# define SDL_FUNCTION __func__
|
||||
#elif ((__GNUC__ >= 2) || defined(_MSC_VER) || defined (__WATCOMC__))
|
||||
# define SDL_FUNCTION __FUNCTION__
|
||||
#else
|
||||
# define SDL_FUNCTION "???"
|
||||
#endif
|
||||
#define SDL_FILE __FILE__
|
||||
#define SDL_LINE __LINE__
|
||||
|
||||
/*
|
||||
sizeof (x) makes the compiler still parse the expression even without
|
||||
assertions enabled, so the code is always checked at compile time, but
|
||||
doesn't actually generate code for it, so there are no side effects or
|
||||
expensive checks at run time, just the constant size of what x WOULD be,
|
||||
which presumably gets optimized out as unused.
|
||||
This also solves the problem of...
|
||||
|
||||
int somevalue = blah();
|
||||
SDL_assert(somevalue == 1);
|
||||
|
||||
...which would cause compiles to complain that somevalue is unused if we
|
||||
disable assertions.
|
||||
*/
|
||||
|
||||
/* "while (0,0)" fools Microsoft's compiler's /W4 warning level into thinking
|
||||
this condition isn't constant. And looks like an owl's face! */
|
||||
#ifdef _MSC_VER /* stupid /W4 warnings. */
|
||||
#define SDL_NULL_WHILE_LOOP_CONDITION (0,0)
|
||||
#else
|
||||
#define SDL_NULL_WHILE_LOOP_CONDITION (0)
|
||||
#endif
|
||||
|
||||
#define SDL_disabled_assert(condition) \
|
||||
do { (void) sizeof ((condition)); } while (SDL_NULL_WHILE_LOOP_CONDITION)
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SDL_ASSERTION_RETRY, /**< Retry the assert immediately. */
|
||||
SDL_ASSERTION_BREAK, /**< Make the debugger trigger a breakpoint. */
|
||||
SDL_ASSERTION_ABORT, /**< Terminate the program. */
|
||||
SDL_ASSERTION_IGNORE, /**< Ignore the assert. */
|
||||
SDL_ASSERTION_ALWAYS_IGNORE /**< Ignore the assert from now on. */
|
||||
} SDL_AssertState;
|
||||
|
||||
typedef struct SDL_AssertData
|
||||
{
|
||||
int always_ignore;
|
||||
unsigned int trigger_count;
|
||||
const char *condition;
|
||||
const char *filename;
|
||||
int linenum;
|
||||
const char *function;
|
||||
const struct SDL_AssertData *next;
|
||||
} SDL_AssertData;
|
||||
|
||||
#if (SDL_ASSERT_LEVEL > 0)
|
||||
|
||||
/* Never call this directly. Use the SDL_assert* macros. */
|
||||
extern DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData *,
|
||||
const char *,
|
||||
const char *, int)
|
||||
#if defined(__clang__)
|
||||
#if __has_feature(attribute_analyzer_noreturn)
|
||||
/* this tells Clang's static analysis that we're a custom assert function,
|
||||
and that the analyzer should assume the condition was always true past this
|
||||
SDL_assert test. */
|
||||
__attribute__((analyzer_noreturn))
|
||||
#endif
|
||||
#endif
|
||||
;
|
||||
|
||||
/* the do {} while(0) avoids dangling else problems:
|
||||
if (x) SDL_assert(y); else blah();
|
||||
... without the do/while, the "else" could attach to this macro's "if".
|
||||
We try to handle just the minimum we need here in a macro...the loop,
|
||||
the static vars, and break points. The heavy lifting is handled in
|
||||
SDL_ReportAssertion(), in SDL_assert.c.
|
||||
*/
|
||||
#define SDL_enabled_assert(condition) \
|
||||
do { \
|
||||
while ( !(condition) ) { \
|
||||
static struct SDL_AssertData sdl_assert_data = { \
|
||||
0, 0, #condition, 0, 0, 0, 0 \
|
||||
}; \
|
||||
const SDL_AssertState sdl_assert_state = SDL_ReportAssertion(&sdl_assert_data, SDL_FUNCTION, SDL_FILE, SDL_LINE); \
|
||||
if (sdl_assert_state == SDL_ASSERTION_RETRY) { \
|
||||
continue; /* go again. */ \
|
||||
} else if (sdl_assert_state == SDL_ASSERTION_BREAK) { \
|
||||
SDL_TriggerBreakpoint(); \
|
||||
} \
|
||||
break; /* not retrying. */ \
|
||||
} \
|
||||
} while (SDL_NULL_WHILE_LOOP_CONDITION)
|
||||
|
||||
#endif /* enabled assertions support code */
|
||||
|
||||
/* Enable various levels of assertions. */
|
||||
#if SDL_ASSERT_LEVEL == 0 /* assertions disabled */
|
||||
# define SDL_assert(condition) SDL_disabled_assert(condition)
|
||||
# define SDL_assert_release(condition) SDL_disabled_assert(condition)
|
||||
# define SDL_assert_paranoid(condition) SDL_disabled_assert(condition)
|
||||
#elif SDL_ASSERT_LEVEL == 1 /* release settings. */
|
||||
# define SDL_assert(condition) SDL_disabled_assert(condition)
|
||||
# define SDL_assert_release(condition) SDL_enabled_assert(condition)
|
||||
# define SDL_assert_paranoid(condition) SDL_disabled_assert(condition)
|
||||
#elif SDL_ASSERT_LEVEL == 2 /* normal settings. */
|
||||
# define SDL_assert(condition) SDL_enabled_assert(condition)
|
||||
# define SDL_assert_release(condition) SDL_enabled_assert(condition)
|
||||
# define SDL_assert_paranoid(condition) SDL_disabled_assert(condition)
|
||||
#elif SDL_ASSERT_LEVEL == 3 /* paranoid settings. */
|
||||
# define SDL_assert(condition) SDL_enabled_assert(condition)
|
||||
# define SDL_assert_release(condition) SDL_enabled_assert(condition)
|
||||
# define SDL_assert_paranoid(condition) SDL_enabled_assert(condition)
|
||||
#else
|
||||
# error Unknown assertion level.
|
||||
#endif
|
||||
|
||||
/* this assertion is never disabled at any level. */
|
||||
#define SDL_assert_always(condition) SDL_enabled_assert(condition)
|
||||
|
||||
|
||||
/**
|
||||
* A callback that fires when an SDL assertion fails.
|
||||
*
|
||||
* \param data a pointer to the SDL_AssertData structure corresponding to the
|
||||
* current assertion
|
||||
* \param userdata what was passed as `userdata` to SDL_SetAssertionHandler()
|
||||
* \returns an SDL_AssertState value indicating how to handle the failure.
|
||||
*/
|
||||
typedef SDL_AssertState (SDLCALL *SDL_AssertionHandler)(
|
||||
const SDL_AssertData* data, void* userdata);
|
||||
|
||||
/**
|
||||
* Set an application-defined assertion handler.
|
||||
*
|
||||
* This function allows an application to show its own assertion UI and/or
|
||||
* force the response to an assertion failure. If the application doesn't
|
||||
* provide this, SDL will try to do the right thing, popping up a
|
||||
* system-specific GUI dialog, and probably minimizing any fullscreen windows.
|
||||
*
|
||||
* This callback may fire from any thread, but it runs wrapped in a mutex, so
|
||||
* it will only fire from one thread at a time.
|
||||
*
|
||||
* This callback is NOT reset to SDL's internal handler upon SDL_Quit()!
|
||||
*
|
||||
* \param handler the SDL_AssertionHandler function to call when an assertion
|
||||
* fails or NULL for the default handler
|
||||
* \param userdata a pointer that is passed to `handler`
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_GetAssertionHandler
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_SetAssertionHandler(
|
||||
SDL_AssertionHandler handler,
|
||||
void *userdata);
|
||||
|
||||
/**
|
||||
* Get the default assertion handler.
|
||||
*
|
||||
* This returns the function pointer that is called by default when an
|
||||
* assertion is triggered. This is an internal function provided by SDL, that
|
||||
* is used for assertions when SDL_SetAssertionHandler() hasn't been used to
|
||||
* provide a different function.
|
||||
*
|
||||
* \returns the default SDL_AssertionHandler that is called when an assert
|
||||
* triggers.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.2.
|
||||
*
|
||||
* \sa SDL_GetAssertionHandler
|
||||
*/
|
||||
extern DECLSPEC SDL_AssertionHandler SDLCALL SDL_GetDefaultAssertionHandler(void);
|
||||
|
||||
/**
|
||||
* Get the current assertion handler.
|
||||
*
|
||||
* This returns the function pointer that is called when an assertion is
|
||||
* triggered. This is either the value last passed to
|
||||
* SDL_SetAssertionHandler(), or if no application-specified function is set,
|
||||
* is equivalent to calling SDL_GetDefaultAssertionHandler().
|
||||
*
|
||||
* The parameter `puserdata` is a pointer to a void*, which will store the
|
||||
* "userdata" pointer that was passed to SDL_SetAssertionHandler(). This value
|
||||
* will always be NULL for the default handler. If you don't care about this
|
||||
* data, it is safe to pass a NULL pointer to this function to ignore it.
|
||||
*
|
||||
* \param puserdata pointer which is filled with the "userdata" pointer that
|
||||
* was passed to SDL_SetAssertionHandler()
|
||||
* \returns the SDL_AssertionHandler that is called when an assert triggers.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.2.
|
||||
*
|
||||
* \sa SDL_SetAssertionHandler
|
||||
*/
|
||||
extern DECLSPEC SDL_AssertionHandler SDLCALL SDL_GetAssertionHandler(void **puserdata);
|
||||
|
||||
/**
|
||||
* Get a list of all assertion failures.
|
||||
*
|
||||
* This function gets all assertions triggered since the last call to
|
||||
* SDL_ResetAssertionReport(), or the start of the program.
|
||||
*
|
||||
* The proper way to examine this data looks something like this:
|
||||
*
|
||||
* ```c
|
||||
* const SDL_AssertData *item = SDL_GetAssertionReport();
|
||||
* while (item) {
|
||||
* printf("'%s', %s (%s:%d), triggered %u times, always ignore: %s.\\n",
|
||||
* item->condition, item->function, item->filename,
|
||||
* item->linenum, item->trigger_count,
|
||||
* item->always_ignore ? "yes" : "no");
|
||||
* item = item->next;
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* \returns a list of all failed assertions or NULL if the list is empty. This
|
||||
* memory should not be modified or freed by the application.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_ResetAssertionReport
|
||||
*/
|
||||
extern DECLSPEC const SDL_AssertData * SDLCALL SDL_GetAssertionReport(void);
|
||||
|
||||
/**
|
||||
* Clear the list of all assertion failures.
|
||||
*
|
||||
* This function will clear the list of all assertions triggered up to that
|
||||
* point. Immediately following this call, SDL_GetAssertionReport will return
|
||||
* no items. In addition, any previously-triggered assertions will be reset to
|
||||
* a trigger_count of zero, and their always_ignore state will be false.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_GetAssertionReport
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_ResetAssertionReport(void);
|
||||
|
||||
|
||||
/* these had wrong naming conventions until 2.0.4. Please update your app! */
|
||||
#define SDL_assert_state SDL_AssertState
|
||||
#define SDL_assert_data SDL_AssertData
|
||||
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include <SDL2/close_code.h>
|
||||
|
||||
#endif /* SDL_assert_h_ */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
@@ -0,0 +1,395 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file SDL_atomic.h
|
||||
*
|
||||
* Atomic operations.
|
||||
*
|
||||
* IMPORTANT:
|
||||
* If you are not an expert in concurrent lockless programming, you should
|
||||
* only be using the atomic lock and reference counting functions in this
|
||||
* file. In all other cases you should be protecting your data structures
|
||||
* with full mutexes.
|
||||
*
|
||||
* The list of "safe" functions to use are:
|
||||
* SDL_AtomicLock()
|
||||
* SDL_AtomicUnlock()
|
||||
* SDL_AtomicIncRef()
|
||||
* SDL_AtomicDecRef()
|
||||
*
|
||||
* Seriously, here be dragons!
|
||||
* ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
*
|
||||
* You can find out a little more about lockless programming and the
|
||||
* subtle issues that can arise here:
|
||||
* http://msdn.microsoft.com/en-us/library/ee418650%28v=vs.85%29.aspx
|
||||
*
|
||||
* There's also lots of good information here:
|
||||
* http://www.1024cores.net/home/lock-free-algorithms
|
||||
* http://preshing.com/
|
||||
*
|
||||
* These operations may or may not actually be implemented using
|
||||
* processor specific atomic operations. When possible they are
|
||||
* implemented as true processor specific atomic operations. When that
|
||||
* is not possible the are implemented using locks that *do* use the
|
||||
* available atomic operations.
|
||||
*
|
||||
* All of the atomic operations that modify memory are full memory barriers.
|
||||
*/
|
||||
|
||||
#ifndef SDL_atomic_h_
|
||||
#define SDL_atomic_h_
|
||||
|
||||
#include <SDL2/SDL_stdinc.h>
|
||||
#include <SDL2/SDL_platform.h>
|
||||
|
||||
#include <SDL2/begin_code.h>
|
||||
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \name SDL AtomicLock
|
||||
*
|
||||
* The atomic locks are efficient spinlocks using CPU instructions,
|
||||
* but are vulnerable to starvation and can spin forever if a thread
|
||||
* holding a lock has been terminated. For this reason you should
|
||||
* minimize the code executed inside an atomic lock and never do
|
||||
* expensive things like API or system calls while holding them.
|
||||
*
|
||||
* The atomic locks are not safe to lock recursively.
|
||||
*
|
||||
* Porting Note:
|
||||
* The spin lock functions and type are required and can not be
|
||||
* emulated because they are used in the atomic emulation code.
|
||||
*/
|
||||
/* @{ */
|
||||
|
||||
typedef int SDL_SpinLock;
|
||||
|
||||
/**
|
||||
* Try to lock a spin lock by setting it to a non-zero value.
|
||||
*
|
||||
* ***Please note that spinlocks are dangerous if you don't know what you're
|
||||
* doing. Please be careful using any sort of spinlock!***
|
||||
*
|
||||
* \param lock a pointer to a lock variable
|
||||
* \returns SDL_TRUE if the lock succeeded, SDL_FALSE if the lock is already
|
||||
* held.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_AtomicLock
|
||||
* \sa SDL_AtomicUnlock
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_AtomicTryLock(SDL_SpinLock *lock);
|
||||
|
||||
/**
|
||||
* Lock a spin lock by setting it to a non-zero value.
|
||||
*
|
||||
* ***Please note that spinlocks are dangerous if you don't know what you're
|
||||
* doing. Please be careful using any sort of spinlock!***
|
||||
*
|
||||
* \param lock a pointer to a lock variable
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_AtomicTryLock
|
||||
* \sa SDL_AtomicUnlock
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_AtomicLock(SDL_SpinLock *lock);
|
||||
|
||||
/**
|
||||
* Unlock a spin lock by setting it to 0.
|
||||
*
|
||||
* Always returns immediately.
|
||||
*
|
||||
* ***Please note that spinlocks are dangerous if you don't know what you're
|
||||
* doing. Please be careful using any sort of spinlock!***
|
||||
*
|
||||
* \param lock a pointer to a lock variable
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_AtomicLock
|
||||
* \sa SDL_AtomicTryLock
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_AtomicUnlock(SDL_SpinLock *lock);
|
||||
|
||||
/* @} *//* SDL AtomicLock */
|
||||
|
||||
|
||||
/**
|
||||
* The compiler barrier prevents the compiler from reordering
|
||||
* reads and writes to globally visible variables across the call.
|
||||
*/
|
||||
#if defined(_MSC_VER) && (_MSC_VER > 1200) && !defined(__clang__)
|
||||
void _ReadWriteBarrier(void);
|
||||
#pragma intrinsic(_ReadWriteBarrier)
|
||||
#define SDL_CompilerBarrier() _ReadWriteBarrier()
|
||||
#elif (defined(__GNUC__) && !defined(__EMSCRIPTEN__)) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5120))
|
||||
/* This is correct for all CPUs when using GCC or Solaris Studio 12.1+. */
|
||||
#define SDL_CompilerBarrier() __asm__ __volatile__ ("" : : : "memory")
|
||||
#elif defined(__WATCOMC__)
|
||||
extern __inline void SDL_CompilerBarrier(void);
|
||||
#pragma aux SDL_CompilerBarrier = "" parm [] modify exact [];
|
||||
#else
|
||||
#define SDL_CompilerBarrier() \
|
||||
{ SDL_SpinLock _tmp = 0; SDL_AtomicLock(&_tmp); SDL_AtomicUnlock(&_tmp); }
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Memory barriers are designed to prevent reads and writes from being
|
||||
* reordered by the compiler and being seen out of order on multi-core CPUs.
|
||||
*
|
||||
* A typical pattern would be for thread A to write some data and a flag, and
|
||||
* for thread B to read the flag and get the data. In this case you would
|
||||
* insert a release barrier between writing the data and the flag,
|
||||
* guaranteeing that the data write completes no later than the flag is
|
||||
* written, and you would insert an acquire barrier between reading the flag
|
||||
* and reading the data, to ensure that all the reads associated with the flag
|
||||
* have completed.
|
||||
*
|
||||
* In this pattern you should always see a release barrier paired with an
|
||||
* acquire barrier and you should gate the data reads/writes with a single
|
||||
* flag variable.
|
||||
*
|
||||
* For more information on these semantics, take a look at the blog post:
|
||||
* http://preshing.com/20120913/acquire-and-release-semantics
|
||||
*
|
||||
* \since This function is available since SDL 2.0.6.
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_MemoryBarrierReleaseFunction(void);
|
||||
extern DECLSPEC void SDLCALL SDL_MemoryBarrierAcquireFunction(void);
|
||||
|
||||
#if defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
|
||||
#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("lwsync" : : : "memory")
|
||||
#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("lwsync" : : : "memory")
|
||||
#elif defined(__GNUC__) && defined(__aarch64__)
|
||||
#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("dmb ish" : : : "memory")
|
||||
#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("dmb ish" : : : "memory")
|
||||
#elif defined(__GNUC__) && defined(__arm__)
|
||||
#if 0 /* defined(__LINUX__) || defined(__ANDROID__) */
|
||||
/* Information from:
|
||||
https://chromium.googlesource.com/chromium/chromium/+/trunk/base/atomicops_internals_arm_gcc.h#19
|
||||
|
||||
The Linux kernel provides a helper function which provides the right code for a memory barrier,
|
||||
hard-coded at address 0xffff0fa0
|
||||
*/
|
||||
typedef void (*SDL_KernelMemoryBarrierFunc)();
|
||||
#define SDL_MemoryBarrierRelease() ((SDL_KernelMemoryBarrierFunc)0xffff0fa0)()
|
||||
#define SDL_MemoryBarrierAcquire() ((SDL_KernelMemoryBarrierFunc)0xffff0fa0)()
|
||||
#elif 0 /* defined(__QNXNTO__) */
|
||||
#include <sys/cpuinline.h>
|
||||
|
||||
#define SDL_MemoryBarrierRelease() __cpu_membarrier()
|
||||
#define SDL_MemoryBarrierAcquire() __cpu_membarrier()
|
||||
#else
|
||||
#if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7EM__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__) || defined(__ARM_ARCH_8A__)
|
||||
#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("dmb ish" : : : "memory")
|
||||
#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("dmb ish" : : : "memory")
|
||||
#elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_5TE__)
|
||||
#ifdef __thumb__
|
||||
/* The mcr instruction isn't available in thumb mode, use real functions */
|
||||
#define SDL_MEMORY_BARRIER_USES_FUNCTION
|
||||
#define SDL_MemoryBarrierRelease() SDL_MemoryBarrierReleaseFunction()
|
||||
#define SDL_MemoryBarrierAcquire() SDL_MemoryBarrierAcquireFunction()
|
||||
#else
|
||||
#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r"(0) : "memory")
|
||||
#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r"(0) : "memory")
|
||||
#endif /* __thumb__ */
|
||||
#else
|
||||
#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("" : : : "memory")
|
||||
#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("" : : : "memory")
|
||||
#endif /* __LINUX__ || __ANDROID__ */
|
||||
#endif /* __GNUC__ && __arm__ */
|
||||
#else
|
||||
#if (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5120))
|
||||
/* This is correct for all CPUs on Solaris when using Solaris Studio 12.1+. */
|
||||
#include <mbarrier.h>
|
||||
#define SDL_MemoryBarrierRelease() __machine_rel_barrier()
|
||||
#define SDL_MemoryBarrierAcquire() __machine_acq_barrier()
|
||||
#else
|
||||
/* This is correct for the x86 and x64 CPUs, and we'll expand this over time. */
|
||||
#define SDL_MemoryBarrierRelease() SDL_CompilerBarrier()
|
||||
#define SDL_MemoryBarrierAcquire() SDL_CompilerBarrier()
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief A type representing an atomic integer value. It is a struct
|
||||
* so people don't accidentally use numeric operations on it.
|
||||
*/
|
||||
typedef struct { int value; } SDL_atomic_t;
|
||||
|
||||
/**
|
||||
* Set an atomic variable to a new value if it is currently an old value.
|
||||
*
|
||||
* ***Note: If you don't know what this function is for, you shouldn't use
|
||||
* it!***
|
||||
*
|
||||
* \param a a pointer to an SDL_atomic_t variable to be modified
|
||||
* \param oldval the old value
|
||||
* \param newval the new value
|
||||
* \returns SDL_TRUE if the atomic variable was set, SDL_FALSE otherwise.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_AtomicCASPtr
|
||||
* \sa SDL_AtomicGet
|
||||
* \sa SDL_AtomicSet
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCAS(SDL_atomic_t *a, int oldval, int newval);
|
||||
|
||||
/**
|
||||
* Set an atomic variable to a value.
|
||||
*
|
||||
* This function also acts as a full memory barrier.
|
||||
*
|
||||
* ***Note: If you don't know what this function is for, you shouldn't use
|
||||
* it!***
|
||||
*
|
||||
* \param a a pointer to an SDL_atomic_t variable to be modified
|
||||
* \param v the desired value
|
||||
* \returns the previous value of the atomic variable.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.2.
|
||||
*
|
||||
* \sa SDL_AtomicGet
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_AtomicSet(SDL_atomic_t *a, int v);
|
||||
|
||||
/**
|
||||
* Get the value of an atomic variable.
|
||||
*
|
||||
* ***Note: If you don't know what this function is for, you shouldn't use
|
||||
* it!***
|
||||
*
|
||||
* \param a a pointer to an SDL_atomic_t variable
|
||||
* \returns the current value of an atomic variable.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.2.
|
||||
*
|
||||
* \sa SDL_AtomicSet
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_AtomicGet(SDL_atomic_t *a);
|
||||
|
||||
/**
|
||||
* Add to an atomic variable.
|
||||
*
|
||||
* This function also acts as a full memory barrier.
|
||||
*
|
||||
* ***Note: If you don't know what this function is for, you shouldn't use
|
||||
* it!***
|
||||
*
|
||||
* \param a a pointer to an SDL_atomic_t variable to be modified
|
||||
* \param v the desired value to add
|
||||
* \returns the previous value of the atomic variable.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.2.
|
||||
*
|
||||
* \sa SDL_AtomicDecRef
|
||||
* \sa SDL_AtomicIncRef
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_AtomicAdd(SDL_atomic_t *a, int v);
|
||||
|
||||
/**
|
||||
* \brief Increment an atomic variable used as a reference count.
|
||||
*/
|
||||
#ifndef SDL_AtomicIncRef
|
||||
#define SDL_AtomicIncRef(a) SDL_AtomicAdd(a, 1)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief Decrement an atomic variable used as a reference count.
|
||||
*
|
||||
* \return SDL_TRUE if the variable reached zero after decrementing,
|
||||
* SDL_FALSE otherwise
|
||||
*/
|
||||
#ifndef SDL_AtomicDecRef
|
||||
#define SDL_AtomicDecRef(a) (SDL_AtomicAdd(a, -1) == 1)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Set a pointer to a new value if it is currently an old value.
|
||||
*
|
||||
* ***Note: If you don't know what this function is for, you shouldn't use
|
||||
* it!***
|
||||
*
|
||||
* \param a a pointer to a pointer
|
||||
* \param oldval the old pointer value
|
||||
* \param newval the new pointer value
|
||||
* \returns SDL_TRUE if the pointer was set, SDL_FALSE otherwise.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_AtomicCAS
|
||||
* \sa SDL_AtomicGetPtr
|
||||
* \sa SDL_AtomicSetPtr
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCASPtr(void **a, void *oldval, void *newval);
|
||||
|
||||
/**
|
||||
* Set a pointer to a value atomically.
|
||||
*
|
||||
* ***Note: If you don't know what this function is for, you shouldn't use
|
||||
* it!***
|
||||
*
|
||||
* \param a a pointer to a pointer
|
||||
* \param v the desired pointer value
|
||||
* \returns the previous value of the pointer.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.2.
|
||||
*
|
||||
* \sa SDL_AtomicCASPtr
|
||||
* \sa SDL_AtomicGetPtr
|
||||
*/
|
||||
extern DECLSPEC void* SDLCALL SDL_AtomicSetPtr(void **a, void* v);
|
||||
|
||||
/**
|
||||
* Get the value of a pointer atomically.
|
||||
*
|
||||
* ***Note: If you don't know what this function is for, you shouldn't use
|
||||
* it!***
|
||||
*
|
||||
* \param a a pointer to a pointer
|
||||
* \returns the current value of a pointer.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.2.
|
||||
*
|
||||
* \sa SDL_AtomicCASPtr
|
||||
* \sa SDL_AtomicSetPtr
|
||||
*/
|
||||
extern DECLSPEC void* SDLCALL SDL_AtomicGetPtr(void **a);
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#include <SDL2/close_code.h>
|
||||
|
||||
#endif /* SDL_atomic_h_ */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,126 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file SDL_bits.h
|
||||
*
|
||||
* Functions for fiddling with bits and bitmasks.
|
||||
*/
|
||||
|
||||
#ifndef SDL_bits_h_
|
||||
#define SDL_bits_h_
|
||||
|
||||
#include <SDL2/SDL_stdinc.h>
|
||||
|
||||
#include <SDL2/begin_code.h>
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \file SDL_bits.h
|
||||
*/
|
||||
|
||||
/**
|
||||
* Get the index of the most significant bit. Result is undefined when called
|
||||
* with 0. This operation can also be stated as "count leading zeroes" and
|
||||
* "log base 2".
|
||||
*
|
||||
* \return the index of the most significant bit, or -1 if the value is 0.
|
||||
*/
|
||||
#if defined(__WATCOMC__) && defined(__386__)
|
||||
extern __inline int _SDL_bsr_watcom(Uint32);
|
||||
#pragma aux _SDL_bsr_watcom = \
|
||||
"bsr eax, eax" \
|
||||
parm [eax] nomemory \
|
||||
value [eax] \
|
||||
modify exact [eax] nomemory;
|
||||
#endif
|
||||
|
||||
SDL_FORCE_INLINE int
|
||||
SDL_MostSignificantBitIndex32(Uint32 x)
|
||||
{
|
||||
#if defined(__GNUC__) && (__GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
|
||||
/* Count Leading Zeroes builtin in GCC.
|
||||
* http://gcc.gnu.org/onlinedocs/gcc-4.3.4/gcc/Other-Builtins.html
|
||||
*/
|
||||
if (x == 0) {
|
||||
return -1;
|
||||
}
|
||||
return 31 - __builtin_clz(x);
|
||||
#elif defined(__WATCOMC__) && defined(__386__)
|
||||
if (x == 0) {
|
||||
return -1;
|
||||
}
|
||||
return _SDL_bsr_watcom(x);
|
||||
#elif defined(_MSC_VER)
|
||||
unsigned long index;
|
||||
if (_BitScanReverse(&index, x)) {
|
||||
return index;
|
||||
}
|
||||
return -1;
|
||||
#else
|
||||
/* Based off of Bit Twiddling Hacks by Sean Eron Anderson
|
||||
* <seander@cs.stanford.edu>, released in the public domain.
|
||||
* http://graphics.stanford.edu/~seander/bithacks.html#IntegerLog
|
||||
*/
|
||||
const Uint32 b[] = {0x2, 0xC, 0xF0, 0xFF00, 0xFFFF0000};
|
||||
const int S[] = {1, 2, 4, 8, 16};
|
||||
|
||||
int msbIndex = 0;
|
||||
int i;
|
||||
|
||||
if (x == 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (i = 4; i >= 0; i--)
|
||||
{
|
||||
if (x & b[i])
|
||||
{
|
||||
x >>= S[i];
|
||||
msbIndex |= S[i];
|
||||
}
|
||||
}
|
||||
|
||||
return msbIndex;
|
||||
#endif
|
||||
}
|
||||
|
||||
SDL_FORCE_INLINE SDL_bool
|
||||
SDL_HasExactlyOneBitSet32(Uint32 x)
|
||||
{
|
||||
if (x && !(x & (x - 1))) {
|
||||
return SDL_TRUE;
|
||||
}
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include <SDL2/close_code.h>
|
||||
|
||||
#endif /* SDL_bits_h_ */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
@@ -0,0 +1,198 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file SDL_blendmode.h
|
||||
*
|
||||
* Header file declaring the SDL_BlendMode enumeration
|
||||
*/
|
||||
|
||||
#ifndef SDL_blendmode_h_
|
||||
#define SDL_blendmode_h_
|
||||
|
||||
#include <SDL2/begin_code.h>
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief The blend mode used in SDL_RenderCopy() and drawing operations.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
SDL_BLENDMODE_NONE = 0x00000000, /**< no blending
|
||||
dstRGBA = srcRGBA */
|
||||
SDL_BLENDMODE_BLEND = 0x00000001, /**< alpha blending
|
||||
dstRGB = (srcRGB * srcA) + (dstRGB * (1-srcA))
|
||||
dstA = srcA + (dstA * (1-srcA)) */
|
||||
SDL_BLENDMODE_ADD = 0x00000002, /**< additive blending
|
||||
dstRGB = (srcRGB * srcA) + dstRGB
|
||||
dstA = dstA */
|
||||
SDL_BLENDMODE_MOD = 0x00000004, /**< color modulate
|
||||
dstRGB = srcRGB * dstRGB
|
||||
dstA = dstA */
|
||||
SDL_BLENDMODE_MUL = 0x00000008, /**< color multiply
|
||||
dstRGB = (srcRGB * dstRGB) + (dstRGB * (1-srcA))
|
||||
dstA = (srcA * dstA) + (dstA * (1-srcA)) */
|
||||
SDL_BLENDMODE_INVALID = 0x7FFFFFFF
|
||||
|
||||
/* Additional custom blend modes can be returned by SDL_ComposeCustomBlendMode() */
|
||||
|
||||
} SDL_BlendMode;
|
||||
|
||||
/**
|
||||
* \brief The blend operation used when combining source and destination pixel components
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
SDL_BLENDOPERATION_ADD = 0x1, /**< dst + src: supported by all renderers */
|
||||
SDL_BLENDOPERATION_SUBTRACT = 0x2, /**< dst - src : supported by D3D9, D3D11, OpenGL, OpenGLES */
|
||||
SDL_BLENDOPERATION_REV_SUBTRACT = 0x3, /**< src - dst : supported by D3D9, D3D11, OpenGL, OpenGLES */
|
||||
SDL_BLENDOPERATION_MINIMUM = 0x4, /**< min(dst, src) : supported by D3D9, D3D11 */
|
||||
SDL_BLENDOPERATION_MAXIMUM = 0x5 /**< max(dst, src) : supported by D3D9, D3D11 */
|
||||
} SDL_BlendOperation;
|
||||
|
||||
/**
|
||||
* \brief The normalized factor used to multiply pixel components
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
SDL_BLENDFACTOR_ZERO = 0x1, /**< 0, 0, 0, 0 */
|
||||
SDL_BLENDFACTOR_ONE = 0x2, /**< 1, 1, 1, 1 */
|
||||
SDL_BLENDFACTOR_SRC_COLOR = 0x3, /**< srcR, srcG, srcB, srcA */
|
||||
SDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR = 0x4, /**< 1-srcR, 1-srcG, 1-srcB, 1-srcA */
|
||||
SDL_BLENDFACTOR_SRC_ALPHA = 0x5, /**< srcA, srcA, srcA, srcA */
|
||||
SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA = 0x6, /**< 1-srcA, 1-srcA, 1-srcA, 1-srcA */
|
||||
SDL_BLENDFACTOR_DST_COLOR = 0x7, /**< dstR, dstG, dstB, dstA */
|
||||
SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR = 0x8, /**< 1-dstR, 1-dstG, 1-dstB, 1-dstA */
|
||||
SDL_BLENDFACTOR_DST_ALPHA = 0x9, /**< dstA, dstA, dstA, dstA */
|
||||
SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA = 0xA /**< 1-dstA, 1-dstA, 1-dstA, 1-dstA */
|
||||
} SDL_BlendFactor;
|
||||
|
||||
/**
|
||||
* Compose a custom blend mode for renderers.
|
||||
*
|
||||
* The functions SDL_SetRenderDrawBlendMode and SDL_SetTextureBlendMode accept
|
||||
* the SDL_BlendMode returned by this function if the renderer supports it.
|
||||
*
|
||||
* A blend mode controls how the pixels from a drawing operation (source) get
|
||||
* combined with the pixels from the render target (destination). First, the
|
||||
* components of the source and destination pixels get multiplied with their
|
||||
* blend factors. Then, the blend operation takes the two products and
|
||||
* calculates the result that will get stored in the render target.
|
||||
*
|
||||
* Expressed in pseudocode, it would look like this:
|
||||
*
|
||||
* ```c
|
||||
* dstRGB = colorOperation(srcRGB * srcColorFactor, dstRGB * dstColorFactor);
|
||||
* dstA = alphaOperation(srcA * srcAlphaFactor, dstA * dstAlphaFactor);
|
||||
* ```
|
||||
*
|
||||
* Where the functions `colorOperation(src, dst)` and `alphaOperation(src,
|
||||
* dst)` can return one of the following:
|
||||
*
|
||||
* - `src + dst`
|
||||
* - `src - dst`
|
||||
* - `dst - src`
|
||||
* - `min(src, dst)`
|
||||
* - `max(src, dst)`
|
||||
*
|
||||
* The red, green, and blue components are always multiplied with the first,
|
||||
* second, and third components of the SDL_BlendFactor, respectively. The
|
||||
* fourth component is not used.
|
||||
*
|
||||
* The alpha component is always multiplied with the fourth component of the
|
||||
* SDL_BlendFactor. The other components are not used in the alpha
|
||||
* calculation.
|
||||
*
|
||||
* Support for these blend modes varies for each renderer. To check if a
|
||||
* specific SDL_BlendMode is supported, create a renderer and pass it to
|
||||
* either SDL_SetRenderDrawBlendMode or SDL_SetTextureBlendMode. They will
|
||||
* return with an error if the blend mode is not supported.
|
||||
*
|
||||
* This list describes the support of custom blend modes for each renderer in
|
||||
* SDL 2.0.6. All renderers support the four blend modes listed in the
|
||||
* SDL_BlendMode enumeration.
|
||||
*
|
||||
* - **direct3d**: Supports all operations with all factors. However, some
|
||||
* factors produce unexpected results with `SDL_BLENDOPERATION_MINIMUM` and
|
||||
* `SDL_BLENDOPERATION_MAXIMUM`.
|
||||
* - **direct3d11**: Same as Direct3D 9.
|
||||
* - **opengl**: Supports the `SDL_BLENDOPERATION_ADD` operation with all
|
||||
* factors. OpenGL versions 1.1, 1.2, and 1.3 do not work correctly with SDL
|
||||
* 2.0.6.
|
||||
* - **opengles**: Supports the `SDL_BLENDOPERATION_ADD` operation with all
|
||||
* factors. Color and alpha factors need to be the same. OpenGL ES 1
|
||||
* implementation specific: May also support `SDL_BLENDOPERATION_SUBTRACT`
|
||||
* and `SDL_BLENDOPERATION_REV_SUBTRACT`. May support color and alpha
|
||||
* operations being different from each other. May support color and alpha
|
||||
* factors being different from each other.
|
||||
* - **opengles2**: Supports the `SDL_BLENDOPERATION_ADD`,
|
||||
* `SDL_BLENDOPERATION_SUBTRACT`, `SDL_BLENDOPERATION_REV_SUBTRACT`
|
||||
* operations with all factors.
|
||||
* - **psp**: No custom blend mode support.
|
||||
* - **software**: No custom blend mode support.
|
||||
*
|
||||
* Some renderers do not provide an alpha component for the default render
|
||||
* target. The `SDL_BLENDFACTOR_DST_ALPHA` and
|
||||
* `SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA` factors do not have an effect in this
|
||||
* case.
|
||||
*
|
||||
* \param srcColorFactor the SDL_BlendFactor applied to the red, green, and
|
||||
* blue components of the source pixels
|
||||
* \param dstColorFactor the SDL_BlendFactor applied to the red, green, and
|
||||
* blue components of the destination pixels
|
||||
* \param colorOperation the SDL_BlendOperation used to combine the red,
|
||||
* green, and blue components of the source and
|
||||
* destination pixels
|
||||
* \param srcAlphaFactor the SDL_BlendFactor applied to the alpha component of
|
||||
* the source pixels
|
||||
* \param dstAlphaFactor the SDL_BlendFactor applied to the alpha component of
|
||||
* the destination pixels
|
||||
* \param alphaOperation the SDL_BlendOperation used to combine the alpha
|
||||
* component of the source and destination pixels
|
||||
* \returns an SDL_BlendMode that represents the chosen factors and
|
||||
* operations.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.6.
|
||||
*
|
||||
* \sa SDL_SetRenderDrawBlendMode
|
||||
* \sa SDL_GetRenderDrawBlendMode
|
||||
* \sa SDL_SetTextureBlendMode
|
||||
* \sa SDL_GetTextureBlendMode
|
||||
*/
|
||||
extern DECLSPEC SDL_BlendMode SDLCALL SDL_ComposeCustomBlendMode(SDL_BlendFactor srcColorFactor,
|
||||
SDL_BlendFactor dstColorFactor,
|
||||
SDL_BlendOperation colorOperation,
|
||||
SDL_BlendFactor srcAlphaFactor,
|
||||
SDL_BlendFactor dstAlphaFactor,
|
||||
SDL_BlendOperation alphaOperation);
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include <SDL2/close_code.h>
|
||||
|
||||
#endif /* SDL_blendmode_h_ */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
@@ -0,0 +1,94 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file SDL_clipboard.h
|
||||
*
|
||||
* Include file for SDL clipboard handling
|
||||
*/
|
||||
|
||||
#ifndef SDL_clipboard_h_
|
||||
#define SDL_clipboard_h_
|
||||
|
||||
#include <SDL2/SDL_stdinc.h>
|
||||
|
||||
#include <SDL2/begin_code.h>
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Function prototypes */
|
||||
|
||||
/**
|
||||
* Put UTF-8 text into the clipboard.
|
||||
*
|
||||
* \param text the text to store in the clipboard
|
||||
* \returns 0 on success or a negative error code on failure; call
|
||||
* SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_GetClipboardText
|
||||
* \sa SDL_HasClipboardText
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SetClipboardText(const char *text);
|
||||
|
||||
/**
|
||||
* Get UTF-8 text from the clipboard, which must be freed with SDL_free().
|
||||
*
|
||||
* This functions returns empty string if there was not enough memory left for
|
||||
* a copy of the clipboard's content.
|
||||
*
|
||||
* \returns the clipboard text on success or an empty string on failure; call
|
||||
* SDL_GetError() for more information. Caller must call SDL_free()
|
||||
* on the returned pointer when done with it (even if there was an
|
||||
* error).
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_HasClipboardText
|
||||
* \sa SDL_SetClipboardText
|
||||
*/
|
||||
extern DECLSPEC char * SDLCALL SDL_GetClipboardText(void);
|
||||
|
||||
/**
|
||||
* Query whether the clipboard exists and contains a non-empty text string.
|
||||
*
|
||||
* \returns SDL_TRUE if the clipboard has text, or SDL_FALSE if it does not.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_GetClipboardText
|
||||
* \sa SDL_SetClipboardText
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_HasClipboardText(void);
|
||||
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include <SDL2/close_code.h>
|
||||
|
||||
#endif /* SDL_clipboard_h_ */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef SDL_config_h_
|
||||
#define SDL_config_h_
|
||||
|
||||
#include <SDL2/SDL_platform.h>
|
||||
|
||||
/**
|
||||
* \file SDL_config.h
|
||||
*/
|
||||
|
||||
/* Add any platform that doesn't build using the configure system. */
|
||||
#if defined(__WIN32__)
|
||||
#include <SDL2/SDL_config_windows.h>
|
||||
#elif defined(__WINRT__)
|
||||
#include <SDL2/SDL_config_winrt.h>
|
||||
#elif defined(__MACOSX__)
|
||||
#include <SDL2/SDL_config_macosx.h>
|
||||
#elif defined(__IPHONEOS__)
|
||||
#include <SDL2/SDL_config_iphoneos.h>
|
||||
#elif defined(__ANDROID__)
|
||||
#include <SDL2/SDL_config_android.h>
|
||||
#elif defined(__OS2__)
|
||||
#include <SDL2/SDL_config_os2.h>
|
||||
#elif defined(__EMSCRIPTEN__)
|
||||
#include <SDL2/SDL_config_emscripten.h>
|
||||
#else
|
||||
/* This is a minimal configuration just to get SDL running on new platforms. */
|
||||
#include <SDL2/SDL_config_minimal.h>
|
||||
#endif /* platform config */
|
||||
|
||||
#ifdef USING_GENERATED_CONFIG_H
|
||||
#error Wrong SDL_config.h, check your include path?
|
||||
#endif
|
||||
|
||||
#endif /* SDL_config_h_ */
|
||||
@@ -0,0 +1,215 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef SDL_config_iphoneos_h_
|
||||
#define SDL_config_iphoneos_h_
|
||||
#define SDL_config_h_
|
||||
|
||||
#include <SDL2/SDL_platform.h>
|
||||
|
||||
#ifdef __LP64__
|
||||
#define SIZEOF_VOIDP 8
|
||||
#else
|
||||
#define SIZEOF_VOIDP 4
|
||||
#endif
|
||||
|
||||
#define HAVE_GCC_ATOMICS 1
|
||||
|
||||
#define STDC_HEADERS 1
|
||||
#define HAVE_ALLOCA_H 1
|
||||
#define HAVE_CTYPE_H 1
|
||||
#define HAVE_INTTYPES_H 1
|
||||
#define HAVE_LIMITS_H 1
|
||||
#define HAVE_MATH_H 1
|
||||
#define HAVE_SIGNAL_H 1
|
||||
#define HAVE_STDINT_H 1
|
||||
#define HAVE_STDIO_H 1
|
||||
#define HAVE_STRING_H 1
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
/* The libunwind functions are only available on x86 */
|
||||
/* #undef HAVE_LIBUNWIND_H */
|
||||
|
||||
/* C library functions */
|
||||
#define HAVE_DLOPEN 1
|
||||
#define HAVE_MALLOC 1
|
||||
#define HAVE_CALLOC 1
|
||||
#define HAVE_REALLOC 1
|
||||
#define HAVE_FREE 1
|
||||
#define HAVE_ALLOCA 1
|
||||
#define HAVE_GETENV 1
|
||||
#define HAVE_SETENV 1
|
||||
#define HAVE_PUTENV 1
|
||||
#define HAVE_SETENV 1
|
||||
#define HAVE_UNSETENV 1
|
||||
#define HAVE_QSORT 1
|
||||
#define HAVE_ABS 1
|
||||
#define HAVE_BCOPY 1
|
||||
#define HAVE_MEMSET 1
|
||||
#define HAVE_MEMCPY 1
|
||||
#define HAVE_MEMMOVE 1
|
||||
#define HAVE_MEMCMP 1
|
||||
#define HAVE_STRLEN 1
|
||||
#define HAVE_STRLCPY 1
|
||||
#define HAVE_STRLCAT 1
|
||||
#define HAVE_STRCHR 1
|
||||
#define HAVE_STRRCHR 1
|
||||
#define HAVE_STRSTR 1
|
||||
#define HAVE_STRTOK_R 1
|
||||
#define HAVE_STRTOL 1
|
||||
#define HAVE_STRTOUL 1
|
||||
#define HAVE_STRTOLL 1
|
||||
#define HAVE_STRTOULL 1
|
||||
#define HAVE_STRTOD 1
|
||||
#define HAVE_ATOI 1
|
||||
#define HAVE_ATOF 1
|
||||
#define HAVE_STRCMP 1
|
||||
#define HAVE_STRNCMP 1
|
||||
#define HAVE_STRCASECMP 1
|
||||
#define HAVE_STRNCASECMP 1
|
||||
#define HAVE_VSSCANF 1
|
||||
#define HAVE_VSNPRINTF 1
|
||||
#define HAVE_M_PI 1
|
||||
#define HAVE_ACOS 1
|
||||
#define HAVE_ACOSF 1
|
||||
#define HAVE_ASIN 1
|
||||
#define HAVE_ASINF 1
|
||||
#define HAVE_ATAN 1
|
||||
#define HAVE_ATANF 1
|
||||
#define HAVE_ATAN2 1
|
||||
#define HAVE_ATAN2F 1
|
||||
#define HAVE_CEIL 1
|
||||
#define HAVE_CEILF 1
|
||||
#define HAVE_COPYSIGN 1
|
||||
#define HAVE_COPYSIGNF 1
|
||||
#define HAVE_COS 1
|
||||
#define HAVE_COSF 1
|
||||
#define HAVE_EXP 1
|
||||
#define HAVE_EXPF 1
|
||||
#define HAVE_FABS 1
|
||||
#define HAVE_FABSF 1
|
||||
#define HAVE_FLOOR 1
|
||||
#define HAVE_FLOORF 1
|
||||
#define HAVE_FMOD 1
|
||||
#define HAVE_FMODF 1
|
||||
#define HAVE_LOG 1
|
||||
#define HAVE_LOGF 1
|
||||
#define HAVE_LOG10 1
|
||||
#define HAVE_LOG10F 1
|
||||
#define HAVE_LROUND 1
|
||||
#define HAVE_LROUNDF 1
|
||||
#define HAVE_POW 1
|
||||
#define HAVE_POWF 1
|
||||
#define HAVE_ROUND 1
|
||||
#define HAVE_ROUNDF 1
|
||||
#define HAVE_SCALBN 1
|
||||
#define HAVE_SCALBNF 1
|
||||
#define HAVE_SIN 1
|
||||
#define HAVE_SINF 1
|
||||
#define HAVE_SQRT 1
|
||||
#define HAVE_SQRTF 1
|
||||
#define HAVE_TAN 1
|
||||
#define HAVE_TANF 1
|
||||
#define HAVE_TRUNC 1
|
||||
#define HAVE_TRUNCF 1
|
||||
#define HAVE_SIGACTION 1
|
||||
#define HAVE_SETJMP 1
|
||||
#define HAVE_NANOSLEEP 1
|
||||
#define HAVE_SYSCONF 1
|
||||
#define HAVE_SYSCTLBYNAME 1
|
||||
#define HAVE_O_CLOEXEC 1
|
||||
|
||||
/* enable iPhone version of Core Audio driver */
|
||||
#define SDL_AUDIO_DRIVER_COREAUDIO 1
|
||||
/* Enable the dummy audio driver (src/audio/dummy/\*.c) */
|
||||
#define SDL_AUDIO_DRIVER_DUMMY 1
|
||||
|
||||
/* Enable the stub haptic driver (src/haptic/dummy/\*.c) */
|
||||
#define SDL_HAPTIC_DUMMY 1
|
||||
|
||||
/* Enable joystick support */
|
||||
/* Only enable HIDAPI support if you want to support Steam Controllers on iOS and tvOS */
|
||||
/*#define SDL_JOYSTICK_HIDAPI 1*/
|
||||
#define SDL_JOYSTICK_MFI 1
|
||||
#define SDL_JOYSTICK_VIRTUAL 1
|
||||
|
||||
#ifdef __TVOS__
|
||||
#define SDL_SENSOR_DUMMY 1
|
||||
#else
|
||||
/* Enable the CoreMotion sensor driver */
|
||||
#define SDL_SENSOR_COREMOTION 1
|
||||
#endif
|
||||
|
||||
/* Enable Unix style SO loading */
|
||||
#define SDL_LOADSO_DLOPEN 1
|
||||
|
||||
/* Enable various threading systems */
|
||||
#define SDL_THREAD_PTHREAD 1
|
||||
#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1
|
||||
|
||||
/* Enable various timer systems */
|
||||
#define SDL_TIMER_UNIX 1
|
||||
|
||||
/* Supported video drivers */
|
||||
#define SDL_VIDEO_DRIVER_UIKIT 1
|
||||
#define SDL_VIDEO_DRIVER_DUMMY 1
|
||||
|
||||
/* Enable OpenGL ES */
|
||||
#if !TARGET_OS_MACCATALYST
|
||||
#define SDL_VIDEO_OPENGL_ES2 1
|
||||
#define SDL_VIDEO_OPENGL_ES 1
|
||||
#define SDL_VIDEO_RENDER_OGL_ES 1
|
||||
#define SDL_VIDEO_RENDER_OGL_ES2 1
|
||||
#endif
|
||||
|
||||
/* Metal supported on 64-bit devices running iOS 8.0 and tvOS 9.0 and newer
|
||||
Also supported in simulator from iOS 13.0 and tvOS 13.0
|
||||
*/
|
||||
#if (TARGET_OS_SIMULATOR && ((__IPHONE_OS_VERSION_MIN_REQUIRED >= 130000) || (__TV_OS_VERSION_MIN_REQUIRED >= 130000))) || (!TARGET_CPU_ARM && ((__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 90000)))
|
||||
#define SDL_PLATFORM_SUPPORTS_METAL 1
|
||||
#else
|
||||
#define SDL_PLATFORM_SUPPORTS_METAL 0
|
||||
#endif
|
||||
|
||||
#if SDL_PLATFORM_SUPPORTS_METAL
|
||||
#define SDL_VIDEO_RENDER_METAL 1
|
||||
#endif
|
||||
|
||||
#if SDL_PLATFORM_SUPPORTS_METAL
|
||||
#define SDL_VIDEO_VULKAN 1
|
||||
#endif
|
||||
|
||||
#if SDL_PLATFORM_SUPPORTS_METAL
|
||||
#define SDL_VIDEO_METAL 1
|
||||
#endif
|
||||
|
||||
/* Enable system power support */
|
||||
#define SDL_POWER_UIKIT 1
|
||||
|
||||
/* enable iPhone keyboard support */
|
||||
#define SDL_IPHONE_KEYBOARD 1
|
||||
|
||||
/* enable iOS extended launch screen */
|
||||
#define SDL_IPHONE_LAUNCHSCREEN 1
|
||||
|
||||
/* enable filesystem support */
|
||||
#define SDL_FILESYSTEM_COCOA 1
|
||||
|
||||
#endif /* SDL_config_iphoneos_h_ */
|
||||
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
@@ -0,0 +1,559 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file SDL_cpuinfo.h
|
||||
*
|
||||
* CPU feature detection for SDL.
|
||||
*/
|
||||
|
||||
#ifndef SDL_cpuinfo_h_
|
||||
#define SDL_cpuinfo_h_
|
||||
|
||||
#include <SDL2/SDL_stdinc.h>
|
||||
|
||||
/* Need to do this here because intrin.h has C++ code in it */
|
||||
/* Visual Studio 2005 has a bug where intrin.h conflicts with winnt.h */
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1500) && (defined(_M_IX86) || defined(_M_X64))
|
||||
#ifdef __clang__
|
||||
/* As of Clang 11, '_m_prefetchw' is conflicting with the winnt.h's version,
|
||||
so we define the needed '_m_prefetch' here as a pseudo-header, until the issue is fixed. */
|
||||
|
||||
#ifndef __PRFCHWINTRIN_H
|
||||
#define __PRFCHWINTRIN_H
|
||||
|
||||
static __inline__ void __attribute__((__always_inline__, __nodebug__))
|
||||
_m_prefetch(void *__P)
|
||||
{
|
||||
__builtin_prefetch (__P, 0, 3 /* _MM_HINT_T0 */);
|
||||
}
|
||||
|
||||
#endif /* __PRFCHWINTRIN_H */
|
||||
#endif /* __clang__ */
|
||||
#include <intrin.h>
|
||||
#ifndef _WIN64
|
||||
#ifndef __MMX__
|
||||
#define __MMX__
|
||||
#endif
|
||||
#ifndef __3dNOW__
|
||||
#define __3dNOW__
|
||||
#endif
|
||||
#endif
|
||||
#ifndef __SSE__
|
||||
#define __SSE__
|
||||
#endif
|
||||
#ifndef __SSE2__
|
||||
#define __SSE2__
|
||||
#endif
|
||||
#ifndef __SSE3__
|
||||
#define __SSE3__
|
||||
#endif
|
||||
#elif defined(__MINGW64_VERSION_MAJOR)
|
||||
#include <intrin.h>
|
||||
#if !defined(SDL_DISABLE_ARM_NEON_H) && defined(__ARM_NEON)
|
||||
# include <arm_neon.h>
|
||||
#endif
|
||||
#else
|
||||
/* altivec.h redefining bool causes a number of problems, see bugs 3993 and 4392, so you need to explicitly define SDL_ENABLE_ALTIVEC_H to have it included. */
|
||||
#if defined(HAVE_ALTIVEC_H) && defined(__ALTIVEC__) && !defined(__APPLE_ALTIVEC__) && defined(SDL_ENABLE_ALTIVEC_H)
|
||||
#include <altivec.h>
|
||||
#endif
|
||||
#if !defined(SDL_DISABLE_ARM_NEON_H)
|
||||
# if defined(__ARM_NEON)
|
||||
# include <arm_neon.h>
|
||||
# elif defined(__WINDOWS__) || defined(__WINRT__)
|
||||
/* Visual Studio doesn't define __ARM_ARCH, but _M_ARM (if set, always 7), and _M_ARM64 (if set, always 1). */
|
||||
# if defined(_M_ARM)
|
||||
# include <armintr.h>
|
||||
# include <arm_neon.h>
|
||||
# define __ARM_NEON 1 /* Set __ARM_NEON so that it can be used elsewhere, at compile time */
|
||||
# endif
|
||||
# if defined (_M_ARM64)
|
||||
# include <arm64intr.h>
|
||||
# include <arm64_neon.h>
|
||||
# define __ARM_NEON 1 /* Set __ARM_NEON so that it can be used elsewhere, at compile time */
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
#endif /* compiler version */
|
||||
|
||||
#if defined(__3dNOW__) && !defined(SDL_DISABLE_MM3DNOW_H)
|
||||
#include <mm3dnow.h>
|
||||
#endif
|
||||
#if defined(HAVE_IMMINTRIN_H) && !defined(SDL_DISABLE_IMMINTRIN_H)
|
||||
#include <immintrin.h>
|
||||
#else
|
||||
#if defined(__MMX__) && !defined(SDL_DISABLE_MMINTRIN_H)
|
||||
#include <mmintrin.h>
|
||||
#endif
|
||||
#if defined(__SSE__) && !defined(SDL_DISABLE_XMMINTRIN_H)
|
||||
#include <xmmintrin.h>
|
||||
#endif
|
||||
#if defined(__SSE2__) && !defined(SDL_DISABLE_EMMINTRIN_H)
|
||||
#include <emmintrin.h>
|
||||
#endif
|
||||
#if defined(__SSE3__) && !defined(SDL_DISABLE_PMMINTRIN_H)
|
||||
#include <pmmintrin.h>
|
||||
#endif
|
||||
#endif /* HAVE_IMMINTRIN_H */
|
||||
|
||||
#include <SDL2/begin_code.h>
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* This is a guess for the cacheline size used for padding.
|
||||
* Most x86 processors have a 64 byte cache line.
|
||||
* The 64-bit PowerPC processors have a 128 byte cache line.
|
||||
* We'll use the larger value to be generally safe.
|
||||
*/
|
||||
#define SDL_CACHELINE_SIZE 128
|
||||
|
||||
/**
|
||||
* Get the number of CPU cores available.
|
||||
*
|
||||
* \returns the total number of logical CPU cores. On CPUs that include
|
||||
* technologies such as hyperthreading, the number of logical cores
|
||||
* may be more than the number of physical cores.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_GetCPUCount(void);
|
||||
|
||||
/**
|
||||
* Determine the L1 cache line size of the CPU.
|
||||
*
|
||||
* This is useful for determining multi-threaded structure padding or SIMD
|
||||
* prefetch sizes.
|
||||
*
|
||||
* \returns the L1 cache line size of the CPU, in bytes.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_GetCPUCacheLineSize(void);
|
||||
|
||||
/**
|
||||
* Determine whether the CPU has the RDTSC instruction.
|
||||
*
|
||||
* This always returns false on CPUs that aren't using Intel instruction sets.
|
||||
*
|
||||
* \returns SDL_TRUE if the CPU has the RDTSC instruction or SDL_FALSE if not.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_Has3DNow
|
||||
* \sa SDL_HasAltiVec
|
||||
* \sa SDL_HasAVX
|
||||
* \sa SDL_HasAVX2
|
||||
* \sa SDL_HasMMX
|
||||
* \sa SDL_HasSSE
|
||||
* \sa SDL_HasSSE2
|
||||
* \sa SDL_HasSSE3
|
||||
* \sa SDL_HasSSE41
|
||||
* \sa SDL_HasSSE42
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_HasRDTSC(void);
|
||||
|
||||
/**
|
||||
* Determine whether the CPU has AltiVec features.
|
||||
*
|
||||
* This always returns false on CPUs that aren't using PowerPC instruction
|
||||
* sets.
|
||||
*
|
||||
* \returns SDL_TRUE if the CPU has AltiVec features or SDL_FALSE if not.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_Has3DNow
|
||||
* \sa SDL_HasAVX
|
||||
* \sa SDL_HasAVX2
|
||||
* \sa SDL_HasMMX
|
||||
* \sa SDL_HasRDTSC
|
||||
* \sa SDL_HasSSE
|
||||
* \sa SDL_HasSSE2
|
||||
* \sa SDL_HasSSE3
|
||||
* \sa SDL_HasSSE41
|
||||
* \sa SDL_HasSSE42
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_HasAltiVec(void);
|
||||
|
||||
/**
|
||||
* Determine whether the CPU has MMX features.
|
||||
*
|
||||
* This always returns false on CPUs that aren't using Intel instruction sets.
|
||||
*
|
||||
* \returns SDL_TRUE if the CPU has MMX features or SDL_FALSE if not.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_Has3DNow
|
||||
* \sa SDL_HasAltiVec
|
||||
* \sa SDL_HasAVX
|
||||
* \sa SDL_HasAVX2
|
||||
* \sa SDL_HasRDTSC
|
||||
* \sa SDL_HasSSE
|
||||
* \sa SDL_HasSSE2
|
||||
* \sa SDL_HasSSE3
|
||||
* \sa SDL_HasSSE41
|
||||
* \sa SDL_HasSSE42
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_HasMMX(void);
|
||||
|
||||
/**
|
||||
* Determine whether the CPU has 3DNow! features.
|
||||
*
|
||||
* This always returns false on CPUs that aren't using AMD instruction sets.
|
||||
*
|
||||
* \returns SDL_TRUE if the CPU has 3DNow! features or SDL_FALSE if not.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_HasAltiVec
|
||||
* \sa SDL_HasAVX
|
||||
* \sa SDL_HasAVX2
|
||||
* \sa SDL_HasMMX
|
||||
* \sa SDL_HasRDTSC
|
||||
* \sa SDL_HasSSE
|
||||
* \sa SDL_HasSSE2
|
||||
* \sa SDL_HasSSE3
|
||||
* \sa SDL_HasSSE41
|
||||
* \sa SDL_HasSSE42
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_Has3DNow(void);
|
||||
|
||||
/**
|
||||
* Determine whether the CPU has SSE features.
|
||||
*
|
||||
* This always returns false on CPUs that aren't using Intel instruction sets.
|
||||
*
|
||||
* \returns SDL_TRUE if the CPU has SSE features or SDL_FALSE if not.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_Has3DNow
|
||||
* \sa SDL_HasAltiVec
|
||||
* \sa SDL_HasAVX
|
||||
* \sa SDL_HasAVX2
|
||||
* \sa SDL_HasMMX
|
||||
* \sa SDL_HasRDTSC
|
||||
* \sa SDL_HasSSE2
|
||||
* \sa SDL_HasSSE3
|
||||
* \sa SDL_HasSSE41
|
||||
* \sa SDL_HasSSE42
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE(void);
|
||||
|
||||
/**
|
||||
* Determine whether the CPU has SSE2 features.
|
||||
*
|
||||
* This always returns false on CPUs that aren't using Intel instruction sets.
|
||||
*
|
||||
* \returns SDL_TRUE if the CPU has SSE2 features or SDL_FALSE if not.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_Has3DNow
|
||||
* \sa SDL_HasAltiVec
|
||||
* \sa SDL_HasAVX
|
||||
* \sa SDL_HasAVX2
|
||||
* \sa SDL_HasMMX
|
||||
* \sa SDL_HasRDTSC
|
||||
* \sa SDL_HasSSE
|
||||
* \sa SDL_HasSSE3
|
||||
* \sa SDL_HasSSE41
|
||||
* \sa SDL_HasSSE42
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE2(void);
|
||||
|
||||
/**
|
||||
* Determine whether the CPU has SSE3 features.
|
||||
*
|
||||
* This always returns false on CPUs that aren't using Intel instruction sets.
|
||||
*
|
||||
* \returns SDL_TRUE if the CPU has SSE3 features or SDL_FALSE if not.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_Has3DNow
|
||||
* \sa SDL_HasAltiVec
|
||||
* \sa SDL_HasAVX
|
||||
* \sa SDL_HasAVX2
|
||||
* \sa SDL_HasMMX
|
||||
* \sa SDL_HasRDTSC
|
||||
* \sa SDL_HasSSE
|
||||
* \sa SDL_HasSSE2
|
||||
* \sa SDL_HasSSE41
|
||||
* \sa SDL_HasSSE42
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE3(void);
|
||||
|
||||
/**
|
||||
* Determine whether the CPU has SSE4.1 features.
|
||||
*
|
||||
* This always returns false on CPUs that aren't using Intel instruction sets.
|
||||
*
|
||||
* \returns SDL_TRUE if the CPU has SSE4.1 features or SDL_FALSE if not.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_Has3DNow
|
||||
* \sa SDL_HasAltiVec
|
||||
* \sa SDL_HasAVX
|
||||
* \sa SDL_HasAVX2
|
||||
* \sa SDL_HasMMX
|
||||
* \sa SDL_HasRDTSC
|
||||
* \sa SDL_HasSSE
|
||||
* \sa SDL_HasSSE2
|
||||
* \sa SDL_HasSSE3
|
||||
* \sa SDL_HasSSE42
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE41(void);
|
||||
|
||||
/**
|
||||
* Determine whether the CPU has SSE4.2 features.
|
||||
*
|
||||
* This always returns false on CPUs that aren't using Intel instruction sets.
|
||||
*
|
||||
* \returns SDL_TRUE if the CPU has SSE4.2 features or SDL_FALSE if not.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_Has3DNow
|
||||
* \sa SDL_HasAltiVec
|
||||
* \sa SDL_HasAVX
|
||||
* \sa SDL_HasAVX2
|
||||
* \sa SDL_HasMMX
|
||||
* \sa SDL_HasRDTSC
|
||||
* \sa SDL_HasSSE
|
||||
* \sa SDL_HasSSE2
|
||||
* \sa SDL_HasSSE3
|
||||
* \sa SDL_HasSSE41
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE42(void);
|
||||
|
||||
/**
|
||||
* Determine whether the CPU has AVX features.
|
||||
*
|
||||
* This always returns false on CPUs that aren't using Intel instruction sets.
|
||||
*
|
||||
* \returns SDL_TRUE if the CPU has AVX features or SDL_FALSE if not.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.2.
|
||||
*
|
||||
* \sa SDL_Has3DNow
|
||||
* \sa SDL_HasAltiVec
|
||||
* \sa SDL_HasAVX2
|
||||
* \sa SDL_HasMMX
|
||||
* \sa SDL_HasRDTSC
|
||||
* \sa SDL_HasSSE
|
||||
* \sa SDL_HasSSE2
|
||||
* \sa SDL_HasSSE3
|
||||
* \sa SDL_HasSSE41
|
||||
* \sa SDL_HasSSE42
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX(void);
|
||||
|
||||
/**
|
||||
* Determine whether the CPU has AVX2 features.
|
||||
*
|
||||
* This always returns false on CPUs that aren't using Intel instruction sets.
|
||||
*
|
||||
* \returns SDL_TRUE if the CPU has AVX2 features or SDL_FALSE if not.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.4.
|
||||
*
|
||||
* \sa SDL_Has3DNow
|
||||
* \sa SDL_HasAltiVec
|
||||
* \sa SDL_HasAVX
|
||||
* \sa SDL_HasMMX
|
||||
* \sa SDL_HasRDTSC
|
||||
* \sa SDL_HasSSE
|
||||
* \sa SDL_HasSSE2
|
||||
* \sa SDL_HasSSE3
|
||||
* \sa SDL_HasSSE41
|
||||
* \sa SDL_HasSSE42
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX2(void);
|
||||
|
||||
/**
|
||||
* Determine whether the CPU has AVX-512F (foundation) features.
|
||||
*
|
||||
* This always returns false on CPUs that aren't using Intel instruction sets.
|
||||
*
|
||||
* \returns SDL_TRUE if the CPU has AVX-512F features or SDL_FALSE if not.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.9.
|
||||
*
|
||||
* \sa SDL_HasAVX
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX512F(void);
|
||||
|
||||
/**
|
||||
* Determine whether the CPU has ARM SIMD (ARMv6) features.
|
||||
*
|
||||
* This is different from ARM NEON, which is a different instruction set.
|
||||
*
|
||||
* This always returns false on CPUs that aren't using ARM instruction sets.
|
||||
*
|
||||
* \returns SDL_TRUE if the CPU has ARM SIMD features or SDL_FALSE if not.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.12.
|
||||
*
|
||||
* \sa SDL_HasNEON
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_HasARMSIMD(void);
|
||||
|
||||
/**
|
||||
* Determine whether the CPU has NEON (ARM SIMD) features.
|
||||
*
|
||||
* This always returns false on CPUs that aren't using ARM instruction sets.
|
||||
*
|
||||
* \returns SDL_TRUE if the CPU has ARM NEON features or SDL_FALSE if not.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.6.
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_HasNEON(void);
|
||||
|
||||
/**
|
||||
* Get the amount of RAM configured in the system.
|
||||
*
|
||||
* \returns the amount of RAM configured in the system in MB.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.1.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_GetSystemRAM(void);
|
||||
|
||||
/**
|
||||
* Report the alignment this system needs for SIMD allocations.
|
||||
*
|
||||
* This will return the minimum number of bytes to which a pointer must be
|
||||
* aligned to be compatible with SIMD instructions on the current machine. For
|
||||
* example, if the machine supports SSE only, it will return 16, but if it
|
||||
* supports AVX-512F, it'll return 64 (etc). This only reports values for
|
||||
* instruction sets SDL knows about, so if your SDL build doesn't have
|
||||
* SDL_HasAVX512F(), then it might return 16 for the SSE support it sees and
|
||||
* not 64 for the AVX-512 instructions that exist but SDL doesn't know about.
|
||||
* Plan accordingly.
|
||||
*
|
||||
* \returns the alignment in bytes needed for available, known SIMD
|
||||
* instructions.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.10.
|
||||
*/
|
||||
extern DECLSPEC size_t SDLCALL SDL_SIMDGetAlignment(void);
|
||||
|
||||
/**
|
||||
* Allocate memory in a SIMD-friendly way.
|
||||
*
|
||||
* This will allocate a block of memory that is suitable for use with SIMD
|
||||
* instructions. Specifically, it will be properly aligned and padded for the
|
||||
* system's supported vector instructions.
|
||||
*
|
||||
* The memory returned will be padded such that it is safe to read or write an
|
||||
* incomplete vector at the end of the memory block. This can be useful so you
|
||||
* don't have to drop back to a scalar fallback at the end of your SIMD
|
||||
* processing loop to deal with the final elements without overflowing the
|
||||
* allocated buffer.
|
||||
*
|
||||
* You must free this memory with SDL_FreeSIMD(), not free() or SDL_free() or
|
||||
* delete[], etc.
|
||||
*
|
||||
* Note that SDL will only deal with SIMD instruction sets it is aware of; for
|
||||
* example, SDL 2.0.8 knows that SSE wants 16-byte vectors (SDL_HasSSE()), and
|
||||
* AVX2 wants 32 bytes (SDL_HasAVX2()), but doesn't know that AVX-512 wants
|
||||
* 64. To be clear: if you can't decide to use an instruction set with an
|
||||
* SDL_Has*() function, don't use that instruction set with memory allocated
|
||||
* through here.
|
||||
*
|
||||
* SDL_AllocSIMD(0) will return a non-NULL pointer, assuming the system isn't
|
||||
* out of memory, but you are not allowed to dereference it (because you only
|
||||
* own zero bytes of that buffer).
|
||||
*
|
||||
* \param len The length, in bytes, of the block to allocate. The actual
|
||||
* allocated block might be larger due to padding, etc.
|
||||
* \returns a pointer to the newly-allocated block, NULL if out of memory.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.10.
|
||||
*
|
||||
* \sa SDL_SIMDAlignment
|
||||
* \sa SDL_SIMDRealloc
|
||||
* \sa SDL_SIMDFree
|
||||
*/
|
||||
extern DECLSPEC void * SDLCALL SDL_SIMDAlloc(const size_t len);
|
||||
|
||||
/**
|
||||
* Reallocate memory obtained from SDL_SIMDAlloc
|
||||
*
|
||||
* It is not valid to use this function on a pointer from anything but
|
||||
* SDL_SIMDAlloc(). It can't be used on pointers from malloc, realloc,
|
||||
* SDL_malloc, memalign, new[], etc.
|
||||
*
|
||||
* \param mem The pointer obtained from SDL_SIMDAlloc. This function also
|
||||
* accepts NULL, at which point this function is the same as
|
||||
* calling SDL_SIMDAlloc with a NULL pointer.
|
||||
* \param len The length, in bytes, of the block to allocated. The actual
|
||||
* allocated block might be larger due to padding, etc. Passing 0
|
||||
* will return a non-NULL pointer, assuming the system isn't out of
|
||||
* memory.
|
||||
* \returns a pointer to the newly-reallocated block, NULL if out of memory.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.14.
|
||||
*
|
||||
* \sa SDL_SIMDAlignment
|
||||
* \sa SDL_SIMDAlloc
|
||||
* \sa SDL_SIMDFree
|
||||
*/
|
||||
extern DECLSPEC void * SDLCALL SDL_SIMDRealloc(void *mem, const size_t len);
|
||||
|
||||
/**
|
||||
* Deallocate memory obtained from SDL_SIMDAlloc
|
||||
*
|
||||
* It is not valid to use this function on a pointer from anything but
|
||||
* SDL_SIMDAlloc() or SDL_SIMDRealloc(). It can't be used on pointers from
|
||||
* malloc, realloc, SDL_malloc, memalign, new[], etc.
|
||||
*
|
||||
* However, SDL_SIMDFree(NULL) is a legal no-op.
|
||||
*
|
||||
* The memory pointed to by `ptr` is no longer valid for access upon return,
|
||||
* and may be returned to the system or reused by a future allocation. The
|
||||
* pointer passed to this function is no longer safe to dereference once this
|
||||
* function returns, and should be discarded.
|
||||
*
|
||||
* \param ptr The pointer, returned from SDL_SIMDAlloc or SDL_SIMDRealloc, to
|
||||
* deallocate. NULL is a legal no-op.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.10.
|
||||
*
|
||||
* \sa SDL_SIMDAlloc
|
||||
* \sa SDL_SIMDRealloc
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_SIMDFree(void *ptr);
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include <SDL2/close_code.h>
|
||||
|
||||
#endif /* SDL_cpuinfo_h_ */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
@@ -0,0 +1,326 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file SDL_endian.h
|
||||
*
|
||||
* Functions for reading and writing endian-specific values
|
||||
*/
|
||||
|
||||
#ifndef SDL_endian_h_
|
||||
#define SDL_endian_h_
|
||||
|
||||
#include <SDL2/SDL_stdinc.h>
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1400)
|
||||
/* As of Clang 11, '_m_prefetchw' is conflicting with the winnt.h's version,
|
||||
so we define the needed '_m_prefetch' here as a pseudo-header, until the issue is fixed. */
|
||||
#ifdef __clang__
|
||||
#ifndef __PRFCHWINTRIN_H
|
||||
#define __PRFCHWINTRIN_H
|
||||
static __inline__ void __attribute__((__always_inline__, __nodebug__))
|
||||
_m_prefetch(void *__P)
|
||||
{
|
||||
__builtin_prefetch (__P, 0, 3 /* _MM_HINT_T0 */);
|
||||
}
|
||||
#endif /* __PRFCHWINTRIN_H */
|
||||
#endif /* __clang__ */
|
||||
|
||||
#include <intrin.h>
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \name The two types of endianness
|
||||
*/
|
||||
/* @{ */
|
||||
#define SDL_LIL_ENDIAN 1234
|
||||
#define SDL_BIG_ENDIAN 4321
|
||||
/* @} */
|
||||
|
||||
#ifndef SDL_BYTEORDER /* Not defined in SDL_config.h? */
|
||||
#ifdef __linux__
|
||||
#include <endian.h>
|
||||
#define SDL_BYTEORDER __BYTE_ORDER
|
||||
#elif defined(__OpenBSD__)
|
||||
#include <endian.h>
|
||||
#define SDL_BYTEORDER BYTE_ORDER
|
||||
#elif defined(__FreeBSD__) || defined(__NetBSD__)
|
||||
#include <sys/endian.h>
|
||||
#define SDL_BYTEORDER BYTE_ORDER
|
||||
/* predefs from newer gcc and clang versions: */
|
||||
#elif defined(__ORDER_LITTLE_ENDIAN__) && defined(__ORDER_BIG_ENDIAN__) && defined(__BYTE_ORDER__)
|
||||
#if (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
|
||||
#define SDL_BYTEORDER SDL_LIL_ENDIAN
|
||||
#elif (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
|
||||
#define SDL_BYTEORDER SDL_BIG_ENDIAN
|
||||
#else
|
||||
#error Unsupported endianness
|
||||
#endif /**/
|
||||
#else
|
||||
#if defined(__hppa__) || \
|
||||
defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || \
|
||||
(defined(__MIPS__) && defined(__MIPSEB__)) || \
|
||||
defined(__ppc__) || defined(__POWERPC__) || defined(_M_PPC) || \
|
||||
defined(__sparc__)
|
||||
#define SDL_BYTEORDER SDL_BIG_ENDIAN
|
||||
#else
|
||||
#define SDL_BYTEORDER SDL_LIL_ENDIAN
|
||||
#endif
|
||||
#endif /* __linux__ */
|
||||
#endif /* !SDL_BYTEORDER */
|
||||
|
||||
|
||||
#include <SDL2/begin_code.h>
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \file SDL_endian.h
|
||||
*/
|
||||
|
||||
/* various modern compilers may have builtin swap */
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
# define HAS_BUILTIN_BSWAP16 (_SDL_HAS_BUILTIN(__builtin_bswap16)) || \
|
||||
(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8))
|
||||
# define HAS_BUILTIN_BSWAP32 (_SDL_HAS_BUILTIN(__builtin_bswap32)) || \
|
||||
(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
|
||||
# define HAS_BUILTIN_BSWAP64 (_SDL_HAS_BUILTIN(__builtin_bswap64)) || \
|
||||
(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
|
||||
|
||||
/* this one is broken */
|
||||
# define HAS_BROKEN_BSWAP (__GNUC__ == 2 && __GNUC_MINOR__ <= 95)
|
||||
#else
|
||||
# define HAS_BUILTIN_BSWAP16 0
|
||||
# define HAS_BUILTIN_BSWAP32 0
|
||||
# define HAS_BUILTIN_BSWAP64 0
|
||||
# define HAS_BROKEN_BSWAP 0
|
||||
#endif
|
||||
|
||||
#if HAS_BUILTIN_BSWAP16
|
||||
#define SDL_Swap16(x) __builtin_bswap16(x)
|
||||
#elif defined(_MSC_VER) && (_MSC_VER >= 1400)
|
||||
#pragma intrinsic(_byteswap_ushort)
|
||||
#define SDL_Swap16(x) _byteswap_ushort(x)
|
||||
#elif defined(__i386__) && !HAS_BROKEN_BSWAP
|
||||
SDL_FORCE_INLINE Uint16
|
||||
SDL_Swap16(Uint16 x)
|
||||
{
|
||||
__asm__("xchgb %b0,%h0": "=q"(x):"0"(x));
|
||||
return x;
|
||||
}
|
||||
#elif defined(__x86_64__)
|
||||
SDL_FORCE_INLINE Uint16
|
||||
SDL_Swap16(Uint16 x)
|
||||
{
|
||||
__asm__("xchgb %b0,%h0": "=Q"(x):"0"(x));
|
||||
return x;
|
||||
}
|
||||
#elif (defined(__powerpc__) || defined(__ppc__))
|
||||
SDL_FORCE_INLINE Uint16
|
||||
SDL_Swap16(Uint16 x)
|
||||
{
|
||||
int result;
|
||||
|
||||
__asm__("rlwimi %0,%2,8,16,23": "=&r"(result):"0"(x >> 8), "r"(x));
|
||||
return (Uint16)result;
|
||||
}
|
||||
#elif (defined(__m68k__) && !defined(__mcoldfire__))
|
||||
SDL_FORCE_INLINE Uint16
|
||||
SDL_Swap16(Uint16 x)
|
||||
{
|
||||
__asm__("rorw #8,%0": "=d"(x): "0"(x):"cc");
|
||||
return x;
|
||||
}
|
||||
#elif defined(__WATCOMC__) && defined(__386__)
|
||||
extern __inline Uint16 SDL_Swap16(Uint16);
|
||||
#pragma aux SDL_Swap16 = \
|
||||
"xchg al, ah" \
|
||||
parm [ax] \
|
||||
modify [ax];
|
||||
#else
|
||||
SDL_FORCE_INLINE Uint16
|
||||
SDL_Swap16(Uint16 x)
|
||||
{
|
||||
return SDL_static_cast(Uint16, ((x << 8) | (x >> 8)));
|
||||
}
|
||||
#endif
|
||||
|
||||
#if HAS_BUILTIN_BSWAP32
|
||||
#define SDL_Swap32(x) __builtin_bswap32(x)
|
||||
#elif defined(_MSC_VER) && (_MSC_VER >= 1400)
|
||||
#pragma intrinsic(_byteswap_ulong)
|
||||
#define SDL_Swap32(x) _byteswap_ulong(x)
|
||||
#elif defined(__i386__) && !HAS_BROKEN_BSWAP
|
||||
SDL_FORCE_INLINE Uint32
|
||||
SDL_Swap32(Uint32 x)
|
||||
{
|
||||
__asm__("bswap %0": "=r"(x):"0"(x));
|
||||
return x;
|
||||
}
|
||||
#elif defined(__x86_64__)
|
||||
SDL_FORCE_INLINE Uint32
|
||||
SDL_Swap32(Uint32 x)
|
||||
{
|
||||
__asm__("bswapl %0": "=r"(x):"0"(x));
|
||||
return x;
|
||||
}
|
||||
#elif (defined(__powerpc__) || defined(__ppc__))
|
||||
SDL_FORCE_INLINE Uint32
|
||||
SDL_Swap32(Uint32 x)
|
||||
{
|
||||
Uint32 result;
|
||||
|
||||
__asm__("rlwimi %0,%2,24,16,23": "=&r"(result): "0" (x>>24), "r"(x));
|
||||
__asm__("rlwimi %0,%2,8,8,15" : "=&r"(result): "0" (result), "r"(x));
|
||||
__asm__("rlwimi %0,%2,24,0,7" : "=&r"(result): "0" (result), "r"(x));
|
||||
return result;
|
||||
}
|
||||
#elif (defined(__m68k__) && !defined(__mcoldfire__))
|
||||
SDL_FORCE_INLINE Uint32
|
||||
SDL_Swap32(Uint32 x)
|
||||
{
|
||||
__asm__("rorw #8,%0\n\tswap %0\n\trorw #8,%0": "=d"(x): "0"(x):"cc");
|
||||
return x;
|
||||
}
|
||||
#elif defined(__WATCOMC__) && defined(__386__)
|
||||
extern __inline Uint32 SDL_Swap32(Uint32);
|
||||
#pragma aux SDL_Swap32 = \
|
||||
"bswap eax" \
|
||||
parm [eax] \
|
||||
modify [eax];
|
||||
#else
|
||||
SDL_FORCE_INLINE Uint32
|
||||
SDL_Swap32(Uint32 x)
|
||||
{
|
||||
return SDL_static_cast(Uint32, ((x << 24) | ((x << 8) & 0x00FF0000) |
|
||||
((x >> 8) & 0x0000FF00) | (x >> 24)));
|
||||
}
|
||||
#endif
|
||||
|
||||
#if HAS_BUILTIN_BSWAP64
|
||||
#define SDL_Swap64(x) __builtin_bswap64(x)
|
||||
#elif defined(_MSC_VER) && (_MSC_VER >= 1400)
|
||||
#pragma intrinsic(_byteswap_uint64)
|
||||
#define SDL_Swap64(x) _byteswap_uint64(x)
|
||||
#elif defined(__i386__) && !HAS_BROKEN_BSWAP
|
||||
SDL_FORCE_INLINE Uint64
|
||||
SDL_Swap64(Uint64 x)
|
||||
{
|
||||
union {
|
||||
struct {
|
||||
Uint32 a, b;
|
||||
} s;
|
||||
Uint64 u;
|
||||
} v;
|
||||
v.u = x;
|
||||
__asm__("bswapl %0 ; bswapl %1 ; xchgl %0,%1"
|
||||
: "=r"(v.s.a), "=r"(v.s.b)
|
||||
: "0" (v.s.a), "1"(v.s.b));
|
||||
return v.u;
|
||||
}
|
||||
#elif defined(__x86_64__)
|
||||
SDL_FORCE_INLINE Uint64
|
||||
SDL_Swap64(Uint64 x)
|
||||
{
|
||||
__asm__("bswapq %0": "=r"(x):"0"(x));
|
||||
return x;
|
||||
}
|
||||
#elif defined(__WATCOMC__) && defined(__386__)
|
||||
extern __inline Uint64 SDL_Swap64(Uint64);
|
||||
#pragma aux SDL_Swap64 = \
|
||||
"bswap eax" \
|
||||
"bswap edx" \
|
||||
"xchg eax,edx" \
|
||||
parm [eax edx] \
|
||||
modify [eax edx];
|
||||
#else
|
||||
SDL_FORCE_INLINE Uint64
|
||||
SDL_Swap64(Uint64 x)
|
||||
{
|
||||
Uint32 hi, lo;
|
||||
|
||||
/* Separate into high and low 32-bit values and swap them */
|
||||
lo = SDL_static_cast(Uint32, x & 0xFFFFFFFF);
|
||||
x >>= 32;
|
||||
hi = SDL_static_cast(Uint32, x & 0xFFFFFFFF);
|
||||
x = SDL_Swap32(lo);
|
||||
x <<= 32;
|
||||
x |= SDL_Swap32(hi);
|
||||
return (x);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
SDL_FORCE_INLINE float
|
||||
SDL_SwapFloat(float x)
|
||||
{
|
||||
union {
|
||||
float f;
|
||||
Uint32 ui32;
|
||||
} swapper;
|
||||
swapper.f = x;
|
||||
swapper.ui32 = SDL_Swap32(swapper.ui32);
|
||||
return swapper.f;
|
||||
}
|
||||
|
||||
/* remove extra macros */
|
||||
#undef HAS_BROKEN_BSWAP
|
||||
#undef HAS_BUILTIN_BSWAP16
|
||||
#undef HAS_BUILTIN_BSWAP32
|
||||
#undef HAS_BUILTIN_BSWAP64
|
||||
|
||||
/**
|
||||
* \name Swap to native
|
||||
* Byteswap item from the specified endianness to the native endianness.
|
||||
*/
|
||||
/* @{ */
|
||||
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
|
||||
#define SDL_SwapLE16(X) (X)
|
||||
#define SDL_SwapLE32(X) (X)
|
||||
#define SDL_SwapLE64(X) (X)
|
||||
#define SDL_SwapFloatLE(X) (X)
|
||||
#define SDL_SwapBE16(X) SDL_Swap16(X)
|
||||
#define SDL_SwapBE32(X) SDL_Swap32(X)
|
||||
#define SDL_SwapBE64(X) SDL_Swap64(X)
|
||||
#define SDL_SwapFloatBE(X) SDL_SwapFloat(X)
|
||||
#else
|
||||
#define SDL_SwapLE16(X) SDL_Swap16(X)
|
||||
#define SDL_SwapLE32(X) SDL_Swap32(X)
|
||||
#define SDL_SwapLE64(X) SDL_Swap64(X)
|
||||
#define SDL_SwapFloatLE(X) SDL_SwapFloat(X)
|
||||
#define SDL_SwapBE16(X) (X)
|
||||
#define SDL_SwapBE32(X) (X)
|
||||
#define SDL_SwapBE64(X) (X)
|
||||
#define SDL_SwapFloatBE(X) (X)
|
||||
#endif
|
||||
/* @} *//* Swap to native */
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include <SDL2/close_code.h>
|
||||
|
||||
#endif /* SDL_endian_h_ */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
@@ -0,0 +1,163 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file SDL_error.h
|
||||
*
|
||||
* Simple error message routines for SDL.
|
||||
*/
|
||||
|
||||
#ifndef SDL_error_h_
|
||||
#define SDL_error_h_
|
||||
|
||||
#include <SDL2/SDL_stdinc.h>
|
||||
|
||||
#include <SDL2/begin_code.h>
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Public functions */
|
||||
|
||||
|
||||
/**
|
||||
* Set the SDL error message for the current thread.
|
||||
*
|
||||
* Calling this function will replace any previous error message that was set.
|
||||
*
|
||||
* This function always returns -1, since SDL frequently uses -1 to signify an
|
||||
* failing result, leading to this idiom:
|
||||
*
|
||||
* ```c
|
||||
* if (error_code) {
|
||||
* return SDL_SetError("This operation has failed: %d", error_code);
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* \param fmt a printf()-style message format string
|
||||
* \param ... additional parameters matching % tokens in the `fmt` string, if
|
||||
* any
|
||||
* \returns always -1.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_ClearError
|
||||
* \sa SDL_GetError
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1);
|
||||
|
||||
/**
|
||||
* Retrieve a message about the last error that occurred on the current
|
||||
* thread.
|
||||
*
|
||||
* It is possible for multiple errors to occur before calling SDL_GetError().
|
||||
* Only the last error is returned.
|
||||
*
|
||||
* The message is only applicable when an SDL function has signaled an error.
|
||||
* You must check the return values of SDL function calls to determine when to
|
||||
* appropriately call SDL_GetError(). You should *not* use the results of
|
||||
* SDL_GetError() to decide if an error has occurred! Sometimes SDL will set
|
||||
* an error string even when reporting success.
|
||||
*
|
||||
* SDL will *not* clear the error string for successful API calls. You *must*
|
||||
* check return values for failure cases before you can assume the error
|
||||
* string applies.
|
||||
*
|
||||
* Error strings are set per-thread, so an error set in a different thread
|
||||
* will not interfere with the current thread's operation.
|
||||
*
|
||||
* The returned string is internally allocated and must not be freed by the
|
||||
* application.
|
||||
*
|
||||
* \returns a message with information about the specific error that occurred,
|
||||
* or an empty string if there hasn't been an error message set since
|
||||
* the last call to SDL_ClearError(). The message is only applicable
|
||||
* when an SDL function has signaled an error. You must check the
|
||||
* return values of SDL function calls to determine when to
|
||||
* appropriately call SDL_GetError().
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_ClearError
|
||||
* \sa SDL_SetError
|
||||
*/
|
||||
extern DECLSPEC const char *SDLCALL SDL_GetError(void);
|
||||
|
||||
/**
|
||||
* Get the last error message that was set for the current thread.
|
||||
*
|
||||
* This allows the caller to copy the error string into a provided buffer, but
|
||||
* otherwise operates exactly the same as SDL_GetError().
|
||||
*
|
||||
* \param errstr A buffer to fill with the last error message that was set for
|
||||
* the current thread
|
||||
* \param maxlen The size of the buffer pointed to by the errstr parameter
|
||||
* \returns the pointer passed in as the `errstr` parameter.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.14.
|
||||
*
|
||||
* \sa SDL_GetError
|
||||
*/
|
||||
extern DECLSPEC char * SDLCALL SDL_GetErrorMsg(char *errstr, int maxlen);
|
||||
|
||||
/**
|
||||
* Clear any previous error message for this thread.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_GetError
|
||||
* \sa SDL_SetError
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_ClearError(void);
|
||||
|
||||
/**
|
||||
* \name Internal error functions
|
||||
*
|
||||
* \internal
|
||||
* Private error reporting function - used internally.
|
||||
*/
|
||||
/* @{ */
|
||||
#define SDL_OutOfMemory() SDL_Error(SDL_ENOMEM)
|
||||
#define SDL_Unsupported() SDL_Error(SDL_UNSUPPORTED)
|
||||
#define SDL_InvalidParamError(param) SDL_SetError("Parameter '%s' is invalid", (param))
|
||||
typedef enum
|
||||
{
|
||||
SDL_ENOMEM,
|
||||
SDL_EFREAD,
|
||||
SDL_EFWRITE,
|
||||
SDL_EFSEEK,
|
||||
SDL_UNSUPPORTED,
|
||||
SDL_LASTERROR
|
||||
} SDL_errorcode;
|
||||
/* SDL_Error() unconditionally returns -1. */
|
||||
extern DECLSPEC int SDLCALL SDL_Error(SDL_errorcode code);
|
||||
/* @} *//* Internal error functions */
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include <SDL2/close_code.h>
|
||||
|
||||
#endif /* SDL_error_h_ */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,145 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file SDL_filesystem.h
|
||||
*
|
||||
* \brief Include file for filesystem SDL API functions
|
||||
*/
|
||||
|
||||
#ifndef SDL_filesystem_h_
|
||||
#define SDL_filesystem_h_
|
||||
|
||||
#include <SDL2/SDL_stdinc.h>
|
||||
|
||||
#include <SDL2/begin_code.h>
|
||||
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Get the directory where the application was run from.
|
||||
*
|
||||
* This is not necessarily a fast call, so you should call this once near
|
||||
* startup and save the string if you need it.
|
||||
*
|
||||
* **Mac OS X and iOS Specific Functionality**: If the application is in a
|
||||
* ".app" bundle, this function returns the Resource directory (e.g.
|
||||
* MyApp.app/Contents/Resources/). This behaviour can be overridden by adding
|
||||
* a property to the Info.plist file. Adding a string key with the name
|
||||
* SDL_FILESYSTEM_BASE_DIR_TYPE with a supported value will change the
|
||||
* behaviour.
|
||||
*
|
||||
* Supported values for the SDL_FILESYSTEM_BASE_DIR_TYPE property (Given an
|
||||
* application in /Applications/SDLApp/MyApp.app):
|
||||
*
|
||||
* - `resource`: bundle resource directory (the default). For example:
|
||||
* `/Applications/SDLApp/MyApp.app/Contents/Resources`
|
||||
* - `bundle`: the Bundle directory. For example:
|
||||
* `/Applications/SDLApp/MyApp.app/`
|
||||
* - `parent`: the containing directory of the bundle. For example:
|
||||
* `/Applications/SDLApp/`
|
||||
*
|
||||
* The returned path is guaranteed to end with a path separator ('\' on
|
||||
* Windows, '/' on most other platforms).
|
||||
*
|
||||
* The pointer returned is owned by the caller. Please call SDL_free() on the
|
||||
* pointer when done with it.
|
||||
*
|
||||
* \returns an absolute path in UTF-8 encoding to the application data
|
||||
* directory. NULL will be returned on error or when the platform
|
||||
* doesn't implement this functionality, call SDL_GetError() for more
|
||||
* information.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.1.
|
||||
*
|
||||
* \sa SDL_GetPrefPath
|
||||
*/
|
||||
extern DECLSPEC char *SDLCALL SDL_GetBasePath(void);
|
||||
|
||||
/**
|
||||
* Get the user-and-app-specific path where files can be written.
|
||||
*
|
||||
* Get the "pref dir". This is meant to be where users can write personal
|
||||
* files (preferences and save games, etc) that are specific to your
|
||||
* application. This directory is unique per user, per application.
|
||||
*
|
||||
* This function will decide the appropriate location in the native
|
||||
* filesystem, create the directory if necessary, and return a string of the
|
||||
* absolute path to the directory in UTF-8 encoding.
|
||||
*
|
||||
* On Windows, the string might look like:
|
||||
*
|
||||
* `C:\\Users\\bob\\AppData\\Roaming\\My Company\\My Program Name\\`
|
||||
*
|
||||
* On Linux, the string might look like"
|
||||
*
|
||||
* `/home/bob/.local/share/My Program Name/`
|
||||
*
|
||||
* On Mac OS X, the string might look like:
|
||||
*
|
||||
* `/Users/bob/Library/Application Support/My Program Name/`
|
||||
*
|
||||
* You should assume the path returned by this function is the only safe place
|
||||
* to write files (and that SDL_GetBasePath(), while it might be writable, or
|
||||
* even the parent of the returned path, isn't where you should be writing
|
||||
* things).
|
||||
*
|
||||
* Both the org and app strings may become part of a directory name, so please
|
||||
* follow these rules:
|
||||
*
|
||||
* - Try to use the same org string (_including case-sensitivity_) for all
|
||||
* your applications that use this function.
|
||||
* - Always use a unique app string for each one, and make sure it never
|
||||
* changes for an app once you've decided on it.
|
||||
* - Unicode characters are legal, as long as it's UTF-8 encoded, but...
|
||||
* - ...only use letters, numbers, and spaces. Avoid punctuation like "Game
|
||||
* Name 2: Bad Guy's Revenge!" ... "Game Name 2" is sufficient.
|
||||
*
|
||||
* The returned path is guaranteed to end with a path separator ('\' on
|
||||
* Windows, '/' on most other platforms).
|
||||
*
|
||||
* The pointer returned is owned by the caller. Please call SDL_free() on the
|
||||
* pointer when done with it.
|
||||
*
|
||||
* \param org the name of your organization
|
||||
* \param app the name of your application
|
||||
* \returns a UTF-8 string of the user directory in platform-dependent
|
||||
* notation. NULL if there's a problem (creating directory failed,
|
||||
* etc.).
|
||||
*
|
||||
* \since This function is available since SDL 2.0.1.
|
||||
*
|
||||
* \sa SDL_GetBasePath
|
||||
*/
|
||||
extern DECLSPEC char *SDLCALL SDL_GetPrefPath(const char *org, const char *app);
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include <SDL2/close_code.h>
|
||||
|
||||
#endif /* SDL_filesystem_h_ */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,117 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file SDL_gesture.h
|
||||
*
|
||||
* Include file for SDL gesture event handling.
|
||||
*/
|
||||
|
||||
#ifndef SDL_gesture_h_
|
||||
#define SDL_gesture_h_
|
||||
|
||||
#include <SDL2/SDL_stdinc.h>
|
||||
#include <SDL2/SDL_error.h>
|
||||
#include <SDL2/SDL_video.h>
|
||||
|
||||
#include <SDL2/SDL_touch.h>
|
||||
|
||||
|
||||
#include <SDL2/begin_code.h>
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef Sint64 SDL_GestureID;
|
||||
|
||||
/* Function prototypes */
|
||||
|
||||
/**
|
||||
* Begin recording a gesture on a specified touch device or all touch devices.
|
||||
*
|
||||
* If the parameter `touchId` is -1 (i.e., all devices), this function will
|
||||
* always return 1, regardless of whether there actually are any devices.
|
||||
*
|
||||
* \param touchId the touch device id, or -1 for all touch devices
|
||||
* \returns 1 on success or 0 if the specified device could not be found.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_GetTouchDevice
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_RecordGesture(SDL_TouchID touchId);
|
||||
|
||||
|
||||
/**
|
||||
* Save all currently loaded Dollar Gesture templates.
|
||||
*
|
||||
* \param dst a SDL_RWops to save to
|
||||
* \returns the number of saved templates on success or 0 on failure; call
|
||||
* SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_LoadDollarTemplates
|
||||
* \sa SDL_SaveDollarTemplate
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SaveAllDollarTemplates(SDL_RWops *dst);
|
||||
|
||||
/**
|
||||
* Save a currently loaded Dollar Gesture template.
|
||||
*
|
||||
* \param gestureId a gesture id
|
||||
* \param dst a SDL_RWops to save to
|
||||
* \returns 1 on success or 0 on failure; call SDL_GetError() for more
|
||||
* information.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_LoadDollarTemplates
|
||||
* \sa SDL_SaveAllDollarTemplates
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SaveDollarTemplate(SDL_GestureID gestureId,SDL_RWops *dst);
|
||||
|
||||
|
||||
/**
|
||||
* Load Dollar Gesture templates from a file.
|
||||
*
|
||||
* \param touchId a touch id
|
||||
* \param src a SDL_RWops to load from
|
||||
* \returns the number of loaded templates on success or a negative error code
|
||||
* (or 0) on failure; call SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_SaveAllDollarTemplates
|
||||
* \sa SDL_SaveDollarTemplate
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_LoadDollarTemplates(SDL_TouchID touchId, SDL_RWops *src);
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include <SDL2/close_code.h>
|
||||
|
||||
#endif /* SDL_gesture_h_ */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,451 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file SDL_hidapi.h
|
||||
*
|
||||
* Header file for SDL HIDAPI functions.
|
||||
*
|
||||
* This is an adaptation of the original HIDAPI interface by Alan Ott,
|
||||
* and includes source code licensed under the following BSD license:
|
||||
*
|
||||
Copyright (c) 2010, Alan Ott, Signal 11 Software
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Signal 11 Software nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* If you would like a version of SDL without this code, you can build SDL
|
||||
* with SDL_HIDAPI_DISABLED defined to 1. You might want to do this for example
|
||||
* on iOS or tvOS to avoid a dependency on the CoreBluetooth framework.
|
||||
*/
|
||||
|
||||
#ifndef SDL_hidapi_h_
|
||||
#define SDL_hidapi_h_
|
||||
|
||||
#include <SDL2/SDL_stdinc.h>
|
||||
|
||||
#include <SDL2/begin_code.h>
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief A handle representing an open HID device
|
||||
*/
|
||||
struct SDL_hid_device_;
|
||||
typedef struct SDL_hid_device_ SDL_hid_device; /**< opaque hidapi structure */
|
||||
|
||||
/** hidapi info structure */
|
||||
/**
|
||||
* \brief Information about a connected HID device
|
||||
*/
|
||||
typedef struct SDL_hid_device_info
|
||||
{
|
||||
/** Platform-specific device path */
|
||||
char *path;
|
||||
/** Device Vendor ID */
|
||||
unsigned short vendor_id;
|
||||
/** Device Product ID */
|
||||
unsigned short product_id;
|
||||
/** Serial Number */
|
||||
wchar_t *serial_number;
|
||||
/** Device Release Number in binary-coded decimal,
|
||||
also known as Device Version Number */
|
||||
unsigned short release_number;
|
||||
/** Manufacturer String */
|
||||
wchar_t *manufacturer_string;
|
||||
/** Product string */
|
||||
wchar_t *product_string;
|
||||
/** Usage Page for this Device/Interface
|
||||
(Windows/Mac only). */
|
||||
unsigned short usage_page;
|
||||
/** Usage for this Device/Interface
|
||||
(Windows/Mac only).*/
|
||||
unsigned short usage;
|
||||
/** The USB interface which this logical device
|
||||
represents.
|
||||
|
||||
* Valid on both Linux implementations in all cases.
|
||||
* Valid on the Windows implementation only if the device
|
||||
contains more than one interface. */
|
||||
int interface_number;
|
||||
|
||||
/** Additional information about the USB interface.
|
||||
Valid on libusb and Android implementations. */
|
||||
int interface_class;
|
||||
int interface_subclass;
|
||||
int interface_protocol;
|
||||
|
||||
/** Pointer to the next device */
|
||||
struct SDL_hid_device_info *next;
|
||||
} SDL_hid_device_info;
|
||||
|
||||
|
||||
/**
|
||||
* Initialize the HIDAPI library.
|
||||
*
|
||||
* This function initializes the HIDAPI library. Calling it is not strictly
|
||||
* necessary, as it will be called automatically by SDL_hid_enumerate() and
|
||||
* any of the SDL_hid_open_*() functions if it is needed. This function should
|
||||
* be called at the beginning of execution however, if there is a chance of
|
||||
* HIDAPI handles being opened by different threads simultaneously.
|
||||
*
|
||||
* Each call to this function should have a matching call to SDL_hid_exit()
|
||||
*
|
||||
* \returns 0 on success and -1 on error.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.18.
|
||||
*
|
||||
* \sa SDL_hid_exit
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_hid_init(void);
|
||||
|
||||
/**
|
||||
* Finalize the HIDAPI library.
|
||||
*
|
||||
* This function frees all of the static data associated with HIDAPI. It
|
||||
* should be called at the end of execution to avoid memory leaks.
|
||||
*
|
||||
* \returns 0 on success and -1 on error.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.18.
|
||||
*
|
||||
* \sa SDL_hid_init
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_hid_exit(void);
|
||||
|
||||
/**
|
||||
* Check to see if devices may have been added or removed.
|
||||
*
|
||||
* Enumerating the HID devices is an expensive operation, so you can call this
|
||||
* to see if there have been any system device changes since the last call to
|
||||
* this function. A change in the counter returned doesn't necessarily mean
|
||||
* that anything has changed, but you can call SDL_hid_enumerate() to get an
|
||||
* updated device list.
|
||||
*
|
||||
* Calling this function for the first time may cause a thread or other system
|
||||
* resource to be allocated to track device change notifications.
|
||||
*
|
||||
* \returns a change counter that is incremented with each potential device
|
||||
* change, or 0 if device change detection isn't available.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.18.
|
||||
*
|
||||
* \sa SDL_hid_enumerate
|
||||
*/
|
||||
extern DECLSPEC Uint32 SDLCALL SDL_hid_device_change_count(void);
|
||||
|
||||
/**
|
||||
* Enumerate the HID Devices.
|
||||
*
|
||||
* This function returns a linked list of all the HID devices attached to the
|
||||
* system which match vendor_id and product_id. If `vendor_id` is set to 0
|
||||
* then any vendor matches. If `product_id` is set to 0 then any product
|
||||
* matches. If `vendor_id` and `product_id` are both set to 0, then all HID
|
||||
* devices will be returned.
|
||||
*
|
||||
* \param vendor_id The Vendor ID (VID) of the types of device to open.
|
||||
* \param product_id The Product ID (PID) of the types of device to open.
|
||||
* \returns a pointer to a linked list of type SDL_hid_device_info, containing
|
||||
* information about the HID devices attached to the system, or NULL
|
||||
* in the case of failure. Free this linked list by calling
|
||||
* SDL_hid_free_enumeration().
|
||||
*
|
||||
* \since This function is available since SDL 2.0.18.
|
||||
*
|
||||
* \sa SDL_hid_device_change_count
|
||||
*/
|
||||
extern DECLSPEC SDL_hid_device_info * SDLCALL SDL_hid_enumerate(unsigned short vendor_id, unsigned short product_id);
|
||||
|
||||
/**
|
||||
* Free an enumeration Linked List
|
||||
*
|
||||
* This function frees a linked list created by SDL_hid_enumerate().
|
||||
*
|
||||
* \param devs Pointer to a list of struct_device returned from
|
||||
* SDL_hid_enumerate().
|
||||
*
|
||||
* \since This function is available since SDL 2.0.18.
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_hid_free_enumeration(SDL_hid_device_info *devs);
|
||||
|
||||
/**
|
||||
* Open a HID device using a Vendor ID (VID), Product ID (PID) and optionally
|
||||
* a serial number.
|
||||
*
|
||||
* If `serial_number` is NULL, the first device with the specified VID and PID
|
||||
* is opened.
|
||||
*
|
||||
* \param vendor_id The Vendor ID (VID) of the device to open.
|
||||
* \param product_id The Product ID (PID) of the device to open.
|
||||
* \param serial_number The Serial Number of the device to open (Optionally
|
||||
* NULL).
|
||||
* \returns a pointer to a SDL_hid_device object on success or NULL on
|
||||
* failure.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.18.
|
||||
*/
|
||||
extern DECLSPEC SDL_hid_device * SDLCALL SDL_hid_open(unsigned short vendor_id, unsigned short product_id, const wchar_t *serial_number);
|
||||
|
||||
/**
|
||||
* Open a HID device by its path name.
|
||||
*
|
||||
* The path name be determined by calling SDL_hid_enumerate(), or a
|
||||
* platform-specific path name can be used (eg: /dev/hidraw0 on Linux).
|
||||
*
|
||||
* \param path The path name of the device to open
|
||||
* \returns a pointer to a SDL_hid_device object on success or NULL on
|
||||
* failure.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.18.
|
||||
*/
|
||||
extern DECLSPEC SDL_hid_device * SDLCALL SDL_hid_open_path(const char *path, int bExclusive /* = false */);
|
||||
|
||||
/**
|
||||
* Write an Output report to a HID device.
|
||||
*
|
||||
* The first byte of `data` must contain the Report ID. For devices which only
|
||||
* support a single report, this must be set to 0x0. The remaining bytes
|
||||
* contain the report data. Since the Report ID is mandatory, calls to
|
||||
* SDL_hid_write() will always contain one more byte than the report contains.
|
||||
* For example, if a hid report is 16 bytes long, 17 bytes must be passed to
|
||||
* SDL_hid_write(), the Report ID (or 0x0, for devices with a single report),
|
||||
* followed by the report data (16 bytes). In this example, the length passed
|
||||
* in would be 17.
|
||||
*
|
||||
* SDL_hid_write() will send the data on the first OUT endpoint, if one
|
||||
* exists. If it does not, it will send the data through the Control Endpoint
|
||||
* (Endpoint 0).
|
||||
*
|
||||
* \param dev A device handle returned from SDL_hid_open().
|
||||
* \param data The data to send, including the report number as the first
|
||||
* byte.
|
||||
* \param length The length in bytes of the data to send.
|
||||
* \returns the actual number of bytes written and -1 on error.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.18.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_hid_write(SDL_hid_device *dev, const unsigned char *data, size_t length);
|
||||
|
||||
/**
|
||||
* Read an Input report from a HID device with timeout.
|
||||
*
|
||||
* Input reports are returned to the host through the INTERRUPT IN endpoint.
|
||||
* The first byte will contain the Report number if the device uses numbered
|
||||
* reports.
|
||||
*
|
||||
* \param dev A device handle returned from SDL_hid_open().
|
||||
* \param data A buffer to put the read data into.
|
||||
* \param length The number of bytes to read. For devices with multiple
|
||||
* reports, make sure to read an extra byte for the report
|
||||
* number.
|
||||
* \param milliseconds timeout in milliseconds or -1 for blocking wait.
|
||||
* \returns the actual number of bytes read and -1 on error. If no packet was
|
||||
* available to be read within the timeout period, this function
|
||||
* returns 0.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.18.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_hid_read_timeout(SDL_hid_device *dev, unsigned char *data, size_t length, int milliseconds);
|
||||
|
||||
/**
|
||||
* Read an Input report from a HID device.
|
||||
*
|
||||
* Input reports are returned to the host through the INTERRUPT IN endpoint.
|
||||
* The first byte will contain the Report number if the device uses numbered
|
||||
* reports.
|
||||
*
|
||||
* \param dev A device handle returned from SDL_hid_open().
|
||||
* \param data A buffer to put the read data into.
|
||||
* \param length The number of bytes to read. For devices with multiple
|
||||
* reports, make sure to read an extra byte for the report
|
||||
* number.
|
||||
* \returns the actual number of bytes read and -1 on error. If no packet was
|
||||
* available to be read and the handle is in non-blocking mode, this
|
||||
* function returns 0.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.18.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_hid_read(SDL_hid_device *dev, unsigned char *data, size_t length);
|
||||
|
||||
/**
|
||||
* Set the device handle to be non-blocking.
|
||||
*
|
||||
* In non-blocking mode calls to SDL_hid_read() will return immediately with a
|
||||
* value of 0 if there is no data to be read. In blocking mode, SDL_hid_read()
|
||||
* will wait (block) until there is data to read before returning.
|
||||
*
|
||||
* Nonblocking can be turned on and off at any time.
|
||||
*
|
||||
* \param dev A device handle returned from SDL_hid_open().
|
||||
* \param nonblock enable or not the nonblocking reads - 1 to enable
|
||||
* nonblocking - 0 to disable nonblocking.
|
||||
* \returns 0 on success and -1 on error.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.18.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_hid_set_nonblocking(SDL_hid_device *dev, int nonblock);
|
||||
|
||||
/**
|
||||
* Send a Feature report to the device.
|
||||
*
|
||||
* Feature reports are sent over the Control endpoint as a Set_Report
|
||||
* transfer. The first byte of `data` must contain the Report ID. For devices
|
||||
* which only support a single report, this must be set to 0x0. The remaining
|
||||
* bytes contain the report data. Since the Report ID is mandatory, calls to
|
||||
* SDL_hid_send_feature_report() will always contain one more byte than the
|
||||
* report contains. For example, if a hid report is 16 bytes long, 17 bytes
|
||||
* must be passed to SDL_hid_send_feature_report(): the Report ID (or 0x0, for
|
||||
* devices which do not use numbered reports), followed by the report data (16
|
||||
* bytes). In this example, the length passed in would be 17.
|
||||
*
|
||||
* \param dev A device handle returned from SDL_hid_open().
|
||||
* \param data The data to send, including the report number as the first
|
||||
* byte.
|
||||
* \param length The length in bytes of the data to send, including the report
|
||||
* number.
|
||||
* \returns the actual number of bytes written and -1 on error.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.18.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_hid_send_feature_report(SDL_hid_device *dev, const unsigned char *data, size_t length);
|
||||
|
||||
/**
|
||||
* Get a feature report from a HID device.
|
||||
*
|
||||
* Set the first byte of `data` to the Report ID of the report to be read.
|
||||
* Make sure to allow space for this extra byte in `data`. Upon return, the
|
||||
* first byte will still contain the Report ID, and the report data will start
|
||||
* in data[1].
|
||||
*
|
||||
* \param dev A device handle returned from SDL_hid_open().
|
||||
* \param data A buffer to put the read data into, including the Report ID.
|
||||
* Set the first byte of `data` to the Report ID of the report to
|
||||
* be read, or set it to zero if your device does not use numbered
|
||||
* reports.
|
||||
* \param length The number of bytes to read, including an extra byte for the
|
||||
* report ID. The buffer can be longer than the actual report.
|
||||
* \returns the number of bytes read plus one for the report ID (which is
|
||||
* still in the first byte), or -1 on error.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.18.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_hid_get_feature_report(SDL_hid_device *dev, unsigned char *data, size_t length);
|
||||
|
||||
/**
|
||||
* Close a HID device.
|
||||
*
|
||||
* \param dev A device handle returned from SDL_hid_open().
|
||||
*
|
||||
* \since This function is available since SDL 2.0.18.
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_hid_close(SDL_hid_device *dev);
|
||||
|
||||
/**
|
||||
* Get The Manufacturer String from a HID device.
|
||||
*
|
||||
* \param dev A device handle returned from SDL_hid_open().
|
||||
* \param string A wide string buffer to put the data into.
|
||||
* \param maxlen The length of the buffer in multiples of wchar_t.
|
||||
* \returns 0 on success and -1 on error.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.18.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_hid_get_manufacturer_string(SDL_hid_device *dev, wchar_t *string, size_t maxlen);
|
||||
|
||||
/**
|
||||
* Get The Product String from a HID device.
|
||||
*
|
||||
* \param dev A device handle returned from SDL_hid_open().
|
||||
* \param string A wide string buffer to put the data into.
|
||||
* \param maxlen The length of the buffer in multiples of wchar_t.
|
||||
* \returns 0 on success and -1 on error.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.18.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_hid_get_product_string(SDL_hid_device *dev, wchar_t *string, size_t maxlen);
|
||||
|
||||
/**
|
||||
* Get The Serial Number String from a HID device.
|
||||
*
|
||||
* \param dev A device handle returned from SDL_hid_open().
|
||||
* \param string A wide string buffer to put the data into.
|
||||
* \param maxlen The length of the buffer in multiples of wchar_t.
|
||||
* \returns 0 on success and -1 on error.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.18.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_hid_get_serial_number_string(SDL_hid_device *dev, wchar_t *string, size_t maxlen);
|
||||
|
||||
/**
|
||||
* Get a string from a HID device, based on its string index.
|
||||
*
|
||||
* \param dev A device handle returned from SDL_hid_open().
|
||||
* \param string_index The index of the string to get.
|
||||
* \param string A wide string buffer to put the data into.
|
||||
* \param maxlen The length of the buffer in multiples of wchar_t.
|
||||
* \returns 0 on success and -1 on error.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.18.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_hid_get_indexed_string(SDL_hid_device *dev, int string_index, wchar_t *string, size_t maxlen);
|
||||
|
||||
/**
|
||||
* Start or stop a BLE scan on iOS and tvOS to pair Steam Controllers
|
||||
*
|
||||
* \param active SDL_TRUE to start the scan, SDL_FALSE to stop the scan
|
||||
*
|
||||
* \since This function is available since SDL 2.0.18.
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_hid_ble_scan(SDL_bool active);
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include <SDL2/close_code.h>
|
||||
|
||||
#endif /* SDL_hidapi_h_ */
|
||||
|
||||
/* vi: set sts=4 ts=4 sw=4 expandtab: */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,946 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file SDL_joystick.h
|
||||
*
|
||||
* Include file for SDL joystick event handling
|
||||
*
|
||||
* The term "device_index" identifies currently plugged in joystick devices between 0 and SDL_NumJoysticks(), with the exact joystick
|
||||
* behind a device_index changing as joysticks are plugged and unplugged.
|
||||
*
|
||||
* The term "instance_id" is the current instantiation of a joystick device in the system, if the joystick is removed and then re-inserted
|
||||
* then it will get a new instance_id, instance_id's are monotonically increasing identifiers of a joystick plugged in.
|
||||
*
|
||||
* The term "player_index" is the number assigned to a player on a specific
|
||||
* controller. For XInput controllers this returns the XInput user index.
|
||||
* Many joysticks will not be able to supply this information.
|
||||
*
|
||||
* The term JoystickGUID is a stable 128-bit identifier for a joystick device that does not change over time, it identifies class of
|
||||
* the device (a X360 wired controller for example). This identifier is platform dependent.
|
||||
*/
|
||||
|
||||
#ifndef SDL_joystick_h_
|
||||
#define SDL_joystick_h_
|
||||
|
||||
#include <SDL2/SDL_stdinc.h>
|
||||
#include <SDL2/SDL_error.h>
|
||||
|
||||
#include <SDL2/begin_code.h>
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \file SDL_joystick.h
|
||||
*
|
||||
* In order to use these functions, SDL_Init() must have been called
|
||||
* with the ::SDL_INIT_JOYSTICK flag. This causes SDL to scan the system
|
||||
* for joysticks, and load appropriate drivers.
|
||||
*
|
||||
* If you would like to receive joystick updates while the application
|
||||
* is in the background, you should set the following hint before calling
|
||||
* SDL_Init(): SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS
|
||||
*/
|
||||
|
||||
/**
|
||||
* The joystick structure used to identify an SDL joystick
|
||||
*/
|
||||
struct _SDL_Joystick;
|
||||
typedef struct _SDL_Joystick SDL_Joystick;
|
||||
|
||||
/* A structure that encodes the stable unique id for a joystick device */
|
||||
typedef struct {
|
||||
Uint8 data[16];
|
||||
} SDL_JoystickGUID;
|
||||
|
||||
/**
|
||||
* This is a unique ID for a joystick for the time it is connected to the system,
|
||||
* and is never reused for the lifetime of the application. If the joystick is
|
||||
* disconnected and reconnected, it will get a new ID.
|
||||
*
|
||||
* The ID value starts at 0 and increments from there. The value -1 is an invalid ID.
|
||||
*/
|
||||
typedef Sint32 SDL_JoystickID;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SDL_JOYSTICK_TYPE_UNKNOWN,
|
||||
SDL_JOYSTICK_TYPE_GAMECONTROLLER,
|
||||
SDL_JOYSTICK_TYPE_WHEEL,
|
||||
SDL_JOYSTICK_TYPE_ARCADE_STICK,
|
||||
SDL_JOYSTICK_TYPE_FLIGHT_STICK,
|
||||
SDL_JOYSTICK_TYPE_DANCE_PAD,
|
||||
SDL_JOYSTICK_TYPE_GUITAR,
|
||||
SDL_JOYSTICK_TYPE_DRUM_KIT,
|
||||
SDL_JOYSTICK_TYPE_ARCADE_PAD,
|
||||
SDL_JOYSTICK_TYPE_THROTTLE
|
||||
} SDL_JoystickType;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SDL_JOYSTICK_POWER_UNKNOWN = -1,
|
||||
SDL_JOYSTICK_POWER_EMPTY, /* <= 5% */
|
||||
SDL_JOYSTICK_POWER_LOW, /* <= 20% */
|
||||
SDL_JOYSTICK_POWER_MEDIUM, /* <= 70% */
|
||||
SDL_JOYSTICK_POWER_FULL, /* <= 100% */
|
||||
SDL_JOYSTICK_POWER_WIRED,
|
||||
SDL_JOYSTICK_POWER_MAX
|
||||
} SDL_JoystickPowerLevel;
|
||||
|
||||
/* Set max recognized G-force from accelerometer
|
||||
See src/joystick/uikit/SDL_sysjoystick.m for notes on why this is needed
|
||||
*/
|
||||
#define SDL_IPHONE_MAX_GFORCE 5.0
|
||||
|
||||
|
||||
/* Function prototypes */
|
||||
|
||||
/**
|
||||
* Locking for multi-threaded access to the joystick API
|
||||
*
|
||||
* If you are using the joystick API or handling events from multiple threads
|
||||
* you should use these locking functions to protect access to the joysticks.
|
||||
*
|
||||
* In particular, you are guaranteed that the joystick list won't change, so
|
||||
* the API functions that take a joystick index will be valid, and joystick
|
||||
* and game controller events will not be delivered.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.7.
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_LockJoysticks(void);
|
||||
|
||||
|
||||
/**
|
||||
* Unlocking for multi-threaded access to the joystick API
|
||||
*
|
||||
* If you are using the joystick API or handling events from multiple threads
|
||||
* you should use these locking functions to protect access to the joysticks.
|
||||
*
|
||||
* In particular, you are guaranteed that the joystick list won't change, so
|
||||
* the API functions that take a joystick index will be valid, and joystick
|
||||
* and game controller events will not be delivered.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.7.
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_UnlockJoysticks(void);
|
||||
|
||||
/**
|
||||
* Count the number of joysticks attached to the system.
|
||||
*
|
||||
* \returns the number of attached joysticks on success or a negative error
|
||||
* code on failure; call SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_JoystickName
|
||||
* \sa SDL_JoystickOpen
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_NumJoysticks(void);
|
||||
|
||||
/**
|
||||
* Get the implementation dependent name of a joystick.
|
||||
*
|
||||
* This can be called before any joysticks are opened.
|
||||
*
|
||||
* \param device_index the index of the joystick to query (the N'th joystick
|
||||
* on the system)
|
||||
* \returns the name of the selected joystick. If no name can be found, this
|
||||
* function returns NULL; call SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_JoystickName
|
||||
* \sa SDL_JoystickOpen
|
||||
*/
|
||||
extern DECLSPEC const char *SDLCALL SDL_JoystickNameForIndex(int device_index);
|
||||
|
||||
/**
|
||||
* Get the player index of a joystick, or -1 if it's not available This can be
|
||||
* called before any joysticks are opened.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.9.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_JoystickGetDevicePlayerIndex(int device_index);
|
||||
|
||||
/**
|
||||
* Get the implementation-dependent GUID for the joystick at a given device
|
||||
* index.
|
||||
*
|
||||
* This function can be called before any joysticks are opened.
|
||||
*
|
||||
* \param device_index the index of the joystick to query (the N'th joystick
|
||||
* on the system
|
||||
* \returns the GUID of the selected joystick. If called on an invalid index,
|
||||
* this function returns a zero GUID
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_JoystickGetGUID
|
||||
* \sa SDL_JoystickGetGUIDString
|
||||
*/
|
||||
extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetDeviceGUID(int device_index);
|
||||
|
||||
/**
|
||||
* Get the USB vendor ID of a joystick, if available.
|
||||
*
|
||||
* This can be called before any joysticks are opened. If the vendor ID isn't
|
||||
* available this function returns 0.
|
||||
*
|
||||
* \param device_index the index of the joystick to query (the N'th joystick
|
||||
* on the system
|
||||
* \returns the USB vendor ID of the selected joystick. If called on an
|
||||
* invalid index, this function returns zero
|
||||
*
|
||||
* \since This function is available since SDL 2.0.6.
|
||||
*/
|
||||
extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceVendor(int device_index);
|
||||
|
||||
/**
|
||||
* Get the USB product ID of a joystick, if available.
|
||||
*
|
||||
* This can be called before any joysticks are opened. If the product ID isn't
|
||||
* available this function returns 0.
|
||||
*
|
||||
* \param device_index the index of the joystick to query (the N'th joystick
|
||||
* on the system
|
||||
* \returns the USB product ID of the selected joystick. If called on an
|
||||
* invalid index, this function returns zero
|
||||
*
|
||||
* \since This function is available since SDL 2.0.6.
|
||||
*/
|
||||
extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceProduct(int device_index);
|
||||
|
||||
/**
|
||||
* Get the product version of a joystick, if available.
|
||||
*
|
||||
* This can be called before any joysticks are opened. If the product version
|
||||
* isn't available this function returns 0.
|
||||
*
|
||||
* \param device_index the index of the joystick to query (the N'th joystick
|
||||
* on the system
|
||||
* \returns the product version of the selected joystick. If called on an
|
||||
* invalid index, this function returns zero
|
||||
*
|
||||
* \since This function is available since SDL 2.0.6.
|
||||
*/
|
||||
extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceProductVersion(int device_index);
|
||||
|
||||
/**
|
||||
* Get the type of a joystick, if available.
|
||||
*
|
||||
* This can be called before any joysticks are opened.
|
||||
*
|
||||
* \param device_index the index of the joystick to query (the N'th joystick
|
||||
* on the system
|
||||
* \returns the SDL_JoystickType of the selected joystick. If called on an
|
||||
* invalid index, this function returns `SDL_JOYSTICK_TYPE_UNKNOWN`
|
||||
*
|
||||
* \since This function is available since SDL 2.0.6.
|
||||
*/
|
||||
extern DECLSPEC SDL_JoystickType SDLCALL SDL_JoystickGetDeviceType(int device_index);
|
||||
|
||||
/**
|
||||
* Get the instance ID of a joystick.
|
||||
*
|
||||
* This can be called before any joysticks are opened. If the index is out of
|
||||
* range, this function will return -1.
|
||||
*
|
||||
* \param device_index the index of the joystick to query (the N'th joystick
|
||||
* on the system
|
||||
* \returns the instance id of the selected joystick. If called on an invalid
|
||||
* index, this function returns zero
|
||||
*
|
||||
* \since This function is available since SDL 2.0.6.
|
||||
*/
|
||||
extern DECLSPEC SDL_JoystickID SDLCALL SDL_JoystickGetDeviceInstanceID(int device_index);
|
||||
|
||||
/**
|
||||
* Open a joystick for use.
|
||||
*
|
||||
* The `device_index` argument refers to the N'th joystick presently
|
||||
* recognized by SDL on the system. It is **NOT** the same as the instance ID
|
||||
* used to identify the joystick in future events. See
|
||||
* SDL_JoystickInstanceID() for more details about instance IDs.
|
||||
*
|
||||
* The joystick subsystem must be initialized before a joystick can be opened
|
||||
* for use.
|
||||
*
|
||||
* \param device_index the index of the joystick to query
|
||||
* \returns a joystick identifier or NULL if an error occurred; call
|
||||
* SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_JoystickClose
|
||||
* \sa SDL_JoystickInstanceID
|
||||
*/
|
||||
extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickOpen(int device_index);
|
||||
|
||||
/**
|
||||
* Get the SDL_Joystick associated with an instance id.
|
||||
*
|
||||
* \param instance_id the instance id to get the SDL_Joystick for
|
||||
* \returns an SDL_Joystick on success or NULL on failure; call SDL_GetError()
|
||||
* for more information.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.4.
|
||||
*/
|
||||
extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickFromInstanceID(SDL_JoystickID instance_id);
|
||||
|
||||
/**
|
||||
* Get the SDL_Joystick associated with a player index.
|
||||
*
|
||||
* \param player_index the player index to get the SDL_Joystick for
|
||||
* \returns an SDL_Joystick on success or NULL on failure; call SDL_GetError()
|
||||
* for more information.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.12.
|
||||
*/
|
||||
extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickFromPlayerIndex(int player_index);
|
||||
|
||||
/**
|
||||
* Attach a new virtual joystick.
|
||||
*
|
||||
* \returns the joystick's device index, or -1 if an error occurred.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.14.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_JoystickAttachVirtual(SDL_JoystickType type,
|
||||
int naxes,
|
||||
int nbuttons,
|
||||
int nhats);
|
||||
|
||||
/**
|
||||
* Detach a virtual joystick.
|
||||
*
|
||||
* \param device_index a value previously returned from
|
||||
* SDL_JoystickAttachVirtual()
|
||||
* \returns 0 on success, or -1 if an error occurred.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.14.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_JoystickDetachVirtual(int device_index);
|
||||
|
||||
/**
|
||||
* Query whether or not the joystick at a given device index is virtual.
|
||||
*
|
||||
* \param device_index a joystick device index.
|
||||
* \returns SDL_TRUE if the joystick is virtual, SDL_FALSE otherwise.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.14.
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_JoystickIsVirtual(int device_index);
|
||||
|
||||
/**
|
||||
* Set values on an opened, virtual-joystick's axis.
|
||||
*
|
||||
* Please note that values set here will not be applied until the next call to
|
||||
* SDL_JoystickUpdate, which can either be called directly, or can be called
|
||||
* indirectly through various other SDL APIs, including, but not limited to
|
||||
* the following: SDL_PollEvent, SDL_PumpEvents, SDL_WaitEventTimeout,
|
||||
* SDL_WaitEvent.
|
||||
*
|
||||
* \param joystick the virtual joystick on which to set state.
|
||||
* \param axis the specific axis on the virtual joystick to set.
|
||||
* \param value the new value for the specified axis.
|
||||
* \returns 0 on success, -1 on error.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.14.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_JoystickSetVirtualAxis(SDL_Joystick *joystick, int axis, Sint16 value);
|
||||
|
||||
/**
|
||||
* Set values on an opened, virtual-joystick's button.
|
||||
*
|
||||
* Please note that values set here will not be applied until the next call to
|
||||
* SDL_JoystickUpdate, which can either be called directly, or can be called
|
||||
* indirectly through various other SDL APIs, including, but not limited to
|
||||
* the following: SDL_PollEvent, SDL_PumpEvents, SDL_WaitEventTimeout,
|
||||
* SDL_WaitEvent.
|
||||
*
|
||||
* \param joystick the virtual joystick on which to set state.
|
||||
* \param button the specific button on the virtual joystick to set.
|
||||
* \param value the new value for the specified button.
|
||||
* \returns 0 on success, -1 on error.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.14.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_JoystickSetVirtualButton(SDL_Joystick *joystick, int button, Uint8 value);
|
||||
|
||||
/**
|
||||
* Set values on an opened, virtual-joystick's hat.
|
||||
*
|
||||
* Please note that values set here will not be applied until the next call to
|
||||
* SDL_JoystickUpdate, which can either be called directly, or can be called
|
||||
* indirectly through various other SDL APIs, including, but not limited to
|
||||
* the following: SDL_PollEvent, SDL_PumpEvents, SDL_WaitEventTimeout,
|
||||
* SDL_WaitEvent.
|
||||
*
|
||||
* \param joystick the virtual joystick on which to set state.
|
||||
* \param hat the specific hat on the virtual joystick to set.
|
||||
* \param value the new value for the specified hat.
|
||||
* \returns 0 on success, -1 on error.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.14.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_JoystickSetVirtualHat(SDL_Joystick *joystick, int hat, Uint8 value);
|
||||
|
||||
/**
|
||||
* Get the implementation dependent name of a joystick.
|
||||
*
|
||||
* \param joystick the SDL_Joystick obtained from SDL_JoystickOpen()
|
||||
* \returns the name of the selected joystick. If no name can be found, this
|
||||
* function returns NULL; call SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_JoystickNameForIndex
|
||||
* \sa SDL_JoystickOpen
|
||||
*/
|
||||
extern DECLSPEC const char *SDLCALL SDL_JoystickName(SDL_Joystick *joystick);
|
||||
|
||||
/**
|
||||
* Get the player index of an opened joystick.
|
||||
*
|
||||
* For XInput controllers this returns the XInput user index. Many joysticks
|
||||
* will not be able to supply this information.
|
||||
*
|
||||
* \param joystick the SDL_Joystick obtained from SDL_JoystickOpen()
|
||||
* \returns the player index, or -1 if it's not available.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.9.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_JoystickGetPlayerIndex(SDL_Joystick *joystick);
|
||||
|
||||
/**
|
||||
* Set the player index of an opened joystick.
|
||||
*
|
||||
* \param joystick the SDL_Joystick obtained from SDL_JoystickOpen()
|
||||
* \param player_index the player index to set.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.12.
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_JoystickSetPlayerIndex(SDL_Joystick *joystick, int player_index);
|
||||
|
||||
/**
|
||||
* Get the implementation-dependent GUID for the joystick.
|
||||
*
|
||||
* This function requires an open joystick.
|
||||
*
|
||||
* \param joystick the SDL_Joystick obtained from SDL_JoystickOpen()
|
||||
* \returns the GUID of the given joystick. If called on an invalid index,
|
||||
* this function returns a zero GUID; call SDL_GetError() for more
|
||||
* information.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_JoystickGetDeviceGUID
|
||||
* \sa SDL_JoystickGetGUIDString
|
||||
*/
|
||||
extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUID(SDL_Joystick *joystick);
|
||||
|
||||
/**
|
||||
* Get the USB vendor ID of an opened joystick, if available.
|
||||
*
|
||||
* If the vendor ID isn't available this function returns 0.
|
||||
*
|
||||
* \param joystick the SDL_Joystick obtained from SDL_JoystickOpen()
|
||||
* \returns the USB vendor ID of the selected joystick, or 0 if unavailable.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.6.
|
||||
*/
|
||||
extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetVendor(SDL_Joystick *joystick);
|
||||
|
||||
/**
|
||||
* Get the USB product ID of an opened joystick, if available.
|
||||
*
|
||||
* If the product ID isn't available this function returns 0.
|
||||
*
|
||||
* \param joystick the SDL_Joystick obtained from SDL_JoystickOpen()
|
||||
* \returns the USB product ID of the selected joystick, or 0 if unavailable.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.6.
|
||||
*/
|
||||
extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetProduct(SDL_Joystick *joystick);
|
||||
|
||||
/**
|
||||
* Get the product version of an opened joystick, if available.
|
||||
*
|
||||
* If the product version isn't available this function returns 0.
|
||||
*
|
||||
* \param joystick the SDL_Joystick obtained from SDL_JoystickOpen()
|
||||
* \returns the product version of the selected joystick, or 0 if unavailable.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.6.
|
||||
*/
|
||||
extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetProductVersion(SDL_Joystick *joystick);
|
||||
|
||||
/**
|
||||
* Get the serial number of an opened joystick, if available.
|
||||
*
|
||||
* Returns the serial number of the joystick, or NULL if it is not available.
|
||||
*
|
||||
* \param joystick the SDL_Joystick obtained from SDL_JoystickOpen()
|
||||
* \returns the serial number of the selected joystick, or NULL if
|
||||
* unavailable.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.14.
|
||||
*/
|
||||
extern DECLSPEC const char * SDLCALL SDL_JoystickGetSerial(SDL_Joystick *joystick);
|
||||
|
||||
/**
|
||||
* Get the type of an opened joystick.
|
||||
*
|
||||
* \param joystick the SDL_Joystick obtained from SDL_JoystickOpen()
|
||||
* \returns the SDL_JoystickType of the selected joystick.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.6.
|
||||
*/
|
||||
extern DECLSPEC SDL_JoystickType SDLCALL SDL_JoystickGetType(SDL_Joystick *joystick);
|
||||
|
||||
/**
|
||||
* Get an ASCII string representation for a given SDL_JoystickGUID.
|
||||
*
|
||||
* You should supply at least 33 bytes for pszGUID.
|
||||
*
|
||||
* \param guid the SDL_JoystickGUID you wish to convert to string
|
||||
* \param pszGUID buffer in which to write the ASCII string
|
||||
* \param cbGUID the size of pszGUID
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_JoystickGetDeviceGUID
|
||||
* \sa SDL_JoystickGetGUID
|
||||
* \sa SDL_JoystickGetGUIDFromString
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_JoystickGetGUIDString(SDL_JoystickGUID guid, char *pszGUID, int cbGUID);
|
||||
|
||||
/**
|
||||
* Convert a GUID string into a SDL_JoystickGUID structure.
|
||||
*
|
||||
* Performs no error checking. If this function is given a string containing
|
||||
* an invalid GUID, the function will silently succeed, but the GUID generated
|
||||
* will not be useful.
|
||||
*
|
||||
* \param pchGUID string containing an ASCII representation of a GUID
|
||||
* \returns a SDL_JoystickGUID structure.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_JoystickGetGUIDString
|
||||
*/
|
||||
extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUIDFromString(const char *pchGUID);
|
||||
|
||||
/**
|
||||
* Get the status of a specified joystick.
|
||||
*
|
||||
* \param joystick the joystick to query
|
||||
* \returns SDL_TRUE if the joystick has been opened, SDL_FALSE if it has not;
|
||||
* call SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_JoystickClose
|
||||
* \sa SDL_JoystickOpen
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_JoystickGetAttached(SDL_Joystick *joystick);
|
||||
|
||||
/**
|
||||
* Get the instance ID of an opened joystick.
|
||||
*
|
||||
* \param joystick an SDL_Joystick structure containing joystick information
|
||||
* \returns the instance ID of the specified joystick on success or a negative
|
||||
* error code on failure; call SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_JoystickOpen
|
||||
*/
|
||||
extern DECLSPEC SDL_JoystickID SDLCALL SDL_JoystickInstanceID(SDL_Joystick *joystick);
|
||||
|
||||
/**
|
||||
* Get the number of general axis controls on a joystick.
|
||||
*
|
||||
* Often, the directional pad on a game controller will either look like 4
|
||||
* separate buttons or a POV hat, and not axes, but all of this is up to the
|
||||
* device and platform.
|
||||
*
|
||||
* \param joystick an SDL_Joystick structure containing joystick information
|
||||
* \returns the number of axis controls/number of axes on success or a
|
||||
* negative error code on failure; call SDL_GetError() for more
|
||||
* information.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_JoystickGetAxis
|
||||
* \sa SDL_JoystickOpen
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_JoystickNumAxes(SDL_Joystick *joystick);
|
||||
|
||||
/**
|
||||
* Get the number of trackballs on a joystick.
|
||||
*
|
||||
* Joystick trackballs have only relative motion events associated with them
|
||||
* and their state cannot be polled.
|
||||
*
|
||||
* Most joysticks do not have trackballs.
|
||||
*
|
||||
* \param joystick an SDL_Joystick structure containing joystick information
|
||||
* \returns the number of trackballs on success or a negative error code on
|
||||
* failure; call SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_JoystickGetBall
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_JoystickNumBalls(SDL_Joystick *joystick);
|
||||
|
||||
/**
|
||||
* Get the number of POV hats on a joystick.
|
||||
*
|
||||
* \param joystick an SDL_Joystick structure containing joystick information
|
||||
* \returns the number of POV hats on success or a negative error code on
|
||||
* failure; call SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_JoystickGetHat
|
||||
* \sa SDL_JoystickOpen
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_JoystickNumHats(SDL_Joystick *joystick);
|
||||
|
||||
/**
|
||||
* Get the number of buttons on a joystick.
|
||||
*
|
||||
* \param joystick an SDL_Joystick structure containing joystick information
|
||||
* \returns the number of buttons on success or a negative error code on
|
||||
* failure; call SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_JoystickGetButton
|
||||
* \sa SDL_JoystickOpen
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_JoystickNumButtons(SDL_Joystick *joystick);
|
||||
|
||||
/**
|
||||
* Update the current state of the open joysticks.
|
||||
*
|
||||
* This is called automatically by the event loop if any joystick events are
|
||||
* enabled.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_JoystickEventState
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_JoystickUpdate(void);
|
||||
|
||||
/**
|
||||
* Enable/disable joystick event polling.
|
||||
*
|
||||
* If joystick events are disabled, you must call SDL_JoystickUpdate()
|
||||
* yourself and manually check the state of the joystick when you want
|
||||
* joystick information.
|
||||
*
|
||||
* It is recommended that you leave joystick event handling enabled.
|
||||
*
|
||||
* **WARNING**: Calling this function may delete all events currently in SDL's
|
||||
* event queue.
|
||||
*
|
||||
* \param state can be one of `SDL_QUERY`, `SDL_IGNORE`, or `SDL_ENABLE`
|
||||
* \returns 1 if enabled, 0 if disabled, or a negative error code on failure;
|
||||
* call SDL_GetError() for more information.
|
||||
*
|
||||
* If `state` is `SDL_QUERY` then the current state is returned,
|
||||
* otherwise the new processing state is returned.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_GameControllerEventState
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_JoystickEventState(int state);
|
||||
|
||||
#define SDL_JOYSTICK_AXIS_MAX 32767
|
||||
#define SDL_JOYSTICK_AXIS_MIN -32768
|
||||
|
||||
/**
|
||||
* Get the current state of an axis control on a joystick.
|
||||
*
|
||||
* SDL makes no promises about what part of the joystick any given axis refers
|
||||
* to. Your game should have some sort of configuration UI to let users
|
||||
* specify what each axis should be bound to. Alternately, SDL's higher-level
|
||||
* Game Controller API makes a great effort to apply order to this lower-level
|
||||
* interface, so you know that a specific axis is the "left thumb stick," etc.
|
||||
*
|
||||
* The value returned by SDL_JoystickGetAxis() is a signed integer (-32768 to
|
||||
* 32767) representing the current position of the axis. It may be necessary
|
||||
* to impose certain tolerances on these values to account for jitter.
|
||||
*
|
||||
* \param joystick an SDL_Joystick structure containing joystick information
|
||||
* \param axis the axis to query; the axis indices start at index 0
|
||||
* \returns a 16-bit signed integer representing the current position of the
|
||||
* axis or 0 on failure; call SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_JoystickNumAxes
|
||||
*/
|
||||
extern DECLSPEC Sint16 SDLCALL SDL_JoystickGetAxis(SDL_Joystick *joystick,
|
||||
int axis);
|
||||
|
||||
/**
|
||||
* Get the initial state of an axis control on a joystick.
|
||||
*
|
||||
* The state is a value ranging from -32768 to 32767.
|
||||
*
|
||||
* The axis indices start at index 0.
|
||||
*
|
||||
* \param joystick an SDL_Joystick structure containing joystick information
|
||||
* \param axis the axis to query; the axis indices start at index 0
|
||||
* \param state Upon return, the initial value is supplied here.
|
||||
* \return SDL_TRUE if this axis has any initial value, or SDL_FALSE if not.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.6.
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_JoystickGetAxisInitialState(SDL_Joystick *joystick,
|
||||
int axis, Sint16 *state);
|
||||
|
||||
/**
|
||||
* \name Hat positions
|
||||
*/
|
||||
/* @{ */
|
||||
#define SDL_HAT_CENTERED 0x00
|
||||
#define SDL_HAT_UP 0x01
|
||||
#define SDL_HAT_RIGHT 0x02
|
||||
#define SDL_HAT_DOWN 0x04
|
||||
#define SDL_HAT_LEFT 0x08
|
||||
#define SDL_HAT_RIGHTUP (SDL_HAT_RIGHT|SDL_HAT_UP)
|
||||
#define SDL_HAT_RIGHTDOWN (SDL_HAT_RIGHT|SDL_HAT_DOWN)
|
||||
#define SDL_HAT_LEFTUP (SDL_HAT_LEFT|SDL_HAT_UP)
|
||||
#define SDL_HAT_LEFTDOWN (SDL_HAT_LEFT|SDL_HAT_DOWN)
|
||||
/* @} */
|
||||
|
||||
/**
|
||||
* Get the current state of a POV hat on a joystick.
|
||||
*
|
||||
* The returned value will be one of the following positions:
|
||||
*
|
||||
* - `SDL_HAT_CENTERED`
|
||||
* - `SDL_HAT_UP`
|
||||
* - `SDL_HAT_RIGHT`
|
||||
* - `SDL_HAT_DOWN`
|
||||
* - `SDL_HAT_LEFT`
|
||||
* - `SDL_HAT_RIGHTUP`
|
||||
* - `SDL_HAT_RIGHTDOWN`
|
||||
* - `SDL_HAT_LEFTUP`
|
||||
* - `SDL_HAT_LEFTDOWN`
|
||||
*
|
||||
* \param joystick an SDL_Joystick structure containing joystick information
|
||||
* \param hat the hat index to get the state from; indices start at index 0
|
||||
* \returns the current hat position.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_JoystickNumHats
|
||||
*/
|
||||
extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetHat(SDL_Joystick *joystick,
|
||||
int hat);
|
||||
|
||||
/**
|
||||
* Get the ball axis change since the last poll.
|
||||
*
|
||||
* Trackballs can only return relative motion since the last call to
|
||||
* SDL_JoystickGetBall(), these motion deltas are placed into `dx` and `dy`.
|
||||
*
|
||||
* Most joysticks do not have trackballs.
|
||||
*
|
||||
* \param joystick the SDL_Joystick to query
|
||||
* \param ball the ball index to query; ball indices start at index 0
|
||||
* \param dx stores the difference in the x axis position since the last poll
|
||||
* \param dy stores the difference in the y axis position since the last poll
|
||||
* \returns 0 on success or a negative error code on failure; call
|
||||
* SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_JoystickNumBalls
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_JoystickGetBall(SDL_Joystick *joystick,
|
||||
int ball, int *dx, int *dy);
|
||||
|
||||
/**
|
||||
* Get the current state of a button on a joystick.
|
||||
*
|
||||
* \param joystick an SDL_Joystick structure containing joystick information
|
||||
* \param button the button index to get the state from; indices start at
|
||||
* index 0
|
||||
* \returns 1 if the specified button is pressed, 0 otherwise.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_JoystickNumButtons
|
||||
*/
|
||||
extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetButton(SDL_Joystick *joystick,
|
||||
int button);
|
||||
|
||||
/**
|
||||
* Start a rumble effect.
|
||||
*
|
||||
* Each call to this function cancels any previous rumble effect, and calling
|
||||
* it with 0 intensity stops any rumbling.
|
||||
*
|
||||
* \param joystick The joystick to vibrate
|
||||
* \param low_frequency_rumble The intensity of the low frequency (left)
|
||||
* rumble motor, from 0 to 0xFFFF
|
||||
* \param high_frequency_rumble The intensity of the high frequency (right)
|
||||
* rumble motor, from 0 to 0xFFFF
|
||||
* \param duration_ms The duration of the rumble effect, in milliseconds
|
||||
* \returns 0, or -1 if rumble isn't supported on this joystick
|
||||
*
|
||||
* \since This function is available since SDL 2.0.9.
|
||||
*
|
||||
* \sa SDL_JoystickHasRumble
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms);
|
||||
|
||||
/**
|
||||
* Start a rumble effect in the joystick's triggers
|
||||
*
|
||||
* Each call to this function cancels any previous trigger rumble effect, and
|
||||
* calling it with 0 intensity stops any rumbling.
|
||||
*
|
||||
* Note that this is rumbling of the _triggers_ and not the game controller as
|
||||
* a whole. This is currently only supported on Xbox One controllers. If you
|
||||
* want the (more common) whole-controller rumble, use SDL_JoystickRumble()
|
||||
* instead.
|
||||
*
|
||||
* \param joystick The joystick to vibrate
|
||||
* \param left_rumble The intensity of the left trigger rumble motor, from 0
|
||||
* to 0xFFFF
|
||||
* \param right_rumble The intensity of the right trigger rumble motor, from 0
|
||||
* to 0xFFFF
|
||||
* \param duration_ms The duration of the rumble effect, in milliseconds
|
||||
* \returns 0, or -1 if trigger rumble isn't supported on this joystick
|
||||
*
|
||||
* \since This function is available since SDL 2.0.14.
|
||||
*
|
||||
* \sa SDL_JoystickHasRumbleTriggers
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_JoystickRumbleTriggers(SDL_Joystick *joystick, Uint16 left_rumble, Uint16 right_rumble, Uint32 duration_ms);
|
||||
|
||||
/**
|
||||
* Query whether a joystick has an LED.
|
||||
*
|
||||
* An example of a joystick LED is the light on the back of a PlayStation 4's
|
||||
* DualShock 4 controller.
|
||||
*
|
||||
* \param joystick The joystick to query
|
||||
* \return SDL_TRUE if the joystick has a modifiable LED, SDL_FALSE otherwise.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.14.
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_JoystickHasLED(SDL_Joystick *joystick);
|
||||
|
||||
/**
|
||||
* Query whether a joystick has rumble support.
|
||||
*
|
||||
* \param joystick The joystick to query
|
||||
* \return SDL_TRUE if the joystick has rumble, SDL_FALSE otherwise.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.18.
|
||||
*
|
||||
* \sa SDL_JoystickRumble
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_JoystickHasRumble(SDL_Joystick *joystick);
|
||||
|
||||
/**
|
||||
* Query whether a joystick has rumble support on triggers.
|
||||
*
|
||||
* \param joystick The joystick to query
|
||||
* \return SDL_TRUE if the joystick has trigger rumble, SDL_FALSE otherwise.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.18.
|
||||
*
|
||||
* \sa SDL_JoystickRumbleTriggers
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_JoystickHasRumbleTriggers(SDL_Joystick *joystick);
|
||||
|
||||
/**
|
||||
* Update a joystick's LED color.
|
||||
*
|
||||
* An example of a joystick LED is the light on the back of a PlayStation 4's
|
||||
* DualShock 4 controller.
|
||||
*
|
||||
* \param joystick The joystick to update
|
||||
* \param red The intensity of the red LED
|
||||
* \param green The intensity of the green LED
|
||||
* \param blue The intensity of the blue LED
|
||||
* \returns 0 on success, -1 if this joystick does not have a modifiable LED
|
||||
*
|
||||
* \since This function is available since SDL 2.0.14.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_JoystickSetLED(SDL_Joystick *joystick, Uint8 red, Uint8 green, Uint8 blue);
|
||||
|
||||
/**
|
||||
* Send a joystick specific effect packet
|
||||
*
|
||||
* \param joystick The joystick to affect
|
||||
* \param data The data to send to the joystick
|
||||
* \param size The size of the data to send to the joystick
|
||||
* \returns 0, or -1 if this joystick or driver doesn't support effect packets
|
||||
*
|
||||
* \since This function is available since SDL 2.0.16.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_JoystickSendEffect(SDL_Joystick *joystick, const void *data, int size);
|
||||
|
||||
/**
|
||||
* Close a joystick previously opened with SDL_JoystickOpen().
|
||||
*
|
||||
* \param joystick The joystick device to close
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_JoystickOpen
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_JoystickClose(SDL_Joystick *joystick);
|
||||
|
||||
/**
|
||||
* Get the battery level of a joystick as SDL_JoystickPowerLevel.
|
||||
*
|
||||
* \param joystick the SDL_Joystick to query
|
||||
* \returns the current battery level as SDL_JoystickPowerLevel on success or
|
||||
* `SDL_JOYSTICK_POWER_UNKNOWN` if it is unknown
|
||||
*
|
||||
* \since This function is available since SDL 2.0.4.
|
||||
*/
|
||||
extern DECLSPEC SDL_JoystickPowerLevel SDLCALL SDL_JoystickCurrentPowerLevel(SDL_Joystick *joystick);
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include <SDL2/close_code.h>
|
||||
|
||||
#endif /* SDL_joystick_h_ */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
@@ -0,0 +1,337 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file SDL_keyboard.h
|
||||
*
|
||||
* Include file for SDL keyboard event handling
|
||||
*/
|
||||
|
||||
#ifndef SDL_keyboard_h_
|
||||
#define SDL_keyboard_h_
|
||||
|
||||
#include <SDL2/SDL_stdinc.h>
|
||||
#include <SDL2/SDL_error.h>
|
||||
#include <SDL2/SDL_keycode.h>
|
||||
#include <SDL2/SDL_video.h>
|
||||
|
||||
#include <SDL2/begin_code.h>
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief The SDL keysym structure, used in key events.
|
||||
*
|
||||
* \note If you are looking for translated character input, see the ::SDL_TEXTINPUT event.
|
||||
*/
|
||||
typedef struct SDL_Keysym
|
||||
{
|
||||
SDL_Scancode scancode; /**< SDL physical key code - see ::SDL_Scancode for details */
|
||||
SDL_Keycode sym; /**< SDL virtual key code - see ::SDL_Keycode for details */
|
||||
Uint16 mod; /**< current key modifiers */
|
||||
Uint32 unused;
|
||||
} SDL_Keysym;
|
||||
|
||||
/* Function prototypes */
|
||||
|
||||
/**
|
||||
* Query the window which currently has keyboard focus.
|
||||
*
|
||||
* \returns the window with keyboard focus.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*/
|
||||
extern DECLSPEC SDL_Window * SDLCALL SDL_GetKeyboardFocus(void);
|
||||
|
||||
/**
|
||||
* Get a snapshot of the current state of the keyboard.
|
||||
*
|
||||
* The pointer returned is a pointer to an internal SDL array. It will be
|
||||
* valid for the whole lifetime of the application and should not be freed by
|
||||
* the caller.
|
||||
*
|
||||
* A array element with a value of 1 means that the key is pressed and a value
|
||||
* of 0 means that it is not. Indexes into this array are obtained by using
|
||||
* SDL_Scancode values.
|
||||
*
|
||||
* Use SDL_PumpEvents() to update the state array.
|
||||
*
|
||||
* This function gives you the current state after all events have been
|
||||
* processed, so if a key or button has been pressed and released before you
|
||||
* process events, then the pressed state will never show up in the
|
||||
* SDL_GetKeyboardState() calls.
|
||||
*
|
||||
* Note: This function doesn't take into account whether shift has been
|
||||
* pressed or not.
|
||||
*
|
||||
* \param numkeys if non-NULL, receives the length of the returned array
|
||||
* \returns a pointer to an array of key states.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_PumpEvents
|
||||
*/
|
||||
extern DECLSPEC const Uint8 *SDLCALL SDL_GetKeyboardState(int *numkeys);
|
||||
|
||||
/**
|
||||
* Get the current key modifier state for the keyboard.
|
||||
*
|
||||
* \returns an OR'd combination of the modifier keys for the keyboard. See
|
||||
* SDL_Keymod for details.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_GetKeyboardState
|
||||
* \sa SDL_SetModState
|
||||
*/
|
||||
extern DECLSPEC SDL_Keymod SDLCALL SDL_GetModState(void);
|
||||
|
||||
/**
|
||||
* Set the current key modifier state for the keyboard.
|
||||
*
|
||||
* The inverse of SDL_GetModState(), SDL_SetModState() allows you to impose
|
||||
* modifier key states on your application. Simply pass your desired modifier
|
||||
* states into `modstate`. This value may be a bitwise, OR'd combination of
|
||||
* SDL_Keymod values.
|
||||
*
|
||||
* This does not change the keyboard state, only the key modifier flags that
|
||||
* SDL reports.
|
||||
*
|
||||
* \param modstate the desired SDL_Keymod for the keyboard
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_GetModState
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_SetModState(SDL_Keymod modstate);
|
||||
|
||||
/**
|
||||
* Get the key code corresponding to the given scancode according to the
|
||||
* current keyboard layout.
|
||||
*
|
||||
* See SDL_Keycode for details.
|
||||
*
|
||||
* \param scancode the desired SDL_Scancode to query
|
||||
* \returns the SDL_Keycode that corresponds to the given SDL_Scancode.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_GetKeyName
|
||||
* \sa SDL_GetScancodeFromKey
|
||||
*/
|
||||
extern DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromScancode(SDL_Scancode scancode);
|
||||
|
||||
/**
|
||||
* Get the scancode corresponding to the given key code according to the
|
||||
* current keyboard layout.
|
||||
*
|
||||
* See SDL_Scancode for details.
|
||||
*
|
||||
* \param key the desired SDL_Keycode to query
|
||||
* \returns the SDL_Scancode that corresponds to the given SDL_Keycode.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_GetKeyFromScancode
|
||||
* \sa SDL_GetScancodeName
|
||||
*/
|
||||
extern DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromKey(SDL_Keycode key);
|
||||
|
||||
/**
|
||||
* Get a human-readable name for a scancode.
|
||||
*
|
||||
* See SDL_Scancode for details.
|
||||
*
|
||||
* **Warning**: The returned name is by design not stable across platforms,
|
||||
* e.g. the name for `SDL_SCANCODE_LGUI` is "Left GUI" under Linux but "Left
|
||||
* Windows" under Microsoft Windows, and some scancodes like
|
||||
* `SDL_SCANCODE_NONUSBACKSLASH` don't have any name at all. There are even
|
||||
* scancodes that share names, e.g. `SDL_SCANCODE_RETURN` and
|
||||
* `SDL_SCANCODE_RETURN2` (both called "Return"). This function is therefore
|
||||
* unsuitable for creating a stable cross-platform two-way mapping between
|
||||
* strings and scancodes.
|
||||
*
|
||||
* \param scancode the desired SDL_Scancode to query
|
||||
* \returns a pointer to the name for the scancode. If the scancode doesn't
|
||||
* have a name this function returns an empty string ("").
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_GetScancodeFromKey
|
||||
* \sa SDL_GetScancodeFromName
|
||||
*/
|
||||
extern DECLSPEC const char *SDLCALL SDL_GetScancodeName(SDL_Scancode scancode);
|
||||
|
||||
/**
|
||||
* Get a scancode from a human-readable name.
|
||||
*
|
||||
* \param name the human-readable scancode name
|
||||
* \returns the SDL_Scancode, or `SDL_SCANCODE_UNKNOWN` if the name wasn't
|
||||
* recognized; call SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_GetKeyFromName
|
||||
* \sa SDL_GetScancodeFromKey
|
||||
* \sa SDL_GetScancodeName
|
||||
*/
|
||||
extern DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromName(const char *name);
|
||||
|
||||
/**
|
||||
* Get a human-readable name for a key.
|
||||
*
|
||||
* See SDL_Scancode and SDL_Keycode for details.
|
||||
*
|
||||
* \param key the desired SDL_Keycode to query
|
||||
* \returns a pointer to a UTF-8 string that stays valid at least until the
|
||||
* next call to this function. If you need it around any longer, you
|
||||
* must copy it. If the key doesn't have a name, this function
|
||||
* returns an empty string ("").
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_GetKeyFromName
|
||||
* \sa SDL_GetKeyFromScancode
|
||||
* \sa SDL_GetScancodeFromKey
|
||||
*/
|
||||
extern DECLSPEC const char *SDLCALL SDL_GetKeyName(SDL_Keycode key);
|
||||
|
||||
/**
|
||||
* Get a key code from a human-readable name.
|
||||
*
|
||||
* \param name the human-readable key name
|
||||
* \returns key code, or `SDLK_UNKNOWN` if the name wasn't recognized; call
|
||||
* SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_GetKeyFromScancode
|
||||
* \sa SDL_GetKeyName
|
||||
* \sa SDL_GetScancodeFromName
|
||||
*/
|
||||
extern DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromName(const char *name);
|
||||
|
||||
/**
|
||||
* Start accepting Unicode text input events.
|
||||
*
|
||||
* This function will start accepting Unicode text input events in the focused
|
||||
* SDL window, and start emitting SDL_TextInputEvent (SDL_TEXTINPUT) and
|
||||
* SDL_TextEditingEvent (SDL_TEXTEDITING) events. Please use this function in
|
||||
* pair with SDL_StopTextInput().
|
||||
*
|
||||
* On some platforms using this function activates the screen keyboard.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_SetTextInputRect
|
||||
* \sa SDL_StopTextInput
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_StartTextInput(void);
|
||||
|
||||
/**
|
||||
* Check whether or not Unicode text input events are enabled.
|
||||
*
|
||||
* \returns SDL_TRUE if text input events are enabled else SDL_FALSE.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_StartTextInput
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_IsTextInputActive(void);
|
||||
|
||||
/**
|
||||
* Stop receiving any text input events.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_StartTextInput
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_StopTextInput(void);
|
||||
|
||||
/**
|
||||
* Dismiss the composition window/IME without disabling the subsystem.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.22.
|
||||
*
|
||||
* \sa SDL_StartTextInput
|
||||
* \sa SDL_StopTextInput
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_ClearComposition(void);
|
||||
|
||||
/**
|
||||
* Returns if an IME Composite or Candidate window is currently shown.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.22.
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_IsTextInputShown(void);
|
||||
|
||||
/**
|
||||
* Set the rectangle used to type Unicode text inputs.
|
||||
*
|
||||
* Note: If you want use system native IME window, try to set hint
|
||||
* **SDL_HINT_IME_SHOW_UI** to **1**, otherwise this function won't give you
|
||||
* any feedback.
|
||||
*
|
||||
* \param rect the SDL_Rect structure representing the rectangle to receive
|
||||
* text (ignored if NULL)
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_StartTextInput
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_SetTextInputRect(SDL_Rect *rect);
|
||||
|
||||
/**
|
||||
* Check whether the platform has screen keyboard support.
|
||||
*
|
||||
* \returns SDL_TRUE if the platform has some screen keyboard support or
|
||||
* SDL_FALSE if not.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_StartTextInput
|
||||
* \sa SDL_IsScreenKeyboardShown
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_HasScreenKeyboardSupport(void);
|
||||
|
||||
/**
|
||||
* Check whether the screen keyboard is shown for given window.
|
||||
*
|
||||
* \param window the window for which screen keyboard should be queried
|
||||
* \returns SDL_TRUE if screen keyboard is shown or SDL_FALSE if not.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_HasScreenKeyboardSupport
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_IsScreenKeyboardShown(SDL_Window *window);
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include <SDL2/close_code.h>
|
||||
|
||||
#endif /* SDL_keyboard_h_ */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
@@ -0,0 +1,353 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file SDL_keycode.h
|
||||
*
|
||||
* Defines constants which identify keyboard keys and modifiers.
|
||||
*/
|
||||
|
||||
#ifndef SDL_keycode_h_
|
||||
#define SDL_keycode_h_
|
||||
|
||||
#include <SDL2/SDL_stdinc.h>
|
||||
#include <SDL2/SDL_scancode.h>
|
||||
|
||||
/**
|
||||
* \brief The SDL virtual key representation.
|
||||
*
|
||||
* Values of this type are used to represent keyboard keys using the current
|
||||
* layout of the keyboard. These values include Unicode values representing
|
||||
* the unmodified character that would be generated by pressing the key, or
|
||||
* an SDLK_* constant for those keys that do not generate characters.
|
||||
*
|
||||
* A special exception is the number keys at the top of the keyboard which
|
||||
* always map to SDLK_0...SDLK_9, regardless of layout.
|
||||
*/
|
||||
typedef Sint32 SDL_Keycode;
|
||||
|
||||
#define SDLK_SCANCODE_MASK (1<<30)
|
||||
#define SDL_SCANCODE_TO_KEYCODE(X) (X | SDLK_SCANCODE_MASK)
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SDLK_UNKNOWN = 0,
|
||||
|
||||
SDLK_RETURN = '\r',
|
||||
SDLK_ESCAPE = '\x1B',
|
||||
SDLK_BACKSPACE = '\b',
|
||||
SDLK_TAB = '\t',
|
||||
SDLK_SPACE = ' ',
|
||||
SDLK_EXCLAIM = '!',
|
||||
SDLK_QUOTEDBL = '"',
|
||||
SDLK_HASH = '#',
|
||||
SDLK_PERCENT = '%',
|
||||
SDLK_DOLLAR = '$',
|
||||
SDLK_AMPERSAND = '&',
|
||||
SDLK_QUOTE = '\'',
|
||||
SDLK_LEFTPAREN = '(',
|
||||
SDLK_RIGHTPAREN = ')',
|
||||
SDLK_ASTERISK = '*',
|
||||
SDLK_PLUS = '+',
|
||||
SDLK_COMMA = ',',
|
||||
SDLK_MINUS = '-',
|
||||
SDLK_PERIOD = '.',
|
||||
SDLK_SLASH = '/',
|
||||
SDLK_0 = '0',
|
||||
SDLK_1 = '1',
|
||||
SDLK_2 = '2',
|
||||
SDLK_3 = '3',
|
||||
SDLK_4 = '4',
|
||||
SDLK_5 = '5',
|
||||
SDLK_6 = '6',
|
||||
SDLK_7 = '7',
|
||||
SDLK_8 = '8',
|
||||
SDLK_9 = '9',
|
||||
SDLK_COLON = ':',
|
||||
SDLK_SEMICOLON = ';',
|
||||
SDLK_LESS = '<',
|
||||
SDLK_EQUALS = '=',
|
||||
SDLK_GREATER = '>',
|
||||
SDLK_QUESTION = '?',
|
||||
SDLK_AT = '@',
|
||||
|
||||
/*
|
||||
Skip uppercase letters
|
||||
*/
|
||||
|
||||
SDLK_LEFTBRACKET = '[',
|
||||
SDLK_BACKSLASH = '\\',
|
||||
SDLK_RIGHTBRACKET = ']',
|
||||
SDLK_CARET = '^',
|
||||
SDLK_UNDERSCORE = '_',
|
||||
SDLK_BACKQUOTE = '`',
|
||||
SDLK_a = 'a',
|
||||
SDLK_b = 'b',
|
||||
SDLK_c = 'c',
|
||||
SDLK_d = 'd',
|
||||
SDLK_e = 'e',
|
||||
SDLK_f = 'f',
|
||||
SDLK_g = 'g',
|
||||
SDLK_h = 'h',
|
||||
SDLK_i = 'i',
|
||||
SDLK_j = 'j',
|
||||
SDLK_k = 'k',
|
||||
SDLK_l = 'l',
|
||||
SDLK_m = 'm',
|
||||
SDLK_n = 'n',
|
||||
SDLK_o = 'o',
|
||||
SDLK_p = 'p',
|
||||
SDLK_q = 'q',
|
||||
SDLK_r = 'r',
|
||||
SDLK_s = 's',
|
||||
SDLK_t = 't',
|
||||
SDLK_u = 'u',
|
||||
SDLK_v = 'v',
|
||||
SDLK_w = 'w',
|
||||
SDLK_x = 'x',
|
||||
SDLK_y = 'y',
|
||||
SDLK_z = 'z',
|
||||
|
||||
SDLK_CAPSLOCK = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CAPSLOCK),
|
||||
|
||||
SDLK_F1 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F1),
|
||||
SDLK_F2 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F2),
|
||||
SDLK_F3 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F3),
|
||||
SDLK_F4 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F4),
|
||||
SDLK_F5 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F5),
|
||||
SDLK_F6 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F6),
|
||||
SDLK_F7 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F7),
|
||||
SDLK_F8 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F8),
|
||||
SDLK_F9 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F9),
|
||||
SDLK_F10 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F10),
|
||||
SDLK_F11 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F11),
|
||||
SDLK_F12 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F12),
|
||||
|
||||
SDLK_PRINTSCREEN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PRINTSCREEN),
|
||||
SDLK_SCROLLLOCK = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SCROLLLOCK),
|
||||
SDLK_PAUSE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PAUSE),
|
||||
SDLK_INSERT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_INSERT),
|
||||
SDLK_HOME = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_HOME),
|
||||
SDLK_PAGEUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PAGEUP),
|
||||
SDLK_DELETE = '\x7F',
|
||||
SDLK_END = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_END),
|
||||
SDLK_PAGEDOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PAGEDOWN),
|
||||
SDLK_RIGHT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RIGHT),
|
||||
SDLK_LEFT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LEFT),
|
||||
SDLK_DOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_DOWN),
|
||||
SDLK_UP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_UP),
|
||||
|
||||
SDLK_NUMLOCKCLEAR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_NUMLOCKCLEAR),
|
||||
SDLK_KP_DIVIDE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DIVIDE),
|
||||
SDLK_KP_MULTIPLY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MULTIPLY),
|
||||
SDLK_KP_MINUS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MINUS),
|
||||
SDLK_KP_PLUS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PLUS),
|
||||
SDLK_KP_ENTER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_ENTER),
|
||||
SDLK_KP_1 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_1),
|
||||
SDLK_KP_2 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_2),
|
||||
SDLK_KP_3 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_3),
|
||||
SDLK_KP_4 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_4),
|
||||
SDLK_KP_5 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_5),
|
||||
SDLK_KP_6 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_6),
|
||||
SDLK_KP_7 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_7),
|
||||
SDLK_KP_8 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_8),
|
||||
SDLK_KP_9 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_9),
|
||||
SDLK_KP_0 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_0),
|
||||
SDLK_KP_PERIOD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PERIOD),
|
||||
|
||||
SDLK_APPLICATION = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_APPLICATION),
|
||||
SDLK_POWER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_POWER),
|
||||
SDLK_KP_EQUALS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_EQUALS),
|
||||
SDLK_F13 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F13),
|
||||
SDLK_F14 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F14),
|
||||
SDLK_F15 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F15),
|
||||
SDLK_F16 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F16),
|
||||
SDLK_F17 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F17),
|
||||
SDLK_F18 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F18),
|
||||
SDLK_F19 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F19),
|
||||
SDLK_F20 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F20),
|
||||
SDLK_F21 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F21),
|
||||
SDLK_F22 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F22),
|
||||
SDLK_F23 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F23),
|
||||
SDLK_F24 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F24),
|
||||
SDLK_EXECUTE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_EXECUTE),
|
||||
SDLK_HELP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_HELP),
|
||||
SDLK_MENU = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MENU),
|
||||
SDLK_SELECT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SELECT),
|
||||
SDLK_STOP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_STOP),
|
||||
SDLK_AGAIN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AGAIN),
|
||||
SDLK_UNDO = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_UNDO),
|
||||
SDLK_CUT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CUT),
|
||||
SDLK_COPY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_COPY),
|
||||
SDLK_PASTE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PASTE),
|
||||
SDLK_FIND = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_FIND),
|
||||
SDLK_MUTE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MUTE),
|
||||
SDLK_VOLUMEUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_VOLUMEUP),
|
||||
SDLK_VOLUMEDOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_VOLUMEDOWN),
|
||||
SDLK_KP_COMMA = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_COMMA),
|
||||
SDLK_KP_EQUALSAS400 =
|
||||
SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_EQUALSAS400),
|
||||
|
||||
SDLK_ALTERASE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_ALTERASE),
|
||||
SDLK_SYSREQ = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SYSREQ),
|
||||
SDLK_CANCEL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CANCEL),
|
||||
SDLK_CLEAR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CLEAR),
|
||||
SDLK_PRIOR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PRIOR),
|
||||
SDLK_RETURN2 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RETURN2),
|
||||
SDLK_SEPARATOR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SEPARATOR),
|
||||
SDLK_OUT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_OUT),
|
||||
SDLK_OPER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_OPER),
|
||||
SDLK_CLEARAGAIN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CLEARAGAIN),
|
||||
SDLK_CRSEL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CRSEL),
|
||||
SDLK_EXSEL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_EXSEL),
|
||||
|
||||
SDLK_KP_00 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_00),
|
||||
SDLK_KP_000 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_000),
|
||||
SDLK_THOUSANDSSEPARATOR =
|
||||
SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_THOUSANDSSEPARATOR),
|
||||
SDLK_DECIMALSEPARATOR =
|
||||
SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_DECIMALSEPARATOR),
|
||||
SDLK_CURRENCYUNIT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CURRENCYUNIT),
|
||||
SDLK_CURRENCYSUBUNIT =
|
||||
SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CURRENCYSUBUNIT),
|
||||
SDLK_KP_LEFTPAREN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_LEFTPAREN),
|
||||
SDLK_KP_RIGHTPAREN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_RIGHTPAREN),
|
||||
SDLK_KP_LEFTBRACE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_LEFTBRACE),
|
||||
SDLK_KP_RIGHTBRACE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_RIGHTBRACE),
|
||||
SDLK_KP_TAB = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_TAB),
|
||||
SDLK_KP_BACKSPACE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_BACKSPACE),
|
||||
SDLK_KP_A = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_A),
|
||||
SDLK_KP_B = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_B),
|
||||
SDLK_KP_C = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_C),
|
||||
SDLK_KP_D = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_D),
|
||||
SDLK_KP_E = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_E),
|
||||
SDLK_KP_F = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_F),
|
||||
SDLK_KP_XOR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_XOR),
|
||||
SDLK_KP_POWER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_POWER),
|
||||
SDLK_KP_PERCENT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PERCENT),
|
||||
SDLK_KP_LESS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_LESS),
|
||||
SDLK_KP_GREATER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_GREATER),
|
||||
SDLK_KP_AMPERSAND = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_AMPERSAND),
|
||||
SDLK_KP_DBLAMPERSAND =
|
||||
SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DBLAMPERSAND),
|
||||
SDLK_KP_VERTICALBAR =
|
||||
SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_VERTICALBAR),
|
||||
SDLK_KP_DBLVERTICALBAR =
|
||||
SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DBLVERTICALBAR),
|
||||
SDLK_KP_COLON = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_COLON),
|
||||
SDLK_KP_HASH = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_HASH),
|
||||
SDLK_KP_SPACE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_SPACE),
|
||||
SDLK_KP_AT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_AT),
|
||||
SDLK_KP_EXCLAM = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_EXCLAM),
|
||||
SDLK_KP_MEMSTORE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMSTORE),
|
||||
SDLK_KP_MEMRECALL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMRECALL),
|
||||
SDLK_KP_MEMCLEAR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMCLEAR),
|
||||
SDLK_KP_MEMADD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMADD),
|
||||
SDLK_KP_MEMSUBTRACT =
|
||||
SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMSUBTRACT),
|
||||
SDLK_KP_MEMMULTIPLY =
|
||||
SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMMULTIPLY),
|
||||
SDLK_KP_MEMDIVIDE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMDIVIDE),
|
||||
SDLK_KP_PLUSMINUS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PLUSMINUS),
|
||||
SDLK_KP_CLEAR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_CLEAR),
|
||||
SDLK_KP_CLEARENTRY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_CLEARENTRY),
|
||||
SDLK_KP_BINARY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_BINARY),
|
||||
SDLK_KP_OCTAL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_OCTAL),
|
||||
SDLK_KP_DECIMAL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DECIMAL),
|
||||
SDLK_KP_HEXADECIMAL =
|
||||
SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_HEXADECIMAL),
|
||||
|
||||
SDLK_LCTRL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LCTRL),
|
||||
SDLK_LSHIFT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LSHIFT),
|
||||
SDLK_LALT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LALT),
|
||||
SDLK_LGUI = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LGUI),
|
||||
SDLK_RCTRL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RCTRL),
|
||||
SDLK_RSHIFT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RSHIFT),
|
||||
SDLK_RALT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RALT),
|
||||
SDLK_RGUI = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RGUI),
|
||||
|
||||
SDLK_MODE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MODE),
|
||||
|
||||
SDLK_AUDIONEXT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIONEXT),
|
||||
SDLK_AUDIOPREV = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOPREV),
|
||||
SDLK_AUDIOSTOP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOSTOP),
|
||||
SDLK_AUDIOPLAY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOPLAY),
|
||||
SDLK_AUDIOMUTE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOMUTE),
|
||||
SDLK_MEDIASELECT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MEDIASELECT),
|
||||
SDLK_WWW = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_WWW),
|
||||
SDLK_MAIL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MAIL),
|
||||
SDLK_CALCULATOR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CALCULATOR),
|
||||
SDLK_COMPUTER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_COMPUTER),
|
||||
SDLK_AC_SEARCH = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_SEARCH),
|
||||
SDLK_AC_HOME = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_HOME),
|
||||
SDLK_AC_BACK = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_BACK),
|
||||
SDLK_AC_FORWARD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_FORWARD),
|
||||
SDLK_AC_STOP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_STOP),
|
||||
SDLK_AC_REFRESH = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_REFRESH),
|
||||
SDLK_AC_BOOKMARKS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_BOOKMARKS),
|
||||
|
||||
SDLK_BRIGHTNESSDOWN =
|
||||
SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_BRIGHTNESSDOWN),
|
||||
SDLK_BRIGHTNESSUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_BRIGHTNESSUP),
|
||||
SDLK_DISPLAYSWITCH = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_DISPLAYSWITCH),
|
||||
SDLK_KBDILLUMTOGGLE =
|
||||
SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KBDILLUMTOGGLE),
|
||||
SDLK_KBDILLUMDOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KBDILLUMDOWN),
|
||||
SDLK_KBDILLUMUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KBDILLUMUP),
|
||||
SDLK_EJECT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_EJECT),
|
||||
SDLK_SLEEP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SLEEP),
|
||||
SDLK_APP1 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_APP1),
|
||||
SDLK_APP2 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_APP2),
|
||||
|
||||
SDLK_AUDIOREWIND = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOREWIND),
|
||||
SDLK_AUDIOFASTFORWARD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOFASTFORWARD)
|
||||
} SDL_KeyCode;
|
||||
|
||||
/**
|
||||
* \brief Enumeration of valid key mods (possibly OR'd together).
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
KMOD_NONE = 0x0000,
|
||||
KMOD_LSHIFT = 0x0001,
|
||||
KMOD_RSHIFT = 0x0002,
|
||||
KMOD_LCTRL = 0x0040,
|
||||
KMOD_RCTRL = 0x0080,
|
||||
KMOD_LALT = 0x0100,
|
||||
KMOD_RALT = 0x0200,
|
||||
KMOD_LGUI = 0x0400,
|
||||
KMOD_RGUI = 0x0800,
|
||||
KMOD_NUM = 0x1000,
|
||||
KMOD_CAPS = 0x2000,
|
||||
KMOD_MODE = 0x4000,
|
||||
KMOD_SCROLL = 0x8000,
|
||||
|
||||
KMOD_CTRL = KMOD_LCTRL | KMOD_RCTRL,
|
||||
KMOD_SHIFT = KMOD_LSHIFT | KMOD_RSHIFT,
|
||||
KMOD_ALT = KMOD_LALT | KMOD_RALT,
|
||||
KMOD_GUI = KMOD_LGUI | KMOD_RGUI,
|
||||
|
||||
KMOD_RESERVED = KMOD_SCROLL /* This is for source-level compatibility with SDL 2.0.0. */
|
||||
} SDL_Keymod;
|
||||
|
||||
#endif /* SDL_keycode_h_ */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
@@ -0,0 +1,115 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file SDL_loadso.h
|
||||
*
|
||||
* System dependent library loading routines
|
||||
*
|
||||
* Some things to keep in mind:
|
||||
* \li These functions only work on C function names. Other languages may
|
||||
* have name mangling and intrinsic language support that varies from
|
||||
* compiler to compiler.
|
||||
* \li Make sure you declare your function pointers with the same calling
|
||||
* convention as the actual library function. Your code will crash
|
||||
* mysteriously if you do not do this.
|
||||
* \li Avoid namespace collisions. If you load a symbol from the library,
|
||||
* it is not defined whether or not it goes into the global symbol
|
||||
* namespace for the application. If it does and it conflicts with
|
||||
* symbols in your code or other shared libraries, you will not get
|
||||
* the results you expect. :)
|
||||
*/
|
||||
|
||||
#ifndef SDL_loadso_h_
|
||||
#define SDL_loadso_h_
|
||||
|
||||
#include <SDL2/SDL_stdinc.h>
|
||||
#include <SDL2/SDL_error.h>
|
||||
|
||||
#include <SDL2/begin_code.h>
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Dynamically load a shared object.
|
||||
*
|
||||
* \param sofile a system-dependent name of the object file
|
||||
* \returns an opaque pointer to the object handle or NULL if there was an
|
||||
* error; call SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_LoadFunction
|
||||
* \sa SDL_UnloadObject
|
||||
*/
|
||||
extern DECLSPEC void *SDLCALL SDL_LoadObject(const char *sofile);
|
||||
|
||||
/**
|
||||
* Look up the address of the named function in a shared object.
|
||||
*
|
||||
* This function pointer is no longer valid after calling SDL_UnloadObject().
|
||||
*
|
||||
* This function can only look up C function names. Other languages may have
|
||||
* name mangling and intrinsic language support that varies from compiler to
|
||||
* compiler.
|
||||
*
|
||||
* Make sure you declare your function pointers with the same calling
|
||||
* convention as the actual library function. Your code will crash
|
||||
* mysteriously if you do not do this.
|
||||
*
|
||||
* If the requested function doesn't exist, NULL is returned.
|
||||
*
|
||||
* \param handle a valid shared object handle returned by SDL_LoadObject()
|
||||
* \param name the name of the function to look up
|
||||
* \returns a pointer to the function or NULL if there was an error; call
|
||||
* SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_LoadObject
|
||||
* \sa SDL_UnloadObject
|
||||
*/
|
||||
extern DECLSPEC void *SDLCALL SDL_LoadFunction(void *handle,
|
||||
const char *name);
|
||||
|
||||
/**
|
||||
* Unload a shared object from memory.
|
||||
*
|
||||
* \param handle a valid shared object handle returned by SDL_LoadObject()
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_LoadFunction
|
||||
* \sa SDL_LoadObject
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_UnloadObject(void *handle);
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include <SDL2/close_code.h>
|
||||
|
||||
#endif /* SDL_loadso_h_ */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file SDL_locale.h
|
||||
*
|
||||
* Include file for SDL locale services
|
||||
*/
|
||||
|
||||
#ifndef _SDL_locale_h
|
||||
#define _SDL_locale_h
|
||||
|
||||
#include <SDL2/SDL_stdinc.h>
|
||||
#include <SDL2/SDL_error.h>
|
||||
|
||||
#include <SDL2/begin_code.h>
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
|
||||
typedef struct SDL_Locale
|
||||
{
|
||||
const char *language; /**< A language name, like "en" for English. */
|
||||
const char *country; /**< A country, like "US" for America. Can be NULL. */
|
||||
} SDL_Locale;
|
||||
|
||||
/**
|
||||
* Report the user's preferred locale.
|
||||
*
|
||||
* This returns an array of SDL_Locale structs, the final item zeroed out.
|
||||
* When the caller is done with this array, it should call SDL_free() on the
|
||||
* returned value; all the memory involved is allocated in a single block, so
|
||||
* a single SDL_free() will suffice.
|
||||
*
|
||||
* Returned language strings are in the format xx, where 'xx' is an ISO-639
|
||||
* language specifier (such as "en" for English, "de" for German, etc).
|
||||
* Country strings are in the format YY, where "YY" is an ISO-3166 country
|
||||
* code (such as "US" for the United States, "CA" for Canada, etc). Country
|
||||
* might be NULL if there's no specific guidance on them (so you might get {
|
||||
* "en", "US" } for American English, but { "en", NULL } means "English
|
||||
* language, generically"). Language strings are never NULL, except to
|
||||
* terminate the array.
|
||||
*
|
||||
* Please note that not all of these strings are 2 characters; some are three
|
||||
* or more.
|
||||
*
|
||||
* The returned list of locales are in the order of the user's preference. For
|
||||
* example, a German citizen that is fluent in US English and knows enough
|
||||
* Japanese to navigate around Tokyo might have a list like: { "de", "en_US",
|
||||
* "jp", NULL }. Someone from England might prefer British English (where
|
||||
* "color" is spelled "colour", etc), but will settle for anything like it: {
|
||||
* "en_GB", "en", NULL }.
|
||||
*
|
||||
* This function returns NULL on error, including when the platform does not
|
||||
* supply this information at all.
|
||||
*
|
||||
* This might be a "slow" call that has to query the operating system. It's
|
||||
* best to ask for this once and save the results. However, this list can
|
||||
* change, usually because the user has changed a system preference outside of
|
||||
* your program; SDL will send an SDL_LOCALECHANGED event in this case, if
|
||||
* possible, and you can call this function again to get an updated copy of
|
||||
* preferred locales.
|
||||
*
|
||||
* \return array of locales, terminated with a locale with a NULL language
|
||||
* field. Will return NULL on error.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.14.
|
||||
*/
|
||||
extern DECLSPEC SDL_Locale * SDLCALL SDL_GetPreferredLocales(void);
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include <SDL2/close_code.h>
|
||||
|
||||
#endif /* _SDL_locale_h */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
@@ -0,0 +1,404 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file SDL_log.h
|
||||
*
|
||||
* Simple log messages with categories and priorities.
|
||||
*
|
||||
* By default logs are quiet, but if you're debugging SDL you might want:
|
||||
*
|
||||
* SDL_LogSetAllPriority(SDL_LOG_PRIORITY_WARN);
|
||||
*
|
||||
* Here's where the messages go on different platforms:
|
||||
* Windows: debug output stream
|
||||
* Android: log output
|
||||
* Others: standard error output (stderr)
|
||||
*/
|
||||
|
||||
#ifndef SDL_log_h_
|
||||
#define SDL_log_h_
|
||||
|
||||
#include <SDL2/SDL_stdinc.h>
|
||||
|
||||
#include <SDL2/begin_code.h>
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* \brief The maximum size of a log message
|
||||
*
|
||||
* Messages longer than the maximum size will be truncated
|
||||
*/
|
||||
#define SDL_MAX_LOG_MESSAGE 4096
|
||||
|
||||
/**
|
||||
* \brief The predefined log categories
|
||||
*
|
||||
* By default the application category is enabled at the INFO level,
|
||||
* the assert category is enabled at the WARN level, test is enabled
|
||||
* at the VERBOSE level and all other categories are enabled at the
|
||||
* CRITICAL level.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
SDL_LOG_CATEGORY_APPLICATION,
|
||||
SDL_LOG_CATEGORY_ERROR,
|
||||
SDL_LOG_CATEGORY_ASSERT,
|
||||
SDL_LOG_CATEGORY_SYSTEM,
|
||||
SDL_LOG_CATEGORY_AUDIO,
|
||||
SDL_LOG_CATEGORY_VIDEO,
|
||||
SDL_LOG_CATEGORY_RENDER,
|
||||
SDL_LOG_CATEGORY_INPUT,
|
||||
SDL_LOG_CATEGORY_TEST,
|
||||
|
||||
/* Reserved for future SDL library use */
|
||||
SDL_LOG_CATEGORY_RESERVED1,
|
||||
SDL_LOG_CATEGORY_RESERVED2,
|
||||
SDL_LOG_CATEGORY_RESERVED3,
|
||||
SDL_LOG_CATEGORY_RESERVED4,
|
||||
SDL_LOG_CATEGORY_RESERVED5,
|
||||
SDL_LOG_CATEGORY_RESERVED6,
|
||||
SDL_LOG_CATEGORY_RESERVED7,
|
||||
SDL_LOG_CATEGORY_RESERVED8,
|
||||
SDL_LOG_CATEGORY_RESERVED9,
|
||||
SDL_LOG_CATEGORY_RESERVED10,
|
||||
|
||||
/* Beyond this point is reserved for application use, e.g.
|
||||
enum {
|
||||
MYAPP_CATEGORY_AWESOME1 = SDL_LOG_CATEGORY_CUSTOM,
|
||||
MYAPP_CATEGORY_AWESOME2,
|
||||
MYAPP_CATEGORY_AWESOME3,
|
||||
...
|
||||
};
|
||||
*/
|
||||
SDL_LOG_CATEGORY_CUSTOM
|
||||
} SDL_LogCategory;
|
||||
|
||||
/**
|
||||
* \brief The predefined log priorities
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
SDL_LOG_PRIORITY_VERBOSE = 1,
|
||||
SDL_LOG_PRIORITY_DEBUG,
|
||||
SDL_LOG_PRIORITY_INFO,
|
||||
SDL_LOG_PRIORITY_WARN,
|
||||
SDL_LOG_PRIORITY_ERROR,
|
||||
SDL_LOG_PRIORITY_CRITICAL,
|
||||
SDL_NUM_LOG_PRIORITIES
|
||||
} SDL_LogPriority;
|
||||
|
||||
|
||||
/**
|
||||
* Set the priority of all log categories.
|
||||
*
|
||||
* \param priority the SDL_LogPriority to assign
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_LogSetPriority
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_LogSetAllPriority(SDL_LogPriority priority);
|
||||
|
||||
/**
|
||||
* Set the priority of a particular log category.
|
||||
*
|
||||
* \param category the category to assign a priority to
|
||||
* \param priority the SDL_LogPriority to assign
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_LogGetPriority
|
||||
* \sa SDL_LogSetAllPriority
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_LogSetPriority(int category,
|
||||
SDL_LogPriority priority);
|
||||
|
||||
/**
|
||||
* Get the priority of a particular log category.
|
||||
*
|
||||
* \param category the category to query
|
||||
* \returns the SDL_LogPriority for the requested category
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_LogSetPriority
|
||||
*/
|
||||
extern DECLSPEC SDL_LogPriority SDLCALL SDL_LogGetPriority(int category);
|
||||
|
||||
/**
|
||||
* Reset all priorities to default.
|
||||
*
|
||||
* This is called by SDL_Quit().
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_LogSetAllPriority
|
||||
* \sa SDL_LogSetPriority
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_LogResetPriorities(void);
|
||||
|
||||
/**
|
||||
* Log a message with SDL_LOG_CATEGORY_APPLICATION and SDL_LOG_PRIORITY_INFO.
|
||||
*
|
||||
* = * \param fmt a printf() style message format string
|
||||
*
|
||||
* \param ... additional parameters matching % tokens in the `fmt` string, if
|
||||
* any
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_LogCritical
|
||||
* \sa SDL_LogDebug
|
||||
* \sa SDL_LogError
|
||||
* \sa SDL_LogInfo
|
||||
* \sa SDL_LogMessage
|
||||
* \sa SDL_LogMessageV
|
||||
* \sa SDL_LogVerbose
|
||||
* \sa SDL_LogWarn
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_Log(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1);
|
||||
|
||||
/**
|
||||
* Log a message with SDL_LOG_PRIORITY_VERBOSE.
|
||||
*
|
||||
* \param category the category of the message
|
||||
* \param fmt a printf() style message format string
|
||||
* \param ... additional parameters matching % tokens in the **fmt** string,
|
||||
* if any
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_Log
|
||||
* \sa SDL_LogCritical
|
||||
* \sa SDL_LogDebug
|
||||
* \sa SDL_LogError
|
||||
* \sa SDL_LogInfo
|
||||
* \sa SDL_LogMessage
|
||||
* \sa SDL_LogMessageV
|
||||
* \sa SDL_LogWarn
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_LogVerbose(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2);
|
||||
|
||||
/**
|
||||
* Log a message with SDL_LOG_PRIORITY_DEBUG.
|
||||
*
|
||||
* \param category the category of the message
|
||||
* \param fmt a printf() style message format string
|
||||
* \param ... additional parameters matching % tokens in the **fmt** string,
|
||||
* if any
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_Log
|
||||
* \sa SDL_LogCritical
|
||||
* \sa SDL_LogError
|
||||
* \sa SDL_LogInfo
|
||||
* \sa SDL_LogMessage
|
||||
* \sa SDL_LogMessageV
|
||||
* \sa SDL_LogVerbose
|
||||
* \sa SDL_LogWarn
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_LogDebug(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2);
|
||||
|
||||
/**
|
||||
* Log a message with SDL_LOG_PRIORITY_INFO.
|
||||
*
|
||||
* \param category the category of the message
|
||||
* \param fmt a printf() style message format string
|
||||
* \param ... additional parameters matching % tokens in the **fmt** string,
|
||||
* if any
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_Log
|
||||
* \sa SDL_LogCritical
|
||||
* \sa SDL_LogDebug
|
||||
* \sa SDL_LogError
|
||||
* \sa SDL_LogMessage
|
||||
* \sa SDL_LogMessageV
|
||||
* \sa SDL_LogVerbose
|
||||
* \sa SDL_LogWarn
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_LogInfo(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2);
|
||||
|
||||
/**
|
||||
* Log a message with SDL_LOG_PRIORITY_WARN.
|
||||
*
|
||||
* \param category the category of the message
|
||||
* \param fmt a printf() style message format string
|
||||
* \param ... additional parameters matching % tokens in the **fmt** string,
|
||||
* if any
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_Log
|
||||
* \sa SDL_LogCritical
|
||||
* \sa SDL_LogDebug
|
||||
* \sa SDL_LogError
|
||||
* \sa SDL_LogInfo
|
||||
* \sa SDL_LogMessage
|
||||
* \sa SDL_LogMessageV
|
||||
* \sa SDL_LogVerbose
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_LogWarn(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2);
|
||||
|
||||
/**
|
||||
* Log a message with SDL_LOG_PRIORITY_ERROR.
|
||||
*
|
||||
* \param category the category of the message
|
||||
* \param fmt a printf() style message format string
|
||||
* \param ... additional parameters matching % tokens in the **fmt** string,
|
||||
* if any
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_Log
|
||||
* \sa SDL_LogCritical
|
||||
* \sa SDL_LogDebug
|
||||
* \sa SDL_LogInfo
|
||||
* \sa SDL_LogMessage
|
||||
* \sa SDL_LogMessageV
|
||||
* \sa SDL_LogVerbose
|
||||
* \sa SDL_LogWarn
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_LogError(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2);
|
||||
|
||||
/**
|
||||
* Log a message with SDL_LOG_PRIORITY_CRITICAL.
|
||||
*
|
||||
* \param category the category of the message
|
||||
* \param fmt a printf() style message format string
|
||||
* \param ... additional parameters matching % tokens in the **fmt** string,
|
||||
* if any
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_Log
|
||||
* \sa SDL_LogDebug
|
||||
* \sa SDL_LogError
|
||||
* \sa SDL_LogInfo
|
||||
* \sa SDL_LogMessage
|
||||
* \sa SDL_LogMessageV
|
||||
* \sa SDL_LogVerbose
|
||||
* \sa SDL_LogWarn
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_LogCritical(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2);
|
||||
|
||||
/**
|
||||
* Log a message with the specified category and priority.
|
||||
*
|
||||
* \param category the category of the message
|
||||
* \param priority the priority of the message
|
||||
* \param fmt a printf() style message format string
|
||||
* \param ... additional parameters matching % tokens in the **fmt** string,
|
||||
* if any
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_Log
|
||||
* \sa SDL_LogCritical
|
||||
* \sa SDL_LogDebug
|
||||
* \sa SDL_LogError
|
||||
* \sa SDL_LogInfo
|
||||
* \sa SDL_LogMessageV
|
||||
* \sa SDL_LogVerbose
|
||||
* \sa SDL_LogWarn
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_LogMessage(int category,
|
||||
SDL_LogPriority priority,
|
||||
SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(3);
|
||||
|
||||
/**
|
||||
* Log a message with the specified category and priority.
|
||||
*
|
||||
* \param category the category of the message
|
||||
* \param priority the priority of the message
|
||||
* \param fmt a printf() style message format string
|
||||
* \param ap a variable argument list
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_Log
|
||||
* \sa SDL_LogCritical
|
||||
* \sa SDL_LogDebug
|
||||
* \sa SDL_LogError
|
||||
* \sa SDL_LogInfo
|
||||
* \sa SDL_LogMessage
|
||||
* \sa SDL_LogVerbose
|
||||
* \sa SDL_LogWarn
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_LogMessageV(int category,
|
||||
SDL_LogPriority priority,
|
||||
const char *fmt, va_list ap);
|
||||
|
||||
/**
|
||||
* The prototype for the log output callback function.
|
||||
*
|
||||
* This function is called by SDL when there is new text to be logged.
|
||||
*
|
||||
* \param userdata what was passed as `userdata` to SDL_LogSetOutputFunction()
|
||||
* \param category the category of the message
|
||||
* \param priority the priority of the message
|
||||
* \param message the message being output
|
||||
*/
|
||||
typedef void (SDLCALL *SDL_LogOutputFunction)(void *userdata, int category, SDL_LogPriority priority, const char *message);
|
||||
|
||||
/**
|
||||
* Get the current log output function.
|
||||
*
|
||||
* \param callback an SDL_LogOutputFunction filled in with the current log
|
||||
* callback
|
||||
* \param userdata a pointer filled in with the pointer that is passed to
|
||||
* `callback`
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_LogSetOutputFunction
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_LogGetOutputFunction(SDL_LogOutputFunction *callback, void **userdata);
|
||||
|
||||
/**
|
||||
* Replace the default log output function with one of your own.
|
||||
*
|
||||
* \param callback an SDL_LogOutputFunction to call instead of the default
|
||||
* \param userdata a pointer that is passed to `callback`
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_LogGetOutputFunction
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_LogSetOutputFunction(SDL_LogOutputFunction callback, void *userdata);
|
||||
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include <SDL2/close_code.h>
|
||||
|
||||
#endif /* SDL_log_h_ */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
@@ -0,0 +1,235 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef SDL_main_h_
|
||||
#define SDL_main_h_
|
||||
|
||||
#include <SDL2/SDL_stdinc.h>
|
||||
|
||||
/**
|
||||
* \file SDL_main.h
|
||||
*
|
||||
* Redefine main() on some platforms so that it is called by SDL.
|
||||
*/
|
||||
|
||||
#ifndef SDL_MAIN_HANDLED
|
||||
#if defined(__WIN32__)
|
||||
/* On Windows SDL provides WinMain(), which parses the command line and passes
|
||||
the arguments to your main function.
|
||||
|
||||
If you provide your own WinMain(), you may define SDL_MAIN_HANDLED
|
||||
*/
|
||||
#define SDL_MAIN_AVAILABLE
|
||||
|
||||
#elif defined(__WINRT__)
|
||||
/* On WinRT, SDL provides a main function that initializes CoreApplication,
|
||||
creating an instance of IFrameworkView in the process.
|
||||
|
||||
Please note that #include'ing SDL_main.h is not enough to get a main()
|
||||
function working. In non-XAML apps, the file,
|
||||
src/main/winrt/SDL_WinRT_main_NonXAML.cpp, or a copy of it, must be compiled
|
||||
into the app itself. In XAML apps, the function, SDL_WinRTRunApp must be
|
||||
called, with a pointer to the Direct3D-hosted XAML control passed in.
|
||||
*/
|
||||
#define SDL_MAIN_NEEDED
|
||||
|
||||
#elif defined(__IPHONEOS__)
|
||||
/* On iOS SDL provides a main function that creates an application delegate
|
||||
and starts the iOS application run loop.
|
||||
|
||||
If you link with SDL dynamically on iOS, the main function can't be in a
|
||||
shared library, so you need to link with libSDLmain.a, which includes a
|
||||
stub main function that calls into the shared library to start execution.
|
||||
|
||||
See src/video/uikit/SDL_uikitappdelegate.m for more details.
|
||||
*/
|
||||
#define SDL_MAIN_NEEDED
|
||||
|
||||
#elif defined(__ANDROID__)
|
||||
/* On Android SDL provides a Java class in SDLActivity.java that is the
|
||||
main activity entry point.
|
||||
|
||||
See docs/README-android.md for more details on extending that class.
|
||||
*/
|
||||
#define SDL_MAIN_NEEDED
|
||||
|
||||
/* We need to export SDL_main so it can be launched from Java */
|
||||
#define SDLMAIN_DECLSPEC DECLSPEC
|
||||
|
||||
#elif defined(__NACL__)
|
||||
/* On NACL we use ppapi_simple to set up the application helper code,
|
||||
then wait for the first PSE_INSTANCE_DIDCHANGEVIEW event before
|
||||
starting the user main function.
|
||||
All user code is run in a separate thread by ppapi_simple, thus
|
||||
allowing for blocking io to take place via nacl_io
|
||||
*/
|
||||
#define SDL_MAIN_NEEDED
|
||||
|
||||
#elif defined(__PSP__)
|
||||
/* On PSP SDL provides a main function that sets the module info,
|
||||
activates the GPU and starts the thread required to be able to exit
|
||||
the software.
|
||||
|
||||
If you provide this yourself, you may define SDL_MAIN_HANDLED
|
||||
*/
|
||||
#define SDL_MAIN_AVAILABLE
|
||||
|
||||
#endif
|
||||
#endif /* SDL_MAIN_HANDLED */
|
||||
|
||||
#ifndef SDLMAIN_DECLSPEC
|
||||
#define SDLMAIN_DECLSPEC
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \file SDL_main.h
|
||||
*
|
||||
* The application's main() function must be called with C linkage,
|
||||
* and should be declared like this:
|
||||
* \code
|
||||
* #ifdef __cplusplus
|
||||
* extern "C"
|
||||
* #endif
|
||||
* int main(int argc, char *argv[])
|
||||
* {
|
||||
* }
|
||||
* \endcode
|
||||
*/
|
||||
|
||||
#if defined(SDL_MAIN_NEEDED) || defined(SDL_MAIN_AVAILABLE)
|
||||
#define main SDL_main
|
||||
#endif
|
||||
|
||||
#include <SDL2/begin_code.h>
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* The prototype for the application's main() function
|
||||
*/
|
||||
typedef int (*SDL_main_func)(int argc, char *argv[]);
|
||||
extern SDLMAIN_DECLSPEC int SDL_main(int argc, char *argv[]);
|
||||
|
||||
|
||||
/**
|
||||
* Circumvent failure of SDL_Init() when not using SDL_main() as an entry
|
||||
* point.
|
||||
*
|
||||
* This function is defined in SDL_main.h, along with the preprocessor rule to
|
||||
* redefine main() as SDL_main(). Thus to ensure that your main() function
|
||||
* will not be changed it is necessary to define SDL_MAIN_HANDLED before
|
||||
* including SDL.h.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_Init
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_SetMainReady(void);
|
||||
|
||||
#ifdef __WIN32__
|
||||
|
||||
/**
|
||||
* Register a win32 window class for SDL's use.
|
||||
*
|
||||
* This can be called to set the application window class at startup. It is
|
||||
* safe to call this multiple times, as long as every call is eventually
|
||||
* paired with a call to SDL_UnregisterApp, but a second registration attempt
|
||||
* while a previous registration is still active will be ignored, other than
|
||||
* to increment a counter.
|
||||
*
|
||||
* Most applications do not need to, and should not, call this directly; SDL
|
||||
* will call it when initializing the video subsystem.
|
||||
*
|
||||
* \param name the window class name, in UTF-8 encoding. If NULL, SDL
|
||||
* currently uses "SDL_app" but this isn't guaranteed.
|
||||
* \param style the value to use in WNDCLASSEX::style. If `name` is NULL, SDL
|
||||
* currently uses `(CS_BYTEALIGNCLIENT | CS_OWNDC)` regardless of
|
||||
* what is specified here.
|
||||
* \param hInst the HINSTANCE to use in WNDCLASSEX::hInstance. If zero, SDL
|
||||
* will use `GetModuleHandle(NULL)` instead.
|
||||
* \returns 0 on success, -1 on error. SDL_GetError() may have details.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.2.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_RegisterApp(const char *name, Uint32 style, void *hInst);
|
||||
|
||||
/**
|
||||
* Deregister the win32 window class from an SDL_RegisterApp call.
|
||||
*
|
||||
* This can be called to undo the effects of SDL_RegisterApp.
|
||||
*
|
||||
* Most applications do not need to, and should not, call this directly; SDL
|
||||
* will call it when deinitializing the video subsystem.
|
||||
*
|
||||
* It is safe to call this multiple times, as long as every call is eventually
|
||||
* paired with a prior call to SDL_RegisterApp. The window class will only be
|
||||
* deregistered when the registration counter in SDL_RegisterApp decrements to
|
||||
* zero through calls to this function.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.2.
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_UnregisterApp(void);
|
||||
|
||||
#endif /* __WIN32__ */
|
||||
|
||||
|
||||
#ifdef __WINRT__
|
||||
|
||||
/**
|
||||
* Initialize and launch an SDL/WinRT application.
|
||||
*
|
||||
* \param mainFunction the SDL app's C-style main(), an SDL_main_func
|
||||
* \param reserved reserved for future use; should be NULL
|
||||
* \returns 0 on success or -1 on failure; call SDL_GetError() to retrieve
|
||||
* more information on the failure.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.3.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_WinRTRunApp(SDL_main_func mainFunction, void * reserved);
|
||||
|
||||
#endif /* __WINRT__ */
|
||||
|
||||
#if defined(__IPHONEOS__)
|
||||
|
||||
/**
|
||||
* Initializes and launches an SDL application.
|
||||
*
|
||||
* \param argc The argc parameter from the application's main() function
|
||||
* \param argv The argv parameter from the application's main() function
|
||||
* \param mainFunction The SDL app's C-style main(), an SDL_main_func
|
||||
* \return the return value from mainFunction
|
||||
*
|
||||
* \since This function is available since SDL 2.0.10.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_UIKitRunApp(int argc, char *argv[], SDL_main_func mainFunction);
|
||||
|
||||
#endif /* __IPHONEOS__ */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include <SDL2/close_code.h>
|
||||
|
||||
#endif /* SDL_main_h_ */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
@@ -0,0 +1,193 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef SDL_messagebox_h_
|
||||
#define SDL_messagebox_h_
|
||||
|
||||
#include <SDL2/SDL_stdinc.h>
|
||||
#include <SDL2/SDL_video.h> /* For SDL_Window */
|
||||
|
||||
#include <SDL2/begin_code.h>
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* SDL_MessageBox flags. If supported will display warning icon, etc.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
SDL_MESSAGEBOX_ERROR = 0x00000010, /**< error dialog */
|
||||
SDL_MESSAGEBOX_WARNING = 0x00000020, /**< warning dialog */
|
||||
SDL_MESSAGEBOX_INFORMATION = 0x00000040, /**< informational dialog */
|
||||
SDL_MESSAGEBOX_BUTTONS_LEFT_TO_RIGHT = 0x00000080, /**< buttons placed left to right */
|
||||
SDL_MESSAGEBOX_BUTTONS_RIGHT_TO_LEFT = 0x00000100 /**< buttons placed right to left */
|
||||
} SDL_MessageBoxFlags;
|
||||
|
||||
/**
|
||||
* Flags for SDL_MessageBoxButtonData.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT = 0x00000001, /**< Marks the default button when return is hit */
|
||||
SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT = 0x00000002 /**< Marks the default button when escape is hit */
|
||||
} SDL_MessageBoxButtonFlags;
|
||||
|
||||
/**
|
||||
* Individual button data.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
Uint32 flags; /**< ::SDL_MessageBoxButtonFlags */
|
||||
int buttonid; /**< User defined button id (value returned via SDL_ShowMessageBox) */
|
||||
const char * text; /**< The UTF-8 button text */
|
||||
} SDL_MessageBoxButtonData;
|
||||
|
||||
/**
|
||||
* RGB value used in a message box color scheme
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
Uint8 r, g, b;
|
||||
} SDL_MessageBoxColor;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SDL_MESSAGEBOX_COLOR_BACKGROUND,
|
||||
SDL_MESSAGEBOX_COLOR_TEXT,
|
||||
SDL_MESSAGEBOX_COLOR_BUTTON_BORDER,
|
||||
SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND,
|
||||
SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED,
|
||||
SDL_MESSAGEBOX_COLOR_MAX
|
||||
} SDL_MessageBoxColorType;
|
||||
|
||||
/**
|
||||
* A set of colors to use for message box dialogs
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
SDL_MessageBoxColor colors[SDL_MESSAGEBOX_COLOR_MAX];
|
||||
} SDL_MessageBoxColorScheme;
|
||||
|
||||
/**
|
||||
* MessageBox structure containing title, text, window, etc.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
Uint32 flags; /**< ::SDL_MessageBoxFlags */
|
||||
SDL_Window *window; /**< Parent window, can be NULL */
|
||||
const char *title; /**< UTF-8 title */
|
||||
const char *message; /**< UTF-8 message text */
|
||||
|
||||
int numbuttons;
|
||||
const SDL_MessageBoxButtonData *buttons;
|
||||
|
||||
const SDL_MessageBoxColorScheme *colorScheme; /**< ::SDL_MessageBoxColorScheme, can be NULL to use system settings */
|
||||
} SDL_MessageBoxData;
|
||||
|
||||
/**
|
||||
* Create a modal message box.
|
||||
*
|
||||
* If your needs aren't complex, it might be easier to use
|
||||
* SDL_ShowSimpleMessageBox.
|
||||
*
|
||||
* This function should be called on the thread that created the parent
|
||||
* window, or on the main thread if the messagebox has no parent. It will
|
||||
* block execution of that thread until the user clicks a button or closes the
|
||||
* messagebox.
|
||||
*
|
||||
* This function may be called at any time, even before SDL_Init(). This makes
|
||||
* it useful for reporting errors like a failure to create a renderer or
|
||||
* OpenGL context.
|
||||
*
|
||||
* On X11, SDL rolls its own dialog box with X11 primitives instead of a
|
||||
* formal toolkit like GTK+ or Qt.
|
||||
*
|
||||
* Note that if SDL_Init() would fail because there isn't any available video
|
||||
* target, this function is likely to fail for the same reasons. If this is a
|
||||
* concern, check the return value from this function and fall back to writing
|
||||
* to stderr if you can.
|
||||
*
|
||||
* \param messageboxdata the SDL_MessageBoxData structure with title, text and
|
||||
* other options
|
||||
* \param buttonid the pointer to which user id of hit button should be copied
|
||||
* \returns 0 on success or a negative error code on failure; call
|
||||
* SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_ShowSimpleMessageBox
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid);
|
||||
|
||||
/**
|
||||
* Display a simple modal message box.
|
||||
*
|
||||
* If your needs aren't complex, this function is preferred over
|
||||
* SDL_ShowMessageBox.
|
||||
*
|
||||
* `flags` may be any of the following:
|
||||
*
|
||||
* - `SDL_MESSAGEBOX_ERROR`: error dialog
|
||||
* - `SDL_MESSAGEBOX_WARNING`: warning dialog
|
||||
* - `SDL_MESSAGEBOX_INFORMATION`: informational dialog
|
||||
*
|
||||
* This function should be called on the thread that created the parent
|
||||
* window, or on the main thread if the messagebox has no parent. It will
|
||||
* block execution of that thread until the user clicks a button or closes the
|
||||
* messagebox.
|
||||
*
|
||||
* This function may be called at any time, even before SDL_Init(). This makes
|
||||
* it useful for reporting errors like a failure to create a renderer or
|
||||
* OpenGL context.
|
||||
*
|
||||
* On X11, SDL rolls its own dialog box with X11 primitives instead of a
|
||||
* formal toolkit like GTK+ or Qt.
|
||||
*
|
||||
* Note that if SDL_Init() would fail because there isn't any available video
|
||||
* target, this function is likely to fail for the same reasons. If this is a
|
||||
* concern, check the return value from this function and fall back to writing
|
||||
* to stderr if you can.
|
||||
*
|
||||
* \param flags an SDL_MessageBoxFlags value
|
||||
* \param title UTF-8 title text
|
||||
* \param message UTF-8 message text
|
||||
* \param window the parent window, or NULL for no parent
|
||||
* \returns 0 on success or a negative error code on failure; call
|
||||
* SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_ShowMessageBox
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_ShowSimpleMessageBox(Uint32 flags, const char *title, const char *message, SDL_Window *window);
|
||||
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include <SDL2/close_code.h>
|
||||
|
||||
#endif /* SDL_messagebox_h_ */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
@@ -0,0 +1,113 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file SDL_metal.h
|
||||
*
|
||||
* Header file for functions to creating Metal layers and views on SDL windows.
|
||||
*/
|
||||
|
||||
#ifndef SDL_metal_h_
|
||||
#define SDL_metal_h_
|
||||
|
||||
#include <SDL2/SDL_video.h>
|
||||
|
||||
#include <SDL2/begin_code.h>
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief A handle to a CAMetalLayer-backed NSView (macOS) or UIView (iOS/tvOS).
|
||||
*
|
||||
* \note This can be cast directly to an NSView or UIView.
|
||||
*/
|
||||
typedef void *SDL_MetalView;
|
||||
|
||||
/**
|
||||
* \name Metal support functions
|
||||
*/
|
||||
/* @{ */
|
||||
|
||||
/**
|
||||
* Create a CAMetalLayer-backed NSView/UIView and attach it to the specified
|
||||
* window.
|
||||
*
|
||||
* On macOS, this does *not* associate a MTLDevice with the CAMetalLayer on
|
||||
* its own. It is up to user code to do that.
|
||||
*
|
||||
* The returned handle can be casted directly to a NSView or UIView. To access
|
||||
* the backing CAMetalLayer, call SDL_Metal_GetLayer().
|
||||
*
|
||||
* \since This function is available since SDL 2.0.12.
|
||||
*
|
||||
* \sa SDL_Metal_DestroyView
|
||||
* \sa SDL_Metal_GetLayer
|
||||
*/
|
||||
extern DECLSPEC SDL_MetalView SDLCALL SDL_Metal_CreateView(SDL_Window * window);
|
||||
|
||||
/**
|
||||
* Destroy an existing SDL_MetalView object.
|
||||
*
|
||||
* This should be called before SDL_DestroyWindow, if SDL_Metal_CreateView was
|
||||
* called after SDL_CreateWindow.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.12.
|
||||
*
|
||||
* \sa SDL_Metal_CreateView
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_Metal_DestroyView(SDL_MetalView view);
|
||||
|
||||
/**
|
||||
* Get a pointer to the backing CAMetalLayer for the given view.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.14.
|
||||
*
|
||||
* \sa SDL_MetalCreateView
|
||||
*/
|
||||
extern DECLSPEC void *SDLCALL SDL_Metal_GetLayer(SDL_MetalView view);
|
||||
|
||||
/**
|
||||
* Get the size of a window's underlying drawable in pixels (for use with
|
||||
* setting viewport, scissor & etc).
|
||||
*
|
||||
* \param window SDL_Window from which the drawable size should be queried
|
||||
* \param w Pointer to variable for storing the width in pixels, may be NULL
|
||||
* \param h Pointer to variable for storing the height in pixels, may be NULL
|
||||
*
|
||||
* \since This function is available since SDL 2.0.14.
|
||||
*
|
||||
* \sa SDL_GetWindowSize
|
||||
* \sa SDL_CreateWindow
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_Metal_GetDrawableSize(SDL_Window* window, int *w,
|
||||
int *h);
|
||||
|
||||
/* @} *//* Metal support functions */
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include <SDL2/close_code.h>
|
||||
|
||||
#endif /* SDL_metal_h_ */
|
||||
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file SDL_misc.h
|
||||
*
|
||||
* \brief Include file for SDL API functions that don't fit elsewhere.
|
||||
*/
|
||||
|
||||
#ifndef SDL_misc_h_
|
||||
#define SDL_misc_h_
|
||||
|
||||
#include <SDL2/SDL_stdinc.h>
|
||||
|
||||
#include <SDL2/begin_code.h>
|
||||
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Open a URL/URI in the browser or other appropriate external application.
|
||||
*
|
||||
* Open a URL in a separate, system-provided application. How this works will
|
||||
* vary wildly depending on the platform. This will likely launch what makes
|
||||
* sense to handle a specific URL's protocol (a web browser for `http://`,
|
||||
* etc), but it might also be able to launch file managers for directories and
|
||||
* other things.
|
||||
*
|
||||
* What happens when you open a URL varies wildly as well: your game window
|
||||
* may lose focus (and may or may not lose focus if your game was fullscreen
|
||||
* or grabbing input at the time). On mobile devices, your app will likely
|
||||
* move to the background or your process might be paused. Any given platform
|
||||
* may or may not handle a given URL.
|
||||
*
|
||||
* If this is unimplemented (or simply unavailable) for a platform, this will
|
||||
* fail with an error. A successful result does not mean the URL loaded, just
|
||||
* that we launched _something_ to handle it (or at least believe we did).
|
||||
*
|
||||
* All this to say: this function can be useful, but you should definitely
|
||||
* test it on every platform you target.
|
||||
*
|
||||
* \param url A valid URL/URI to open. Use `file:///full/path/to/file` for
|
||||
* local files, if supported.
|
||||
* \returns 0 on success, or -1 on error; call SDL_GetError() for more
|
||||
* information.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.14.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_OpenURL(const char *url);
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include <SDL2/close_code.h>
|
||||
|
||||
#endif /* SDL_misc_h_ */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
@@ -0,0 +1,454 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file SDL_mouse.h
|
||||
*
|
||||
* Include file for SDL mouse event handling.
|
||||
*/
|
||||
|
||||
#ifndef SDL_mouse_h_
|
||||
#define SDL_mouse_h_
|
||||
|
||||
#include <SDL2/SDL_stdinc.h>
|
||||
#include <SDL2/SDL_error.h>
|
||||
#include <SDL2/SDL_video.h>
|
||||
|
||||
#include <SDL2/begin_code.h>
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct SDL_Cursor SDL_Cursor; /**< Implementation dependent */
|
||||
|
||||
/**
|
||||
* \brief Cursor types for SDL_CreateSystemCursor().
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
SDL_SYSTEM_CURSOR_ARROW, /**< Arrow */
|
||||
SDL_SYSTEM_CURSOR_IBEAM, /**< I-beam */
|
||||
SDL_SYSTEM_CURSOR_WAIT, /**< Wait */
|
||||
SDL_SYSTEM_CURSOR_CROSSHAIR, /**< Crosshair */
|
||||
SDL_SYSTEM_CURSOR_WAITARROW, /**< Small wait cursor (or Wait if not available) */
|
||||
SDL_SYSTEM_CURSOR_SIZENWSE, /**< Double arrow pointing northwest and southeast */
|
||||
SDL_SYSTEM_CURSOR_SIZENESW, /**< Double arrow pointing northeast and southwest */
|
||||
SDL_SYSTEM_CURSOR_SIZEWE, /**< Double arrow pointing west and east */
|
||||
SDL_SYSTEM_CURSOR_SIZENS, /**< Double arrow pointing north and south */
|
||||
SDL_SYSTEM_CURSOR_SIZEALL, /**< Four pointed arrow pointing north, south, east, and west */
|
||||
SDL_SYSTEM_CURSOR_NO, /**< Slashed circle or crossbones */
|
||||
SDL_SYSTEM_CURSOR_HAND, /**< Hand */
|
||||
SDL_NUM_SYSTEM_CURSORS
|
||||
} SDL_SystemCursor;
|
||||
|
||||
/**
|
||||
* \brief Scroll direction types for the Scroll event
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
SDL_MOUSEWHEEL_NORMAL, /**< The scroll direction is normal */
|
||||
SDL_MOUSEWHEEL_FLIPPED /**< The scroll direction is flipped / natural */
|
||||
} SDL_MouseWheelDirection;
|
||||
|
||||
/* Function prototypes */
|
||||
|
||||
/**
|
||||
* Get the window which currently has mouse focus.
|
||||
*
|
||||
* \returns the window with mouse focus.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*/
|
||||
extern DECLSPEC SDL_Window * SDLCALL SDL_GetMouseFocus(void);
|
||||
|
||||
/**
|
||||
* Retrieve the current state of the mouse.
|
||||
*
|
||||
* The current button state is returned as a button bitmask, which can be
|
||||
* tested using the `SDL_BUTTON(X)` macros (where `X` is generally 1 for the
|
||||
* left, 2 for middle, 3 for the right button), and `x` and `y` are set to the
|
||||
* mouse cursor position relative to the focus window. You can pass NULL for
|
||||
* either `x` or `y`.
|
||||
*
|
||||
* \param x the x coordinate of the mouse cursor position relative to the
|
||||
* focus window
|
||||
* \param y the y coordinate of the mouse cursor position relative to the
|
||||
* focus window
|
||||
* \returns a 32-bit button bitmask of the current button state.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_GetGlobalMouseState
|
||||
* \sa SDL_GetRelativeMouseState
|
||||
* \sa SDL_PumpEvents
|
||||
*/
|
||||
extern DECLSPEC Uint32 SDLCALL SDL_GetMouseState(int *x, int *y);
|
||||
|
||||
/**
|
||||
* Get the current state of the mouse in relation to the desktop.
|
||||
*
|
||||
* This works similarly to SDL_GetMouseState(), but the coordinates will be
|
||||
* reported relative to the top-left of the desktop. This can be useful if you
|
||||
* need to track the mouse outside of a specific window and SDL_CaptureMouse()
|
||||
* doesn't fit your needs. For example, it could be useful if you need to
|
||||
* track the mouse while dragging a window, where coordinates relative to a
|
||||
* window might not be in sync at all times.
|
||||
*
|
||||
* Note: SDL_GetMouseState() returns the mouse position as SDL understands it
|
||||
* from the last pump of the event queue. This function, however, queries the
|
||||
* OS for the current mouse position, and as such, might be a slightly less
|
||||
* efficient function. Unless you know what you're doing and have a good
|
||||
* reason to use this function, you probably want SDL_GetMouseState() instead.
|
||||
*
|
||||
* \param x filled in with the current X coord relative to the desktop; can be
|
||||
* NULL
|
||||
* \param y filled in with the current Y coord relative to the desktop; can be
|
||||
* NULL
|
||||
* \returns the current button state as a bitmask which can be tested using
|
||||
* the SDL_BUTTON(X) macros.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.4.
|
||||
*
|
||||
* \sa SDL_CaptureMouse
|
||||
*/
|
||||
extern DECLSPEC Uint32 SDLCALL SDL_GetGlobalMouseState(int *x, int *y);
|
||||
|
||||
/**
|
||||
* Retrieve the relative state of the mouse.
|
||||
*
|
||||
* The current button state is returned as a button bitmask, which can be
|
||||
* tested using the `SDL_BUTTON(X)` macros (where `X` is generally 1 for the
|
||||
* left, 2 for middle, 3 for the right button), and `x` and `y` are set to the
|
||||
* mouse deltas since the last call to SDL_GetRelativeMouseState() or since
|
||||
* event initialization. You can pass NULL for either `x` or `y`.
|
||||
*
|
||||
* \param x a pointer filled with the last recorded x coordinate of the mouse
|
||||
* \param y a pointer filled with the last recorded y coordinate of the mouse
|
||||
* \returns a 32-bit button bitmask of the relative button state.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_GetMouseState
|
||||
*/
|
||||
extern DECLSPEC Uint32 SDLCALL SDL_GetRelativeMouseState(int *x, int *y);
|
||||
|
||||
/**
|
||||
* Move the mouse cursor to the given position within the window.
|
||||
*
|
||||
* This function generates a mouse motion event.
|
||||
*
|
||||
* Note that this function will appear to succeed, but not actually move the
|
||||
* mouse when used over Microsoft Remote Desktop.
|
||||
*
|
||||
* \param window the window to move the mouse into, or NULL for the current
|
||||
* mouse focus
|
||||
* \param x the x coordinate within the window
|
||||
* \param y the y coordinate within the window
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_WarpMouseGlobal
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_WarpMouseInWindow(SDL_Window * window,
|
||||
int x, int y);
|
||||
|
||||
/**
|
||||
* Move the mouse to the given position in global screen space.
|
||||
*
|
||||
* This function generates a mouse motion event.
|
||||
*
|
||||
* A failure of this function usually means that it is unsupported by a
|
||||
* platform.
|
||||
*
|
||||
* Note that this function will appear to succeed, but not actually move the
|
||||
* mouse when used over Microsoft Remote Desktop.
|
||||
*
|
||||
* \param x the x coordinate
|
||||
* \param y the y coordinate
|
||||
* \returns 0 on success or a negative error code on failure; call
|
||||
* SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.4.
|
||||
*
|
||||
* \sa SDL_WarpMouseInWindow
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_WarpMouseGlobal(int x, int y);
|
||||
|
||||
/**
|
||||
* Set relative mouse mode.
|
||||
*
|
||||
* While the mouse is in relative mode, the cursor is hidden, and the driver
|
||||
* will try to report continuous motion in the current window. Only relative
|
||||
* motion events will be delivered, the mouse position will not change.
|
||||
*
|
||||
* Note that this function will not be able to provide continuous relative
|
||||
* motion when used over Microsoft Remote Desktop, instead motion is limited
|
||||
* to the bounds of the screen.
|
||||
*
|
||||
* This function will flush any pending mouse motion.
|
||||
*
|
||||
* \param enabled SDL_TRUE to enable relative mode, SDL_FALSE to disable.
|
||||
* \returns 0 on success or a negative error code on failure; call
|
||||
* SDL_GetError() for more information.
|
||||
*
|
||||
* If relative mode is not supported, this returns -1.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_GetRelativeMouseMode
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SetRelativeMouseMode(SDL_bool enabled);
|
||||
|
||||
/**
|
||||
* Capture the mouse and to track input outside an SDL window.
|
||||
*
|
||||
* Capturing enables your app to obtain mouse events globally, instead of just
|
||||
* within your window. Not all video targets support this function. When
|
||||
* capturing is enabled, the current window will get all mouse events, but
|
||||
* unlike relative mode, no change is made to the cursor and it is not
|
||||
* restrained to your window.
|
||||
*
|
||||
* This function may also deny mouse input to other windows--both those in
|
||||
* your application and others on the system--so you should use this function
|
||||
* sparingly, and in small bursts. For example, you might want to track the
|
||||
* mouse while the user is dragging something, until the user releases a mouse
|
||||
* button. It is not recommended that you capture the mouse for long periods
|
||||
* of time, such as the entire time your app is running. For that, you should
|
||||
* probably use SDL_SetRelativeMouseMode() or SDL_SetWindowGrab(), depending
|
||||
* on your goals.
|
||||
*
|
||||
* While captured, mouse events still report coordinates relative to the
|
||||
* current (foreground) window, but those coordinates may be outside the
|
||||
* bounds of the window (including negative values). Capturing is only allowed
|
||||
* for the foreground window. If the window loses focus while capturing, the
|
||||
* capture will be disabled automatically.
|
||||
*
|
||||
* While capturing is enabled, the current window will have the
|
||||
* `SDL_WINDOW_MOUSE_CAPTURE` flag set.
|
||||
*
|
||||
* \param enabled SDL_TRUE to enable capturing, SDL_FALSE to disable.
|
||||
* \returns 0 on success or -1 if not supported; call SDL_GetError() for more
|
||||
* information.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.4.
|
||||
*
|
||||
* \sa SDL_GetGlobalMouseState
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_CaptureMouse(SDL_bool enabled);
|
||||
|
||||
/**
|
||||
* Query whether relative mouse mode is enabled.
|
||||
*
|
||||
* \returns SDL_TRUE if relative mode is enabled or SDL_FALSE otherwise.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_SetRelativeMouseMode
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_GetRelativeMouseMode(void);
|
||||
|
||||
/**
|
||||
* Create a cursor using the specified bitmap data and mask (in MSB format).
|
||||
*
|
||||
* `mask` has to be in MSB (Most Significant Bit) format.
|
||||
*
|
||||
* The cursor width (`w`) must be a multiple of 8 bits.
|
||||
*
|
||||
* The cursor is created in black and white according to the following:
|
||||
*
|
||||
* - data=0, mask=1: white
|
||||
* - data=1, mask=1: black
|
||||
* - data=0, mask=0: transparent
|
||||
* - data=1, mask=0: inverted color if possible, black if not.
|
||||
*
|
||||
* Cursors created with this function must be freed with SDL_FreeCursor().
|
||||
*
|
||||
* If you want to have a color cursor, or create your cursor from an
|
||||
* SDL_Surface, you should use SDL_CreateColorCursor(). Alternately, you can
|
||||
* hide the cursor and draw your own as part of your game's rendering, but it
|
||||
* will be bound to the framerate.
|
||||
*
|
||||
* Also, since SDL 2.0.0, SDL_CreateSystemCursor() is available, which
|
||||
* provides twelve readily available system cursors to pick from.
|
||||
*
|
||||
* \param data the color value for each pixel of the cursor
|
||||
* \param mask the mask value for each pixel of the cursor
|
||||
* \param w the width of the cursor
|
||||
* \param h the height of the cursor
|
||||
* \param hot_x the X-axis location of the upper left corner of the cursor
|
||||
* relative to the actual mouse position
|
||||
* \param hot_y the Y-axis location of the upper left corner of the cursor
|
||||
* relative to the actual mouse position
|
||||
* \returns a new cursor with the specified parameters on success or NULL on
|
||||
* failure; call SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_FreeCursor
|
||||
* \sa SDL_SetCursor
|
||||
* \sa SDL_ShowCursor
|
||||
*/
|
||||
extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateCursor(const Uint8 * data,
|
||||
const Uint8 * mask,
|
||||
int w, int h, int hot_x,
|
||||
int hot_y);
|
||||
|
||||
/**
|
||||
* Create a color cursor.
|
||||
*
|
||||
* \param surface an SDL_Surface structure representing the cursor image
|
||||
* \param hot_x the x position of the cursor hot spot
|
||||
* \param hot_y the y position of the cursor hot spot
|
||||
* \returns the new cursor on success or NULL on failure; call SDL_GetError()
|
||||
* for more information.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_CreateCursor
|
||||
* \sa SDL_FreeCursor
|
||||
*/
|
||||
extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateColorCursor(SDL_Surface *surface,
|
||||
int hot_x,
|
||||
int hot_y);
|
||||
|
||||
/**
|
||||
* Create a system cursor.
|
||||
*
|
||||
* \param id an SDL_SystemCursor enum value
|
||||
* \returns a cursor on success or NULL on failure; call SDL_GetError() for
|
||||
* more information.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_FreeCursor
|
||||
*/
|
||||
extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateSystemCursor(SDL_SystemCursor id);
|
||||
|
||||
/**
|
||||
* Set the active cursor.
|
||||
*
|
||||
* This function sets the currently active cursor to the specified one. If the
|
||||
* cursor is currently visible, the change will be immediately represented on
|
||||
* the display. SDL_SetCursor(NULL) can be used to force cursor redraw, if
|
||||
* this is desired for any reason.
|
||||
*
|
||||
* \param cursor a cursor to make active
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_CreateCursor
|
||||
* \sa SDL_GetCursor
|
||||
* \sa SDL_ShowCursor
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_SetCursor(SDL_Cursor * cursor);
|
||||
|
||||
/**
|
||||
* Get the active cursor.
|
||||
*
|
||||
* This function returns a pointer to the current cursor which is owned by the
|
||||
* library. It is not necessary to free the cursor with SDL_FreeCursor().
|
||||
*
|
||||
* \returns the active cursor or NULL if there is no mouse.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_SetCursor
|
||||
*/
|
||||
extern DECLSPEC SDL_Cursor *SDLCALL SDL_GetCursor(void);
|
||||
|
||||
/**
|
||||
* Get the default cursor.
|
||||
*
|
||||
* \returns the default cursor on success or NULL on failure.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_CreateSystemCursor
|
||||
*/
|
||||
extern DECLSPEC SDL_Cursor *SDLCALL SDL_GetDefaultCursor(void);
|
||||
|
||||
/**
|
||||
* Free a previously-created cursor.
|
||||
*
|
||||
* Use this function to free cursor resources created with SDL_CreateCursor(),
|
||||
* SDL_CreateColorCursor() or SDL_CreateSystemCursor().
|
||||
*
|
||||
* \param cursor the cursor to free
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_CreateColorCursor
|
||||
* \sa SDL_CreateCursor
|
||||
* \sa SDL_CreateSystemCursor
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_FreeCursor(SDL_Cursor * cursor);
|
||||
|
||||
/**
|
||||
* Toggle whether or not the cursor is shown.
|
||||
*
|
||||
* The cursor starts off displayed but can be turned off. Passing `SDL_ENABLE`
|
||||
* displays the cursor and passing `SDL_DISABLE` hides it.
|
||||
*
|
||||
* The current state of the mouse cursor can be queried by passing
|
||||
* `SDL_QUERY`; either `SDL_DISABLE` or `SDL_ENABLE` will be returned.
|
||||
*
|
||||
* \param toggle `SDL_ENABLE` to show the cursor, `SDL_DISABLE` to hide it,
|
||||
* `SDL_QUERY` to query the current state without changing it.
|
||||
* \returns `SDL_ENABLE` if the cursor is shown, or `SDL_DISABLE` if the
|
||||
* cursor is hidden, or a negative error code on failure; call
|
||||
* SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_CreateCursor
|
||||
* \sa SDL_SetCursor
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_ShowCursor(int toggle);
|
||||
|
||||
/**
|
||||
* Used as a mask when testing buttons in buttonstate.
|
||||
*
|
||||
* - Button 1: Left mouse button
|
||||
* - Button 2: Middle mouse button
|
||||
* - Button 3: Right mouse button
|
||||
*/
|
||||
#define SDL_BUTTON(X) (1 << ((X)-1))
|
||||
#define SDL_BUTTON_LEFT 1
|
||||
#define SDL_BUTTON_MIDDLE 2
|
||||
#define SDL_BUTTON_RIGHT 3
|
||||
#define SDL_BUTTON_X1 4
|
||||
#define SDL_BUTTON_X2 5
|
||||
#define SDL_BUTTON_LMASK SDL_BUTTON(SDL_BUTTON_LEFT)
|
||||
#define SDL_BUTTON_MMASK SDL_BUTTON(SDL_BUTTON_MIDDLE)
|
||||
#define SDL_BUTTON_RMASK SDL_BUTTON(SDL_BUTTON_RIGHT)
|
||||
#define SDL_BUTTON_X1MASK SDL_BUTTON(SDL_BUTTON_X1)
|
||||
#define SDL_BUTTON_X2MASK SDL_BUTTON(SDL_BUTTON_X2)
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include <SDL2/close_code.h>
|
||||
|
||||
#endif /* SDL_mouse_h_ */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
@@ -0,0 +1,471 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef SDL_mutex_h_
|
||||
#define SDL_mutex_h_
|
||||
|
||||
/**
|
||||
* \file SDL_mutex.h
|
||||
*
|
||||
* Functions to provide thread synchronization primitives.
|
||||
*/
|
||||
|
||||
#include <SDL2/SDL_stdinc.h>
|
||||
#include <SDL2/SDL_error.h>
|
||||
|
||||
#include <SDL2/begin_code.h>
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Synchronization functions which can time out return this value
|
||||
* if they time out.
|
||||
*/
|
||||
#define SDL_MUTEX_TIMEDOUT 1
|
||||
|
||||
/**
|
||||
* This is the timeout value which corresponds to never time out.
|
||||
*/
|
||||
#define SDL_MUTEX_MAXWAIT (~(Uint32)0)
|
||||
|
||||
|
||||
/**
|
||||
* \name Mutex functions
|
||||
*/
|
||||
/* @{ */
|
||||
|
||||
/* The SDL mutex structure, defined in SDL_sysmutex.c */
|
||||
struct SDL_mutex;
|
||||
typedef struct SDL_mutex SDL_mutex;
|
||||
|
||||
/**
|
||||
* Create a new mutex.
|
||||
*
|
||||
* All newly-created mutexes begin in the _unlocked_ state.
|
||||
*
|
||||
* Calls to SDL_LockMutex() will not return while the mutex is locked by
|
||||
* another thread. See SDL_TryLockMutex() to attempt to lock without blocking.
|
||||
*
|
||||
* SDL mutexes are reentrant.
|
||||
*
|
||||
* \returns the initialized and unlocked mutex or NULL on failure; call
|
||||
* SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_DestroyMutex
|
||||
* \sa SDL_LockMutex
|
||||
* \sa SDL_TryLockMutex
|
||||
* \sa SDL_UnlockMutex
|
||||
*/
|
||||
extern DECLSPEC SDL_mutex *SDLCALL SDL_CreateMutex(void);
|
||||
|
||||
/**
|
||||
* Lock the mutex.
|
||||
*
|
||||
* This will block until the mutex is available, which is to say it is in the
|
||||
* unlocked state and the OS has chosen the caller as the next thread to lock
|
||||
* it. Of all threads waiting to lock the mutex, only one may do so at a time.
|
||||
*
|
||||
* It is legal for the owning thread to lock an already-locked mutex. It must
|
||||
* unlock it the same number of times before it is actually made available for
|
||||
* other threads in the system (this is known as a "recursive mutex").
|
||||
*
|
||||
* \param mutex the mutex to lock
|
||||
* \return 0, or -1 on error.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_LockMutex(SDL_mutex * mutex);
|
||||
#define SDL_mutexP(m) SDL_LockMutex(m)
|
||||
|
||||
/**
|
||||
* Try to lock a mutex without blocking.
|
||||
*
|
||||
* This works just like SDL_LockMutex(), but if the mutex is not available,
|
||||
* this function returns `SDL_MUTEX_TIMEOUT` immediately.
|
||||
*
|
||||
* This technique is useful if you need exclusive access to a resource but
|
||||
* don't want to wait for it, and will return to it to try again later.
|
||||
*
|
||||
* \param mutex the mutex to try to lock
|
||||
* \returns 0, `SDL_MUTEX_TIMEDOUT`, or -1 on error; call SDL_GetError() for
|
||||
* more information.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_CreateMutex
|
||||
* \sa SDL_DestroyMutex
|
||||
* \sa SDL_LockMutex
|
||||
* \sa SDL_UnlockMutex
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_TryLockMutex(SDL_mutex * mutex);
|
||||
|
||||
/**
|
||||
* Unlock the mutex.
|
||||
*
|
||||
* It is legal for the owning thread to lock an already-locked mutex. It must
|
||||
* unlock it the same number of times before it is actually made available for
|
||||
* other threads in the system (this is known as a "recursive mutex").
|
||||
*
|
||||
* It is an error to unlock a mutex that has not been locked by the current
|
||||
* thread, and doing so results in undefined behavior.
|
||||
*
|
||||
* It is also an error to unlock a mutex that isn't locked at all.
|
||||
*
|
||||
* \param mutex the mutex to unlock.
|
||||
* \returns 0, or -1 on error.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_UnlockMutex(SDL_mutex * mutex);
|
||||
#define SDL_mutexV(m) SDL_UnlockMutex(m)
|
||||
|
||||
/**
|
||||
* Destroy a mutex created with SDL_CreateMutex().
|
||||
*
|
||||
* This function must be called on any mutex that is no longer needed. Failure
|
||||
* to destroy a mutex will result in a system memory or resource leak. While
|
||||
* it is safe to destroy a mutex that is _unlocked_, it is not safe to attempt
|
||||
* to destroy a locked mutex, and may result in undefined behavior depending
|
||||
* on the platform.
|
||||
*
|
||||
* \param mutex the mutex to destroy
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_CreateMutex
|
||||
* \sa SDL_LockMutex
|
||||
* \sa SDL_TryLockMutex
|
||||
* \sa SDL_UnlockMutex
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_DestroyMutex(SDL_mutex * mutex);
|
||||
|
||||
/* @} *//* Mutex functions */
|
||||
|
||||
|
||||
/**
|
||||
* \name Semaphore functions
|
||||
*/
|
||||
/* @{ */
|
||||
|
||||
/* The SDL semaphore structure, defined in SDL_syssem.c */
|
||||
struct SDL_semaphore;
|
||||
typedef struct SDL_semaphore SDL_sem;
|
||||
|
||||
/**
|
||||
* Create a semaphore.
|
||||
*
|
||||
* This function creates a new semaphore and initializes it with the value
|
||||
* `initial_value`. Each wait operation on the semaphore will atomically
|
||||
* decrement the semaphore value and potentially block if the semaphore value
|
||||
* is 0. Each post operation will atomically increment the semaphore value and
|
||||
* wake waiting threads and allow them to retry the wait operation.
|
||||
*
|
||||
* \param initial_value the starting value of the semaphore
|
||||
* \returns a new semaphore or NULL on failure; call SDL_GetError() for more
|
||||
* information.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_DestroySemaphore
|
||||
* \sa SDL_SemPost
|
||||
* \sa SDL_SemTryWait
|
||||
* \sa SDL_SemValue
|
||||
* \sa SDL_SemWait
|
||||
* \sa SDL_SemWaitTimeout
|
||||
*/
|
||||
extern DECLSPEC SDL_sem *SDLCALL SDL_CreateSemaphore(Uint32 initial_value);
|
||||
|
||||
/**
|
||||
* Destroy a semaphore.
|
||||
*
|
||||
* It is not safe to destroy a semaphore if there are threads currently
|
||||
* waiting on it.
|
||||
*
|
||||
* \param sem the semaphore to destroy
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_CreateSemaphore
|
||||
* \sa SDL_SemPost
|
||||
* \sa SDL_SemTryWait
|
||||
* \sa SDL_SemValue
|
||||
* \sa SDL_SemWait
|
||||
* \sa SDL_SemWaitTimeout
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_DestroySemaphore(SDL_sem * sem);
|
||||
|
||||
/**
|
||||
* Wait until a semaphore has a positive value and then decrements it.
|
||||
*
|
||||
* This function suspends the calling thread until either the semaphore
|
||||
* pointed to by `sem` has a positive value or the call is interrupted by a
|
||||
* signal or error. If the call is successful it will atomically decrement the
|
||||
* semaphore value.
|
||||
*
|
||||
* This function is the equivalent of calling SDL_SemWaitTimeout() with a time
|
||||
* length of `SDL_MUTEX_MAXWAIT`.
|
||||
*
|
||||
* \param sem the semaphore wait on
|
||||
* \returns 0 on success or a negative error code on failure; call
|
||||
* SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_CreateSemaphore
|
||||
* \sa SDL_DestroySemaphore
|
||||
* \sa SDL_SemPost
|
||||
* \sa SDL_SemTryWait
|
||||
* \sa SDL_SemValue
|
||||
* \sa SDL_SemWait
|
||||
* \sa SDL_SemWaitTimeout
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SemWait(SDL_sem * sem);
|
||||
|
||||
/**
|
||||
* See if a semaphore has a positive value and decrement it if it does.
|
||||
*
|
||||
* This function checks to see if the semaphore pointed to by `sem` has a
|
||||
* positive value and atomically decrements the semaphore value if it does. If
|
||||
* the semaphore doesn't have a positive value, the function immediately
|
||||
* returns SDL_MUTEX_TIMEDOUT.
|
||||
*
|
||||
* \param sem the semaphore to wait on
|
||||
* \returns 0 if the wait succeeds, `SDL_MUTEX_TIMEDOUT` if the wait would
|
||||
* block, or a negative error code on failure; call SDL_GetError()
|
||||
* for more information.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_CreateSemaphore
|
||||
* \sa SDL_DestroySemaphore
|
||||
* \sa SDL_SemPost
|
||||
* \sa SDL_SemValue
|
||||
* \sa SDL_SemWait
|
||||
* \sa SDL_SemWaitTimeout
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SemTryWait(SDL_sem * sem);
|
||||
|
||||
/**
|
||||
* Wait until a semaphore has a positive value and then decrements it.
|
||||
*
|
||||
* This function suspends the calling thread until either the semaphore
|
||||
* pointed to by `sem` has a positive value, the call is interrupted by a
|
||||
* signal or error, or the specified time has elapsed. If the call is
|
||||
* successful it will atomically decrement the semaphore value.
|
||||
*
|
||||
* \param sem the semaphore to wait on
|
||||
* \param ms the length of the timeout, in milliseconds
|
||||
* \returns 0 if the wait succeeds, `SDL_MUTEX_TIMEDOUT` if the wait does not
|
||||
* succeed in the allotted time, or a negative error code on failure;
|
||||
* call SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_CreateSemaphore
|
||||
* \sa SDL_DestroySemaphore
|
||||
* \sa SDL_SemPost
|
||||
* \sa SDL_SemTryWait
|
||||
* \sa SDL_SemValue
|
||||
* \sa SDL_SemWait
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SemWaitTimeout(SDL_sem * sem, Uint32 ms);
|
||||
|
||||
/**
|
||||
* Atomically increment a semaphore's value and wake waiting threads.
|
||||
*
|
||||
* \param sem the semaphore to increment
|
||||
* \returns 0 on success or a negative error code on failure; call
|
||||
* SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_CreateSemaphore
|
||||
* \sa SDL_DestroySemaphore
|
||||
* \sa SDL_SemTryWait
|
||||
* \sa SDL_SemValue
|
||||
* \sa SDL_SemWait
|
||||
* \sa SDL_SemWaitTimeout
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SemPost(SDL_sem * sem);
|
||||
|
||||
/**
|
||||
* Get the current value of a semaphore.
|
||||
*
|
||||
* \param sem the semaphore to query
|
||||
* \returns the current value of the semaphore.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_CreateSemaphore
|
||||
*/
|
||||
extern DECLSPEC Uint32 SDLCALL SDL_SemValue(SDL_sem * sem);
|
||||
|
||||
/* @} *//* Semaphore functions */
|
||||
|
||||
|
||||
/**
|
||||
* \name Condition variable functions
|
||||
*/
|
||||
/* @{ */
|
||||
|
||||
/* The SDL condition variable structure, defined in SDL_syscond.c */
|
||||
struct SDL_cond;
|
||||
typedef struct SDL_cond SDL_cond;
|
||||
|
||||
/**
|
||||
* Create a condition variable.
|
||||
*
|
||||
* \returns a new condition variable or NULL on failure; call SDL_GetError()
|
||||
* for more information.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_CondBroadcast
|
||||
* \sa SDL_CondSignal
|
||||
* \sa SDL_CondWait
|
||||
* \sa SDL_CondWaitTimeout
|
||||
* \sa SDL_DestroyCond
|
||||
*/
|
||||
extern DECLSPEC SDL_cond *SDLCALL SDL_CreateCond(void);
|
||||
|
||||
/**
|
||||
* Destroy a condition variable.
|
||||
*
|
||||
* \param cond the condition variable to destroy
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_CondBroadcast
|
||||
* \sa SDL_CondSignal
|
||||
* \sa SDL_CondWait
|
||||
* \sa SDL_CondWaitTimeout
|
||||
* \sa SDL_CreateCond
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_DestroyCond(SDL_cond * cond);
|
||||
|
||||
/**
|
||||
* Restart one of the threads that are waiting on the condition variable.
|
||||
*
|
||||
* \param cond the condition variable to signal
|
||||
* \returns 0 on success or a negative error code on failure; call
|
||||
* SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_CondBroadcast
|
||||
* \sa SDL_CondWait
|
||||
* \sa SDL_CondWaitTimeout
|
||||
* \sa SDL_CreateCond
|
||||
* \sa SDL_DestroyCond
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_CondSignal(SDL_cond * cond);
|
||||
|
||||
/**
|
||||
* Restart all threads that are waiting on the condition variable.
|
||||
*
|
||||
* \param cond the condition variable to signal
|
||||
* \returns 0 on success or a negative error code on failure; call
|
||||
* SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_CondSignal
|
||||
* \sa SDL_CondWait
|
||||
* \sa SDL_CondWaitTimeout
|
||||
* \sa SDL_CreateCond
|
||||
* \sa SDL_DestroyCond
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_CondBroadcast(SDL_cond * cond);
|
||||
|
||||
/**
|
||||
* Wait until a condition variable is signaled.
|
||||
*
|
||||
* This function unlocks the specified `mutex` and waits for another thread to
|
||||
* call SDL_CondSignal() or SDL_CondBroadcast() on the condition variable
|
||||
* `cond`. Once the condition variable is signaled, the mutex is re-locked and
|
||||
* the function returns.
|
||||
*
|
||||
* The mutex must be locked before calling this function.
|
||||
*
|
||||
* This function is the equivalent of calling SDL_CondWaitTimeout() with a
|
||||
* time length of `SDL_MUTEX_MAXWAIT`.
|
||||
*
|
||||
* \param cond the condition variable to wait on
|
||||
* \param mutex the mutex used to coordinate thread access
|
||||
* \returns 0 when it is signaled or a negative error code on failure; call
|
||||
* SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_CondBroadcast
|
||||
* \sa SDL_CondSignal
|
||||
* \sa SDL_CondWaitTimeout
|
||||
* \sa SDL_CreateCond
|
||||
* \sa SDL_DestroyCond
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_CondWait(SDL_cond * cond, SDL_mutex * mutex);
|
||||
|
||||
/**
|
||||
* Wait until a condition variable is signaled or a certain time has passed.
|
||||
*
|
||||
* This function unlocks the specified `mutex` and waits for another thread to
|
||||
* call SDL_CondSignal() or SDL_CondBroadcast() on the condition variable
|
||||
* `cond`, or for the specified time to elapse. Once the condition variable is
|
||||
* signaled or the time elapsed, the mutex is re-locked and the function
|
||||
* returns.
|
||||
*
|
||||
* The mutex must be locked before calling this function.
|
||||
*
|
||||
* \param cond the condition variable to wait on
|
||||
* \param mutex the mutex used to coordinate thread access
|
||||
* \param ms the maximum time to wait, in milliseconds, or `SDL_MUTEX_MAXWAIT`
|
||||
* to wait indefinitely
|
||||
* \returns 0 if the condition variable is signaled, `SDL_MUTEX_TIMEDOUT` if
|
||||
* the condition is not signaled in the allotted time, or a negative
|
||||
* error code on failure; call SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_CondBroadcast
|
||||
* \sa SDL_CondSignal
|
||||
* \sa SDL_CondWait
|
||||
* \sa SDL_CreateCond
|
||||
* \sa SDL_DestroyCond
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_CondWaitTimeout(SDL_cond * cond,
|
||||
SDL_mutex * mutex, Uint32 ms);
|
||||
|
||||
/* @} *//* Condition variable functions */
|
||||
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include <SDL2/close_code.h>
|
||||
|
||||
#endif /* SDL_mutex_h_ */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef SDLname_h_
|
||||
#define SDLname_h_
|
||||
|
||||
#if defined(__STDC__) || defined(__cplusplus)
|
||||
#define NeedFunctionPrototypes 1
|
||||
#endif
|
||||
|
||||
#define SDL_NAME(X) SDL_##X
|
||||
|
||||
#endif /* SDLname_h_ */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file SDL_opengles.h
|
||||
*
|
||||
* This is a simple file to encapsulate the OpenGL ES 1.X API headers.
|
||||
*/
|
||||
#include <SDL2/SDL_config.h>
|
||||
|
||||
#ifdef __IPHONEOS__
|
||||
#include <OpenGLES/ES1/gl.h>
|
||||
#include <OpenGLES/ES1/glext.h>
|
||||
#else
|
||||
#include <GLES/gl.h>
|
||||
#include <GLES/glext.h>
|
||||
#endif
|
||||
|
||||
#ifndef APIENTRY
|
||||
#define APIENTRY
|
||||
#endif
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file SDL_opengles2.h
|
||||
*
|
||||
* This is a simple file to encapsulate the OpenGL ES 2.0 API headers.
|
||||
*/
|
||||
#include <SDL2/SDL_config.h>
|
||||
|
||||
#if !defined(_MSC_VER) && !defined(SDL_USE_BUILTIN_OPENGL_DEFINITIONS)
|
||||
|
||||
#ifdef __IPHONEOS__
|
||||
#include <OpenGLES/ES2/gl.h>
|
||||
#include <OpenGLES/ES2/glext.h>
|
||||
#else
|
||||
#include <GLES2/gl2platform.h>
|
||||
#include <GLES2/gl2.h>
|
||||
#include <GLES2/gl2ext.h>
|
||||
#endif
|
||||
|
||||
#else /* _MSC_VER */
|
||||
|
||||
/* OpenGL ES2 headers for Visual Studio */
|
||||
#include <SDL2/SDL_opengles2_khrplatform.h>
|
||||
#include <SDL2/SDL_opengles2_gl2platform.h>
|
||||
#include <SDL2/SDL_opengles2_gl2.h>
|
||||
#include <SDL2/SDL_opengles2_gl2ext.h>
|
||||
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
#ifndef APIENTRY
|
||||
#define APIENTRY GL_APIENTRY
|
||||
#endif
|
||||
@@ -0,0 +1,621 @@
|
||||
#ifndef __gl2_h_
|
||||
#define __gl2_h_
|
||||
|
||||
/* $Revision: 20555 $ on $Date:: 2013-02-12 14:32:47 -0800 #$ */
|
||||
|
||||
/*#include <GLES2/gl2platform.h>*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* This document is licensed under the SGI Free Software B License Version
|
||||
* 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
|
||||
*/
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Data type definitions
|
||||
*-----------------------------------------------------------------------*/
|
||||
|
||||
typedef void GLvoid;
|
||||
typedef char GLchar;
|
||||
typedef unsigned int GLenum;
|
||||
typedef unsigned char GLboolean;
|
||||
typedef unsigned int GLbitfield;
|
||||
typedef khronos_int8_t GLbyte;
|
||||
typedef short GLshort;
|
||||
typedef int GLint;
|
||||
typedef int GLsizei;
|
||||
typedef khronos_uint8_t GLubyte;
|
||||
typedef unsigned short GLushort;
|
||||
typedef unsigned int GLuint;
|
||||
typedef khronos_float_t GLfloat;
|
||||
typedef khronos_float_t GLclampf;
|
||||
typedef khronos_int32_t GLfixed;
|
||||
|
||||
/* GL types for handling large vertex buffer objects */
|
||||
typedef khronos_intptr_t GLintptr;
|
||||
typedef khronos_ssize_t GLsizeiptr;
|
||||
|
||||
/* OpenGL ES core versions */
|
||||
#define GL_ES_VERSION_2_0 1
|
||||
|
||||
/* ClearBufferMask */
|
||||
#define GL_DEPTH_BUFFER_BIT 0x00000100
|
||||
#define GL_STENCIL_BUFFER_BIT 0x00000400
|
||||
#define GL_COLOR_BUFFER_BIT 0x00004000
|
||||
|
||||
/* Boolean */
|
||||
#define GL_FALSE 0
|
||||
#define GL_TRUE 1
|
||||
|
||||
/* BeginMode */
|
||||
#define GL_POINTS 0x0000
|
||||
#define GL_LINES 0x0001
|
||||
#define GL_LINE_LOOP 0x0002
|
||||
#define GL_LINE_STRIP 0x0003
|
||||
#define GL_TRIANGLES 0x0004
|
||||
#define GL_TRIANGLE_STRIP 0x0005
|
||||
#define GL_TRIANGLE_FAN 0x0006
|
||||
|
||||
/* AlphaFunction (not supported in ES20) */
|
||||
/* GL_NEVER */
|
||||
/* GL_LESS */
|
||||
/* GL_EQUAL */
|
||||
/* GL_LEQUAL */
|
||||
/* GL_GREATER */
|
||||
/* GL_NOTEQUAL */
|
||||
/* GL_GEQUAL */
|
||||
/* GL_ALWAYS */
|
||||
|
||||
/* BlendingFactorDest */
|
||||
#define GL_ZERO 0
|
||||
#define GL_ONE 1
|
||||
#define GL_SRC_COLOR 0x0300
|
||||
#define GL_ONE_MINUS_SRC_COLOR 0x0301
|
||||
#define GL_SRC_ALPHA 0x0302
|
||||
#define GL_ONE_MINUS_SRC_ALPHA 0x0303
|
||||
#define GL_DST_ALPHA 0x0304
|
||||
#define GL_ONE_MINUS_DST_ALPHA 0x0305
|
||||
|
||||
/* BlendingFactorSrc */
|
||||
/* GL_ZERO */
|
||||
/* GL_ONE */
|
||||
#define GL_DST_COLOR 0x0306
|
||||
#define GL_ONE_MINUS_DST_COLOR 0x0307
|
||||
#define GL_SRC_ALPHA_SATURATE 0x0308
|
||||
/* GL_SRC_ALPHA */
|
||||
/* GL_ONE_MINUS_SRC_ALPHA */
|
||||
/* GL_DST_ALPHA */
|
||||
/* GL_ONE_MINUS_DST_ALPHA */
|
||||
|
||||
/* BlendEquationSeparate */
|
||||
#define GL_FUNC_ADD 0x8006
|
||||
#define GL_BLEND_EQUATION 0x8009
|
||||
#define GL_BLEND_EQUATION_RGB 0x8009 /* same as BLEND_EQUATION */
|
||||
#define GL_BLEND_EQUATION_ALPHA 0x883D
|
||||
|
||||
/* BlendSubtract */
|
||||
#define GL_FUNC_SUBTRACT 0x800A
|
||||
#define GL_FUNC_REVERSE_SUBTRACT 0x800B
|
||||
|
||||
/* Separate Blend Functions */
|
||||
#define GL_BLEND_DST_RGB 0x80C8
|
||||
#define GL_BLEND_SRC_RGB 0x80C9
|
||||
#define GL_BLEND_DST_ALPHA 0x80CA
|
||||
#define GL_BLEND_SRC_ALPHA 0x80CB
|
||||
#define GL_CONSTANT_COLOR 0x8001
|
||||
#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002
|
||||
#define GL_CONSTANT_ALPHA 0x8003
|
||||
#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004
|
||||
#define GL_BLEND_COLOR 0x8005
|
||||
|
||||
/* Buffer Objects */
|
||||
#define GL_ARRAY_BUFFER 0x8892
|
||||
#define GL_ELEMENT_ARRAY_BUFFER 0x8893
|
||||
#define GL_ARRAY_BUFFER_BINDING 0x8894
|
||||
#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895
|
||||
|
||||
#define GL_STREAM_DRAW 0x88E0
|
||||
#define GL_STATIC_DRAW 0x88E4
|
||||
#define GL_DYNAMIC_DRAW 0x88E8
|
||||
|
||||
#define GL_BUFFER_SIZE 0x8764
|
||||
#define GL_BUFFER_USAGE 0x8765
|
||||
|
||||
#define GL_CURRENT_VERTEX_ATTRIB 0x8626
|
||||
|
||||
/* CullFaceMode */
|
||||
#define GL_FRONT 0x0404
|
||||
#define GL_BACK 0x0405
|
||||
#define GL_FRONT_AND_BACK 0x0408
|
||||
|
||||
/* DepthFunction */
|
||||
/* GL_NEVER */
|
||||
/* GL_LESS */
|
||||
/* GL_EQUAL */
|
||||
/* GL_LEQUAL */
|
||||
/* GL_GREATER */
|
||||
/* GL_NOTEQUAL */
|
||||
/* GL_GEQUAL */
|
||||
/* GL_ALWAYS */
|
||||
|
||||
/* EnableCap */
|
||||
#define GL_TEXTURE_2D 0x0DE1
|
||||
#define GL_CULL_FACE 0x0B44
|
||||
#define GL_BLEND 0x0BE2
|
||||
#define GL_DITHER 0x0BD0
|
||||
#define GL_STENCIL_TEST 0x0B90
|
||||
#define GL_DEPTH_TEST 0x0B71
|
||||
#define GL_SCISSOR_TEST 0x0C11
|
||||
#define GL_POLYGON_OFFSET_FILL 0x8037
|
||||
#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E
|
||||
#define GL_SAMPLE_COVERAGE 0x80A0
|
||||
|
||||
/* ErrorCode */
|
||||
#define GL_NO_ERROR 0
|
||||
#define GL_INVALID_ENUM 0x0500
|
||||
#define GL_INVALID_VALUE 0x0501
|
||||
#define GL_INVALID_OPERATION 0x0502
|
||||
#define GL_OUT_OF_MEMORY 0x0505
|
||||
|
||||
/* FrontFaceDirection */
|
||||
#define GL_CW 0x0900
|
||||
#define GL_CCW 0x0901
|
||||
|
||||
/* GetPName */
|
||||
#define GL_LINE_WIDTH 0x0B21
|
||||
#define GL_ALIASED_POINT_SIZE_RANGE 0x846D
|
||||
#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E
|
||||
#define GL_CULL_FACE_MODE 0x0B45
|
||||
#define GL_FRONT_FACE 0x0B46
|
||||
#define GL_DEPTH_RANGE 0x0B70
|
||||
#define GL_DEPTH_WRITEMASK 0x0B72
|
||||
#define GL_DEPTH_CLEAR_VALUE 0x0B73
|
||||
#define GL_DEPTH_FUNC 0x0B74
|
||||
#define GL_STENCIL_CLEAR_VALUE 0x0B91
|
||||
#define GL_STENCIL_FUNC 0x0B92
|
||||
#define GL_STENCIL_FAIL 0x0B94
|
||||
#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95
|
||||
#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96
|
||||
#define GL_STENCIL_REF 0x0B97
|
||||
#define GL_STENCIL_VALUE_MASK 0x0B93
|
||||
#define GL_STENCIL_WRITEMASK 0x0B98
|
||||
#define GL_STENCIL_BACK_FUNC 0x8800
|
||||
#define GL_STENCIL_BACK_FAIL 0x8801
|
||||
#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802
|
||||
#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803
|
||||
#define GL_STENCIL_BACK_REF 0x8CA3
|
||||
#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4
|
||||
#define GL_STENCIL_BACK_WRITEMASK 0x8CA5
|
||||
#define GL_VIEWPORT 0x0BA2
|
||||
#define GL_SCISSOR_BOX 0x0C10
|
||||
/* GL_SCISSOR_TEST */
|
||||
#define GL_COLOR_CLEAR_VALUE 0x0C22
|
||||
#define GL_COLOR_WRITEMASK 0x0C23
|
||||
#define GL_UNPACK_ALIGNMENT 0x0CF5
|
||||
#define GL_PACK_ALIGNMENT 0x0D05
|
||||
#define GL_MAX_TEXTURE_SIZE 0x0D33
|
||||
#define GL_MAX_VIEWPORT_DIMS 0x0D3A
|
||||
#define GL_SUBPIXEL_BITS 0x0D50
|
||||
#define GL_RED_BITS 0x0D52
|
||||
#define GL_GREEN_BITS 0x0D53
|
||||
#define GL_BLUE_BITS 0x0D54
|
||||
#define GL_ALPHA_BITS 0x0D55
|
||||
#define GL_DEPTH_BITS 0x0D56
|
||||
#define GL_STENCIL_BITS 0x0D57
|
||||
#define GL_POLYGON_OFFSET_UNITS 0x2A00
|
||||
/* GL_POLYGON_OFFSET_FILL */
|
||||
#define GL_POLYGON_OFFSET_FACTOR 0x8038
|
||||
#define GL_TEXTURE_BINDING_2D 0x8069
|
||||
#define GL_SAMPLE_BUFFERS 0x80A8
|
||||
#define GL_SAMPLES 0x80A9
|
||||
#define GL_SAMPLE_COVERAGE_VALUE 0x80AA
|
||||
#define GL_SAMPLE_COVERAGE_INVERT 0x80AB
|
||||
|
||||
/* GetTextureParameter */
|
||||
/* GL_TEXTURE_MAG_FILTER */
|
||||
/* GL_TEXTURE_MIN_FILTER */
|
||||
/* GL_TEXTURE_WRAP_S */
|
||||
/* GL_TEXTURE_WRAP_T */
|
||||
|
||||
#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
|
||||
#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3
|
||||
|
||||
/* HintMode */
|
||||
#define GL_DONT_CARE 0x1100
|
||||
#define GL_FASTEST 0x1101
|
||||
#define GL_NICEST 0x1102
|
||||
|
||||
/* HintTarget */
|
||||
#define GL_GENERATE_MIPMAP_HINT 0x8192
|
||||
|
||||
/* DataType */
|
||||
#define GL_BYTE 0x1400
|
||||
#define GL_UNSIGNED_BYTE 0x1401
|
||||
#define GL_SHORT 0x1402
|
||||
#define GL_UNSIGNED_SHORT 0x1403
|
||||
#define GL_INT 0x1404
|
||||
#define GL_UNSIGNED_INT 0x1405
|
||||
#define GL_FLOAT 0x1406
|
||||
#define GL_FIXED 0x140C
|
||||
|
||||
/* PixelFormat */
|
||||
#define GL_DEPTH_COMPONENT 0x1902
|
||||
#define GL_ALPHA 0x1906
|
||||
#define GL_RGB 0x1907
|
||||
#define GL_RGBA 0x1908
|
||||
#define GL_LUMINANCE 0x1909
|
||||
#define GL_LUMINANCE_ALPHA 0x190A
|
||||
|
||||
/* PixelType */
|
||||
/* GL_UNSIGNED_BYTE */
|
||||
#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033
|
||||
#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034
|
||||
#define GL_UNSIGNED_SHORT_5_6_5 0x8363
|
||||
|
||||
/* Shaders */
|
||||
#define GL_FRAGMENT_SHADER 0x8B30
|
||||
#define GL_VERTEX_SHADER 0x8B31
|
||||
#define GL_MAX_VERTEX_ATTRIBS 0x8869
|
||||
#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB
|
||||
#define GL_MAX_VARYING_VECTORS 0x8DFC
|
||||
#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D
|
||||
#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C
|
||||
#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872
|
||||
#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD
|
||||
#define GL_SHADER_TYPE 0x8B4F
|
||||
#define GL_DELETE_STATUS 0x8B80
|
||||
#define GL_LINK_STATUS 0x8B82
|
||||
#define GL_VALIDATE_STATUS 0x8B83
|
||||
#define GL_ATTACHED_SHADERS 0x8B85
|
||||
#define GL_ACTIVE_UNIFORMS 0x8B86
|
||||
#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87
|
||||
#define GL_ACTIVE_ATTRIBUTES 0x8B89
|
||||
#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A
|
||||
#define GL_SHADING_LANGUAGE_VERSION 0x8B8C
|
||||
#define GL_CURRENT_PROGRAM 0x8B8D
|
||||
|
||||
/* StencilFunction */
|
||||
#define GL_NEVER 0x0200
|
||||
#define GL_LESS 0x0201
|
||||
#define GL_EQUAL 0x0202
|
||||
#define GL_LEQUAL 0x0203
|
||||
#define GL_GREATER 0x0204
|
||||
#define GL_NOTEQUAL 0x0205
|
||||
#define GL_GEQUAL 0x0206
|
||||
#define GL_ALWAYS 0x0207
|
||||
|
||||
/* StencilOp */
|
||||
/* GL_ZERO */
|
||||
#define GL_KEEP 0x1E00
|
||||
#define GL_REPLACE 0x1E01
|
||||
#define GL_INCR 0x1E02
|
||||
#define GL_DECR 0x1E03
|
||||
#define GL_INVERT 0x150A
|
||||
#define GL_INCR_WRAP 0x8507
|
||||
#define GL_DECR_WRAP 0x8508
|
||||
|
||||
/* StringName */
|
||||
#define GL_VENDOR 0x1F00
|
||||
#define GL_RENDERER 0x1F01
|
||||
#define GL_VERSION 0x1F02
|
||||
#define GL_EXTENSIONS 0x1F03
|
||||
|
||||
/* TextureMagFilter */
|
||||
#define GL_NEAREST 0x2600
|
||||
#define GL_LINEAR 0x2601
|
||||
|
||||
/* TextureMinFilter */
|
||||
/* GL_NEAREST */
|
||||
/* GL_LINEAR */
|
||||
#define GL_NEAREST_MIPMAP_NEAREST 0x2700
|
||||
#define GL_LINEAR_MIPMAP_NEAREST 0x2701
|
||||
#define GL_NEAREST_MIPMAP_LINEAR 0x2702
|
||||
#define GL_LINEAR_MIPMAP_LINEAR 0x2703
|
||||
|
||||
/* TextureParameterName */
|
||||
#define GL_TEXTURE_MAG_FILTER 0x2800
|
||||
#define GL_TEXTURE_MIN_FILTER 0x2801
|
||||
#define GL_TEXTURE_WRAP_S 0x2802
|
||||
#define GL_TEXTURE_WRAP_T 0x2803
|
||||
|
||||
/* TextureTarget */
|
||||
/* GL_TEXTURE_2D */
|
||||
#define GL_TEXTURE 0x1702
|
||||
|
||||
#define GL_TEXTURE_CUBE_MAP 0x8513
|
||||
#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514
|
||||
#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515
|
||||
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516
|
||||
#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517
|
||||
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518
|
||||
#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519
|
||||
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A
|
||||
#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C
|
||||
|
||||
/* TextureUnit */
|
||||
#define GL_TEXTURE0 0x84C0
|
||||
#define GL_TEXTURE1 0x84C1
|
||||
#define GL_TEXTURE2 0x84C2
|
||||
#define GL_TEXTURE3 0x84C3
|
||||
#define GL_TEXTURE4 0x84C4
|
||||
#define GL_TEXTURE5 0x84C5
|
||||
#define GL_TEXTURE6 0x84C6
|
||||
#define GL_TEXTURE7 0x84C7
|
||||
#define GL_TEXTURE8 0x84C8
|
||||
#define GL_TEXTURE9 0x84C9
|
||||
#define GL_TEXTURE10 0x84CA
|
||||
#define GL_TEXTURE11 0x84CB
|
||||
#define GL_TEXTURE12 0x84CC
|
||||
#define GL_TEXTURE13 0x84CD
|
||||
#define GL_TEXTURE14 0x84CE
|
||||
#define GL_TEXTURE15 0x84CF
|
||||
#define GL_TEXTURE16 0x84D0
|
||||
#define GL_TEXTURE17 0x84D1
|
||||
#define GL_TEXTURE18 0x84D2
|
||||
#define GL_TEXTURE19 0x84D3
|
||||
#define GL_TEXTURE20 0x84D4
|
||||
#define GL_TEXTURE21 0x84D5
|
||||
#define GL_TEXTURE22 0x84D6
|
||||
#define GL_TEXTURE23 0x84D7
|
||||
#define GL_TEXTURE24 0x84D8
|
||||
#define GL_TEXTURE25 0x84D9
|
||||
#define GL_TEXTURE26 0x84DA
|
||||
#define GL_TEXTURE27 0x84DB
|
||||
#define GL_TEXTURE28 0x84DC
|
||||
#define GL_TEXTURE29 0x84DD
|
||||
#define GL_TEXTURE30 0x84DE
|
||||
#define GL_TEXTURE31 0x84DF
|
||||
#define GL_ACTIVE_TEXTURE 0x84E0
|
||||
|
||||
/* TextureWrapMode */
|
||||
#define GL_REPEAT 0x2901
|
||||
#define GL_CLAMP_TO_EDGE 0x812F
|
||||
#define GL_MIRRORED_REPEAT 0x8370
|
||||
|
||||
/* Uniform Types */
|
||||
#define GL_FLOAT_VEC2 0x8B50
|
||||
#define GL_FLOAT_VEC3 0x8B51
|
||||
#define GL_FLOAT_VEC4 0x8B52
|
||||
#define GL_INT_VEC2 0x8B53
|
||||
#define GL_INT_VEC3 0x8B54
|
||||
#define GL_INT_VEC4 0x8B55
|
||||
#define GL_BOOL 0x8B56
|
||||
#define GL_BOOL_VEC2 0x8B57
|
||||
#define GL_BOOL_VEC3 0x8B58
|
||||
#define GL_BOOL_VEC4 0x8B59
|
||||
#define GL_FLOAT_MAT2 0x8B5A
|
||||
#define GL_FLOAT_MAT3 0x8B5B
|
||||
#define GL_FLOAT_MAT4 0x8B5C
|
||||
#define GL_SAMPLER_2D 0x8B5E
|
||||
#define GL_SAMPLER_CUBE 0x8B60
|
||||
|
||||
/* Vertex Arrays */
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F
|
||||
|
||||
/* Read Format */
|
||||
#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A
|
||||
#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B
|
||||
|
||||
/* Shader Source */
|
||||
#define GL_COMPILE_STATUS 0x8B81
|
||||
#define GL_INFO_LOG_LENGTH 0x8B84
|
||||
#define GL_SHADER_SOURCE_LENGTH 0x8B88
|
||||
#define GL_SHADER_COMPILER 0x8DFA
|
||||
|
||||
/* Shader Binary */
|
||||
#define GL_SHADER_BINARY_FORMATS 0x8DF8
|
||||
#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9
|
||||
|
||||
/* Shader Precision-Specified Types */
|
||||
#define GL_LOW_FLOAT 0x8DF0
|
||||
#define GL_MEDIUM_FLOAT 0x8DF1
|
||||
#define GL_HIGH_FLOAT 0x8DF2
|
||||
#define GL_LOW_INT 0x8DF3
|
||||
#define GL_MEDIUM_INT 0x8DF4
|
||||
#define GL_HIGH_INT 0x8DF5
|
||||
|
||||
/* Framebuffer Object. */
|
||||
#define GL_FRAMEBUFFER 0x8D40
|
||||
#define GL_RENDERBUFFER 0x8D41
|
||||
|
||||
#define GL_RGBA4 0x8056
|
||||
#define GL_RGB5_A1 0x8057
|
||||
#define GL_RGB565 0x8D62
|
||||
#define GL_DEPTH_COMPONENT16 0x81A5
|
||||
#define GL_STENCIL_INDEX8 0x8D48
|
||||
|
||||
#define GL_RENDERBUFFER_WIDTH 0x8D42
|
||||
#define GL_RENDERBUFFER_HEIGHT 0x8D43
|
||||
#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44
|
||||
#define GL_RENDERBUFFER_RED_SIZE 0x8D50
|
||||
#define GL_RENDERBUFFER_GREEN_SIZE 0x8D51
|
||||
#define GL_RENDERBUFFER_BLUE_SIZE 0x8D52
|
||||
#define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53
|
||||
#define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54
|
||||
#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55
|
||||
|
||||
#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0
|
||||
#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1
|
||||
#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2
|
||||
#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3
|
||||
|
||||
#define GL_COLOR_ATTACHMENT0 0x8CE0
|
||||
#define GL_DEPTH_ATTACHMENT 0x8D00
|
||||
#define GL_STENCIL_ATTACHMENT 0x8D20
|
||||
|
||||
#define GL_NONE 0
|
||||
|
||||
#define GL_FRAMEBUFFER_COMPLETE 0x8CD5
|
||||
#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6
|
||||
#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7
|
||||
#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS 0x8CD9
|
||||
#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD
|
||||
|
||||
#define GL_FRAMEBUFFER_BINDING 0x8CA6
|
||||
#define GL_RENDERBUFFER_BINDING 0x8CA7
|
||||
#define GL_MAX_RENDERBUFFER_SIZE 0x84E8
|
||||
|
||||
#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* GL core functions.
|
||||
*-----------------------------------------------------------------------*/
|
||||
|
||||
GL_APICALL void GL_APIENTRY glActiveTexture (GLenum texture);
|
||||
GL_APICALL void GL_APIENTRY glAttachShader (GLuint program, GLuint shader);
|
||||
GL_APICALL void GL_APIENTRY glBindAttribLocation (GLuint program, GLuint index, const GLchar* name);
|
||||
GL_APICALL void GL_APIENTRY glBindBuffer (GLenum target, GLuint buffer);
|
||||
GL_APICALL void GL_APIENTRY glBindFramebuffer (GLenum target, GLuint framebuffer);
|
||||
GL_APICALL void GL_APIENTRY glBindRenderbuffer (GLenum target, GLuint renderbuffer);
|
||||
GL_APICALL void GL_APIENTRY glBindTexture (GLenum target, GLuint texture);
|
||||
GL_APICALL void GL_APIENTRY glBlendColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
|
||||
GL_APICALL void GL_APIENTRY glBlendEquation ( GLenum mode );
|
||||
GL_APICALL void GL_APIENTRY glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha);
|
||||
GL_APICALL void GL_APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor);
|
||||
GL_APICALL void GL_APIENTRY glBlendFuncSeparate (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
|
||||
GL_APICALL void GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage);
|
||||
GL_APICALL void GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data);
|
||||
GL_APICALL GLenum GL_APIENTRY glCheckFramebufferStatus (GLenum target);
|
||||
GL_APICALL void GL_APIENTRY glClear (GLbitfield mask);
|
||||
GL_APICALL void GL_APIENTRY glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
|
||||
GL_APICALL void GL_APIENTRY glClearDepthf (GLclampf depth);
|
||||
GL_APICALL void GL_APIENTRY glClearStencil (GLint s);
|
||||
GL_APICALL void GL_APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
|
||||
GL_APICALL void GL_APIENTRY glCompileShader (GLuint shader);
|
||||
GL_APICALL void GL_APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data);
|
||||
GL_APICALL void GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data);
|
||||
GL_APICALL void GL_APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
|
||||
GL_APICALL void GL_APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
GL_APICALL GLuint GL_APIENTRY glCreateProgram (void);
|
||||
GL_APICALL GLuint GL_APIENTRY glCreateShader (GLenum type);
|
||||
GL_APICALL void GL_APIENTRY glCullFace (GLenum mode);
|
||||
GL_APICALL void GL_APIENTRY glDeleteBuffers (GLsizei n, const GLuint* buffers);
|
||||
GL_APICALL void GL_APIENTRY glDeleteFramebuffers (GLsizei n, const GLuint* framebuffers);
|
||||
GL_APICALL void GL_APIENTRY glDeleteProgram (GLuint program);
|
||||
GL_APICALL void GL_APIENTRY glDeleteRenderbuffers (GLsizei n, const GLuint* renderbuffers);
|
||||
GL_APICALL void GL_APIENTRY glDeleteShader (GLuint shader);
|
||||
GL_APICALL void GL_APIENTRY glDeleteTextures (GLsizei n, const GLuint* textures);
|
||||
GL_APICALL void GL_APIENTRY glDepthFunc (GLenum func);
|
||||
GL_APICALL void GL_APIENTRY glDepthMask (GLboolean flag);
|
||||
GL_APICALL void GL_APIENTRY glDepthRangef (GLclampf zNear, GLclampf zFar);
|
||||
GL_APICALL void GL_APIENTRY glDetachShader (GLuint program, GLuint shader);
|
||||
GL_APICALL void GL_APIENTRY glDisable (GLenum cap);
|
||||
GL_APICALL void GL_APIENTRY glDisableVertexAttribArray (GLuint index);
|
||||
GL_APICALL void GL_APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count);
|
||||
GL_APICALL void GL_APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const GLvoid* indices);
|
||||
GL_APICALL void GL_APIENTRY glEnable (GLenum cap);
|
||||
GL_APICALL void GL_APIENTRY glEnableVertexAttribArray (GLuint index);
|
||||
GL_APICALL void GL_APIENTRY glFinish (void);
|
||||
GL_APICALL void GL_APIENTRY glFlush (void);
|
||||
GL_APICALL void GL_APIENTRY glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
|
||||
GL_APICALL void GL_APIENTRY glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
|
||||
GL_APICALL void GL_APIENTRY glFrontFace (GLenum mode);
|
||||
GL_APICALL void GL_APIENTRY glGenBuffers (GLsizei n, GLuint* buffers);
|
||||
GL_APICALL void GL_APIENTRY glGenerateMipmap (GLenum target);
|
||||
GL_APICALL void GL_APIENTRY glGenFramebuffers (GLsizei n, GLuint* framebuffers);
|
||||
GL_APICALL void GL_APIENTRY glGenRenderbuffers (GLsizei n, GLuint* renderbuffers);
|
||||
GL_APICALL void GL_APIENTRY glGenTextures (GLsizei n, GLuint* textures);
|
||||
GL_APICALL void GL_APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name);
|
||||
GL_APICALL void GL_APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name);
|
||||
GL_APICALL void GL_APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders);
|
||||
GL_APICALL GLint GL_APIENTRY glGetAttribLocation (GLuint program, const GLchar* name);
|
||||
GL_APICALL void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean* params);
|
||||
GL_APICALL void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint* params);
|
||||
GL_APICALL GLenum GL_APIENTRY glGetError (void);
|
||||
GL_APICALL void GL_APIENTRY glGetFloatv (GLenum pname, GLfloat* params);
|
||||
GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint* params);
|
||||
GL_APICALL void GL_APIENTRY glGetIntegerv (GLenum pname, GLint* params);
|
||||
GL_APICALL void GL_APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint* params);
|
||||
GL_APICALL void GL_APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog);
|
||||
GL_APICALL void GL_APIENTRY glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint* params);
|
||||
GL_APICALL void GL_APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint* params);
|
||||
GL_APICALL void GL_APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog);
|
||||
GL_APICALL void GL_APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision);
|
||||
GL_APICALL void GL_APIENTRY glGetShaderSource (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source);
|
||||
GL_APICALL const GLubyte* GL_APIENTRY glGetString (GLenum name);
|
||||
GL_APICALL void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat* params);
|
||||
GL_APICALL void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint* params);
|
||||
GL_APICALL void GL_APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat* params);
|
||||
GL_APICALL void GL_APIENTRY glGetUniformiv (GLuint program, GLint location, GLint* params);
|
||||
GL_APICALL GLint GL_APIENTRY glGetUniformLocation (GLuint program, const GLchar* name);
|
||||
GL_APICALL void GL_APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat* params);
|
||||
GL_APICALL void GL_APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint* params);
|
||||
GL_APICALL void GL_APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, GLvoid** pointer);
|
||||
GL_APICALL void GL_APIENTRY glHint (GLenum target, GLenum mode);
|
||||
GL_APICALL GLboolean GL_APIENTRY glIsBuffer (GLuint buffer);
|
||||
GL_APICALL GLboolean GL_APIENTRY glIsEnabled (GLenum cap);
|
||||
GL_APICALL GLboolean GL_APIENTRY glIsFramebuffer (GLuint framebuffer);
|
||||
GL_APICALL GLboolean GL_APIENTRY glIsProgram (GLuint program);
|
||||
GL_APICALL GLboolean GL_APIENTRY glIsRenderbuffer (GLuint renderbuffer);
|
||||
GL_APICALL GLboolean GL_APIENTRY glIsShader (GLuint shader);
|
||||
GL_APICALL GLboolean GL_APIENTRY glIsTexture (GLuint texture);
|
||||
GL_APICALL void GL_APIENTRY glLineWidth (GLfloat width);
|
||||
GL_APICALL void GL_APIENTRY glLinkProgram (GLuint program);
|
||||
GL_APICALL void GL_APIENTRY glPixelStorei (GLenum pname, GLint param);
|
||||
GL_APICALL void GL_APIENTRY glPolygonOffset (GLfloat factor, GLfloat units);
|
||||
GL_APICALL void GL_APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels);
|
||||
GL_APICALL void GL_APIENTRY glReleaseShaderCompiler (void);
|
||||
GL_APICALL void GL_APIENTRY glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
|
||||
GL_APICALL void GL_APIENTRY glSampleCoverage (GLclampf value, GLboolean invert);
|
||||
GL_APICALL void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
GL_APICALL void GL_APIENTRY glShaderBinary (GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length);
|
||||
GL_APICALL void GL_APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar* const* string, const GLint* length);
|
||||
GL_APICALL void GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask);
|
||||
GL_APICALL void GL_APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask);
|
||||
GL_APICALL void GL_APIENTRY glStencilMask (GLuint mask);
|
||||
GL_APICALL void GL_APIENTRY glStencilMaskSeparate (GLenum face, GLuint mask);
|
||||
GL_APICALL void GL_APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass);
|
||||
GL_APICALL void GL_APIENTRY glStencilOpSeparate (GLenum face, GLenum fail, GLenum zfail, GLenum zpass);
|
||||
GL_APICALL void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels);
|
||||
GL_APICALL void GL_APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param);
|
||||
GL_APICALL void GL_APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat* params);
|
||||
GL_APICALL void GL_APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param);
|
||||
GL_APICALL void GL_APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint* params);
|
||||
GL_APICALL void GL_APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels);
|
||||
GL_APICALL void GL_APIENTRY glUniform1f (GLint location, GLfloat x);
|
||||
GL_APICALL void GL_APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat* v);
|
||||
GL_APICALL void GL_APIENTRY glUniform1i (GLint location, GLint x);
|
||||
GL_APICALL void GL_APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint* v);
|
||||
GL_APICALL void GL_APIENTRY glUniform2f (GLint location, GLfloat x, GLfloat y);
|
||||
GL_APICALL void GL_APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat* v);
|
||||
GL_APICALL void GL_APIENTRY glUniform2i (GLint location, GLint x, GLint y);
|
||||
GL_APICALL void GL_APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint* v);
|
||||
GL_APICALL void GL_APIENTRY glUniform3f (GLint location, GLfloat x, GLfloat y, GLfloat z);
|
||||
GL_APICALL void GL_APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat* v);
|
||||
GL_APICALL void GL_APIENTRY glUniform3i (GLint location, GLint x, GLint y, GLint z);
|
||||
GL_APICALL void GL_APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint* v);
|
||||
GL_APICALL void GL_APIENTRY glUniform4f (GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
|
||||
GL_APICALL void GL_APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat* v);
|
||||
GL_APICALL void GL_APIENTRY glUniform4i (GLint location, GLint x, GLint y, GLint z, GLint w);
|
||||
GL_APICALL void GL_APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint* v);
|
||||
GL_APICALL void GL_APIENTRY glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
|
||||
GL_APICALL void GL_APIENTRY glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
|
||||
GL_APICALL void GL_APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
|
||||
GL_APICALL void GL_APIENTRY glUseProgram (GLuint program);
|
||||
GL_APICALL void GL_APIENTRY glValidateProgram (GLuint program);
|
||||
GL_APICALL void GL_APIENTRY glVertexAttrib1f (GLuint indx, GLfloat x);
|
||||
GL_APICALL void GL_APIENTRY glVertexAttrib1fv (GLuint indx, const GLfloat* values);
|
||||
GL_APICALL void GL_APIENTRY glVertexAttrib2f (GLuint indx, GLfloat x, GLfloat y);
|
||||
GL_APICALL void GL_APIENTRY glVertexAttrib2fv (GLuint indx, const GLfloat* values);
|
||||
GL_APICALL void GL_APIENTRY glVertexAttrib3f (GLuint indx, GLfloat x, GLfloat y, GLfloat z);
|
||||
GL_APICALL void GL_APIENTRY glVertexAttrib3fv (GLuint indx, const GLfloat* values);
|
||||
GL_APICALL void GL_APIENTRY glVertexAttrib4f (GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
|
||||
GL_APICALL void GL_APIENTRY glVertexAttrib4fv (GLuint indx, const GLfloat* values);
|
||||
GL_APICALL void GL_APIENTRY glVertexAttribPointer (GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr);
|
||||
GL_APICALL void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __gl2_h_ */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,30 @@
|
||||
#ifndef __gl2platform_h_
|
||||
#define __gl2platform_h_
|
||||
|
||||
/* $Revision: 10602 $ on $Date:: 2010-03-04 22:35:34 -0800 #$ */
|
||||
|
||||
/*
|
||||
* This document is licensed under the SGI Free Software B License Version
|
||||
* 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
|
||||
*/
|
||||
|
||||
/* Platform-specific types and definitions for OpenGL ES 2.X gl2.h
|
||||
*
|
||||
* Adopters may modify khrplatform.h and this file to suit their platform.
|
||||
* You are encouraged to submit all modifications to the Khronos group so that
|
||||
* they can be included in future versions of this file. Please submit changes
|
||||
* by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla)
|
||||
* by filing a bug against product "OpenGL-ES" component "Registry".
|
||||
*/
|
||||
|
||||
/*#include <KHR/khrplatform.h>*/
|
||||
|
||||
#ifndef GL_APICALL
|
||||
#define GL_APICALL KHRONOS_APICALL
|
||||
#endif
|
||||
|
||||
#ifndef GL_APIENTRY
|
||||
#define GL_APIENTRY KHRONOS_APIENTRY
|
||||
#endif
|
||||
|
||||
#endif /* __gl2platform_h_ */
|
||||
@@ -0,0 +1,282 @@
|
||||
#ifndef __khrplatform_h_
|
||||
#define __khrplatform_h_
|
||||
|
||||
/*
|
||||
** Copyright (c) 2008-2009 The Khronos Group Inc.
|
||||
**
|
||||
** Permission is hereby granted, free of charge, to any person obtaining a
|
||||
** copy of this software and/or associated documentation files (the
|
||||
** "Materials"), to deal in the Materials without restriction, including
|
||||
** without limitation the rights to use, copy, modify, merge, publish,
|
||||
** distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
** permit persons to whom the Materials are furnished to do so, subject to
|
||||
** the following conditions:
|
||||
**
|
||||
** The above copyright notice and this permission notice shall be included
|
||||
** in all copies or substantial portions of the Materials.
|
||||
**
|
||||
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
*/
|
||||
|
||||
/* Khronos platform-specific types and definitions.
|
||||
*
|
||||
* $Revision: 23298 $ on $Date: 2013-09-30 17:07:13 -0700 (Mon, 30 Sep 2013) $
|
||||
*
|
||||
* Adopters may modify this file to suit their platform. Adopters are
|
||||
* encouraged to submit platform specific modifications to the Khronos
|
||||
* group so that they can be included in future versions of this file.
|
||||
* Please submit changes by sending them to the public Khronos Bugzilla
|
||||
* (http://khronos.org/bugzilla) by filing a bug against product
|
||||
* "Khronos (general)" component "Registry".
|
||||
*
|
||||
* A predefined template which fills in some of the bug fields can be
|
||||
* reached using http://tinyurl.com/khrplatform-h-bugreport, but you
|
||||
* must create a Bugzilla login first.
|
||||
*
|
||||
*
|
||||
* See the Implementer's Guidelines for information about where this file
|
||||
* should be located on your system and for more details of its use:
|
||||
* http://www.khronos.org/registry/implementers_guide.pdf
|
||||
*
|
||||
* This file should be included as
|
||||
* #include <KHR/khrplatform.h>
|
||||
* by Khronos client API header files that use its types and defines.
|
||||
*
|
||||
* The types in khrplatform.h should only be used to define API-specific types.
|
||||
*
|
||||
* Types defined in khrplatform.h:
|
||||
* khronos_int8_t signed 8 bit
|
||||
* khronos_uint8_t unsigned 8 bit
|
||||
* khronos_int16_t signed 16 bit
|
||||
* khronos_uint16_t unsigned 16 bit
|
||||
* khronos_int32_t signed 32 bit
|
||||
* khronos_uint32_t unsigned 32 bit
|
||||
* khronos_int64_t signed 64 bit
|
||||
* khronos_uint64_t unsigned 64 bit
|
||||
* khronos_intptr_t signed same number of bits as a pointer
|
||||
* khronos_uintptr_t unsigned same number of bits as a pointer
|
||||
* khronos_ssize_t signed size
|
||||
* khronos_usize_t unsigned size
|
||||
* khronos_float_t signed 32 bit floating point
|
||||
* khronos_time_ns_t unsigned 64 bit time in nanoseconds
|
||||
* khronos_utime_nanoseconds_t unsigned time interval or absolute time in
|
||||
* nanoseconds
|
||||
* khronos_stime_nanoseconds_t signed time interval in nanoseconds
|
||||
* khronos_boolean_enum_t enumerated boolean type. This should
|
||||
* only be used as a base type when a client API's boolean type is
|
||||
* an enum. Client APIs which use an integer or other type for
|
||||
* booleans cannot use this as the base type for their boolean.
|
||||
*
|
||||
* Tokens defined in khrplatform.h:
|
||||
*
|
||||
* KHRONOS_FALSE, KHRONOS_TRUE Enumerated boolean false/true values.
|
||||
*
|
||||
* KHRONOS_SUPPORT_INT64 is 1 if 64 bit integers are supported; otherwise 0.
|
||||
* KHRONOS_SUPPORT_FLOAT is 1 if floats are supported; otherwise 0.
|
||||
*
|
||||
* Calling convention macros defined in this file:
|
||||
* KHRONOS_APICALL
|
||||
* KHRONOS_APIENTRY
|
||||
* KHRONOS_APIATTRIBUTES
|
||||
*
|
||||
* These may be used in function prototypes as:
|
||||
*
|
||||
* KHRONOS_APICALL void KHRONOS_APIENTRY funcname(
|
||||
* int arg1,
|
||||
* int arg2) KHRONOS_APIATTRIBUTES;
|
||||
*/
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Definition of KHRONOS_APICALL
|
||||
*-------------------------------------------------------------------------
|
||||
* This precedes the return type of the function in the function prototype.
|
||||
*/
|
||||
#if defined(_WIN32) && !defined(__SCITECH_SNAP__)
|
||||
# define KHRONOS_APICALL __declspec(dllimport)
|
||||
#elif defined (__SYMBIAN32__)
|
||||
# define KHRONOS_APICALL IMPORT_C
|
||||
#else
|
||||
# define KHRONOS_APICALL
|
||||
#endif
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Definition of KHRONOS_APIENTRY
|
||||
*-------------------------------------------------------------------------
|
||||
* This follows the return type of the function and precedes the function
|
||||
* name in the function prototype.
|
||||
*/
|
||||
#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__)
|
||||
/* Win32 but not WinCE */
|
||||
# define KHRONOS_APIENTRY __stdcall
|
||||
#else
|
||||
# define KHRONOS_APIENTRY
|
||||
#endif
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Definition of KHRONOS_APIATTRIBUTES
|
||||
*-------------------------------------------------------------------------
|
||||
* This follows the closing parenthesis of the function prototype arguments.
|
||||
*/
|
||||
#if defined (__ARMCC_2__)
|
||||
#define KHRONOS_APIATTRIBUTES __softfp
|
||||
#else
|
||||
#define KHRONOS_APIATTRIBUTES
|
||||
#endif
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* basic type definitions
|
||||
*-----------------------------------------------------------------------*/
|
||||
#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__)
|
||||
|
||||
|
||||
/*
|
||||
* Using <stdint.h>
|
||||
*/
|
||||
#include <stdint.h>
|
||||
typedef int32_t khronos_int32_t;
|
||||
typedef uint32_t khronos_uint32_t;
|
||||
typedef int64_t khronos_int64_t;
|
||||
typedef uint64_t khronos_uint64_t;
|
||||
#define KHRONOS_SUPPORT_INT64 1
|
||||
#define KHRONOS_SUPPORT_FLOAT 1
|
||||
|
||||
#elif defined(__VMS ) || defined(__sgi)
|
||||
|
||||
/*
|
||||
* Using <inttypes.h>
|
||||
*/
|
||||
#include <inttypes.h>
|
||||
typedef int32_t khronos_int32_t;
|
||||
typedef uint32_t khronos_uint32_t;
|
||||
typedef int64_t khronos_int64_t;
|
||||
typedef uint64_t khronos_uint64_t;
|
||||
#define KHRONOS_SUPPORT_INT64 1
|
||||
#define KHRONOS_SUPPORT_FLOAT 1
|
||||
|
||||
#elif defined(_WIN32) && !defined(__SCITECH_SNAP__)
|
||||
|
||||
/*
|
||||
* Win32
|
||||
*/
|
||||
typedef __int32 khronos_int32_t;
|
||||
typedef unsigned __int32 khronos_uint32_t;
|
||||
typedef __int64 khronos_int64_t;
|
||||
typedef unsigned __int64 khronos_uint64_t;
|
||||
#define KHRONOS_SUPPORT_INT64 1
|
||||
#define KHRONOS_SUPPORT_FLOAT 1
|
||||
|
||||
#elif defined(__sun__) || defined(__digital__)
|
||||
|
||||
/*
|
||||
* Sun or Digital
|
||||
*/
|
||||
typedef int khronos_int32_t;
|
||||
typedef unsigned int khronos_uint32_t;
|
||||
#if defined(__arch64__) || defined(_LP64)
|
||||
typedef long int khronos_int64_t;
|
||||
typedef unsigned long int khronos_uint64_t;
|
||||
#else
|
||||
typedef long long int khronos_int64_t;
|
||||
typedef unsigned long long int khronos_uint64_t;
|
||||
#endif /* __arch64__ */
|
||||
#define KHRONOS_SUPPORT_INT64 1
|
||||
#define KHRONOS_SUPPORT_FLOAT 1
|
||||
|
||||
#elif 0
|
||||
|
||||
/*
|
||||
* Hypothetical platform with no float or int64 support
|
||||
*/
|
||||
typedef int khronos_int32_t;
|
||||
typedef unsigned int khronos_uint32_t;
|
||||
#define KHRONOS_SUPPORT_INT64 0
|
||||
#define KHRONOS_SUPPORT_FLOAT 0
|
||||
|
||||
#else
|
||||
|
||||
/*
|
||||
* Generic fallback
|
||||
*/
|
||||
#include <stdint.h>
|
||||
typedef int32_t khronos_int32_t;
|
||||
typedef uint32_t khronos_uint32_t;
|
||||
typedef int64_t khronos_int64_t;
|
||||
typedef uint64_t khronos_uint64_t;
|
||||
#define KHRONOS_SUPPORT_INT64 1
|
||||
#define KHRONOS_SUPPORT_FLOAT 1
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Types that are (so far) the same on all platforms
|
||||
*/
|
||||
typedef signed char khronos_int8_t;
|
||||
typedef unsigned char khronos_uint8_t;
|
||||
typedef signed short int khronos_int16_t;
|
||||
typedef unsigned short int khronos_uint16_t;
|
||||
|
||||
/*
|
||||
* Types that differ between LLP64 and LP64 architectures - in LLP64,
|
||||
* pointers are 64 bits, but 'long' is still 32 bits. Win64 appears
|
||||
* to be the only LLP64 architecture in current use.
|
||||
*/
|
||||
#ifdef _WIN64
|
||||
typedef signed long long int khronos_intptr_t;
|
||||
typedef unsigned long long int khronos_uintptr_t;
|
||||
typedef signed long long int khronos_ssize_t;
|
||||
typedef unsigned long long int khronos_usize_t;
|
||||
#else
|
||||
typedef signed long int khronos_intptr_t;
|
||||
typedef unsigned long int khronos_uintptr_t;
|
||||
typedef signed long int khronos_ssize_t;
|
||||
typedef unsigned long int khronos_usize_t;
|
||||
#endif
|
||||
|
||||
#if KHRONOS_SUPPORT_FLOAT
|
||||
/*
|
||||
* Float type
|
||||
*/
|
||||
typedef float khronos_float_t;
|
||||
#endif
|
||||
|
||||
#if KHRONOS_SUPPORT_INT64
|
||||
/* Time types
|
||||
*
|
||||
* These types can be used to represent a time interval in nanoseconds or
|
||||
* an absolute Unadjusted System Time. Unadjusted System Time is the number
|
||||
* of nanoseconds since some arbitrary system event (e.g. since the last
|
||||
* time the system booted). The Unadjusted System Time is an unsigned
|
||||
* 64 bit value that wraps back to 0 every 584 years. Time intervals
|
||||
* may be either signed or unsigned.
|
||||
*/
|
||||
typedef khronos_uint64_t khronos_utime_nanoseconds_t;
|
||||
typedef khronos_int64_t khronos_stime_nanoseconds_t;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Dummy value used to pad enum types to 32 bits.
|
||||
*/
|
||||
#ifndef KHRONOS_MAX_ENUM
|
||||
#define KHRONOS_MAX_ENUM 0x7FFFFFFF
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Enumerated boolean type
|
||||
*
|
||||
* Values other than zero should be considered to be true. Therefore
|
||||
* comparisons should not be made against KHRONOS_TRUE.
|
||||
*/
|
||||
typedef enum {
|
||||
KHRONOS_FALSE = 0,
|
||||
KHRONOS_TRUE = 1,
|
||||
KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM
|
||||
} khronos_boolean_enum_t;
|
||||
|
||||
#endif /* __khrplatform_h_ */
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user