summaryrefslogtreecommitdiff
path: root/kon/konui.c
diff options
context:
space:
mode:
Diffstat (limited to 'kon/konui.c')
-rw-r--r--kon/konui.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/kon/konui.c b/kon/konui.c
index ec7651e..6de6971 100644
--- a/kon/konui.c
+++ b/kon/konui.c
@@ -1011,3 +1011,23 @@ void kon_uiNextWidth(kon_ui_t *ui, int width)
{
ui->nextWidth = width;
}
+
+void kon_uiImage(kon_ui_t *ui, kon_image *image, int width, int height)
+{
+ kon_rect_t r;
+ int x, y, tile = 8;
+
+ if (width < 1) width = 1;
+ if (height < 1) height = 1;
+ r = kon_uiNextRect_(ui, width, height);
+
+ for (y = 0; y < r.h; y += tile) {
+ for (x = 0; x < r.w; x += tile) {
+ int w = r.w - x < tile ? r.w - x : tile, h = r.h - y < tile ? r.h - y : tile;
+
+ kon_fillRectangle(ui->fb, r.x + x, r.y + y, w, h, ((x + y) / tile) % 2 ? ui->theme.title : ui->theme.panel);
+ }
+ }
+ if (image) kon_drawImage(ui->fb, r.x, r.y, r.w, r.h, image);
+ kon_uiOutline_(ui, r, ui->theme.border);
+}