diff options
-rw-r--r-- | src/main.c | 29 |
1 files changed, 29 insertions, 0 deletions
@@ -3,6 +3,8 @@ #include <raylib.h> +#include <tiffio.h> + #include <lib/lib.h> int main() @@ -11,6 +13,30 @@ int main() const char* gui_title = "Image Manip - Useful for segmentations!"; InitWindow(SCREEN_WIDTH, SCREEN_HEIGHT, gui_title); + TIFF *tif = TIFFOpen("./data/test.tif", "r"); + if (!tif) { + fprintf(stderr, "Failed to open TIFF file\n"); + return 1; + } + + uint32_t width, height; + TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &width); + TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &height); + + uint32_t* raster = (uint32_t*)_TIFFmalloc(width*height*sizeof(uint32_t)); + if (raster == NULL) { + fprintf(stderr, "Memory allocation error\n"); + TIFFClose(tif); + return 1; + } + + if (!TIFFReadRGBAImage(tif, width, height, raster, 0)) { + fprintf(stderr, "Failed to read TIFF image\n"); + _TIFFfree(raster); + TIFFClose(tif); + return 1; + } + SetTargetFPS(60); Camera2D camera = { 0 }; camera.zoom = 1.0f; @@ -28,6 +54,9 @@ int main() //----------------------------------------------- } + _TIFFfree(raster); + TIFFClose(tif); + CloseWindow(); return 0; } |