From d241ee85166e720cc0d3bc777ea940e25e1f1d3c Mon Sep 17 00:00:00 2001 From: Ray Date: Tue, 29 Nov 2022 10:58:27 +0100 Subject: ADDED: Optional support for PNM images (.ppm, .pgm) --- src/config.h | 1 + src/rtextures.c | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/config.h b/src/config.h index a7ec2523..82224e3a 100644 --- a/src/config.h +++ b/src/config.h @@ -148,6 +148,7 @@ //#define SUPPORT_FILEFORMAT_PSD 1 #define SUPPORT_FILEFORMAT_DDS 1 #define SUPPORT_FILEFORMAT_HDR 1 +//#define SUPPORT_FILEFORMAT_PNM 1 //#define SUPPORT_FILEFORMAT_KTX 1 //#define SUPPORT_FILEFORMAT_ASTC 1 //#define SUPPORT_FILEFORMAT_PKM 1 diff --git a/src/rtextures.c b/src/rtextures.c index 6b8af71d..19dd5f62 100644 --- a/src/rtextures.c +++ b/src/rtextures.c @@ -16,6 +16,7 @@ * #define SUPPORT_FILEFORMAT_PSD * #define SUPPORT_FILEFORMAT_PIC * #define SUPPORT_FILEFORMAT_HDR +* #define SUPPORT_FILEFORMAT_PNM * #define SUPPORT_FILEFORMAT_DDS * #define SUPPORT_FILEFORMAT_PKM * #define SUPPORT_FILEFORMAT_KTX @@ -103,6 +104,9 @@ #if !defined(SUPPORT_FILEFORMAT_HDR) #define STBI_NO_HDR #endif +#if !defined(SUPPORT_FILEFORMAT_PNM) + #define STBI_NO_PNM +#endif #if defined(SUPPORT_FILEFORMAT_DDS) #define RL_GPUTEX_SUPPORT_DDS @@ -135,7 +139,8 @@ defined(SUPPORT_FILEFORMAT_PSD) || \ defined(SUPPORT_FILEFORMAT_GIF) || \ defined(SUPPORT_FILEFORMAT_PIC) || \ - defined(SUPPORT_FILEFORMAT_HDR)) + defined(SUPPORT_FILEFORMAT_HDR) || \ + defined(SUPPORT_FILEFORMAT_PNM)) #define STBI_MALLOC RL_MALLOC #define STBI_FREE RL_FREE @@ -234,6 +239,7 @@ Image LoadImage(const char *fileName) defined(SUPPORT_FILEFORMAT_GIF) || \ defined(SUPPORT_FILEFORMAT_PIC) || \ defined(SUPPORT_FILEFORMAT_HDR) || \ + defined(SUPPORT_FILEFORMAT_PNM) || \ defined(SUPPORT_FILEFORMAT_PSD) #define STBI_REQUIRED @@ -344,6 +350,9 @@ Image LoadImageFromMemory(const char *fileType, const unsigned char *fileData, i #if defined(SUPPORT_FILEFORMAT_PIC) || (strcmp(fileType, ".pic") == 0) #endif +#if defined(SUPPORT_FILEFORMAT_PNM) + || ((strcmp(fileType, ".ppm") == 0) || (strcmp(fileType, ".pgm") == 0)) +#endif #if defined(SUPPORT_FILEFORMAT_PSD) || (strcmp(fileType, ".psd") == 0) #endif -- cgit v1.2.3