diff options
author | Harley Acheson <harley.acheson@gmail.com> | 2020-03-14 21:05:09 +0300 |
---|---|---|
committer | Harley Acheson <harley.acheson@gmail.com> | 2020-03-14 21:05:09 +0300 |
commit | a210b8297f5afe6eaf2d001e57c1e8b7e8429c52 (patch) | |
tree | b7760da467e778d34768183ea99cce590acbedd0 /source/blender/editors/interface/interface_icons.c | |
parent | a816a067ede6c8df3fc3a32bba2370a0ef179061 (diff) |
UI: Larger Alert Icons
Adding a set of larger icons for use in informational dialogs.
Differential Revision: https://developer.blender.org/D6859
Reviewed by Campbell Barton
Diffstat (limited to 'source/blender/editors/interface/interface_icons.c')
-rw-r--r-- | source/blender/editors/interface/interface_icons.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index 3e07023e52d..8dd449b4b67 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -177,6 +177,30 @@ static const IconType icontypes[] = { # include "UI_icons.h" }; +/* ********** Alert Icons ********** */ + +# define ALERT_IMG_SIZE 256 + +ImBuf *UI_alert_image(eAlertIcon icon) +{ +# ifdef WITH_HEADLESS + return NULL +# else + ImBuf *ibuf; + icon = MIN2(icon, ALERT_ICON_MAX - 1); + const int left = icon * ALERT_IMG_SIZE; + const rcti crop = {left, left + ALERT_IMG_SIZE - 1, 0, ALERT_IMG_SIZE - 1}; + ibuf = IMB_ibImageFromMemory((const uchar *)datatoc_alert_icons_png, + datatoc_alert_icons_png_size, + IB_rect, + NULL, + "alert_icon"); + IMB_rect_crop(ibuf, &crop); + IMB_premultiply_alpha(ibuf); + return ibuf; +#endif +} + /* **************************************************** */ static DrawInfo *def_internal_icon( |