From f95df35dc58e01b99ffddfc4ad394feaa4460b09 Mon Sep 17 00:00:00 2001 From: Piotr Dziwinski Date: Wed, 4 Jul 2012 00:04:53 +0200 Subject: Multitexturing support - added CImage class for loading/saving images and a simple test for it - added libpng library to build - added Gfx::Texture struct - updated the Gfx::CDevice interface to include new features - implemented the new features in Gfx::CGLDevice --- src/common/test/CMakeLists.txt | 6 ++++++ src/common/test/image_test.cpp | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 src/common/test/CMakeLists.txt create mode 100644 src/common/test/image_test.cpp (limited to 'src/common/test') diff --git a/src/common/test/CMakeLists.txt b/src/common/test/CMakeLists.txt new file mode 100644 index 0000000..680116c --- /dev/null +++ b/src/common/test/CMakeLists.txt @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 2.8) + +set(CMAKE_BUILD_TYPE debug) +set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g -O0") + +add_executable(image_test ../image.cpp image_test.cpp) diff --git a/src/common/test/image_test.cpp b/src/common/test/image_test.cpp new file mode 100644 index 0000000..0ad1ee2 --- /dev/null +++ b/src/common/test/image_test.cpp @@ -0,0 +1,34 @@ +#include "../image.h" + +#include +#include + +/* 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", err.c_str()); + return 1; + } + + if (! image.SavePNG(argv[2])) + { + std::string err = image.GetError(); + printf("Error saving PNG '%s': %s\n", err.c_str()); + return 2; + } + + return 0; +} -- cgit v1.2.3-1-g7c22