Blender
V3.3
|
#include <cstring>
#include "BLI_alloca.h"
#include "BLI_endian_defines.h"
#include "BLI_endian_switch.h"
#include "BLI_fileops.h"
#include "BLI_filereader.h"
#include "BLI_string.h"
#include "blendthumb.hh"
Go to the source code of this file.
Functions | |
static bool | blend_header_check_magic (const char header[12]) |
static bool | blend_header_is_version_valid (const char header[12]) |
static int | blend_header_pointer_size (const char header[12]) |
static bool | blend_header_is_endian_switch_needed (const char header[12]) |
static void | thumb_data_vertical_flip (Thumbnail *thumb) |
static int32_t | bytes_to_native_i32 (const uint8_t bytes[4], bool endian_switch) |
static bool | file_read (FileReader *file, uint8_t *buf, size_t buf_len) |
static bool | file_seek (FileReader *file, size_t len) |
static eThumbStatus | blendthumb_extract_from_file_impl (FileReader *file, Thumbnail *thumb, const size_t bhead_size, const bool endian_switch) |
eThumbStatus | blendthumb_create_thumb_from_file (FileReader *rawfile, Thumbnail *thumb) |
Expose blendthumb_create_thumb_from_file that creates the PNG data but does not write it to a file.
Definition in file blendthumb_extract.cc.
|
static |
Definition at line 22 of file blendthumb_extract.cc.
References BLI_str_startswith(), and ELEM.
Referenced by blendthumb_create_thumb_from_file().
|
static |
Definition at line 53 of file blendthumb_extract.cc.
References B_ENDIAN, ENDIAN_ORDER, and L_ENDIAN.
Referenced by blendthumb_create_thumb_from_file().
|
static |
Definition at line 39 of file blendthumb_extract.cc.
Referenced by blendthumb_create_thumb_from_file().
|
static |
Definition at line 48 of file blendthumb_extract.cc.
Referenced by blendthumb_create_thumb_from_file().
eThumbStatus blendthumb_create_thumb_from_file | ( | struct FileReader * | rawfile, |
Thumbnail * | thumb | ||
) |
This function extracts the thumbnail from the .blend file into thumb. Returns BT_OK for success and the relevant error code otherwise.
Definition at line 170 of file blendthumb_extract.cc.
References blend_header_check_magic(), blend_header_is_endian_switch_needed(), blend_header_is_version_valid(), blend_header_pointer_size(), blendthumb_extract_from_file_impl(), BLI_file_magic_is_gzip(), BLI_file_magic_is_zstd(), BLI_filereader_new_gzip(), BLI_filereader_new_zstd(), BLI_str_startswith(), BT_EARLY_VERSION, BT_ERROR, BT_INVALID_FILE, BT_OK, FileReader::close, err, file, FileReader::read, FileReader::seek, and thumb_data_vertical_flip().
Referenced by extract_png_from_blend_file(), and CBlendThumb::GetThumbnail().
|
static |
Definition at line 114 of file blendthumb_extract.cc.
References BLI_array_alloca, BT_INVALID_THUMB, BT_OK, bytes_to_native_i32(), Thumbnail::data, blender::Array< T, InlineBufferCapacity, Allocator >::data(), file, file_read(), file_seek(), Thumbnail::height, MAKE_ID, UNLIKELY, and Thumbnail::width.
Referenced by blendthumb_create_thumb_from_file().
Definition at line 77 of file blendthumb_extract.cc.
References BLI_endian_switch_int32(), and data.
Referenced by blendthumb_extract_from_file_impl().
|
static |
Definition at line 87 of file blendthumb_extract.cc.
References file.
Referenced by blendthumb_extract_from_file_impl().
|
static |
Definition at line 92 of file blendthumb_extract.cc.
References blender::Array< T, InlineBufferCapacity, Allocator >::data(), file, len, and min.
Referenced by blendthumb_extract_from_file_impl().
Definition at line 58 of file blendthumb_extract.cc.
References bottom, Thumbnail::data, blender::Array< T, InlineBufferCapacity, Allocator >::data(), free(), Thumbnail::height, top, Thumbnail::width, x, and y.
Referenced by blendthumb_create_thumb_from_file().