aboutsummaryrefslogtreecommitdiffstats
path: root/libgamma_const_of_subpixel_order.c
diff options
context:
space:
mode:
Diffstat (limited to 'libgamma_const_of_subpixel_order.c')
-rw-r--r--libgamma_const_of_subpixel_order.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/libgamma_const_of_subpixel_order.c b/libgamma_const_of_subpixel_order.c
new file mode 100644
index 0000000..7f69bea
--- /dev/null
+++ b/libgamma_const_of_subpixel_order.c
@@ -0,0 +1,25 @@
+/* See LICENSE file for copyright and license details. */
+#include "common.h"
+
+
+/**
+ * Get the name of the constant for a subpixel order,
+ * for example "LIBGAMMA_SUBPIXEL_ORDER_HORIZONTAL_RGB"
+ * for `LIBGAMMA_SUBPIXEL_ORDER_HORIZONTAL_RGB`
+ *
+ * @param order The subpixel order
+ * @return The name of the constant for subpixel order,
+ * `NULL` if not recognised (errno is not changed)
+ */
+const char *
+libgamma_const_of_subpixel_order(int order)
+{
+ switch (order) {
+#define X(CONST, NAME)\
+ case CONST: return #CONST;
+ LIST_SUBPIXEL_ORDERS(X)
+#undef X
+ default:
+ return NULL;
+ }
+}