aboutsummaryrefslogtreecommitdiff
path: root/liblogdiag/ld-types.h
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2011-01-10 16:49:13 +0100
committerPřemysl Janouch <p.janouch@gmail.com>2011-01-10 17:07:02 +0100
commit616c49a5053830a5e0a31c71fd6114926e43235f (patch)
tree8a21f60862a86d5fb2faf5ed7fd70aa7a2ce69d5 /liblogdiag/ld-types.h
parent63b36a2b5b8e04f5d96fa9aa8d212a01c73aad49 (diff)
downloadlogdiag-616c49a5053830a5e0a31c71fd6114926e43235f.tar.gz
logdiag-616c49a5053830a5e0a31c71fd6114926e43235f.tar.xz
logdiag-616c49a5053830a5e0a31c71fd6114926e43235f.zip
Make a separate library.
This is required for gtkdoc-scangobj. So far it's much like it's been before, the main differences are that source files are in two directories from now on and the build process has two stages.
Diffstat (limited to 'liblogdiag/ld-types.h')
-rw-r--r--liblogdiag/ld-types.h101
1 files changed, 101 insertions, 0 deletions
diff --git a/liblogdiag/ld-types.h b/liblogdiag/ld-types.h
new file mode 100644
index 0000000..61a1a7d
--- /dev/null
+++ b/liblogdiag/ld-types.h
@@ -0,0 +1,101 @@
+/*
+ * ld-types.h
+ *
+ * This file is a part of logdiag.
+ * Copyright Přemysl Janouch 2010 - 2011. All rights reserved.
+ *
+ * See the file LICENSE for licensing information.
+ *
+ */
+
+#ifndef __LD_TYPES_H__
+#define __LD_TYPES_H__
+
+G_BEGIN_DECLS
+
+
+/**
+ * SECTION:ld-types
+ * @short_description: Simple data types.
+ *
+ * #LdPoint defines coordinates of a point.
+ *
+ * #LdRectangle defines the position and size of a rectangle.
+ */
+
+#define LD_TYPE_POINT (ld_point_get_type ())
+#define LD_TYPE_POINT_ARRAY (ld_point_array_get_type ())
+#define LD_TYPE_RECTANGLE (ld_rectangle_get_type ())
+
+typedef struct _LdPoint LdPoint;
+typedef struct _LdPointArray LdPointArray;
+typedef struct _LdRectangle LdRectangle;
+
+
+/**
+ * LdPoint:
+ * @x: The X coordinate.
+ * @y: The Y coordinate.
+ *
+ * Defines a point.
+ */
+struct _LdPoint
+{
+ gdouble x, y;
+};
+
+GType ld_point_get_type (void) G_GNUC_CONST;
+
+LdPoint *ld_point_copy (const LdPoint *self);
+void ld_point_free (LdPoint *self);
+gdouble ld_point_distance (LdPoint *self, gdouble x, gdouble y);
+
+
+/**
+ * LdPointArray:
+ * @points: An array of #LdPoint structures.
+ * @num_points: Count of points in @points.
+ *
+ * Moves quickly.
+ */
+struct _LdPointArray
+{
+ LdPoint *points;
+ gint num_points;
+};
+
+GType ld_point_array_get_type (void) G_GNUC_CONST;
+
+LdPointArray *ld_point_array_new (gint num_points);
+LdPointArray *ld_point_array_copy (const LdPointArray *self);
+void ld_point_array_free (LdPointArray *self);
+
+
+/**
+ * LdRectangle:
+ * @x: Left-top X coordinate.
+ * @y: Left-top Y coordinate.
+ * @width: Width of the area, must be positive.
+ * @height: Height of the area, must be positive.
+ *
+ * Defines a rectangle.
+ */
+struct _LdRectangle
+{
+ gdouble x, y;
+ gdouble width, height;
+};
+
+GType ld_rectangle_get_type (void) G_GNUC_CONST;
+
+LdRectangle *ld_rectangle_copy (const LdRectangle *self);
+void ld_rectangle_free (LdRectangle *self);
+gboolean ld_rectangle_contains (LdRectangle *self, gdouble x, gdouble y);
+gboolean ld_rectangle_intersects (LdRectangle *self, LdRectangle *rect);
+void ld_rectangle_extend (LdRectangle *self, gdouble border);
+
+
+G_END_DECLS
+
+#endif /* ! __LD_TYPES_H__ */
+