2 * Copyright (c) 2007, Digital Signal Processing Laboratory, Universita degli studi di Perugia (UPG), Italy
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
15 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
18 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24 * POSSIBILITY OF SUCH DAMAGE.
26 /////////////////////////////////////////////////////////////////////////////
27 // Name: imagalljpeg2000.h
28 // Purpose: wxImage JPEG 2000 family file format handler
29 // Author: G. Baruffa - based on imagjpeg.h, Vaclav Slavik
30 // RCS-ID: $Id: imagalljpeg2000.h,v 0.0 2008/01/31 11:22:00 VZ Exp $
31 // Copyright: (c) Giuseppe Baruffa
32 // Licence: wxWindows licence
33 /////////////////////////////////////////////////////////////////////////////
35 #ifndef _WX_IMAGJPEG2000_H_
36 #define _WX_IMAGJPEG2000_H_
40 //-----------------------------------------------------------------------------
42 //-----------------------------------------------------------------------------
47 #include "libopenjpeg/openjpeg.h"
48 #include "codec/index.h"
50 #define wxBITMAP_TYPE_JPEG2000 50
52 class WXDLLEXPORT wxJPEG2000Handler: public wxImageHandler
55 inline wxJPEG2000Handler()
57 m_name = wxT("JPEG 2000 family file format");
58 m_extension = wxT("mj2");
59 m_type = wxBITMAP_TYPE_JPEG2000;
60 m_mime = wxT("image/mj2");
68 m_expcomps = JPWL_EXPECTED_COMPONENTS;
69 m_maxtiles = JPWL_MAXIMUM_TILES;
73 m_subsampling = wxT("1,1");
74 m_origin = wxT("0,0");
75 m_rates = wxT("20,10,5");
76 m_quality = wxT("30,35,40");
77 m_enablequality = false;
79 m_irreversible = false;
82 m_cbsize = wxT("32,32");
83 m_prsize = wxT("[128,128],[128,128]");
85 m_torigin = wxT("0,0");
90 m_enablereset = false;
91 m_enablesegmark = false;
93 m_enablerestart = false;
94 m_enableerterm = false;
95 m_enablebypass = false;
100 m_index = wxT("index.txt");
102 m_poc = wxT("T1=0,0,1,5,3,CPRL/T1=5,0,1,6,3,CPRL");
105 #if defined __WXMSW__
106 m_comment = wxT("Created by OPJViewer Win32 - OpenJPEG version ");
107 #elif defined __WXGTK__
108 m_comment = wxT("Created by OPJViewer Lin32 - OpenJPEG version ");
110 m_comment = wxT("Created by OPJViewer - OpenJPEG version ");
114 m_comment += wxString::Format(wxT("%s with JPWL"), (char *) opj_version());
116 m_comment += wxString::Format(wxT("%s"), (char *) opj_version());
121 // decoding engine parameters
122 int m_reducefactor, m_qualitylayers, m_components, m_framenum;
125 int m_expcomps, m_maxtiles;
128 // encoding engine parameters
129 wxString m_subsampling;
133 bool m_enablequality;
148 bool m_enablerestart;
150 bool m_enablesegmark;
163 virtual bool LoadFile(wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1);
164 virtual bool SaveFile(wxImage *image, wxOutputStream& stream, bool verbose=true);
166 virtual bool DoCanRead(wxInputStream& stream);
170 OPJ_PROG_ORDER give_progression(char progression[4]);
171 DECLARE_DYNAMIC_CLASS(wxJPEG2000Handler)
174 #endif // wxUSE_LIBOPENJPEG
176 #endif // _WX_IMAGJPEG2000_H_