Browse Source

Insert Imagemeter Library

marinofaggiana 5 years ago
parent
commit
539725e79e

BIN
Libraries external/Imagemeter/Resources/FreeSans.ttf


BIN
Libraries external/Imagemeter/Resources/Objektbeschreibung.imi


+ 73 - 0
Libraries external/Imagemeter/includes/IMEditCore.h

@@ -0,0 +1,73 @@
+/*
+ * ImageMeter confidential
+ *
+ * Copyright (C) 2018-2019 by Dirk Farin, Kronenstr. 49b, 70174 Stuttgart, Germany
+ * All Rights Reserved.
+ *
+ * NOTICE:  All information contained herein is, and remains the property
+ * of Dirk Farin.  The intellectual and technical concepts contained
+ * herein are proprietary to Dirk Farin and are protected by trade secret
+ * and copyright law.
+ * Dissemination of this information or reproduction of this material
+ * is strictly forbidden unless prior written permission is obtained
+ * from Dirk Farin.
+ */
+
+#ifndef IMAGEMETER_IMEDITCORE_H
+#define IMAGEMETER_IMEDITCORE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+#include <stdbool.h>
+
+
+struct IM_EditCore;
+
+void IM_EditCore_release(struct IM_EditCore*);
+
+
+void IM_EditCore_touchDown(struct IM_EditCore*, int id, int x,int y, double timestamp_secs);
+
+void IM_EditCore_touchMove(struct IM_EditCore*, int id, int x,int y, double timestamp_secs);
+
+void IM_EditCore_touchUp(struct IM_EditCore*, int id, int x,int y, double timestamp_secs);
+
+void IM_EditCore_touchCancelled(struct IM_EditCore*, int id);
+
+
+void IM_EditCore_start_interaction_addMeasure(struct IM_EditCore*, const char* preset);
+
+void IM_EditCore_start_interaction_addAngle(struct IM_EditCore*);
+
+void IM_EditCore_start_interaction_addText(struct IM_EditCore*);
+
+void IM_EditCore_start_interaction_addFreehand(struct IM_EditCore*);
+
+void IM_EditCore_end_current_interaction(struct IM_EditCore*);
+
+
+void IM_EditCore_set_color_of_active_element(struct IM_EditCore*,uint32_t argb);
+
+void IM_EditCore_set_color_of_future_created_elements(struct IM_EditCore*,uint32_t argb);
+
+void IM_EditCore_delete_active_element(struct IM_EditCore*);
+
+void IM_EditCore_undo(struct IM_EditCore*);
+
+void IM_EditCore_redo(struct IM_EditCore*);
+
+bool IM_EditCore_undo_available(struct IM_EditCore*);
+
+bool IM_EditCore_redo_available(struct IM_EditCore*);
+
+
+void IM_EditCore_audioCompleted(struct IM_EditCore*, const char* audioFile);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif //IMAGEMETER_IMEDITCORE_H

+ 134 - 0
Libraries external/Imagemeter/includes/IMEditCoreContext.h

