diff options
author | Piotr Dziwinski <piotrdz@gmail.com> | 2014-10-07 22:15:40 +0200 |
---|---|---|
committer | Piotr Dziwinski <piotrdz@gmail.com> | 2014-10-07 22:15:40 +0200 |
commit | 5274acd624c3a5ad60592cee2ebc869b10a96fda (patch) | |
tree | 04836157b8c3aa9553d5e67e8ed248220ff1661a /test/unit/common/image_test.cpp | |
parent | 3ef2f976df56817d2a23d4fe88a1917798beaacd (diff) | |
parent | 2770ee8927cb91419b1918f46228435026790cf6 (diff) | |
download | colobot-5274acd624c3a5ad60592cee2ebc869b10a96fda.tar.gz colobot-5274acd624c3a5ad60592cee2ebc869b10a96fda.tar.bz2 colobot-5274acd624c3a5ad60592cee2ebc869b10a96fda.zip |
Merge with dev
Diffstat (limited to 'test/unit/common/image_test.cpp')
-rw-r--r-- | test/unit/common/image_test.cpp | 57 |
1 files changed, 0 insertions, 57 deletions
diff --git a/test/unit/common/image_test.cpp b/test/unit/common/image_test.cpp deleted file mode 100644 index 2b20a17..0000000 --- a/test/unit/common/image_test.cpp +++ /dev/null @@ -1,57 +0,0 @@ -#include "common/image.h" - -#include <SDL.h> -#include <stdio.h> - -/* For now, just a simple test: loading a file from image - * and saving it to another in PNG. */ - -int main(int argc, char *argv[]) -{ - if (argc != 3) - { - printf("Usage: %s in_image out_image\n", argv[0]); - return 0; - } - - CImage image; - - if (! image.Load(argv[1])) - { - std::string err = image.GetError(); - printf("Error loading '%s': %s\n", argv[1], 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])) - { - std::string err = image.GetError(); - printf("Error saving PNG '%s': %s\n", argv[2], err.c_str()); - return 2; - } - - return 0; -} |