Blender
V3.3
|
#include "IMB_imbuf.h"
Go to the source code of this file.
Classes | |
struct | ImFileType |
Functions | |
Format: PNG (#IMB_FTYPE_PNG) | |
bool | imb_is_a_png (const unsigned char *mem, size_t size) |
struct ImBuf * | imb_loadpng (const unsigned char *mem, size_t size, int flags, char colorspace[IM_MAX_SPACE]) |
bool | imb_savepng (struct ImBuf *ibuf, const char *filepath, int flags) |
Format: TARGA (#IMB_FTYPE_TGA) | |
bool | imb_is_a_targa (const unsigned char *buf, size_t size) |
struct ImBuf * | imb_loadtarga (const unsigned char *mem, size_t size, int flags, char colorspace[IM_MAX_SPACE]) |
bool | imb_savetarga (struct ImBuf *ibuf, const char *filepath, int flags) |
Format: IRIS (#IMB_FTYPE_IMAGIC) | |
bool | imb_is_a_iris (const unsigned char *mem, size_t size) |
struct ImBuf * | imb_loadiris (const unsigned char *mem, size_t size, int flags, char colorspace[IM_MAX_SPACE]) |
bool | imb_saveiris (struct ImBuf *ibuf, const char *filepath, int flags) |
Format: JP2 (#IMB_FTYPE_JP2) | |
bool | imb_is_a_jp2 (const unsigned char *buf, size_t size) |
struct ImBuf * | imb_load_jp2 (const unsigned char *mem, size_t size, int flags, char colorspace[IM_MAX_SPACE]) |
struct ImBuf * | imb_load_jp2_filepath (const char *filepath, int flags, char colorspace[IM_MAX_SPACE]) |
bool | imb_save_jp2 (struct ImBuf *ibuf, const char *filepath, int flags) |
Format: JPEG (#IMB_FTYPE_JPG) | |
bool | imb_is_a_jpeg (const unsigned char *mem, size_t size) |
bool | imb_savejpeg (struct ImBuf *ibuf, const char *filepath, int flags) |
struct ImBuf * | imb_load_jpeg (const unsigned char *buffer, size_t size, int flags, char colorspace[IM_MAX_SPACE]) |
struct ImBuf * | imb_thumbnail_jpeg (const char *filepath, int flags, size_t max_thumb_size, char colorspace[IM_MAX_SPACE], size_t *r_width, size_t *r_height) |
Format: BMP (#IMB_FTYPE_BMP) | |
bool | imb_is_a_bmp (const unsigned char *buf, size_t size) |
struct ImBuf * | imb_bmp_decode (const unsigned char *mem, size_t size, int flags, char colorspace[IM_MAX_SPACE]) |
bool | imb_savebmp (struct ImBuf *ibuf, const char *filepath, int flags) |
Format: CINEON (#IMB_FTYPE_CINEON) | |
bool | imb_is_a_cineon (const unsigned char *buf, size_t size) |
bool | imb_save_cineon (struct ImBuf *buf, const char *filepath, int flags) |
struct ImBuf * | imb_load_cineon (const unsigned char *mem, size_t size, int flags, char colorspace[IM_MAX_SPACE]) |
Format: DPX (#IMB_FTYPE_DPX) | |
bool | imb_is_a_dpx (const unsigned char *buf, size_t size) |
bool | imb_save_dpx (struct ImBuf *buf, const char *filepath, int flags) |
struct ImBuf * | imb_load_dpx (const unsigned char *mem, size_t size, int flags, char colorspace[IM_MAX_SPACE]) |
Format: HDR (#IMB_FTYPE_RADHDR) | |
bool | imb_is_a_hdr (const unsigned char *buf, size_t size) |
struct ImBuf * | imb_loadhdr (const unsigned char *mem, size_t size, int flags, char colorspace[IM_MAX_SPACE]) |
bool | imb_savehdr (struct ImBuf *ibuf, const char *filepath, int flags) |
Format: TIFF (#IMB_FTYPE_TIF) | |
void | imb_inittiff (void) |
bool | imb_is_a_tiff (const unsigned char *buf, size_t size) |
struct ImBuf * | imb_loadtiff (const unsigned char *mem, size_t size, int flags, char colorspace[IM_MAX_SPACE]) |
void | imb_loadtiletiff (struct ImBuf *ibuf, const unsigned char *mem, size_t size, int tx, int ty, unsigned int *rect) |
bool | imb_savetiff (struct ImBuf *ibuf, const char *filepath, int flags) |
Format: TIFF (#IMB_FTYPE_WEBP) | |
bool | imb_is_a_webp (const unsigned char *buf, size_t size) |
struct ImBuf * | imb_loadwebp (const unsigned char *mem, size_t size, int flags, char colorspace[IM_MAX_SPACE]) |
bool | imb_savewebp (struct ImBuf *ibuf, const char *name, int flags) |
Generic File Type | |
#define | IM_FTYPE_FLOAT 1 |
typedef struct ImFileType | ImFileType |
const ImFileType | IMB_FILE_TYPES [] |
const ImFileType * | IMB_FILE_TYPES_LAST |
const ImFileType * | IMB_file_type_from_ftype (int ftype) |
const ImFileType * | IMB_file_type_from_ibuf (const struct ImBuf *ibuf) |
void | imb_filetypes_init (void) |
void | imb_filetypes_exit (void) |
void | imb_tile_cache_init (void) |
void | imb_tile_cache_exit (void) |
void | imb_loadtile (struct ImBuf *ibuf, int tx, int ty, unsigned int *rect) |
void | imb_tile_cache_tile_free (struct ImBuf *ibuf, int tx, int ty) |
#define IM_FTYPE_FLOAT 1 |
Definition at line 17 of file IMB_filetype.h.
typedef struct ImFileType ImFileType |
struct ImBuf* imb_bmp_decode | ( | const unsigned char * | mem, |
size_t | size, | ||
int | flags, | ||
char | colorspace[IM_MAX_SPACE] | ||
) |
Definition at line 105 of file bmp.c.
References BMPINFOHEADER::biBitCount, BMPINFOHEADER::biHeight, BMPINFOHEADER::biSize, BMPINFOHEADER::biWidth, BMPINFOHEADER::biXPelsPerMeter, BMPINFOHEADER::biYPelsPerMeter, BMP_FILEHEADER_SIZE, checkbmp(), col, COLOR_ROLE_DEFAULT_BYTE, colorspace_set_default_role(), ELEM, ImBuf::ftype, IB_rect, IB_test, if(), IM_MAX_SPACE, IMB_allocImBuf(), imb_bmp_calc_row_size_in_bytes(), IMB_FTYPE_BMP, LITTLE_LONG, LITTLE_SHORT, NULL, ImBuf::ppm, ImBuf::rect, size(), x, and y.
const ImFileType* IMB_file_type_from_ftype | ( | int | ftype | ) |
Definition at line 233 of file filetype.c.
References IMB_FILE_TYPES, IMB_FILE_TYPES_LAST, NULL, and type.
Referenced by IMB_file_type_from_ibuf(), IMB_ispic_type_matches(), and IMB_thumb_load_image().
const ImFileType* IMB_file_type_from_ibuf | ( | const struct ImBuf * | ibuf | ) |
Definition at line 259 of file filetype.c.
References IMB_FILE_TYPES, IMB_FILE_TYPES_LAST, and type.
Referenced by IMB_exit().
Definition at line 248 of file filetype.c.
References IMB_FILE_TYPES, IMB_FILE_TYPES_LAST, and type.
Referenced by IMB_init().
bool imb_is_a_bmp | ( | const unsigned char * | buf, |
size_t | size | ||
) |
Definition at line 93 of file bmp.c.
References checkbmp(), and size().
bool imb_is_a_cineon | ( | const unsigned char * | buf, |
size_t | size | ||
) |
Definition at line 176 of file cineon_dpx.c.
References logImageIsCineon(), and size().
Referenced by imb_load_cineon().
bool imb_is_a_dpx | ( | const unsigned char * | buf, |
size_t | size | ||
) |
Definition at line 197 of file cineon_dpx.c.
References logImageIsDpx(), and size().
Referenced by imb_load_dpx().
bool imb_is_a_hdr | ( | const unsigned char * | buf, |
size_t | size | ||
) |
Definition at line 179 of file radiance_hdr.c.
References magic(), and size().
Referenced by imb_loadhdr().
bool imb_is_a_iris | ( | const unsigned char * | mem, |
size_t | size | ||
) |
bool imb_is_a_jp2 | ( | const unsigned char * | buf, |
size_t | size | ||
) |
Definition at line 71 of file jp2.c.
References check_j2k(), check_jp2(), and size().
bool imb_is_a_jpeg | ( | const unsigned char * | mem, |
size_t | size | ||
) |
Definition at line 51 of file jpeg.c.
References magic(), and size().
Referenced by imb_load_jpeg().
bool imb_is_a_png | ( | const unsigned char * | mem, |
size_t | size | ||
) |
bool imb_is_a_targa | ( | const unsigned char * | buf, |
size_t | size | ||
) |
Definition at line 400 of file targa.c.
References checktarga(), and size().
bool imb_is_a_tiff | ( | const unsigned char * | buf, |
size_t | size | ||
) |
Definition at line 306 of file tiff.c.
References IMB_TIFF_NCB, and size().
Referenced by imb_loadtiff().
bool imb_is_a_webp | ( | const unsigned char * | buf, |
size_t | size | ||
) |
struct ImBuf* imb_load_cineon | ( | const unsigned char * | mem, |
size_t | size, | ||
int | flags, | ||
char | colorspace[IM_MAX_SPACE] | ||
) |
Definition at line 181 of file cineon_dpx.c.
References ImBuf::flags, imb_is_a_cineon(), imb_load_dpx_cineon(), NULL, and size().
struct ImBuf* imb_load_dpx | ( | const unsigned char * | mem, |
size_t | size, | ||
int | flags, | ||
char | colorspace[IM_MAX_SPACE] | ||
) |
Definition at line 202 of file cineon_dpx.c.
References ImBuf::flags, imb_is_a_dpx(), imb_load_dpx_cineon(), NULL, and size().
struct ImBuf* imb_load_jp2 | ( | const unsigned char * | mem, |
size_t | size, | ||
int | flags, | ||
char | colorspace[IM_MAX_SPACE] | ||
) |
Definition at line 303 of file jp2.c.
References BufInfo::buf, format_from_header(), imb_load_jp2_stream(), JP2_FILEHEADER_SIZE, opj_stream_create_from_buffer(), and size().
struct ImBuf* imb_load_jp2_filepath | ( | const char * | filepath, |
int | flags, | ||
char | colorspace[IM_MAX_SPACE] | ||
) |
Definition at line 322 of file jp2.c.
References format_from_header(), imb_load_jp2_stream(), JP2_FILEHEADER_SIZE, NULL, and opj_stream_create_from_file().
struct ImBuf* imb_load_jpeg | ( | const unsigned char * | buffer, |
size_t | size, | ||
int | flags, | ||
char | colorspace[IM_MAX_SPACE] | ||
) |
Definition at line 448 of file jpeg.c.
References buffer, COLOR_ROLE_DEFAULT_BYTE, colorspace_set_default_role(), ibJpegImageFromCinfo(), IM_MAX_SPACE, imb_is_a_jpeg(), jpeg_error(), memory_source(), NULL, my_error_mgr::pub, my_error_mgr::setjmp_buffer, and size().
Referenced by imb_thumbnail_jpeg().
struct ImBuf* imb_loadhdr | ( | const unsigned char * | mem, |
size_t | size, | ||
int | flags, | ||
char | colorspace[IM_MAX_SPACE] | ||
) |
Definition at line 197 of file radiance_hdr.c.
References BLU, COLOR_ROLE_DEFAULT_FLOAT, colorspace_set_default_role(), ImBuf::flags, freadcolrs(), ImBuf::ftype, GRN, height, IB_alphamode_detect, IB_alphamode_premul, IB_rect, IB_rectfloat, IB_test, IM_MAX_SPACE, IMB_allocImBuf(), IMB_flipy(), imb_is_a_hdr(), IMB_rect_from_float(), MEM_freeN, MEM_mallocN, MIN2, NULL, ptr, ImBuf::rect_float, RED, RGBE2FLOAT(), size(), UNLIKELY, width, x, and y.
struct ImBuf* imb_loadiris | ( | const unsigned char * | mem, |
size_t | size, | ||
int | flags, | ||
char | colorspace[IM_MAX_SPACE] | ||
) |
Read in a B/W RGB or RGBA iris image file and return an image buffer.
Definition at line 238 of file iris.c.
References BPP, COLOR_ROLE_DEFAULT_BYTE, colorspace_set_default_role(), ELEM, expandrow(), expandrow2(), ImBuf::flags, ImBuf::ftype, HEADER_SIZE, IB_rect, IB_rectfloat, IB_test, if(), IM_MAX_SPACE, image(), IMAGIC, IMB_allocImBuf(), IMB_convert_rgba_to_abgr(), IMB_FTYPE_IMAGIC, imb_is_a_iris(), IMB_rect_from_float(), interleaverow(), interleaverow2(), ISRLE, MEM_freeN, MEM_mallocN, MFILE_CAPACITY_AT_PTR_OK_OR_FAIL, MFILE_DATA, MFILE_SEEK, MFILE_STEP, NULL, ImBuf::planes, readheader(), readtab(), ImBuf::rect, ImBuf::rect_float, size(), test_endian_zbuf(), x, ImBuf::x, y, ImBuf::y, z, and ImBuf::zbuf.
struct ImBuf* imb_loadpng | ( | const unsigned char * | mem, |
size_t | size, | ||
int | flags, | ||
char | colorspace[IM_MAX_SPACE] | ||
) |
Definition at line 524 of file png.c.
References channels(), COLOR_ROLE_DEFAULT_BYTE, colorspace_set_default_role(), count, PNGReadStruct::data, ImbFormatOptions::flag, ImBuf::flags, ImBuf::foptions, from, ImBuf::ftype, height, IB_metadata, IB_test, IM_MAX_SPACE, imb_addrectfloatImBuf(), imb_addrectImBuf(), imb_alloc_pixels(), IMB_allocImBuf(), IMB_freeImBuf(), IMB_FTYPE_PNG, imb_is_a_png(), IMB_metadata_ensure(), IMB_metadata_set_field(), imb_png_error(), imb_png_warning(), MEM_freeN, MEM_mallocN, ImBuf::metadata, NULL, PNG_16BIT, ImBuf::ppm, ImBuf::rect, ImBuf::rect_float, PNGReadStruct::seek, size(), PNGReadStruct::size, blender::bke::to_float(), width, ImBuf::x, and ImBuf::y.
struct ImBuf* imb_loadtarga | ( | const unsigned char * | mem, |
size_t | size, | ||
int | flags, | ||
char | colorspace[IM_MAX_SPACE] | ||
) |
Definition at line 612 of file targa.c.
References BIG_LONG, checktarga(), col, COLOR_ROLE_DEFAULT_BYTE, colorspace_set_default_role(), count, decodetarga(), ELEM, ImbFormatOptions::flag, ImBuf::flags, ImBuf::foptions, ImBuf::ftype, IB_rect, IB_test, IM_MAX_SPACE, IMB_allocImBuf(), IMB_convert_rgba_to_abgr(), IMB_flipy(), IMB_FTYPE_TGA, TARGA::imgdes, TARGA::imgtyp, ldtarga(), TARGA::mapbits, TARGA::mapsize, MEM_callocN, MEM_freeN, NULL, TARGA::numid, TARGA::pixsize, ImBuf::planes, RAWTGA, ImBuf::rect, size(), TARGA_HEADER_SIZE, ImBuf::x, TARGA::xsize, ImBuf::y, and TARGA::ysize.
struct ImBuf* imb_loadtiff | ( | const unsigned char * | mem, |
size_t | size, | ||
int | flags, | ||
char | colorspace[IM_MAX_SPACE] | ||
) |
Loads a TIFF file.
mem | Memory containing the TIFF file. |
size | Size of the mem buffer. |
flags | If flags has IB_test set then the file is not actually loaded, but all other operations take place. |
Definition at line 542 of file tiff.c.
References ceil(), COLOR_ROLE_DEFAULT_BYTE, colorspace_set_default_role(), ImBuf::flags, ImBuf::ftype, height, IB_alphamode_detect, IB_alphamode_premul, IB_test, IB_tilecache, IM_MAX_SPACE, image(), imb_addtilesImBuf(), IMB_allocImBuf(), imb_is_a_tiff(), imb_read_tiff_pixels(), imb_tiff_client_open(), ImBuf::mipmap, ImBuf::miptot, NULL, size(), STREQ, and width.
Definition at line 355 of file readimage.c.
References BLI_open(), ImBuf::cachename, file, imb_loadtilefile(), O_BINARY, and ImBuf::rect.
Referenced by imb_global_cache_tile_load().
void imb_loadtiletiff | ( | struct ImBuf * | ibuf, |
const unsigned char * | mem, | ||
size_t | size, | ||
int | tx, | ||
int | ty, | ||
unsigned int * | rect | ||
) |
Definition at line 667 of file tiff.c.
References height, image(), imb_tiff_client_open(), ImBuf::miplevel, NULL, size(), ImBuf::tilex, ImBuf::tiley, width, ImBuf::x, ImBuf::y, and ImBuf::ytiles.
struct ImBuf* imb_loadwebp | ( | const unsigned char * | mem, |
size_t | size, | ||
int | flags, | ||
char | colorspace[IM_MAX_SPACE] | ||
) |
Definition at line 31 of file webp.c.
References COLOR_ROLE_DEFAULT_BYTE, colorspace_set_default_role(), ImBuf::ftype, IB_test, IM_MAX_SPACE, imb_addrectImBuf(), IMB_allocImBuf(), imb_is_a_webp(), NULL, ImBuf::rect, size(), ImBuf::x, and ImBuf::y.
Definition at line 171 of file cineon_dpx.c.
References ImBuf::flags, and imb_save_dpx_cineon().
Definition at line 192 of file cineon_dpx.c.
References ImBuf::flags, and imb_save_dpx_cineon().
Definition at line 1187 of file jp2.c.
References ImBuf::flags, imb_save_jp2_stream(), NULL, and opj_stream_create_from_file().
Definition at line 409 of file radiance_hdr.c.
References BLI_fopen(), ImBuf::channels, file, ImBuf::flags, fwritecolrs(), height, NULL, ImBuf::rect, ImBuf::rect_float, void, width, writeHeader(), ImBuf::x, y, and ImBuf::y.
Definition at line 961 of file iris.c.
References ImBuf::flags, IB_zbuf, IMB_convert_rgba_to_abgr(), NULL, output_iris(), ImBuf::planes, ImBuf::rect, test_endian_zbuf(), ImBuf::x, ImBuf::y, and ImBuf::zbuf.
Definition at line 110 of file png.c.
References BLI_fopen(), channel_colormanage_noop(), ImBuf::channels, ImBuf::colormanage_flag, IDProperty::data, ImBuf::encodedsize, ListBase::first, ImbFormatOptions::flag, float(), ImBuf::float_colorspace, Flush(), ImBuf::foptions, from, blender::bke::from_float(), ftoshort(), IDPropertyData::group, IB_mem, IDP_String, IDP_STRING, imb_addencodedbufferImBuf(), IMB_COLORMANAGE_IS_DATA, IMB_colormanagement_get_luminance(), linearrgb_to_srgb(), MEM_callocN, MEM_freeN, MEM_mallocN, ImBuf::metadata, IDProperty::name, IDProperty::next, NULL, ImBuf::planes, PNG_16BIT, ImBuf::ppm, premul_to_straight_v4_v4(), ImbFormatOptions::quality, ImBuf::rect, ImBuf::rect_float, usdtokens::rgb(), IDProperty::type, UPSAMPLE_8_TO_16(), ImBuf::x, and ImBuf::y.
Saves a TIFF file.
ImBuf structures with 1, 3 or 4 bytes per pixel (GRAY, RGB, RGBA respectively) are accepted, and interpreted correctly. Note that the TIFF convention is to use pre-multiplied alpha, which can be achieved within Blender by setting premul
alpha handling. Other alpha conventions are not strictly correct, but are permitted anyhow.
ibuf | Image buffer. |
filepath | Name of the TIFF file to create. |
flags | Currently largely ignored. |
Definition at line 724 of file tiff.c.
References alloc_utf16_from_8(), ImBuf::channels, ImBuf::colormanage_flag, copy_v3_v3(), ELEM, ImbFormatOptions::flag, float(), ImBuf::float_colorspace, ImBuf::foptions, free(), from, IB_mem, image(), IMB_COLORMANAGE_IS_DATA, IMB_DPI_DEFAULT, linearrgb_to_srgb(), linearrgb_to_srgb_v3_v3(), NULL, ImBuf::planes, ImBuf::ppm, ImBuf::rect, ImBuf::rect_float, usdtokens::rgb(), unit_float_to_ushort_clamp(), x, ImBuf::x, y, and ImBuf::y.
struct ImBuf* imb_thumbnail_jpeg | ( | const char * | filepath, |
int | flags, | ||
size_t | max_thumb_size, | ||
char | colorspace[IM_MAX_SPACE], | ||
size_t * | r_width, | ||
size_t * | r_height | ||
) |
Definition at line 489 of file jpeg.c.
References BLI_fopen(), buffer, COLOR_ROLE_DEFAULT_BYTE, colorspace_set_default_role(), ibJpegImageFromCinfo(), IM_MAX_SPACE, imb_load_jpeg(), JPEG_APP1_MAX, jpeg_error(), JPEG_MARKER_APP1, JPEG_MARKER_MSB, JPEG_MARKER_SOI, MEM_callocN, MEM_SAFE_FREE, NULL, my_error_mgr::pub, and my_error_mgr::setjmp_buffer.
Definition at line 208 of file cache.c.
References Freestyle::a, BLI_ghash_free(), BLI_memarena_free(), BLI_mutex_end(), ListBase::first, GLOBAL_CACHE, imb_global_cache_tile_unload(), imb_thread_cache_exit(), ImGlobalTileCache::initialized, ImGlobalTileCache::memarena, ImGlobalTileCache::mutex, ImGlobalTile::next, NULL, ImGlobalTileCache::thread_cache, ImGlobalTileCache::tilehash, ImGlobalTileCache::tiles, and ImGlobalTileCache::totthread.
Referenced by IMB_exit(), and IMB_tile_cache_params().
Definition at line 195 of file cache.c.
References BLI_mutex_init(), GLOBAL_CACHE, IMB_tile_cache_params(), ImGlobalTileCache::initialized, and ImGlobalTileCache::mutex.
Referenced by IMB_init().
External free.
Definition at line 142 of file cache.c.
References BLI_addtail(), BLI_ghash_lookup(), BLI_ghash_remove(), BLI_mutex_lock(), BLI_mutex_unlock(), BLI_remlink(), GLOBAL_CACHE, ImGlobalTile::ibuf, ImGlobalTile::loading, ImGlobalTileCache::mutex, NULL, ImGlobalTileCache::tilehash, ImGlobalTileCache::tiles, ImGlobalTile::tx, ImGlobalTile::ty, and ImGlobalTileCache::unused.
Referenced by imb_freetilesImBuf().
|
extern |
Definition at line 29 of file filetype.c.
Referenced by IMB_file_type_from_ftype(), imb_filetypes_exit(), imb_filetypes_init(), IMB_ibImageFromFile(), IMB_ibImageFromMemory(), and IMB_ispic_type_from_memory().
|
extern |
Definition at line 231 of file filetype.c.
Referenced by IMB_file_type_from_ftype(), imb_filetypes_exit(), imb_filetypes_init(), IMB_ibImageFromFile(), IMB_ibImageFromMemory(), and IMB_ispic_type_from_memory().