diff options
| author | bozo.kopic <bozo@kopic.xyz> | 2021-12-24 23:51:11 +0100 |
|---|---|---|
| committer | bozo.kopic <bozo@kopic.xyz> | 2021-12-24 23:51:11 +0100 |
| commit | fd0be422180178516d6d2bf3fb1f343c9ab79e53 (patch) | |
| tree | 8a2e04068ac917df22b14ea0039a88470ca70ae1 /src_c/common.h | |
| parent | c7d7e516528c9cef0caa8f5957d1b7c5a4dabd04 (diff) | |
WIP c implementation
Diffstat (limited to 'src_c/common.h')
| -rw-r--r-- | src_c/common.h | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/src_c/common.h b/src_c/common.h index 660932f..c83f808 100644 --- a/src_c/common.h +++ b/src_c/common.h @@ -13,15 +13,9 @@ ((opcut_params_t){.cut_width = 0, \ .min_initial_usage = false, \ .panels = NULL, \ - .panels_len = 0, \ - .items = NULL, \ - .items_len = 0}) + .items = NULL}) #define OPCUT_RESULT_EMPTY \ - ((opcut_result_t){.params = NULL, \ - .used = NULL, \ - .used_len = 0, \ - .unused = NULL, \ - .unused_len = 0}) + ((opcut_result_t){.params = NULL, .used = NULL, .unused = NULL}) #ifdef __cplusplus extern "C" { @@ -32,22 +26,24 @@ typedef struct { size_t len; } opcut_str_t; -typedef struct { +typedef struct opcut_panel_t { opcut_str_t id; double width; double height; // internal + struct opcut_panel_t *next; double area; } opcut_panel_t; -typedef struct { +typedef struct opcut_item_t { opcut_str_t id; double width; double height; bool can_rotate; // internal + struct opcut_item_t *next; double area; } opcut_item_t; @@ -55,20 +51,21 @@ typedef struct { double cut_width; bool min_initial_usage; opcut_panel_t *panels; - size_t panels_len; opcut_item_t *items; - size_t items_len; } opcut_params_t; -typedef struct { +typedef struct opcut_used_t { opcut_panel_t *panel; opcut_item_t *item; double x; double y; bool rotate; + + // internal + struct opcut_used_t *next; } opcut_used_t; -typedef struct { +typedef struct opcut_unused_t { opcut_panel_t *panel; double width; double height; @@ -76,6 +73,7 @@ typedef struct { double y; // internal + struct opcut_unused_t *next; double area; bool initial; } opcut_unused_t; @@ -83,9 +81,7 @@ typedef struct { typedef struct { opcut_params_t *params; opcut_used_t *used; - size_t used_len; opcut_unused_t *unused; - size_t unused_len; // internal double panels_area; |
