aboutsummaryrefslogtreecommitdiffstats
path: root/djvu.js/test_djvu.cpp
diff options
context:
space:
mode:
authorGuillaume Horel <guillaume.horel@gmail.com>2014-03-12 00:52:17 -0400
committerGuillaume Horel <guillaume.horel@gmail.com>2014-03-12 00:52:17 -0400
commitdfcd65c8f10aa94f19fe40940565681ab9a73e44 (patch)
tree63eeb10b2bc30611835733c2dcbf94ca4b459459 /djvu.js/test_djvu.cpp
parentbf74cd2294598c3dc1d73edd74ca88c87b7d6cd6 (diff)
downloadocr-layer-curation-dfcd65c8f10aa94f19fe40940565681ab9a73e44.tar.gz
trying to build a djvu decoder
Diffstat (limited to 'djvu.js/test_djvu.cpp')
-rw-r--r--djvu.js/test_djvu.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/djvu.js/test_djvu.cpp b/djvu.js/test_djvu.cpp
new file mode 100644
index 0000000..5e09a64
--- /dev/null
+++ b/djvu.js/test_djvu.cpp
@@ -0,0 +1,19 @@
+#include <ByteStream.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <JB2Image.h>
+#include <GBitmap.h>
+
+int main(){
+ int fh = open("image.jb2", O_RDONLY, 0);
+ int fh2 = open("image.pbm", O_WRONLY | O_CREAT, 0600);
+ GP<ByteStream> gbs = ByteStream::create(fh, "r", true);
+ GP<ByteStream> gbs2 = ByteStream::create(fh2, "w", true);
+ GP<JB2Image> img = JB2Image::create();
+ img->decode(gbs, 0, 0);
+ int w =img->get_width();
+ int h = img->get_height();
+ GP<GBitmap> gbmp = img->get_bitmap(1, 1);
+ gbmp->save_pbm(*gbs2);
+ printf("taille est %d %d", w, h);
+}