workarounds for rendering differently sized components

This commit is contained in:
Giuseppe Baruffa 2007-04-27 17:20:26 +00:00
parent 848214e789
commit 7c9dc11e33
6 changed files with 49 additions and 25 deletions

View File

@ -42,15 +42,15 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /G6 /MD /W3 /GX /O2 /I "c:\programmi\wxWidgets-2.8.0\lib\vc_lib\msw" /I "c:\programmi\wxWidgets-2.8.0\include" /I ".." /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /D WINVER=0x400 /D "_MT" /D wxUSE_GUI=1 /D "wxUSE_LIBOPENJPEG" /D "OPJ_STATIC" /D "USE_JPWL" /D "OPJ_HTMLABOUT" /FR /FD /c
# ADD CPP /nologo /G6 /MD /W3 /GX /O2 /I "d:\programmi\wxWidgets-2.8.0\lib\vc_lib\msw" /I "d:\programmi\wxWidgets-2.8.0\include" /I ".." /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /D WINVER=0x400 /D "_MT" /D wxUSE_GUI=1 /D "wxUSE_LIBOPENJPEG" /D "OPJ_STATIC" /D "USE_JPWL" /D "OPJ_HTMLABOUT" /FR /FD /c
# ADD BASE RSC /l 0x410 /d "NDEBUG"
# ADD RSC /l 0x409 /i "c:\programmi\wxWidgets-2.8.0\include" /d "NDEBUG"
# ADD RSC /l 0x409 /i "d:\programmi\wxWidgets-2.8.0\include" /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib wxzlib.lib wxregex.lib wxpng.lib wxjpeg.lib wxbase28.lib wxmsw28_core.lib wxmsw28_html.lib wxmsw28_adv.lib wxmsw28_core.lib wxbase28.lib wxtiff.lib wxjpeg.lib wxpng.lib wxzlib.lib wxregex.lib wxexpat.lib LibOpenJPEG_JPWL.lib /nologo /subsystem:windows /machine:I386 /nodefaultlib:"libcmt.lib" /libpath:"c:\programmi\wxWidgets-2.8.0\lib\vc_lib" /libpath:"..\jpwl\Release" /IGNORE:4089
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib wxzlib.lib wxregex.lib wxpng.lib wxjpeg.lib wxbase28.lib wxmsw28_core.lib wxmsw28_html.lib wxmsw28_adv.lib wxmsw28_core.lib wxbase28.lib wxtiff.lib wxjpeg.lib wxpng.lib wxzlib.lib wxregex.lib wxexpat.lib LibOpenJPEG_JPWL.lib /nologo /subsystem:windows /machine:I386 /nodefaultlib:"libcmt.lib" /libpath:"d:\programmi\wxWidgets-2.8.0\lib\vc_lib" /libpath:"..\jpwl\Release" /IGNORE:4089
# SUBTRACT LINK32 /pdb:none
!ELSEIF "$(CFG)" == "OPJViewer - Win32 Debug"

View File

@ -3,7 +3,7 @@
[Setup]
AppName=OPJViewer
AppVerName=OPJViewer 0.2 alpha
AppVerName=OPJViewer 0.3 alpha
AppPublisher=OpenJPEG
AppPublisherURL=http://www.openjpeg.org
AppSupportURL=http://www.openjpeg.org
@ -11,13 +11,13 @@ AppUpdatesURL=http://www.openjpeg.org
DefaultDirName={pf}\OPJViewer
DefaultGroupName=OPJViewer
OutputDir=setup
OutputBaseFilename=OPJViewer02alpha_setup
OutputBaseFilename=OPJViewer03alpha_setup
Compression=lzma
SolidCompression=true
InfoBeforeFile=source\readmebefore.txt
InfoAfterFile=source\readmeafter.txt
LicenseFile=source\license.txt
VersionInfoVersion=0.2.0.0
VersionInfoVersion=0.3.0.0
VersionInfoCompany=OpenJPEG
VersionInfoDescription=JPEG 2000 viewer
ShowLanguageDialog=yes

View File

@ -803,6 +803,7 @@ void OPJCanvas::OnDraw(wxDC& dc)
// the left button.
void OPJCanvas::OnEvent(wxMouseEvent& event)
{
#if USE_PENCIL_ON_CANVAS
wxClientDC dc(this);
PrepareDC(dc);
@ -814,6 +815,7 @@ void OPJCanvas::OnEvent(wxMouseEvent& event)
}
xpos = pt.x;
ypos = pt.y;
#endif
}
void OPJFrame::OnSize(wxSizeEvent& WXUNUSED(event))
@ -856,7 +858,9 @@ const long style):
GetClientSize(&width, &height);
OPJCanvas *canvas = new OPJCanvas(fname, this, wxPoint(0, 0), wxSize(width, height));
#if USE_PENCIL_ON_CANVAS
canvas->SetCursor(wxCursor(wxCURSOR_PENCIL));
#endif
m_canvas = canvas;
// Give it scrollbars

View File

