diff --git a/tools/cutter/appl/debug.cpp b/tools/cutter/appl/debug.cpp new file mode 100644 index 0000000..43dd16e --- /dev/null +++ b/tools/cutter/appl/debug.cpp @@ -0,0 +1,13 @@ +/** @file + * @author Edouard DUPIN + * @copyright 2010, Edouard DUPIN, all right reserved + * @license GPL v3 (see license file) + */ + + +#include + +int32_t appl::getLogId() { + static int32_t g_val = elog::registerInstance("egami-cutter"); + return g_val; +} diff --git a/tools/cutter/appl/debug.hpp b/tools/cutter/appl/debug.hpp new file mode 100644 index 0000000..09f0dc0 --- /dev/null +++ b/tools/cutter/appl/debug.hpp @@ -0,0 +1,46 @@ +/** @file + * @author Edouard DUPIN + * @copyright 2011, Edouard DUPIN, all right reserved + * @license MPL v2.0 (see license file) + */ +#pragma once + +#include +extern "C" { + #include +} +namespace appl { + /** + * @brief Get local id of the library + * @return Unique ID of the library + */ + int32_t getLogId(); +}; + +#define APPL_BASIC(info,data) ELOG_BASE(appl::getLogId(),info,data) + +#define APPL_PRINT(data) APPL_BASIC(-1, data) +#define APPL_CRITICAL(data) APPL_BASIC(1, data) +#define APPL_ERROR(data) APPL_BASIC(2, data) +#define APPL_WARNING(data) APPL_BASIC(3, data) +#ifdef DEBUG + #define APPL_INFO(data) APPL_BASIC(4, data) + #define APPL_DEBUG(data) APPL_BASIC(5, data) + #define APPL_VERBOSE(data) APPL_BASIC(6, data) + #define APPL_TODO(data) APPL_BASIC(4, "TODO : " << data) +#else + #define APPL_INFO(data) do { } while(false) + #define APPL_DEBUG(data) do { } while(false) + #define APPL_VERBOSE(data) do { } while(false) + #define APPL_TODO(data) do { } while(false) +#endif + +#define APPL_HIDDEN(data) do { } while(false) + +#define APPL_ASSERT(cond,data) \ + do { \ + if (!(cond)) { \ + APPL_CRITICAL(data); \ + assert(!#cond); \ + } \ + } while (0) diff --git a/tools/cutter/appl/main.cpp b/tools/cutter/appl/main.cpp new file mode 100644 index 0000000..1f3924c --- /dev/null +++ b/tools/cutter/appl/main.cpp @@ -0,0 +1,166 @@ +/** @file + * @author Edouard DUPIN + * @copyright 2016, Edouard DUPIN, all right reserved + * @license MPL v2.0 (see license file) + */ + +#include +#include +#include + +static void usage(int _retValue = 0) { + APPL_PRINT("Help : "); + APPL_PRINT(" ./xxx [options]"); + APPL_PRINT(" -h/--help: Display this help"); + APPL_PRINT(" -i/--input: Input of the calculator"); + APPL_PRINT(" -o/--output: Output of the calculator"); + + exit(_retValue); +} + + +int main(int argc, const char *argv[]) { + // the only one init for etk: + etk::init(argc, argv); + etk::String input; + etk::String output; + for (int32_t iii=0; iii an error occured..."); + return -2; + } + APPL_INFO("read [STOP ]"); + + ivec2 middle = image.getSize() / 2; + + APPL_INFO("Source Image Size:" << image.getSize()); + + uint8_t baseValue = 0x40; + + // top: + uint_t posTop = 0; + uint_t posBottom = image.getSize().y(); + uint_t posLeft = 0; + uint_t posRight = image.getSize().x(); + uint_t maxOutOfRange = 3; + for (uint_t yyy=0; yyy=middle.y()+maxOutOfRange; --yyy) { + bool found = false; + //APPL_DEBUG("Check position:" << yyy); + for (uint_t iii=0; iii=middle.x()+maxOutOfRange; --xxx) { + bool found = false; + //APPL_DEBUG("Check position:" << yyy); + for (uint_t iii=0; iii an error occured..."); + return -3; + } + APPL_INFO("write [STOP ]"); + return 0; +} diff --git a/tools/cutter/lutin_egami-cutter.py b/tools/cutter/lutin_egami-cutter.py new file mode 100755 index 0000000..55372cb --- /dev/null +++ b/tools/cutter/lutin_egami-cutter.py @@ -0,0 +1,46 @@ +#!/usr/bin/python +import lutin.debug as debug +import lutin.tools as tools +import os + +def get_type(): + return "BINARY" + +def get_sub_type(): + return "TOOL" + +def get_desc(): + return "egami simple image cutter (bash tools)" + +def get_licence(): + return "MPL-2" + +def get_compagny_type(): + return "com" + +def get_compagny_name(): + return "atria-soft" + +def get_maintainer(): + return ["Mr DUPIN Edouard "] + +def configure(target, my_module): + # add the file to compile: + my_module.add_src_file([ + 'appl/debug.cpp', + 'appl/main.cpp', + ]) + + my_module.add_depend([ + 'egami', + ]) + + #my_module.copy_file('data/icon.png','icon.png') + + my_module.add_path(".") + + return True + + + +