@@ -0,0 +1,134 @@
+/*
+ * ImageMeter confidential
+ *
+ * Copyright (C) 2018-2019 by Dirk Farin, Kronenstr. 49b, 70174 Stuttgart, Germany
+ * All Rights Reserved.
+ *
+ * NOTICE:  All information contained herein is, and remains the property
+ * of Dirk Farin.  The intellectual and technical concepts contained
+ * herein are proprietary to Dirk Farin and are protected by trade secret
+ * and copyright law.
+ * Dissemination of this information or reproduction of this material
+ * is strictly forbidden unless prior written permission is obtained
+ * from Dirk Farin.
+ */
+
+#ifndef IMAGEMETER_IMEDITCORECONTEXT_H
+#define IMAGEMETER_IMEDITCORECONTEXT_H
+
+#include "IMError.h"
+#include "IMEditCore.h"
+
+#include <stdbool.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct IM_EditCoreContext;
+
+
+// from Geometry.h
+enum IM_ImageFitMode
+{
+  IM_ImageFitMode_Fit = 0,          // fit image into screen to be completely visible
+  IM_ImageFitMode_Fill = 1,         // fill screen completely (extending beyond borders)
+  IM_ImageFitMode_GeometricMean = 2 // compromise between Fit and Fill (neither too small, nor too big)
+};
+
+
+// If nRenderingThreads==0, rendering has to be carried out manually
+struct IM_EditCoreContext* IM_EditCoreContext_alloc(bool interactive,
+                                                    int nRenderingThreads);
+
+void IM_EditCoreContext_release(struct IM_EditCoreContext*);
+
+void IM_EditCoreContext_add_font(struct IM_EditCoreContext*, const char* fontFile);
+
+//void add_font(const std::vector<uint8_t>& fontData);
+
+void IM_EditCoreContext_set_EditCoreUIControl(struct IM_EditCoreContext*, struct IM_EditCoreUIControl*);
+
+//struct IM_Result* load_from_bundle(const std::shared_ptr<DataBundleCPP>& bundle);
+
+struct IM_Error* IM_EditCoreContext_load_from_bundle_directory(struct IM_EditCoreContext*,
+                                                               const char* bundleDirectory);
+
+//IMResult<void> load_from_imm_file(Path bundleDirectory,
+//                                  const std::shared_ptr<IMMFile>& imm);
+
+
+enum IM_IMMLoadingState
+{
+  IM_IMMLoadingState_NotLoaded = 0,
+  IM_IMMLoadingState_LoadingError = 1,
+  IM_IMMLoadingState_LoadedIncompletely = 2, // some GElements could not be loaded. Ok for read-only, but do not overwrite.
+  IM_IMMLoadingState_Loaded = 3
+};
+
+enum IM_IMMLoadingState IM_EditCoreContext_get_imm_loading_state(struct IM_EditCoreContext*);
+
+bool IM_EditCoreContext_ready_to_initialize_openGL(struct IM_EditCoreContext*);
+
+
+// returns true if the IMM has changed
+//bool prepare_imm_for_saving();
+
+//IMResult<void> restore_imm_to_stored_state();
+
+// result.throws<IMError_DataBundle_CannotWriteIMM>();
+//IMResult<void> save_to_bundle_directory();
+
+// TODO: set a state whether loading the IMM failed / failed a bit / succeeded
+
+
+
+// --- access to objects managed by the context
+
+//std::shared_ptr<IMMFile> get_IMM_file();
+
+struct IM_EditCore* IM_EditCoreContext_get_EditCore(struct IM_EditCoreContext*);
+
+//std::shared_ptr<GLBackgroundImage> get_BackgroundImage() { return mBkgImage; }
+
+//std::shared_ptr<EditCoreGraphics_OpenGLES2> get_EditCoreGraphics()
+
+//std::shared_ptr<DataBundleCPP> get_data_bundle() { return mDataBundle; }
+
+
+// --- drawing
+
+// These functions (except render()) have to be called on the OpenGL thread
+
+struct IM_Error* IM_EditCoreContext_load_auxiliary_files(struct IM_EditCoreContext*);
+
+struct IM_Error* IM_EditCoreContext_init_OpenGL_resources(struct IM_EditCoreContext*);
+
+void IM_EditCoreContext_set_OpenGL_viewport(struct IM_EditCoreContext*,
+                                            int viewport_width,
+                                            int viewport_height,
+                                            float density_dpi);
+
+void IM_EditCoreContext_set_displayTransform(struct IM_EditCoreContext*,
+                                             enum IM_ImageFitMode mode, bool flipV);
+
+//void set_displayTransform(AffineTransform transform);
+
+//bool is_display_transform_set() const { return mDisplayTransformSet; }
+
+void IM_EditCoreContext_free_OpenGL_resources(struct IM_EditCoreContext*);
+
+// Manually render the scene before drawing. Only needed when there are no rendering threads.
+//void render();
+
+//void wait_until_rendering_is_finished();
+
+void IM_EditCoreContext_draw_to_OpenGL(struct IM_EditCoreContext*);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif //IMAGEMETER_IMEDITCORECONTEXT_H

