diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2010-05-07 19:18:04 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2010-05-07 19:18:04 +0400 |
commit | 008863daec1249d1f17bc69e1105e336db690d63 (patch) | |
tree | 78a4001857b26a287125a3f5fa31496052f6ebdd /source/blender/imbuf/intern/png.c | |
parent | 1613829e8e821321da99cad4790b7e6a1d90cea8 (diff) |
Merge image related changes from the render branch. This includes the image
tile cache code in imbuf, but it is not hooked up to the render engine.
Imbuf module: some small refactoring and removing a lot of unused or old code
(about 6.5k lines).
* Added a ImFileType struct with callbacks to make adding an file format type,
or making changes to the API easier.
* Move imbuf init/exit code into IMB_init()/IMB_exit() functions.
* Increased mipmap levels from 10 to 20, you run into this limit already with
a 2k image.
* Removed hamx, amiga, anim5 format support.
* Removed colormap saving, only simple colormap code now for reading tga.
* Removed gen_dynlibtiff.py, editing this is almost as much work as just
editing the code directly.
* Functions removed that were only used for sequencer plugin API:
IMB_anim_nextpic, IMB_clever_double, IMB_antialias, IMB_gamwarp,
IMB_scalefieldImBuf, IMB_scalefastfieldImBuf, IMB_onethird, IMB_halflace,
IMB_dit0, IMB_dit2, IMB_cspace
* Write metadata info into OpenEXR images. Can be viewed with the command
line utility 'exrheader'
For the image tile cache code, see this page:
http://wiki.blender.org/index.php/Dev:2.5/Source/Imaging/ImageTileCache
Diffstat (limited to 'source/blender/imbuf/intern/png.c')
-rw-r--r-- | source/blender/imbuf/intern/png.c | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/source/blender/imbuf/intern/png.c b/source/blender/imbuf/intern/png.c index 2dafa043da6..68a3324816c 100644 --- a/source/blender/imbuf/intern/png.c +++ b/source/blender/imbuf/intern/png.c @@ -33,15 +33,13 @@ #include "BLI_blenlib.h" #include "imbuf.h" -#include "imbuf_patch.h" #include "IMB_imbuf_types.h" #include "IMB_imbuf.h" #include "IMB_allocimbuf.h" -#include "IMB_cmap.h" -#include "IMB_imginfo.h" -#include "IMB_png.h" +#include "IMB_metadata.h" +#include "IMB_filetype.h" typedef struct PNGReadStruct { unsigned char *data; @@ -53,7 +51,7 @@ static void ReadData( png_structp png_ptr, png_bytep data, png_size_t length); static void WriteData( png_structp png_ptr, png_bytep data, png_size_t length); static void Flush( png_structp png_ptr); -int imb_is_a_png(void *mem) +int imb_is_a_png(unsigned char *mem) { int ret_val = 0; @@ -94,7 +92,7 @@ static void ReadData( png_structp png_ptr, png_bytep data, png_size_t length) longjmp(png_jmpbuf(png_ptr), 1); } -short imb_savepng(struct ImBuf *ibuf, char *name, int flags) +int imb_savepng(struct ImBuf *ibuf, char *name, int flags) { png_structp png_ptr; png_infop info_ptr; @@ -219,30 +217,30 @@ short imb_savepng(struct ImBuf *ibuf, char *name, int flags) PNG_FILTER_TYPE_DEFAULT); /* image text info */ - if (ibuf->img_info) { - png_text* imginfo; - ImgInfo* iptr; + if (ibuf->metadata) { + png_text* metadata; + ImMetaData* iptr; int num_text = 0; - iptr = ibuf->img_info; + iptr = ibuf->metadata; while (iptr) { num_text++; iptr = iptr->next; } - imginfo = MEM_callocN(num_text*sizeof(png_text), "png_imginfo"); - iptr = ibuf->img_info; + metadata = MEM_callocN(num_text*sizeof(png_text), "png_metadata"); + iptr = ibuf->metadata; num_text = 0; while (iptr) { - imginfo[num_text].compression = PNG_TEXT_COMPRESSION_NONE; - imginfo[num_text].key = iptr->key; - imginfo[num_text].text = iptr->value; + metadata[num_text].compression = PNG_TEXT_COMPRESSION_NONE; + metadata[num_text].key = iptr->key; + metadata[num_text].text = iptr->value; num_text++; iptr = iptr->next; } - png_set_text(png_ptr, info_ptr, imginfo, num_text); - MEM_freeN(imginfo); + png_set_text(png_ptr, info_ptr, metadata, num_text); + MEM_freeN(metadata); } @@ -437,12 +435,12 @@ struct ImBuf *imb_loadpng(unsigned char *mem, int size, int flags) break; } - if (flags & IB_imginfo) { + if (flags & IB_metadata) { png_text* text_chunks; int count = png_get_text(png_ptr, info_ptr, &text_chunks, NULL); for(i = 0; i < count; i++) { - IMB_imginfo_add_field(ibuf, text_chunks[i].key, text_chunks[i].text); - ibuf->flags |= IB_imginfo; + IMB_metadata_add_field(ibuf, text_chunks[i].key, text_chunks[i].text); + ibuf->flags |= IB_metadata; } } |