Blender V4.3
BKE_icons.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2006-2007 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#pragma once
6
18#ifdef __cplusplus
19
20# include <optional>
21
22extern "C" {
23#endif
24
25#include "BLI_compiler_attrs.h"
26#include "BLI_sys_types.h"
27
28typedef void (*DrawInfoFreeFP)(void *drawinfo);
29
30enum {
43};
44
48struct Icon {
49 void *drawinfo;
55 void *obj;
58 char flag;
60 short id_type;
62};
63
65struct Icon_Geom {
69 unsigned char (*coords)[2];
70 unsigned char (*colors)[4];
71 /* when not NULL, the memory of coords and colors is a sub-region of this pointer. */
72 const void *mem;
73};
74
75typedef struct Icon Icon;
76
77struct ID;
78struct ImBuf;
79struct PreviewImage;
80struct StudioLight;
81struct bGPDlayer;
82
83void BKE_icons_init(int first_dyn_id);
84
88int BKE_icon_id_ensure(struct ID *id);
89
94
98int BKE_icon_preview_ensure(struct ID *id, struct PreviewImage *preview);
99
107
111struct Icon *BKE_icon_get(int icon_id);
112
113bool BKE_icon_is_preview(int icon_id);
114bool BKE_icon_is_image(int icon_id);
115
120void BKE_icon_set(int icon_id, struct Icon *icon);
121
125void BKE_icon_id_delete(struct ID *id);
126
130bool BKE_icon_delete(int icon_id);
131bool BKE_icon_delete_unmanaged(int icon_id);
132
136void BKE_icon_changed(int icon_id);
137
141void BKE_icons_free(void);
142
146void BKE_icons_deferred_free(void);
147
148int BKE_icon_geom_ensure(struct Icon_Geom *geom);
149struct Icon_Geom *BKE_icon_geom_from_memory(uchar *data, size_t data_len);
150struct Icon_Geom *BKE_icon_geom_from_file(const char *filename);
151
152struct ImBuf *BKE_icon_geom_rasterize(const struct Icon_Geom *geom,
153 unsigned int size_x,
154 unsigned int size_y);
156
157int BKE_icon_ensure_studio_light(struct StudioLight *sl, int id_type);
158
159#define ICON_RENDER_DEFAULT_HEIGHT 32
160
161#ifdef __cplusplus
162}
163#endif
bool BKE_icon_is_preview(int icon_id)
Definition icons.cc:417
void BKE_icon_id_delete(struct ID *id)
Definition icons.cc:451
void(* DrawInfoFreeFP)(void *drawinfo)
Definition BKE_icons.h:28
int BKE_icon_imbuf_create(struct ImBuf *ibuf) ATTR_WARN_UNUSED_RESULT
Definition icons.cc:376
struct ImBuf * BKE_icon_imbuf_get_buffer(int icon_id) ATTR_WARN_UNUSED_RESULT
Definition icons.cc:386
bool BKE_icon_delete(int icon_id)
Definition icons.cc:469
@ ICON_DATA_IMBUF
Definition BKE_icons.h:34
@ ICON_DATA_STUDIOLIGHT
Definition BKE_icons.h:40
@ ICON_DATA_PREVIEW
Definition BKE_icons.h:36
@ ICON_DATA_ID
Definition BKE_icons.h:32
@ ICON_DATA_GPLAYER
Definition BKE_icons.h:42
@ ICON_DATA_GEOM
Definition BKE_icons.h:38
void BKE_icons_deferred_free(void)
Definition icons.cc:191
void BKE_icon_set(int icon_id, struct Icon *icon)
Definition icons.cc:429
void BKE_icon_changed(int icon_id)
Definition icons.cc:205
int BKE_icon_gplayer_color_ensure(struct bGPDlayer *gpl)
Definition icons.cc:313
void BKE_icons_free(void)
Definition icons.cc:179
struct Icon_Geom * BKE_icon_geom_from_memory(uchar *data, size_t data_len)
Definition icons.cc:530
int BKE_icon_preview_ensure(struct ID *id, struct PreviewImage *preview)
Definition icons.cc:336
struct Icon * BKE_icon_get(int icon_id)
Definition icons.cc:401
bool BKE_icon_delete_unmanaged(int icon_id)
Definition icons.cc:486
bool BKE_icon_is_image(int icon_id)
Definition icons.cc:423
int BKE_icon_geom_ensure(struct Icon_Geom *geom)
Definition icons.cc:514
struct ImBuf * BKE_icon_geom_rasterize(const struct Icon_Geom *geom, unsigned int size_x, unsigned int size_y)
void BKE_icon_geom_invert_lightness(struct Icon_Geom *geom)
int BKE_icon_id_ensure(struct ID *id)
Definition icons.cc:268
int BKE_icon_ensure_studio_light(struct StudioLight *sl, int id_type)
Definition icons.cc:586
struct Icon_Geom * BKE_icon_geom_from_file(const char *filename)
Definition icons.cc:569
void BKE_icons_init(int first_dyn_id)
Definition icons.cc:166
#define ATTR_WARN_UNUSED_RESULT
unsigned char uchar
Definition DNA_ID.h:413
int coords_len
Definition BKE_icons.h:67
const void * mem
Definition BKE_icons.h:72
int icon_id
Definition BKE_icons.h:66
unsigned char(* coords)[2]
Definition BKE_icons.h:69
int coords_range[2]
Definition BKE_icons.h:68
void * obj
Definition BKE_icons.h:55
char flag
Definition BKE_icons.h:58
char obj_type
Definition BKE_icons.h:56
void * drawinfo
Definition BKE_icons.h:49
short id_type
Definition BKE_icons.h:60
DrawInfoFreeFP drawinfo_free
Definition BKE_icons.h:61