2 * The copyright in this software is being made available under the 2-clauses
3 * BSD License, included below. This software may be subject to other third
4 * party and contributor rights, including patent rights, and no such rights
5 * are granted under this license.
7 * Copyright (c) 2007, Digital Signal Processing Laboratory, Universita degli studi di Perugia (UPG), Italy
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
31 /////////////////////////////////////////////////////////////////////////////
32 // Name: imagalljpeg2000.h
33 // Purpose: wxImage JPEG 2000 family file format handler
34 // Author: G. Baruffa - based on imagjpeg.h, Vaclav Slavik
35 // RCS-ID: $Id: imagalljpeg2000.h,v 0.0 2008/01/31 11:22:00 VZ Exp $
36 // Copyright: (c) Giuseppe Baruffa
37 // Licence: wxWindows licence
38 /////////////////////////////////////////////////////////////////////////////
40 #ifndef _WX_IMAGJPEG2000_H_
41 #define _WX_IMAGJPEG2000_H_
45 //-----------------------------------------------------------------------------
47 //-----------------------------------------------------------------------------
52 #include "openjp2/openjpeg.h"
53 #include "jp2/index.h"
55 #define wxBITMAP_TYPE_JPEG2000 50
57 class WXDLLEXPORT wxJPEG2000Handler: public wxImageHandler
60 inline wxJPEG2000Handler()
62 m_name = wxT("JPEG 2000 family file format");
63 m_extension = wxT("mj2");
64 m_type = wxBITMAP_TYPE_JPEG2000;
65 m_mime = wxT("image/mj2");
73 m_expcomps = JPWL_EXPECTED_COMPONENTS;
74 m_maxtiles = JPWL_MAXIMUM_TILES;
78 m_subsampling = wxT("1,1");
79 m_origin = wxT("0,0");
80 m_rates = wxT("20,10,5");
81 m_quality = wxT("30,35,40");
82 m_enablequality = false;
84 m_irreversible = false;
87 m_cbsize = wxT("32,32");
88 m_prsize = wxT("[128,128],[128,128]");
90 m_torigin = wxT("0,0");
95 m_enablereset = false;
96 m_enablesegmark = false;
98 m_enablerestart = false;
99 m_enableerterm = false;
100 m_enablebypass = false;
105 m_index = wxT("index.txt");
107 m_poc = wxT("T1=0,0,1,5,3,CPRL/T1=5,0,1,6,3,CPRL");
110 #if defined __WXMSW__
111 m_comment = wxT("Created by OPJViewer Win32 - OpenJPEG version ");
112 #elif defined __WXGTK__
113 m_comment = wxT("Created by OPJViewer Lin32 - OpenJPEG version ");
115 m_comment = wxT("Created by OPJViewer - OpenJPEG version ");
119 m_comment += wxString::Format(wxT("%s with JPWL"), (char *) opj_version());
121 m_comment += wxString::Format(wxT("%s"), (char *) opj_version());
126 // decoding engine parameters
127 int m_reducefactor, m_qualitylayers, m_components, m_framenum;
130 int m_expcomps, m_maxtiles;
133 // encoding engine parameters
134 wxString m_subsampling;
138 bool m_enablequality;
153 bool m_enablerestart;
155 bool m_enablesegmark;
168 virtual bool LoadFile(wxImage *image, wxInputStream& stream,
169 bool verbose = true, int index = -1);
170 virtual bool SaveFile(wxImage *image, wxOutputStream& stream,
171 bool verbose = true);
173 virtual bool DoCanRead(wxInputStream& stream);
177 OPJ_PROG_ORDER give_progression(char progression[4]);
178 DECLARE_DYNAMIC_CLASS(wxJPEG2000Handler)
181 #endif // wxUSE_LIBOPENJPEG
183 #endif // _WX_IMAGJPEG2000_H_