aboutsummaryrefslogtreecommitdiff
path: root/src_c/opcut.h
diff options
context:
space:
mode:
Diffstat (limited to 'src_c/opcut.h')
-rw-r--r--src_c/opcut.h28
1 files changed, 6 insertions, 22 deletions
diff --git a/src_c/opcut.h b/src_c/opcut.h
index 2b7384a..8bd43eb 100644
--- a/src_c/opcut.h
+++ b/src_c/opcut.h
@@ -20,23 +20,19 @@ typedef void (*opcut_free_t)(void *p);
typedef struct opcut_allocator_t opcut_allocator_t;
typedef struct opcut_panel_t {
- int id;
double width;
double height;
// internal
- struct opcut_panel_t *next;
double area;
} opcut_panel_t;
typedef struct opcut_item_t {
- int id;
double width;
double height;
bool can_rotate;
// internal
- struct opcut_item_t *next;
double area;
} opcut_item_t;
@@ -44,15 +40,17 @@ 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;
// internal
double panels_area;
} opcut_params_t;
typedef struct opcut_used_t {
- opcut_panel_t *panel;
- opcut_item_t *item;
+ size_t panel_id;
+ size_t item_id;
double x;
double y;
bool rotate;
@@ -62,7 +60,7 @@ typedef struct opcut_used_t {
} opcut_used_t;
typedef struct opcut_unused_t {
- opcut_panel_t *panel;
+ size_t panel_id;
double width;
double height;
double x;
@@ -74,28 +72,14 @@ typedef struct opcut_unused_t {
bool initial;
} opcut_unused_t;
-typedef struct {
- opcut_params_t *params;
- opcut_used_t *used;
- opcut_unused_t *unused;
-} opcut_result_t;
-
opcut_allocator_t *opcut_allocator_create(opcut_malloc_t malloc,
opcut_free_t free);
void opcut_allocator_destroy(opcut_allocator_t *a);
-opcut_panel_t *opcut_panel_create(opcut_allocator_t *a, int id, double width,
- double height, opcut_panel_t *next);
-opcut_item_t *opcut_item_create(opcut_allocator_t *a, int id, double width,
- double height, bool can_rotate,
- opcut_item_t *next);
-opcut_params_t *opcut_params_create(opcut_allocator_t *a, double cut_width,
- bool min_initial_usage,
- opcut_panel_t *panels, opcut_item_t *items);
int opcut_calculate(opcut_allocator_t *a, int method, opcut_params_t *params,
- opcut_result_t **result);
+ opcut_used_t **used, opcut_unused_t **unused);
#ifdef __cplusplus
}