From 573cc1b371b478fffe7e59dedf11ad24ce42afc9 Mon Sep 17 00:00:00 2001 From: castano Date: Tue, 28 Jul 2009 08:03:36 +0000 Subject: [PATCH] Add support for UINT16 images when using freetype. --- src/nvimage/ImageIO.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/nvimage/ImageIO.cpp b/src/nvimage/ImageIO.cpp index f399343..cd59f3e 100644 --- a/src/nvimage/ImageIO.cpp +++ b/src/nvimage/ImageIO.cpp @@ -431,6 +431,20 @@ FloatImage * nv::ImageIO::loadFloatFreeImage(FREE_IMAGE_FORMAT fif, Stream & s) } } break; + case FIT_UINT16: + floatImage->allocate(1, w, h); + + for (int y=0; y < h; y++) + { + const uint16 * src = (const uint16 *)FreeImage_GetScanLine(bitmap, h - y - 1 ); + float * dst = floatImage->scanline(y, 0); + + for (int x=0; x < w; x++) + { + dst[x] = float(src[x]) / 65535; + } + } + break; case FIT_COMPLEX: floatImage->allocate(2, w, h);