From 48111308a0640f44ae60b6912b90590e35e4251f Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Tue, 1 Jul 2008 16:29:50 +0200 Subject: [PATCH] draw: add draw_align_tostr() Signed-off-by: Julien Danjou --- common/draw.c | 18 ++++++++++++++++++ common/draw.h | 1 + 2 files changed, 19 insertions(+) diff --git a/common/draw.c b/common/draw.c index 27e7a50d..874cfbb1 100644 --- a/common/draw.c +++ b/common/draw.c @@ -1066,6 +1066,24 @@ draw_align_fromstr(const char *align, ssize_t len) } } +/** Transform an alignment to a string. + * \param a The alignment. + * \return A string which must not be freed. + */ +const char * +draw_align_tostr(alignment_t a) +{ + switch(a) + { + case AlignLeft: return "left"; + case AlignCenter: return "center"; + case AlignRight: return "right"; + case AlignFlex: return "flex"; + case AlignAuto: return "auto"; + default: return NULL; + } +} + #define RGB_COLOR_8_TO_16(i) (65535 * ((i) & 0xff) / 255) /** Initialize an X color. diff --git a/common/draw.h b/common/draw.h index 1f7200bd..e236e009 100644 --- a/common/draw.h +++ b/common/draw.h @@ -197,6 +197,7 @@ void draw_image_from_argb_data(draw_context_t *, int, int, int, int, int, unsign void draw_rotate(draw_context_t *, xcb_drawable_t, xcb_drawable_t, int, int, int, int, double, int, int); area_t draw_text_extents(xcb_connection_t *, int, font_t *, const char *, draw_parser_data_t *); alignment_t draw_align_fromstr(const char *, ssize_t); +const char *draw_align_tostr(alignment_t); /** Wipe a color resources. * \param color The color to wipe out.