draw: add draw_align_tostr()

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-07-01 16:29:50 +02:00
parent 677d815a03
commit 48111308a0
2 changed files with 19 additions and 0 deletions

View File

@ -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.

View File

@ -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.