+ 77 - 0
Libraries external/Imagemeter/includes/IMEditCoreUIControl.h

@@ -0,0 +1,77 @@
+/*
+ * ImageMeter confidential
+ *
+ * Copyright (C) 2018-2019 by Dirk Farin, Kronenstr. 49b, 70174 Stuttgart, Germany
+ * All Rights Reserved.
+ *
+ * NOTICE:  All information contained herein is, and remains the property
+ * of Dirk Farin.  The intellectual and technical concepts contained
+ * herein are proprietary to Dirk Farin and are protected by trade secret
+ * and copyright law.
+ * Dissemination of this information or reproduction of this material
+ * is strictly forbidden unless prior written permission is obtained
+ * from Dirk Farin.
+ */
+
+#ifndef IMAGEMETER_IMEDITCOREUICONTROL_H
+#define IMAGEMETER_IMEDITCOREUICONTROL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdbool.h>
+
+struct IM_EditCoreUIControl;
+struct IM_GElement;
+  
+
+// You may set unused callback functions to NULL.
+//
+struct IM_EditCoreUIControl_Callbacks
+{
+  // iOS see: https://stackoverflow.com/questions/7747742/on-demand-opengl-es-rendering-using-glkit
+  void (*needsRedraw)();
+
+  void (*scheduleTouchTimerEvent)(double delay_secs);
+
+  void (*addingGElementFinished)(bool success);
+
+
+  void (*activateGElement)(const struct IM_GElement* element);
+
+  void (*deactivateGElement)();
+
+  void (*updateDeleteButtonState)();
+
+  void (*updateUndoUIButtonStates)();
+
+
+
+  // --- element value entry
+  
+  void (*editTextBox)(int elementID);
+
+
+  // --- playing audio ---
+
+  bool (*supportsAudioPlayback)();
+
+  bool (*playAudio)(const char* filename);
+
+  void (*stopAudio)(const char* filename);
+};
+
+
+void IM_EditCoreUIControl_Callbacks_clear(struct IM_EditCoreUIControl_Callbacks*);
+  
+
+struct IM_EditCoreUIControl* IM_EditCoreUIControl_alloc(const struct IM_EditCoreUIControl_Callbacks*);
+
+void IM_EditCoreUIControl_release(struct IM_EditCoreUIControl*);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif //IMAGEMETER_IMEDITCORE_H

+ 31 - 0
Libraries external/Imagemeter/includes/IMError.h

@@ -0,0 +1,31 @@
+/*
+ * ImageMeter confidential
+ * 
+ * Copyright (C) 2018-2019 by Dirk Farin, Kronenstr. 49b, 70174 Stuttgart, Germany
+ * All Rights Reserved.
+ * 
+ * NOTICE:  All information contained herein is, and remains the property
+ * of Dirk Farin.  The intellectual and technical concepts contained
+ * herein are proprietary to Dirk Farin and are protected by trade secret
+ * and copyright law.
+ * Dissemination of this information or reproduction of this material
+ * is strictly forbidden unless prior written permission is obtained
+ * from Dirk Farin.
+ */
+
+#ifndef IMAGEMETER_IMERROR_H
+#define IMAGEMETER_IMERROR_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct IM_Error;
+
+void IM_Error_release(struct IM_Error*);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif //IMAGEMETER_IMERROR_H

+ 59 - 0
Libraries external/Imagemeter/includes/IMGElement.h

