Blender V5.3
IMB_thumbs.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2024 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#pragma once
10
11#include <atomic>
12#include <cstdint>
13
14namespace blender {
15
16struct ImBuf;
17
25
31
49
51 private:
52 std::atomic<bool> is_cancelled_ = false;
53
54 public:
55 void cancel()
56 {
57 is_cancelled_.store(true, std::memory_order_release);
58 }
59
60 void reset()
61 {
62 is_cancelled_.store(false, std::memory_order_release);
63 }
64
65 bool is_cancelled() const
66 {
67 return is_cancelled_.load(std::memory_order_acquire);
68 }
69};
70
74#define THUMB_SIZE_MAX (100 * 1024 * 1024)
75
76#define PREVIEW_RENDER_DEFAULT_HEIGHT 128
77#define PREVIEW_RENDER_LARGE_HEIGHT 256
78
84#define THUMB_DEFAULT_HASH "00000000000000000000000000000000"
85
93ImBuf *IMB_thumb_create(const char *filepath, ThumbSize size, ThumbSource source, ImBuf *img);
94
100ImBuf *IMB_thumb_read(const char *file_or_lib_path, ThumbSize size);
101
107void IMB_thumb_delete(const char *file_or_lib_path, ThumbSize size);
108
117ImBuf *IMB_thumb_manage(const char *file_or_lib_path,
119 ThumbSource source,
120 const ThumbCancellationToken *cancel_token = nullptr);
121
125void IMB_thumb_makedirs();
126
130ImBuf *IMB_thumb_load_blend(const char *blen_path, const char *blen_group, const char *blen_id);
131
135ImBuf *IMB_thumb_load_font(const char *filepath, unsigned int x, unsigned int y);
136bool IMB_thumb_load_font_get_hash(char *r_hash);
137
138ImBuf *IMB_font_preview(const char *filepath,
139 unsigned int width,
140 const float color[4],
141 const char *sample_text = nullptr);
142
143/* Threading */
144
147void IMB_thumb_path_lock(const char *path);
148void IMB_thumb_path_unlock(const char *path);
149
150} // namespace blender
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition btDbvt.cpp:52
BMesh Iterators.
ImBuf * IMB_font_preview(const char *filepath, unsigned int width, const float color[4], const char *sample_text=nullptr)
void IMB_thumb_locks_release()
Definition thumbs.cc:807
void IMB_thumb_path_unlock(const char *path)
Definition thumbs.cc:836
ImBuf * IMB_thumb_create(const char *filepath, ThumbSize size, ThumbSource source, ImBuf *img)
Definition thumbs.cc:541
void IMB_thumb_locks_acquire()
Definition thumbs.cc:793
ImBuf * IMB_thumb_load_blend(const char *blen_path, const char *blen_group, const char *blen_id)
ImBuf * IMB_thumb_read(const char *file_or_lib_path, ThumbSize size)
Definition thumbs.cc:567
void IMB_thumb_delete(const char *file_or_lib_path, ThumbSize size)
Definition thumbs.cc:583
void IMB_thumb_path_lock(const char *path)
Definition thumbs.cc:822
bool IMB_thumb_load_font_get_hash(char *r_hash)
void IMB_thumb_makedirs()
Definition thumbs.cc:303
ImBuf * IMB_thumb_load_font(const char *filepath, unsigned int x, unsigned int y)
@ THB_SOURCE_IMAGE
Definition IMB_thumbs.hh:33
@ THB_SOURCE_DIRECT
Definition IMB_thumbs.hh:47
@ THB_SOURCE_MOVIE
Definition IMB_thumbs.hh:34
@ THB_SOURCE_FONT
Definition IMB_thumbs.hh:36
@ THB_SOURCE_BLEND
Definition IMB_thumbs.hh:35
@ THB_SOURCE_OBJECT_IO
Definition IMB_thumbs.hh:37
ImBuf * IMB_thumb_manage(const char *file_or_lib_path, ThumbSize size, ThumbSource source, const ThumbCancellationToken *cancel_token=nullptr)
Definition thumbs.cc:601
signed char int8_t
Definition BKE_text.h:76