aboutsummaryrefslogtreecommitdiff
path: root/freeimage.c
diff options
context:
space:
mode:
authorHarry Jeffery <harry@exec64.co.uk>2015-11-06 16:18:54 +0000
committerHarry Jeffery <harry@exec64.co.uk>2015-11-06 16:19:08 +0000
commitae019a01faae3b86808befadab158035d524936f (patch)
treec017788247083d1848bb176c2ce7639e769ff915 /freeimage.c
parent7ebfb17b8503f8913166568b487513c42806b1a2 (diff)
downloadimv-ae019a01faae3b86808befadab158035d524936f.tar.gz
Merge freeimage.c into main.c
Diffstat (limited to 'freeimage.c')
-rw-r--r--freeimage.c24
1 files changed, 0 insertions, 24 deletions
diff --git a/freeimage.c b/freeimage.c
deleted file mode 100644
index 6b62751..0000000
--- a/freeimage.c
+++ /dev/null
@@ -1,24 +0,0 @@
-#include <SDL2/SDL.h>
-#include <FreeImage.h>
-
-SDL_Texture* imv_load_freeimage(SDL_Renderer *r, const char* path)
-{
- FREE_IMAGE_FORMAT fmt = FreeImage_GetFileType(path,0);
- FIBITMAP *image = FreeImage_Load(fmt, path, 0);
- FreeImage_FlipVertical(image);
-
- FIBITMAP* temp = image;
- image = FreeImage_ConvertTo32Bits(image);
- FreeImage_Unload(temp);
-
- int w = FreeImage_GetWidth(image);
- int h = FreeImage_GetHeight(image);
- char* pixels = (char*)FreeImage_GetBits(image);
-
- SDL_Texture *img = SDL_CreateTexture(r,
- SDL_PIXELFORMAT_RGB888, SDL_TEXTUREACCESS_STATIC, w, h);
- SDL_Rect area = {0,0,w,h};
- SDL_UpdateTexture(img, &area, pixels, sizeof(unsigned int) * w);
- FreeImage_Unload(image);
- return img;
-}