@@ -0,0 +1,59 @@
+/*
+ * ImageMeter confidential
+ *
+ * Copyright (C) 2019 by Dirk Farin, Kronenstr. 49b, 70174 Stuttgart, Germany
+ * All Rights Reserved.
+ *
+ * NOTICE:  All information contained herein is, and remains the property
+ * of Dirk Farin.  The intellectual and technical concepts contained
+ * herein are proprietary to Dirk Farin and are protected by trade secret
+ * and copyright law.
+ * Dissemination of this information or reproduction of this material
+ * is strictly forbidden unless prior written permission is obtained
+ * from Dirk Farin.
+ */
+
+#ifndef IMAGEMETER_IMGELEMENT_H
+#define IMAGEMETER_IMGELEMENT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+#include <stdbool.h>
+
+
+struct IM_GElement;
+
+void IM_GElement_release(struct IM_GElement*);
+
+void IM_GElement_set_main_color_argb(struct IM_GElement*, uint32_t argb);
+
+uint32_t IM_GElement_get_main_color_argb(struct IM_GElement*);
+
+void IM_GElement_set_main_line_width(struct IM_GElement*, float width);
+
+float IM_GElement_get_main_line_width(struct IM_GElement*);
+
+void IM_GElement_set_main_line_width_magnification(struct IM_GElement*, float magnification);
+
+float IM_GElement_get_main_line_width_magnification(struct IM_GElement*);
+
+void IM_GElement_set_main_font_base_size(struct IM_GElement*, float fontSize);
+
+float IM_GElement_get_main_font_base_size(struct IM_GElement*);
+
+void IM_GElement_set_main_font_base_size_magnification(struct IM_GElement*, float magnification);
+
+float IM_GElement_get_main_font_base_size_magnification(struct IM_GElement*);
+
+  
+struct IM_Label* IM_GElement_get_label(struct IM_GElement*, int id);
+  
+  
+#ifdef __cplusplus
+}
+#endif
+
+#endif //IMAGEMETER_IMGELEMENT_H

+ 74 - 0
Libraries external/Imagemeter/includes/IMGText.h

@@ -0,0 +1,74 @@
+/*
+ * ImageMeter confidential
+ *
+ * Copyright (C) 2019 by Dirk Farin, Kronenstr. 49b, 70174 Stuttgart, Germany
+ * All Rights Reserved.
+ *
+ * NOTICE:  All information contained herein is, and remains the property
+ * of Dirk Farin.  The intellectual and technical concepts contained
+ * herein are proprietary to Dirk Farin and are protected by trade secret
+ * and copyright law.
+ * Dissemination of this information or reproduction of this material
+ * is strictly forbidden unless prior written permission is obtained
+ * from Dirk Farin.
+ */
+
+#ifndef IMAGEMETER_IMGTEXT_H
+#define IMAGEMETER_IMGTEXT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+#include <stdbool.h>
+
+
+struct IM_GText;
+
+bool IM_GElement_is_GText(struct IM_GElement*);
+
+struct IM_GText* IM_GText_from_GElement(struct IM_GElement*);
+
+void IM_GText_release(struct IM_GText*);
+
+void IM_GText_set_text(struct IM_GText*, const char* text);
+
+const char* IM_GText_get_text(const struct IM_GText*);
+
+void IM_GText_set_text_color_argb(struct IM_GText*, uint32_t argb);
+
+uint32_t IM_GText_get_text_color_argb(const struct IM_GText*);
+
+void IM_GText_set_show_border(struct IM_GText*, bool enable);
+
+bool IM_GText_get_show_border(const struct IM_GText*);
+
+void IM_GText_set_show_arrows(struct IM_GText*, bool enable);
+
+bool IM_GText_get_show_arrows(const struct IM_GText*);
+
+void IM_GText_set_fill_background(struct IM_GText*, bool enable);
+
+bool IM_GText_get_fill_background(const struct IM_GText*);
+
+
+void IM_GText_add_arrow(struct IM_GText*);
+
+bool IM_GText_delete_arrow(const struct IM_GText*);
+
+
+void IM_GText_set_audio_recording(struct IM_GText*, const char* filename, int duration_msecs);
+
+void IM_GText_delete_audio_recording(struct IM_GText*);
+
+const char* IM_GText_get_audio_recording_filename(const struct IM_GText*);
+
+int IM_GText_get_audio_recording_duration_msecs(const struct IM_GText*);
+  
+  
+#ifdef __cplusplus
+}
+#endif
+
+#endif //IMAGEMETER_IMGTEXT_H