@ -113,6 +113,7 @@ typedef unsigned long long int8byte;
#endif // __WXGTK__
#define USE_GENERIC_TREECTRL 0
#define USE_PENCIL_ON_CANVAS 0
#if USE_GENERIC_TREECTRL
#include "wx/generic/treectlg.h"
@ -124,7 +125,7 @@ typedef unsigned long long int8byte;
#define OPJ_APPLICATION wxT("OPJViewer")
#define OPJ_APPLICATION_NAME wxT("OpenJPEG Viewer")
#define OPJ_APPLICATION_VERSION wxT("0.2 alpha")
#define OPJ_APPLICATION_VERSION wxT("0.3 alpha")
#define OPJ_APPLICATION_TITLEBAR OPJ_APPLICATION_NAME wxT(" ") OPJ_APPLICATION_VERSION
#define OPJ_APPLICATION_COPYRIGHT wxT("(C) 2007, Giuseppe Baruffa")

View File

@ -85,27 +85,27 @@ void j2k_error_callback(const char *msg, void *client_data) {
int message_len = strlen(msg) - 1;
if (msg[message_len] != '\n')
message_len = MAX_MESSAGE_LEN;
/*wxMutexGuiEnter();
wxMutexGuiEnter();
wxLogMessage(wxT("[ERROR] %.*s"), message_len, msg);
wxMutexGuiLeave();*/
wxMutexGuiLeave();
}
/* sample warning callback expecting a FILE* client object */
void j2k_warning_callback(const char *msg, void *client_data) {
int message_len = strlen(msg) - 1;
if (msg[message_len] != '\n')
message_len = MAX_MESSAGE_LEN;
/*wxMutexGuiEnter();
wxMutexGuiEnter();
wxLogMessage(wxT("[WARNING] %.*s"), message_len, msg);
wxMutexGuiLeave();*/
wxMutexGuiLeave();
}
/* sample debug callback expecting no client object */
void j2k_info_callback(const char *msg, void *client_data) {
int message_len = strlen(msg) - 1;
if (msg[message_len] != '\n')
message_len = MAX_MESSAGE_LEN;
/*wxMutexGuiEnter();
wxMutexGuiEnter();
wxLogMessage(wxT("[INFO] %.*s"), message_len, msg);
wxMutexGuiLeave();*/
wxMutexGuiLeave();
}
// load the j2k codestream
@ -118,6 +118,7 @@ bool wxJ2KHandler::LoadFile(wxImage *image, wxInputStream& stream, bool verbose,
unsigned char *ptr;
int file_length;
int shiftbpp;
int c, tempcomps;
// destroy the image
image->Destroy();
@ -193,14 +194,6 @@ bool wxJ2KHandler::LoadFile(wxImage *image, wxInputStream& stream, bool verbose,
opj_cio_close(cio);
// check image components
if ((opjimage->numcomps != 1) && (opjimage->numcomps != 3)) {
wxMutexGuiEnter();
wxLogError(wxT("J2K: weird number of components"));
wxMutexGuiLeave();
opj_destroy_decompress(dinfo);
free(src);
return false;
}
// check image depth (only on the first one, for now)
shiftbpp = opjimage->comps[0].prec - 8;
@ -212,8 +205,34 @@ bool wxJ2KHandler::LoadFile(wxImage *image, wxInputStream& stream, bool verbose,
image->SetMask( false );
ptr = image->GetData();
// workaround for components different from 1 or 3
if ((opjimage->numcomps != 1) && (opjimage->numcomps != 3)) {
wxMutexGuiEnter();
wxLogMessage(wxT("J2K: weird number of components"));
tempcomps = 1;
wxMutexGuiLeave();
} else
tempcomps = opjimage->numcomps;
// workaround for subsampled components
for (c = 1; c < tempcomps; c++) {
if ((opjimage->comps[c].w != opjimage->comps[c - 1].w) || (opjimage->comps[c].h != opjimage->comps[c - 1].h)) {
tempcomps = 1;
break;
}
}
// workaround for different precision components
for (c = 1; c < tempcomps; c++) {
if (opjimage->comps[c].bpp != opjimage->comps[c - 1].bpp) {
tempcomps = 1;
break;
}
}
// RGB color picture
if (opjimage->numcomps == 3) {
if (tempcomps == 3) {
int row, col;
int *r = opjimage->comps[0].data;
int *g = opjimage->comps[1].data;
@ -254,7 +273,7 @@ bool wxJ2KHandler::LoadFile(wxImage *image, wxInputStream& stream, bool verbose,
}
// B/W picture
if (opjimage->numcomps == 1) {
if (tempcomps == 1) {
int row, col;
int *y = opjimage->comps[0].data;
if (shiftbpp > 0) {

View File

@ -201,9 +201,9 @@ void OPJParseThread::ParseJ2KFile(wxFile *m_file, wxFileOffset offset, wxFileOff
// randomly marker coincident data
if ((currmark != SOT_VAL) &&
(currmark != EOC_VAL) /*&&
(currmark != EOC_VAL) &&
(currmark != SOP_VAL) &&
(currmark != EPH_VAL)*/) {
(currmark != EPH_VAL)) {
OPJ_ADVANCE(1);
continue;
}