aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlessandro Iezzi <aiezzi@alessandroiezzi.it>2023-05-17 11:44:41 +0200
committerAlessandro Iezzi <aiezzi@alessandroiezzi.it>2023-05-17 11:44:41 +0200
commite1373af3fdded57ab4636f7e15235ccfaea27784 (patch)
tree1ac00530a10cfadab38b8e3fd4e847dccba9cd86
parent6389590c4724a60eb45c97ab871fc6d5d47d8481 (diff)
downloadcherry-e1373af3fdded57ab4636f7e15235ccfaea27784.tar.gz
cherry-e1373af3fdded57ab4636f7e15235ccfaea27784.zip
Add dimension.c and dimension.h
-rw-r--r--src/dimension.c28
-rw-r--r--src/dimension.h15
2 files changed, 43 insertions, 0 deletions
diff --git a/src/dimension.c b/src/dimension.c
new file mode 100644
index 0000000..aa273e8
--- /dev/null
+++ b/src/dimension.c
@@ -0,0 +1,28 @@
+/* See LICENSE file for copyright and license details. */
+
+#include <stdlib.h>
+#include "dimension.h"
+
+CherryDimension *
+cherry_dimension_new(void)
+{
+ CherryDimension *dim = malloc(sizeof(*dim));
+ if (dim == NULL) return NULL;
+
+ cherry_dimension_set_width(dim, 0);
+ cherry_dimension_set_height(dim, 0);
+
+ return dim;
+}
+
+void
+cherry_dimension_set_width(CherryDimension *d, int width)
+{
+ d->width = width;
+}
+
+void
+cherry_dimension_set_height(CherryDimension *d, int height)
+{
+ d->height = height;
+}
diff --git a/src/dimension.h b/src/dimension.h
new file mode 100644
index 0000000..7d5017a
--- /dev/null
+++ b/src/dimension.h
@@ -0,0 +1,15 @@
+/* See LICENSE file for copyright and license details. */
+
+#ifndef __CHERRY_DIMENSION_H__
+#define __CHERRY_DIMENSION_H__
+
+typedef struct {
+ int width;
+ int height;
+} CherryDimension;
+
+CherryDimension *cherry_dimension_new(void);
+void cherry_dimension_set_width(CherryDimension *, int);
+void cherry_dimension_set_height(CherryDimension *, int);
+
+#endif /* __CHERRY_DIMENSION_H__ */