+ 42 - 0
Libraries external/Imagemeter/includes/IMLabel.h

@@ -0,0 +1,42 @@
+/*
+ * ImageMeter confidential
+ *
+ * Copyright (C) 2019 by Dirk Farin, Kronenstr. 49b, 70174 Stuttgart, Germany
+ * All Rights Reserved.
+ *
+ * NOTICE:  All information contained herein is, and remains the property
+ * of Dirk Farin.  The intellectual and technical concepts contained
+ * herein are proprietary to Dirk Farin and are protected by trade secret
+ * and copyright law.
+ * Dissemination of this information or reproduction of this material
+ * is strictly forbidden unless prior written permission is obtained
+ * from Dirk Farin.
+ */
+
+#ifndef IMAGEMETER_IMLABEL_H
+#define IMAGEMETER_IMLABEL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+#include <stdbool.h>
+
+
+struct IM_Label;
+
+  
+void IM_Label_release(struct IM_Label*);
+
+// returns 'true' when this is a value dimension value
+bool IM_Label_set_value_from_string(struct IM_Label*, const char* value_string);
+
+const char* IM_Label_get_value_as_string(const struct IM_Label*);
+
+  
+#ifdef __cplusplus
+}
+#endif
+
+#endif //IMAGEMETER_IMLABEL_H

BIN
Libraries external/Imagemeter/libs/libeditcore-c-api.a


BIN
Libraries external/Imagemeter/libs/libfreetype.a


BIN
Libraries external/Imagemeter/libs/libturbojpeg.a


+ 100 - 0
Libraries external/Imagemeter/swift/EditCore.swift

@@ -0,0 +1,100 @@
+/*
+ * ImageMeter confidential
+ *
+ * Copyright (C) 2019 by Dirk Farin, Kronenstr. 49b, 70174 Stuttgart, Germany
+ * All Rights Reserved.
+ *
+ * NOTICE:  All information contained herein is, and remains the property
+ * of Dirk Farin.  The intellectual and technical concepts contained
+ * herein are proprietary to Dirk Farin and are protected by trade secret
+ * and copyright law.
+ * Dissemination of this information or reproduction of this material
+ * is strictly forbidden unless prior written permission is obtained
+ * from Dirk Farin.
+ */
+
+import Foundation
+
+public class EditCore {
+    
+    var editcore : OpaquePointer;
+    
+    init (ptr : OpaquePointer) {
+        editcore = ptr
+    }
+
+    deinit {
+        IM_EditCore_release(editcore)
+    }
+    
+
+    func touchDown(id : Int32, x : Int32, y : Int32, timestamp_secs : Double) {
+        IM_EditCore_touchDown(editcore, id, x,y, timestamp_secs)
+    }
+    
+    func touchMove(id : Int32, x : Int32, y : Int32, timestamp_secs : Double) {
+        IM_EditCore_touchMove(editcore, id, x,y, timestamp_secs)
+    }
+    
+    func touchUp(id : Int32, x : Int32, y : Int32, timestamp_secs : Double) {
+        IM_EditCore_touchUp(editcore, id, x,y, timestamp_secs)
+    }
+    
+    func touchCancelled(id : Int32) {
+        IM_EditCore_touchCancelled(editcore, id)
+    }
+
+    func start_interaction_addMeasure() {
+        IM_EditCore_start_interaction_addMeasure(editcore, "")
+    }
+
+    // TODO: not fully working yet, because we need timer callbacks because of the double-click interactions
+    func start_interaction_addAngle() {
+        IM_EditCore_start_interaction_addAngle(editcore)
+    }
+
+    func start_interaction_addText() {
+        IM_EditCore_start_interaction_addText(editcore)
+    }
+
+    func start_interaction_addFreehand() {
+        IM_EditCore_start_interaction_addFreehand(editcore)
+    }
+
+    func end_current_interaction() {
+        IM_EditCore_end_current_interaction(editcore)
+    }
+    
+    func set_color_of_active_element(argb : UInt32) {
+        IM_EditCore_set_color_of_active_element(editcore,argb)
+    }
+
+    func set_color_of_future_created_elements(argb : UInt32) {
+        IM_EditCore_set_color_of_future_created_elements(editcore, argb)
+    }
+
+    func delete_active_element() {
+        IM_EditCore_delete_active_element(editcore)
+    }
+    
+    func undo() {
+        IM_EditCore_undo(editcore)
+    }
+    
+    func redo() {
+        IM_EditCore_redo(editcore)
+    }
+    
+    func undo_available() -> Bool {
+        return IM_EditCore_undo_available(editcore)
+    }
+    
+    func redo_available() -> Bool {
+        return IM_EditCore_redo_available(editcore)
+    }
+    
+    func audio_completed(audioFile : String) {
+        IM_EditCore_audioCompleted(editcore, UnsafePointer(audioFile))
+    }
+}
+

