Changeset View
Changeset View
Standalone View
Standalone View
source/blender/imbuf/intern/tiff.c
| Show First 20 Lines • Show All 372 Lines • ▼ Show 20 Lines | |||||
| * and RGB channel orderings. | * and RGB channel orderings. | ||||
| */ | */ | ||||
| static int imb_read_tiff_pixels(ImBuf *ibuf, TIFF *image) | static int imb_read_tiff_pixels(ImBuf *ibuf, TIFF *image) | ||||
| { | { | ||||
| ImBuf *tmpibuf = NULL; | ImBuf *tmpibuf = NULL; | ||||
| int success = 0; | int success = 0; | ||||
| short bitspersample, spp, config; | short bitspersample, spp, config; | ||||
| size_t scanline; | size_t scanline; | ||||
| int ib_flag = 0, row, chan; | eImBufFlags ib_flag = 0; | ||||
| int row, chan; | |||||
| float *fbuf = NULL; | float *fbuf = NULL; | ||||
| unsigned short *sbuf = NULL; | unsigned short *sbuf = NULL; | ||||
| TIFFGetField(image, TIFFTAG_BITSPERSAMPLE, &bitspersample); | TIFFGetField(image, TIFFTAG_BITSPERSAMPLE, &bitspersample); | ||||
| TIFFGetField(image, TIFFTAG_SAMPLESPERPIXEL, &spp); /* number of 'channels' */ | TIFFGetField(image, TIFFTAG_SAMPLESPERPIXEL, &spp); /* number of 'channels' */ | ||||
| TIFFGetField(image, TIFFTAG_PLANARCONFIG, &config); | TIFFGetField(image, TIFFTAG_PLANARCONFIG, &config); | ||||
| if (spp == 4) { | if (spp == 4) { | ||||
| ▲ Show 20 Lines • Show All 143 Lines • ▼ Show 20 Lines | |||||
| * \param size: Size of the mem buffer. | * \param size: Size of the mem buffer. | ||||
| * \param flags: If flags has IB_test set then the file is not actually loaded, | * \param flags: If flags has IB_test set then the file is not actually loaded, | ||||
| * but all other operations take place. | * but all other operations take place. | ||||
| * | * | ||||
| * \return: A newly allocated ImBuf structure if successful, otherwise NULL. | * \return: A newly allocated ImBuf structure if successful, otherwise NULL. | ||||
| */ | */ | ||||
| ImBuf *imb_loadtiff(const unsigned char *mem, | ImBuf *imb_loadtiff(const unsigned char *mem, | ||||
| size_t size, | size_t size, | ||||
| int flags, | eImBufFlags flags, | ||||
| char colorspace[IM_MAX_SPACE]) | char colorspace[IM_MAX_SPACE]) | ||||
| { | { | ||||
| TIFF *image = NULL; | TIFF *image = NULL; | ||||
| ImBuf *ibuf = NULL, *hbuf; | ImBuf *ibuf = NULL, *hbuf; | ||||
| ImbTIFFMemFile memFile; | ImbTIFFMemFile memFile; | ||||
| uint32 width, height; | uint32 width, height; | ||||
| char *format = NULL; | char *format = NULL; | ||||
| int level; | int level; | ||||
| ▲ Show 20 Lines • Show All 177 Lines • ▼ Show 20 Lines | |||||
| * | * | ||||
| * \param ibuf: Image buffer. | * \param ibuf: Image buffer. | ||||
| * \param name: Name of the TIFF file to create. | * \param name: Name of the TIFF file to create. | ||||
| * \param flags: Currently largely ignored. | * \param flags: Currently largely ignored. | ||||
| * | * | ||||
| * \return: 1 if the function is successful, 0 on failure. | * \return: 1 if the function is successful, 0 on failure. | ||||
| */ | */ | ||||
| int imb_savetiff(ImBuf *ibuf, const char *name, int flags) | int imb_savetiff(ImBuf *ibuf, const char *name, eImBufFlags flags) | ||||
| { | { | ||||
| TIFF *image = NULL; | TIFF *image = NULL; | ||||
| uint16 samplesperpixel, bitspersample; | uint16 samplesperpixel, bitspersample; | ||||
| size_t npixels; | size_t npixels; | ||||
| unsigned char *pixels = NULL; | unsigned char *pixels = NULL; | ||||
| unsigned char *from = NULL, *to = NULL; | unsigned char *from = NULL, *to = NULL; | ||||
| unsigned short *pixels16 = NULL, *to16 = NULL; | unsigned short *pixels16 = NULL, *to16 = NULL; | ||||
| float *fromf = NULL; | float *fromf = NULL; | ||||
| ▲ Show 20 Lines • Show All 207 Lines • Show Last 20 Lines | |||||