浏览代码

Added `nk_image_color` back into API #645

No idea what happend but for some reason I accidentally removed
`nk_image_color`. I don't think there is any reason why it should have
been removed so I added it back in.
vurtun 7 年之前
父节点
当前提交
20cd35c0fb
共有 1 个文件被更改,包括 15 次插入0 次删除
  1. 15 0
      nuklear.h

+ 15 - 0
nuklear.h

@@ -2996,6 +2996,7 @@ NK_API void nk_label_colored(struct nk_context*, const char*, nk_flags align, st
 NK_API void nk_label_wrap(struct nk_context*, const char*);
 NK_API void nk_label_colored_wrap(struct nk_context*, const char*, struct nk_color);
 NK_API void nk_image(struct nk_context*, struct nk_image);
+NK_API void nk_image_color(struct nk_context*, struct nk_image, struct nk_color);
 #ifdef NK_INCLUDE_STANDARD_VARARGS
 NK_API void nk_labelf(struct nk_context*, nk_flags, NK_PRINTF_FORMAT_STRING const char*, ...) NK_PRINTF_VARARG_FUNC(3);
 NK_API void nk_labelf_colored(struct nk_context*, nk_flags, struct nk_color, NK_PRINTF_FORMAT_STRING const char*,...) NK_PRINTF_VARARG_FUNC(4);
@@ -21939,7 +21940,21 @@ nk_image(struct nk_context *ctx, struct nk_image img)
     if (!nk_widget(&bounds, ctx)) return;
     nk_draw_image(&win->buffer, bounds, &img, nk_white);
 }
+NK_API void
+nk_image_color(struct nk_context *ctx, struct nk_image img, struct nk_color col)
+{
+    struct nk_window *win;
+    struct nk_rect bounds;
+
+    NK_ASSERT(ctx);
+    NK_ASSERT(ctx->current);
+    NK_ASSERT(ctx->current->layout);
+    if (!ctx || !ctx->current || !ctx->current->layout) return;
 
+    win = ctx->current;
+    if (!nk_widget(&bounds, ctx)) return;
+    nk_draw_image(&win->buffer, bounds, &img, col);
+}
 /*----------------------------------------------------------------
  *
  *                          BUTTON