+ 85 - 0
Libraries external/Imagemeter/swift/EditCoreContext.swift

@@ -0,0 +1,85 @@
+/*
+ * ImageMeter confidential
+ *
+ * Copyright (C) 2018-2019 by Dirk Farin, Kronenstr. 49b, 70174 Stuttgart, Germany
+ * All Rights Reserved.
+ *
+ * NOTICE:  All information contained herein is, and remains the property
+ * of Dirk Farin.  The intellectual and technical concepts contained
+ * herein are proprietary to Dirk Farin and are protected by trade secret
+ * and copyright law.
+ * Dissemination of this information or reproduction of this material
+ * is strictly forbidden unless prior written permission is obtained
+ * from Dirk Farin.
+ */
+
+import Foundation
+
+public class EditCoreContext {
+
+    var ecc : OpaquePointer;
+
+    init(interactive : Bool, nRenderingThreads : Int32) {
+         ecc = IM_EditCoreContext_alloc(interactive, nRenderingThreads)
+    }
+    
+    deinit {
+         IM_EditCoreContext_release(ecc)
+    }
+
+
+    func add_font(fontFile : String) {
+      	 IM_EditCoreContext_add_font(ecc, UnsafePointer(fontFile))
+    }
+
+    func set_EditCoreUIControl(uiControl : EditCoreUIControl) {
+        IM_EditCoreContext_set_EditCoreUIControl(ecc, uiControl.get_C_uiControl())
+    }
+
+    func load_from_bundle_directory(bundleDirectory : String) -> IMError {
+    	 let c_err = IM_EditCoreContext_load_from_bundle_directory(ecc, UnsafePointer(bundleDirectory))!
+        return IMError(ptr: c_err)
+    }
+
+    // enum IM_IMMLoadingState IM_EditCoreContext_get_imm_loading_state(struct IM_EditCoreContext*);
+
+    func ready_to_initialize_openGL() -> Bool {
+    	 return IM_EditCoreContext_ready_to_initialize_openGL(ecc)
+    }
+
+    func get_EditCore() -> EditCore {
+        let c_editcore = IM_EditCoreContext_get_EditCore(ecc)!
+        return EditCore(ptr: c_editcore)
+    }
+
+    func load_auxiliary_files() -> IMError {
+    	 let c_err = IM_EditCoreContext_load_auxiliary_files(ecc)!
+        return IMError(ptr: c_err)
+    }
+
+    func init_OpenGL_resources() -> IMError {
+    	 let c_err = IM_EditCoreContext_init_OpenGL_resources(ecc)!
+        return IMError(ptr: c_err)
+    }
+
+    func set_OpenGL_viewport(viewport_width : Int32, viewport_height : Int32, density_dpi : Float) {
+    	 IM_EditCoreContext_set_OpenGL_viewport(ecc, viewport_width, viewport_height, density_dpi)
+    }
+
+    func set_displayTransform_tmp() {
+        IM_EditCoreContext_set_displayTransform(ecc, IM_ImageFitMode_GeometricMean, false);
+    }
+
+    func free_OpenGL_resources() {
+    	 IM_EditCoreContext_free_OpenGL_resources(ecc)
+    }
+
+// Manually render the scene before drawing. Only needed when there are no rendering threads.
+//void render();
+
+//void wait_until_rendering_is_finished();
+
+    func draw_to_OpenGL() {
+        IM_EditCoreContext_draw_to_OpenGL(ecc);
+    }
+}

