#include "zori.h" #include "zori_widget.h" #include "draw.h" /* Draws a widget's frame based on it's style. If the background bitmap is set * then that is used, otherwise, the background color is used, including a border * if needed. */ void zori_widget_draw_background(struct zori_widget * widget) { float dx, dy, dw, dh; struct zori_style * style = &widget->style; zori_bitmap * background = style->back.image; dx = rebox_x(&widget->box); dy = rebox_y(&widget->box); dw = rebox_w(&widget->box); dh = rebox_h(&widget->box); if (background) { image_blitscale9(background, dx, dy, dw, dh, -1, -1); } else { draw_frame(dx, dy, dw, dh, 3, style->border.color, style->back.color); } }