diff options
author | Tavian Barnes <tavianator@gmail.com> | 2009-07-06 16:36:47 +0000 |
---|---|---|
committer | Tavian Barnes <tavianator@gmail.com> | 2009-07-06 16:36:47 +0000 |
commit | e2c40b8d6cabc68eda634e103d0824fb58d5908b (patch) | |
tree | 8b59b2f92b38821a2b130b971a775ccb1500a28c /tests/pngxx.cpp | |
parent | 6feb3007b1abd0a59940a9d10adac2ff7de34a50 (diff) | |
download | dimension-e2c40b8d6cabc68eda634e103d0824fb58d5908b.tar.xz |
Change C++ canvas import/export semantics.
Diffstat (limited to 'tests/pngxx.cpp')
-rw-r--r-- | tests/pngxx.cpp | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/tests/pngxx.cpp b/tests/pngxx.cpp index 43c4f5d..27fe89c 100644 --- a/tests/pngxx.cpp +++ b/tests/pngxx.cpp @@ -34,7 +34,8 @@ main() { std::ofstream ofstr("dimensionxx1.png", std::ios::binary); - PNG_Canvas ocanvas(3*width, height, ofstr); + Canvas canvas(3*width, height); + PNG_Writer writer(canvas, ofstr); CIE_xyY xyY; CIE_Lab Lab; @@ -46,8 +47,8 @@ main() for (unsigned int y = 0; y < height; ++y) { /* CIE xyY colorspace */ xyY = CIE_xyY(static_cast<double>(x)/(width - 1), - static_cast<double>(y)/(height - 1), - 0.5); + static_cast<double>(y)/(height - 1), + 0.5); color = xyY; RGB = color; @@ -57,15 +58,13 @@ main() color.trans(0.5); } - ocanvas.pixel(x, y, color); + canvas.pixel(x, y, color); /* CIE Lab colorspace */ Lab = CIE_Lab(75.0, - 200.0*(static_cast<double>(x)/ - (width - 1) - 0.5), - 200.0*(static_cast<double>(y)/ - (height - 1) - 0.5)); + 200.0*(static_cast<double>(x)/(width - 1) - 0.5), + 200.0*(static_cast<double>(y)/(height - 1) - 0.5)); color = Lab; RGB = color; @@ -75,15 +74,13 @@ main() color.trans(0.5); } - ocanvas.pixel(x + width, y, color); + canvas.pixel(x + width, y, color); /* CIE Luv colorspace */ Luv = CIE_Luv(75.0, - 200.0*(static_cast<double>(x)/ - (width - 1) - 0.5), - 200.0*(static_cast<double>(y)/ - (height - 1) - 0.5)); + 200.0*(static_cast<double>(x)/(width - 1) - 0.5), + 200.0*(static_cast<double>(y)/(height - 1) - 0.5)); color = Luv; RGB = color; @@ -93,24 +90,25 @@ main() color.trans(0.5); } - ocanvas.pixel(x + 2*width, y, color); + canvas.pixel(x + 2*width, y, color); } } - Progress progress = ocanvas.write_async(); + Progress progress = writer.write_async(); std::cout << "Writing PNG file: " << progress << std::endl; } std::ifstream ifstr("dimensionxx1.png", std::ios::binary); - std::ofstream ofstr("dimensionxx2.png", std::ios::binary); + PNG_Reader reader(ifstr); - Progress iprogress - = PNG_Canvas::read_async(ifstr); + Progress iprogress = reader.read_async(); std::cout << "Reading PNG file: " << iprogress << std::endl; + Canvas canvas = PNG_Reader::finish(iprogress); - PNG_Canvas iocanvas(iprogress, ofstr); + std::ofstream ofstr("dimensionxx2.png", std::ios::binary); + PNG_Writer writer(canvas, ofstr); - Progress oprogress = iocanvas.write_async(); + Progress oprogress = writer.write_async(); std::cout << "Writing PNG file: " << oprogress << std::endl; return 0; |