+ 36 - 0
Libraries external/Imagemeter/swift/EditCoreUIControl.swift

@@ -0,0 +1,36 @@
+/*
+ * ImageMeter confidential
+ *
+ * Copyright (C) 2018-2019 by Dirk Farin, Kronenstr. 49b, 70174 Stuttgart, Germany
+ * All Rights Reserved.
+ *
+ * NOTICE:  All information contained herein is, and remains the property
+ * of Dirk Farin.  The intellectual and technical concepts contained
+ * herein are proprietary to Dirk Farin and are protected by trade secret
+ * and copyright law.
+ * Dissemination of this information or reproduction of this material
+ * is strictly forbidden unless prior written permission is obtained
+ * from Dirk Farin.
+ */
+
+import Foundation
+
+
+public class EditCoreUIControl {
+    
+    var uiControl : OpaquePointer;
+    var mCallbacks : IM_EditCoreUIControl_Callbacks;
+    
+    init(callbacks : IM_EditCoreUIControl_Callbacks) {
+        mCallbacks = callbacks
+        uiControl = IM_EditCoreUIControl_alloc(&mCallbacks) // UnsafeMutablePointer<IM_EditCoreUIControl_Callbacks>(&callbacks))
+    }
+    
+    deinit {
+        IM_EditCoreUIControl_release(uiControl)
+    }
+    
+    func get_C_uiControl() -> OpaquePointer {
+        return uiControl
+    }
+}

+ 42 - 0
Libraries external/Imagemeter/swift/GElement.swift

@@ -0,0 +1,42 @@
+/*
+ * ImageMeter confidential
+ *
+ * Copyright (C) 2019 by Dirk Farin, Kronenstr. 49b, 70174 Stuttgart, Germany
+ * All Rights Reserved.
+ *
+ * NOTICE:  All information contained herein is, and remains the property
+ * of Dirk Farin.  The intellectual and technical concepts contained
+ * herein are proprietary to Dirk Farin and are protected by trade secret
+ * and copyright law.
+ * Dissemination of this information or reproduction of this material
+ * is strictly forbidden unless prior written permission is obtained
+ * from Dirk Farin.
+ */
+
+import Foundation
+
+public class GElement {
+    
+    var gelement : OpaquePointer;
+    
+    init (ptr : OpaquePointer) {
+        gelement = ptr
+    }
+    
+    deinit {
+        IM_GElement_release(gelement)
+    }
+   
+    func set_main_line_width_magnification(magnification : Float) {
+        IM_GElement_set_main_line_width_magnification(gelement, magnification)
+    }
+    
+    func is_GText() -> Bool {
+        return IM_GElement_is_GText(gelement)
+    }
+    
+    func getCPtr() -> OpaquePointer {
+        return gelement
+    }
+}
+

+ 34 - 0
Libraries external/Imagemeter/swift/GText.swift

