diff options
author | Piotr Dziwinski <piotrdz@gmail.com> | 2012-09-19 22:53:06 +0200 |
---|---|---|
committer | Piotr Dziwinski <piotrdz@gmail.com> | 2012-09-19 22:53:06 +0200 |
commit | 7479f486b671acb2a6aea2c84a56b383aaba00ca (patch) | |
tree | 4043545a14234dfaa2d7d08d59c7ee9ee97f0de9 /src/common/test | |
parent | 901f10b2bac18a2063cd21798f22b3917e8519b5 (diff) | |
parent | 57d33d79ea570773d84ad81d4a61f50e079979ef (diff) | |
download | colobot-7479f486b671acb2a6aea2c84a56b383aaba00ca.tar.gz colobot-7479f486b671acb2a6aea2c84a56b383aaba00ca.tar.bz2 colobot-7479f486b671acb2a6aea2c84a56b383aaba00ca.zip |
Forgotten fix in dev-graphics
Diffstat (limited to 'src/common/test')
-rw-r--r-- | src/common/test/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/common/test/image_test.cpp | 23 |
2 files changed, 25 insertions, 0 deletions
diff --git a/src/common/test/CMakeLists.txt b/src/common/test/CMakeLists.txt index d81acab..a1a7a50 100644 --- a/src/common/test/CMakeLists.txt +++ b/src/common/test/CMakeLists.txt @@ -7,6 +7,8 @@ include_directories("../../") include_directories("../../../") add_executable(image_test ../image.cpp image_test.cpp) +target_link_libraries(image_test -lpng -lSDL -lSDL_image) + add_executable(profile_test ../profile.cpp profile_test.cpp) add_test(profile_test ./profile_test) diff --git a/src/common/test/image_test.cpp b/src/common/test/image_test.cpp index 0ad1ee2..a98c9cc 100644 --- a/src/common/test/image_test.cpp +++ b/src/common/test/image_test.cpp @@ -22,6 +22,29 @@ int main(int argc, char *argv[]) printf("Error loading '%s': %s\n", err.c_str()); return 1; } + Gfx::Color color; + std::string str; + + color = image.GetPixel(Math::IntPoint(0, 0)); + str = color.ToString(); + printf("pixel @ (0,0): %s\n", str.c_str()); + + color = image.GetPixel(Math::IntPoint(0, 1)); + str = color.ToString(); + printf("pixel @ (0,1): %s\n", str.c_str()); + + color = image.GetPixel(Math::IntPoint(1, 0)); + str = color.ToString(); + printf("pixel @ (1,0): %s\n", str.c_str()); + + color = image.GetPixel(Math::IntPoint(1, 1)); + str = color.ToString(); + printf("pixel @ (1,1): %s\n", str.c_str()); + + image.SetPixel(Math::IntPoint(0, 0), Gfx::Color(0.1f, 0.2f, 0.3f, 0.0f)); + image.SetPixel(Math::IntPoint(1, 0), Gfx::Color(0.3f, 0.2f, 0.1f, 1.0f)); + image.SetPixel(Math::IntPoint(0, 1), Gfx::Color(1.0f, 1.0f, 1.0f, 1.0f)); + image.SetPixel(Math::IntPoint(1, 1), Gfx::Color(0.0f, 0.0f, 0.0f, 1.0f)); if (! image.SavePNG(argv[2])) { |