diff options
Diffstat (limited to 'lib/include/ultrahdr/editorhelper.h')
-rw-r--r-- | lib/include/ultrahdr/editorhelper.h | 89 |
1 files changed, 74 insertions, 15 deletions
diff --git a/lib/include/ultrahdr/editorhelper.h b/lib/include/ultrahdr/editorhelper.h index 1dd904a..3a82e0e 100644 --- a/lib/include/ultrahdr/editorhelper.h +++ b/lib/include/ultrahdr/editorhelper.h @@ -17,27 +17,86 @@ #ifndef ULTRAHDR_EDITORHELPER_H #define ULTRAHDR_EDITORHELPER_H -#include "ultrahdr/ultrahdr.h" -#include "ultrahdr/jpegr.h" +#include "ultrahdr_api.h" +#include "ultrahdr/ultrahdrcommon.h" + +// todo: move this to ultrahdr_api.h +/*!\brief List of supported mirror directions */ +typedef enum uhdr_mirror_direction { + UHDR_MIRROR_VERTICAL, /**< flip image over x axis */ + UHDR_MIRROR_HORIZONTAL, /**< flip image over y axis */ +} uhdr_mirror_direction_t; /**< alias for enum uhdr_mirror_direction */ namespace ultrahdr { -typedef enum { - ULTRAHDR_MIRROR_VERTICAL, - ULTRAHDR_MIRROR_HORIZONTAL, -} ultrahdr_mirroring_direction; -status_t crop(jr_uncompressed_ptr const in_img, - int left, int right, int top, int bottom, jr_uncompressed_ptr out_img); +/*!\brief uhdr image effect descriptor */ +typedef struct uhdr_effect_desc { + virtual std::string to_string() = 0; + + virtual ~uhdr_effect_desc() = default; +} uhdr_effect_desc_t; /**< alias for struct uhdr_effect_desc */ + +/*!\brief mirror effect descriptor */ +typedef struct uhdr_mirror_effect : uhdr_effect_desc { + uhdr_mirror_effect(uhdr_mirror_direction_t direction) : m_direction{direction} {} + + std::string to_string() { + return "effect : mirror, metadata : direction - " + ((m_direction == UHDR_MIRROR_HORIZONTAL) + ? std::string{"horizontal"} + : std::string{"vertical"}); + } + + uhdr_mirror_direction_t m_direction; +} uhdr_mirror_effect_t; /**< alias for struct uhdr_mirror_effect */ + +/*!\brief rotate effect descriptor */ +typedef struct uhdr_rotate_effect : uhdr_effect_desc { + uhdr_rotate_effect(int degree) : m_degree{degree} {} + + std::string to_string() { + return "effect : rotate, metadata : degree - " + std::to_string(m_degree); + } + + int m_degree; +} uhdr_rotate_effect_t; /**< alias for struct uhdr_rotate_effect */ + +/*!\brief crop effect descriptor */ +typedef struct uhdr_crop_effect : uhdr_effect_desc { + uhdr_crop_effect(int left, int right, int top, int bottom) + : m_left{left}, m_right{right}, m_top{top}, m_bottom{bottom} {} + + std::string to_string() { + return "effect : crop, metadata : left, right, top, bottom - " + std::to_string(m_left) + " ," + + std::to_string(m_right) + " ," + std::to_string(m_top) + " ," + std::to_string(m_bottom); + } + + int m_left; + int m_right; + int m_top; + int m_bottom; +} uhdr_crop_effect_t; /**< alias for struct uhdr_crop_effect */ + +/*!\brief resize effect descriptor */ +typedef struct uhdr_resize_effect : uhdr_effect_desc { + uhdr_resize_effect(int width, int height) : m_width{width}, m_height{height} {} + + std::string to_string() { + return "effect : resize, metadata : dimensions w, h" + std::to_string(m_width) + " ," + + std::to_string(m_height); + } + + int m_width; + int m_height; +} uhdr_resize_effect_t; /**< alias for struct uhdr_resize_effect */ + +std::unique_ptr<uhdr_raw_image_ext_t> apply_rotate(uhdr_raw_image_t* src, int degree); -status_t mirror(jr_uncompressed_ptr const in_img, - ultrahdr_mirroring_direction mirror_dir, - jr_uncompressed_ptr out_img); +std::unique_ptr<uhdr_raw_image_ext_t> apply_mirror(uhdr_raw_image_t* src, + uhdr_mirror_direction_t direction); -status_t rotate(jr_uncompressed_ptr const in_img, int clockwise_degree, - jr_uncompressed_ptr out_img); +std::unique_ptr<uhdr_raw_image_ext_t> apply_resize(uhdr_raw_image* src, int dst_w, int dst_h); -status_t resize(jr_uncompressed_ptr const in_img, int out_width, int out_height, - jr_uncompressed_ptr out_img); +void apply_crop(uhdr_raw_image_t* src, int left, int top, int wd, int ht); } // namespace ultrahdr |