@@ -0,0 +1,34 @@
+/*
+ * ImageMeter confidential
+ *
+ * Copyright (C) 2019 by Dirk Farin, Kronenstr. 49b, 70174 Stuttgart, Germany
+ * All Rights Reserved.
+ *
+ * NOTICE:  All information contained herein is, and remains the property
+ * of Dirk Farin.  The intellectual and technical concepts contained
+ * herein are proprietary to Dirk Farin and are protected by trade secret
+ * and copyright law.
+ * Dissemination of this information or reproduction of this material
+ * is strictly forbidden unless prior written permission is obtained
+ * from Dirk Farin.
+ */
+
+import Foundation
+
+public class GText {
+    
+    var gtext : OpaquePointer;
+    
+    init (elem : GElement) {
+        gtext = IM_GText_from_GElement(elem.getCPtr())
+    }
+    
+    deinit {
+        IM_GText_release(gtext)
+    }
+
+    func set_text(text : String) {
+        IM_GText_set_text(gtext, UnsafePointer(text))
+    }
+}
+

+ 28 - 0
Libraries external/Imagemeter/swift/IMError.swift

@@ -0,0 +1,28 @@
+/*
+ * ImageMeter confidential
+ *
+ * Copyright (C) 2018-2019 by Dirk Farin, Kronenstr. 49b, 70174 Stuttgart, Germany
+ * All Rights Reserved.
+ *
+ * NOTICE:  All information contained herein is, and remains the property
+ * of Dirk Farin.  The intellectual and technical concepts contained
+ * herein are proprietary to Dirk Farin and are protected by trade secret
+ * and copyright law.
+ * Dissemination of this information or reproduction of this material
+ * is strictly forbidden unless prior written permission is obtained
+ * from Dirk Farin.
+ */
+
+import Foundation
+
+public class IMError {
+    var error : OpaquePointer?
+
+    init (ptr : OpaquePointer) {
+        error = ptr
+    }
+    
+    deinit {
+        IM_Error_release(error)
+    }
+}

+ 49 - 0
Libraries external/Imagemeter/swift/libeditcore.swift

@@ -0,0 +1,49 @@
+import Foundation
+
+public class Imagemeter {
+
+    public class func computeImagemeter() -> Int32 {
+        return computeValue()
+    }
+
+    public class func computeFaculty(n : Int32) -> Int32 {
+        return im_computeFaculty(n)
+    }
+    
+    public class func stringLength(str : String) -> Int32 {
+        return im_stringLength(str);
+    }
+
+    public class func toUpper(str : String) -> String {
+        let upperCStr = UnsafeMutablePointer<Int8>(im_toUpper(str))!
+        let upper = String(cString: upperCStr)
+        free(upperCStr)
+        return upper
+    }
+    
+    public class func hash(data : [UInt8], dataSize : Int32) -> UInt8 {
+        return im_hash(UnsafePointer(data), dataSize);
+    }
+    
+    public class func encodeCodedJson(json : String) -> Data {
+        let codedFile = im_encodeCodedJson(UnsafePointer(json))
+        
+        let cPtr = UnsafePointer<UInt8>(codedFile.mem)!
+        
+//        let buffer = UnsafeBufferPointer<UInt8>(start: cPtr, count: Int(codedFile.size))
+//        let coded = Array(buffer)
+//        return coded
+        
+        let outputData = Data(bytes: cPtr, count: Int(codedFile.size))
+        return outputData
+    }
+    
+    public class func decodeCodedJson(input : Data) -> String {
+        let inputData = NSData(data: input)
+        let ptrToInput = inputData.bytes.assumingMemoryBound(to: UInt8.self)
+        let cStr = UnsafeMutablePointer<Int8>(im_decodeCodedJson(ptrToInput, Int32(input.count)))!
+        let json = String(cString : cStr)
+        free(cStr)
+        return json
+    }
+}