Blender V5.3
BKE_icons.hh
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
17
18#include <optional>
19
20#include "BLI_compiler_attrs.hh"
21#include "BLI_span.hh"
22#include "BLI_sys_types.hh"
23
24#include "DNA_ID_enums.h"
25
26namespace blender {
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 unsigned char *mem;
73};
74
75struct 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(ID *id);
89
94
98int BKE_icon_preview_ensure(ID *id, PreviewImage *preview);
99
112
129
137std::optional<IconBufferRef> BKE_icon_get_buffer(int icon_id, eIconSizes size);
138
142Icon *BKE_icon_get(int icon_id);
143
148void BKE_icon_set(int icon_id, Icon *icon);
149
153void BKE_icon_id_delete(ID *id);
154
158bool BKE_icon_delete(int icon_id);
159bool BKE_icon_delete_unmanaged(int icon_id);
160
164void BKE_icon_changed(int icon_id);
165
169void BKE_icons_free();
170
175
179
180ImBuf *BKE_icon_geom_rasterize(const Icon_Geom *geom, unsigned int size_x, unsigned int size_y);
182
183int BKE_icon_ensure_studio_light(StudioLight *sl, int id_type);
184
185#define ICON_RENDER_DEFAULT_HEIGHT 32
186
187} // namespace blender
Enumerations for DNA_ID.h.
std::string filename(const std::string_view &str, size_t pos)
BMesh Iterators.
ImBuf * BKE_icon_geom_rasterize(const Icon_Geom *geom, unsigned int size_x, unsigned int size_y)
void BKE_icon_id_delete(ID *id)
Definition icons.cc:524
bool BKE_icon_delete_unmanaged(int icon_id)
Definition icons.cc:563
Icon_Geom * BKE_icon_geom_from_file(const char *filename)
Definition icons.cc:647
int BKE_icon_id_ensure(ID *id)
Definition icons.cc:279
bool BKE_icon_is_imbuf(int icon_id) ATTR_WARN_UNUSED_RESULT
Definition icons.cc:412
void BKE_icons_deferred_free()
Definition icons.cc:198
void BKE_icon_set(int icon_id, Icon *icon)
Definition icons.cc:507
void BKE_icons_free()
Definition icons.cc:185
@ ICON_DATA_GPLAYER
Definition BKE_icons.hh:42
@ ICON_DATA_GEOM
Definition BKE_icons.hh:38
@ ICON_DATA_STUDIOLIGHT
Definition BKE_icons.hh:40
@ ICON_DATA_ID
Definition BKE_icons.hh:32
@ ICON_DATA_IMBUF
Definition BKE_icons.hh:34
@ ICON_DATA_PREVIEW
Definition BKE_icons.hh:36
Icon * BKE_icon_get(int icon_id)
Definition icons.cc:491
int BKE_icon_ensure_studio_light(StudioLight *sl, int id_type)
Definition icons.cc:664
void BKE_icon_geom_invert_lightness(Icon_Geom *geom)
void BKE_icon_changed(int icon_id)
Definition icons.cc:215
unsigned char uchar
Definition BKE_text.h:58
BMesh const char void * data
Icon_Geom * BKE_icon_geom_from_memory(uchar *data, size_t data_len)
Definition icons.cc:608
int BKE_icon_preview_ensure(ID *id, PreviewImage *preview)
Definition icons.cc:347
int BKE_icon_imbuf_create(ImBuf *ibuf) ATTR_WARN_UNUSED_RESULT
Definition icons.cc:387
void(*) DrawInfoFreeFP(void *drawinfo)
Definition BKE_icons.hh:28
void BKE_icons_init(int first_dyn_id)
Definition icons.cc:175
int BKE_icon_gplayer_color_ensure(bGPDlayer *gpl)
Definition icons.cc:324
bool ATTR_WARN_UNUSED_RESULT
bool BKE_icon_delete(int icon_id)
Definition icons.cc:545
ImBuf * BKE_icon_imbuf_get_buffer(int icon_id) ATTR_WARN_UNUSED_RESULT
Definition icons.cc:397
std::optional< IconBufferRef > BKE_icon_get_buffer(int icon_id, eIconSizes size)
Definition icons.cc:454
int BKE_icon_geom_ensure(Icon_Geom *geom)
Definition icons.cc:592
Span< uint8_t > buffer
Definition BKE_icons.hh:127
const unsigned char * mem
Definition BKE_icons.hh:72
unsigned char(* colors)[4]
Definition BKE_icons.hh:70
unsigned char(* coords)[2]
Definition BKE_icons.hh:69
DrawInfoFreeFP drawinfo_free
Definition BKE_icons.hh:61
void * drawinfo
Definition BKE_icons.hh:49