summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2009-06-24 21:28:51 +0000
committerTavian Barnes <tavianator@gmail.com>2009-06-24 21:28:51 +0000
commit603712c38a127e297eddd23975fb950499a0c10c (patch)
tree1ec4a3f870f57ab72b0003399657654d91bf247b /tests
parent706acbb46a91adef8ed2ec1d255802e93c59b65a (diff)
downloaddimension-603712c38a127e297eddd23975fb950499a0c10c.tar.xz
New asynchronous PNG_Canvas interface.
Diffstat (limited to 'tests')
-rw-r--r--tests/pngxx.cpp33
1 files changed, 32 insertions, 1 deletions
diff --git a/tests/pngxx.cpp b/tests/pngxx.cpp
index 8dc79b2..2bb9fdb 100644
--- a/tests/pngxx.cpp
+++ b/tests/pngxx.cpp
@@ -20,6 +20,7 @@
#include "../libdimensionxx/dimensionxx.hpp"
#include <fstream>
+#include <iostream>
int
main()
@@ -92,11 +93,41 @@ main()
ocanvas.pixel(x + 2*width, y, color);
}
}
+
+ Dimension::Progress progress = ocanvas.write_async();
+
+ // Display ellipsis progress bar
+ double prog = 0.0;
+ while ((prog += 1.0/10.0) <= 1.0) {
+ progress.wait(prog);
+ std::cout << "." << std::flush;
+ }
+ std::cout << std::endl;
}
std::ifstream ifstr("dimensionxx1.png", std::ios::binary);
std::ofstream ofstr("dimensionxx2.png", std::ios::binary);
- Dimension::PNG_Canvas iocanvas(ifstr, ofstr);
+
+ Dimension::Progress iprogress
+ = Dimension::PNG_Canvas::read_async(ifstr);
+
+ double iprog = 0.0;
+ while ((iprog += 1.0/10.0) <= 1.0) {
+ iprogress.wait(iprog);
+ std::cout << "." << std::flush;
+ }
+ std::cout << std::endl;
+
+ Dimension::PNG_Canvas iocanvas(iprogress, ofstr);
+
+ Dimension::Progress oprogress = iocanvas.write_async();
+
+ double oprog = 0.0;
+ while ((oprog += 1.0/10.0) <= 1.0) {
+ oprogress.wait(oprog);
+ std::cout << "." << std::flush;
+ }
+ std::cout << std::endl;
return 0;
}