summaryrefslogtreecommitdiffstats
path: root/kimgio
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2022-04-27 20:07:36 +0200
committerSlávek Banko <slavek.banko@axis.cz>2022-04-27 20:07:36 +0200
commit813d99d1241d251e78fce97c28d2533dbee8dae3 (patch)
tree44ed2b684fd8bd96703c09d618ae3573ea7342e9 /kimgio
parent4a3b0d6dce2c42f7108e39d8da167491d198eb17 (diff)
downloadtdelibs-813d99d1241d251e78fce97c28d2533dbee8dae3.tar.gz
tdelibs-813d99d1241d251e78fce97c28d2533dbee8dae3.zip
Add support for Jasper 3.x.
Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
Diffstat (limited to 'kimgio')
-rw-r--r--kimgio/jp2.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/kimgio/jp2.cpp b/kimgio/jp2.cpp
index 1f3f09c0a..68075cf96 100644
--- a/kimgio/jp2.cpp
+++ b/kimgio/jp2.cpp
@@ -279,7 +279,16 @@ kimgio_jp2_write( TQImageIO* io )
TQTextStream ts( &rate, IO_WriteOnly );
ts << "rate="
<< ( (io->quality() < 0) ? DEFAULT_RATE : io->quality() / 100.0F );
+# if defined(JAS_VERSION_MAJOR) && (JAS_VERSION_MAJOR >= 3)
+ const jas_image_fmtinfo_t *jp2_fmtinfo = jas_image_lookupfmtbyname("jp2");
+ int i = -1;
+ if (jp2_fmtinfo)
+ {
+ i = jas_image_encode(ji, stream, jp2_fmtinfo->id, rate.utf8().data());
+ }
+# else
int i = jp2_encode( ji, stream, rate.utf8().data() );
+# endif
jas_image_destroy( ji );
jas_stream_close( stream );