From 3f36196dfdd740417d5dfd7d7d313dd179d4a304 Mon Sep 17 00:00:00 2001 From: Giuseppe Baruffa Date: Tue, 27 Mar 2007 12:48:17 +0000 Subject: Improved parsing in OPJViewer, as well some aesthetic modifications; support for image rendering with bit depths lower than 8 bits; can display an arbitrary frame of an MJ2 file (only in B/W, though); can reload a file; better image resizing capabilities --- OPJViewer/source/imagj2k.cpp | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'OPJViewer/source/imagj2k.cpp') diff --git a/OPJViewer/source/imagj2k.cpp b/OPJViewer/source/imagj2k.cpp index 2442aa4e..9f972095 100644 --- a/OPJViewer/source/imagj2k.cpp +++ b/OPJViewer/source/imagj2k.cpp @@ -233,14 +233,26 @@ bool wxJ2KHandler::LoadFile(wxImage *image, wxInputStream& stream, bool verbose, } } - } else { + + } else if (shiftbpp < 0) { for (row = 0; row < opjimage->comps[0].h; row++) { for (col = 0; col < opjimage->comps[0].w; col++) { + *(ptr++) = (*(r++)) << -shiftbpp; + *(ptr++) = (*(g++)) << -shiftbpp; + *(ptr++) = (*(b++)) << -shiftbpp; + + } + } + + } else { + for (row = 0; row < opjimage->comps[0].h; row++) { + for (col = 0; col < opjimage->comps[0].w; col++) { + *(ptr++) = *(r++); *(ptr++) = *(g++); *(ptr++) = *(b++); - + } } } @@ -258,6 +270,16 @@ bool wxJ2KHandler::LoadFile(wxImage *image, wxInputStream& stream, bool verbose, *(ptr++) = (*(y)) >> shiftbpp; *(ptr++) = (*(y++)) >> shiftbpp; + } + } + } else if (shiftbpp < 0) { + for (row = 0; row < opjimage->comps[0].h; row++) { + for (col = 0; col < opjimage->comps[0].w; col++) { + + *(ptr++) = (*(y)) << -shiftbpp; + *(ptr++) = (*(y)) << -shiftbpp; + *(ptr++) = (*(y++)) << -shiftbpp; + } } } else { -- cgit v1.2.3