ref: 069edc3b883a71762329a55e0c7661905badc4c5
parent: 957fb2007f36fc99d932e1508c4a6795ae30680d
author: Sigrid Solveig Haflínudóttir <ftrvxmtrx@gmail.com>
date: Fri Mar 19 12:55:00 EDT 2021
sdl2: SDL_image stubs
--- /dev/null
+++ b/include/npe/SDL2/SDL_image.h
@@ -1,0 +1,41 @@
+#ifndef _npe_SDL_image_h_
+#define _npe_SDL_image_h_
+
+#define SDL_IMAGE_MAJOR_VERSION 2
+#define SDL_IMAGE_MINOR_VERSION 0
+#define SDL_IMAGE_PATCHLEVEL 6
+
+enum {
+ IMG_INIT_JPG = 1<<0,
+ IMG_INIT_PNG = 1<<1,
+ IMG_INIT_TIF = 1<<2,
+};
+
+int IMG_Init(int flags);
+void IMG_Quit(void);
+
+SDL_Surface *IMG_LoadTyped_RW(SDL_RWops *src, int freesrc, const char *type);
+SDL_Surface *IMG_Load(const char *file);
+SDL_Surface *IMG_Load_RW(SDL_RWops *src, int freesrc);
+
+SDL_Texture *IMG_LoadTexture(SDL_Renderer *renderer, const char *file);
+SDL_Texture *IMG_LoadTexture_RW(SDL_Renderer *renderer, SDL_RWops *src, int freesrc);
+SDL_Texture *IMG_LoadTextureTyped_RW(SDL_Renderer *renderer, SDL_RWops *src, int freesrc, const char *type);
+
+SDL_Surface *IMG_LoadBMP_RW(SDL_RWops *src);
+SDL_Surface *IMG_LoadGIF_RW(SDL_RWops *src);
+SDL_Surface *IMG_LoadJPG_RW(SDL_RWops *src);
+SDL_Surface *IMG_LoadPNG_RW(SDL_RWops *src);
+SDL_Surface *IMG_LoadPNM_RW(SDL_RWops *src);
+SDL_Surface *IMG_LoadTGA_RW(SDL_RWops *src);
+SDL_Surface *IMG_LoadTIF_RW(SDL_RWops *src);
+
+int IMG_SavePNG(SDL_Surface *surface, const char *file);
+int IMG_SavePNG_RW(SDL_Surface *surface, SDL_RWops *dst, int freedst);
+int IMG_SaveJPG(SDL_Surface *surface, const char *file, int quality);
+int IMG_SaveJPG_RW(SDL_Surface *surface, SDL_RWops *dst, int freedst, int quality);
+
+#define IMG_SetError SDL_SetError
+#define IMG_GetError SDL_GetError
+
+#endif
--- /dev/null
+++ b/libnpe_sdl2/image.c
@@ -1,0 +1,136 @@
+#include "_sdl.h"
+#include <SDL2/SDL_image.h>
+
+int
+IMG_Init(int flags)
+{
+ USED(flags);
+ werrstr("FIXME IMG_Init not implemented");
+
+ return -1;
+}
+
+void
+IMG_Quit(void)
+{
+}
+
+SDL_Surface *
+IMG_LoadTyped_RW(SDL_RWops *src, int freesrc, const char *type)
+{
+ USED(src, freesrc, type);
+ return nil;
+}
+
+SDL_Surface *
+IMG_Load(const char *file)
+{
+ USED(file);
+ return nil;
+}
+
+SDL_Surface *
+IMG_Load_RW(SDL_RWops *src, int freesrc)
+{
+ USED(src, freesrc);
+ return nil;
+}
+
+SDL_Texture *
+IMG_LoadTexture(SDL_Renderer *r, const char *file)
+{
+ USED(r, file);
+ return nil;
+}
+
+SDL_Texture *
+IMG_LoadTexture_RW(SDL_Renderer *r, SDL_RWops *src, int freesrc)
+{
+ USED(r, src, freesrc);
+ return nil;
+}
+
+SDL_Texture *
+IMG_LoadTextureTyped_RW(SDL_Renderer *r, SDL_RWops *src, int freesrc, const char *type)
+{
+ USED(r, src, freesrc, type);
+ return nil;
+}
+
+
+SDL_Surface *
+IMG_LoadBMP_RW(SDL_RWops *src)
+{
+ USED(src);
+ return nil;
+}
+
+SDL_Surface *
+IMG_LoadGIF_RW(SDL_RWops *src)
+{
+ USED(src);
+ return nil;
+}
+
+SDL_Surface *
+IMG_LoadJPG_RW(SDL_RWops *src)
+{
+ USED(src);
+ return nil;
+}
+
+SDL_Surface *
+IMG_LoadPNG_RW(SDL_RWops *src)
+{
+ USED(src);
+ return nil;
+}
+
+SDL_Surface *
+IMG_LoadPNM_RW(SDL_RWops *src)
+{
+ USED(src);
+ return nil;
+}
+
+SDL_Surface *
+IMG_LoadTGA_RW(SDL_RWops *src)
+{
+ USED(src);
+ return nil;
+}
+
+SDL_Surface *
+IMG_LoadTIF_RW(SDL_RWops *src)
+{
+ USED(src);
+ return nil;
+}
+
+int
+IMG_SavePNG(SDL_Surface *s, const char *file)
+{
+ USED(s, file);
+ return -1;
+}
+
+int
+IMG_SavePNG_RW(SDL_Surface *s, SDL_RWops *dst, int freedst)
+{
+ USED(s, dst, freedst);
+ return -1;
+}
+
+int
+IMG_SaveJPG(SDL_Surface *s, const char *file, int quality)
+{
+ USED(s, file, quality);
+ return -1;
+}
+
+int
+IMG_SaveJPG_RW(SDL_Surface *s, SDL_RWops *dst, int freedst, int quality)
+{
+ USED(s, dst, freedst, quality);
+ return -1;
+}
--- a/libnpe_sdl2/mkfile
+++ b/libnpe_sdl2/mkfile
@@ -8,6 +8,7 @@
OFILES=\
audio.$O\
events.$O\
+ image.$O\
rwops.$O\
sdl2.$O\
threads.$O\