diff options
author | Andrea Weikert <elubie@gmx.net> | 2007-09-02 21:25:03 +0400 |
---|---|---|
committer | Andrea Weikert <elubie@gmx.net> | 2007-09-02 21:25:03 +0400 |
commit | 356ab943736e8a2434a8ff5845873482597ba5e2 (patch) | |
tree | 910356ace904dc4f11f1daf15330bb0827934f5b /source/blender/imbuf/intern/png.c | |
parent | 22c23fb04f7f1297b971f03d69b8b04b7dd9caa4 (diff) |
== imagebrowser ==
Initial commit of imagebrowser in trunk.
BIG COMMIT!
Main changes:
* completely reworked imasel space
* creation and storage of the preview images for materials, textures, world and lamp
* thumbnails of images and movie files when browsing in the file system
* loading previews from external .blend when linking or appending
* thumbnail caching according to the Thumbnail Managing Standard: http://jens.triq.net/thumbnail-spec/
* for now just kept imasel access mostly as old imgbrowser (CTRL+F4, CTRL+F1) a bit hidden still.
* filtering of file types (images, movies, .blend, py,...)
* preliminary managing of bookmarks ('B' button to add, XKEY while bookmark active to delete)
More detailed info which will be updated here: http://wiki.blender.org/index.php/User:Elubie/PreviewImageBrowser
Places that need special review (and probably fixes):
* BLO_blendhandle_get_previews in readblenentry
* readfile.c: do_version and refactorings of do_library_append
* UI integration
TODO and known issues still:
* Accented characters do not display correctly with international fonts
* Crash was reported when browsing in directory with movie files
* Bookmark management still needs some UI work (second scrollbar?), feedback here is welcome!
Credits:
Samir Bharadwaj (samirbharadwaj@yahoo.com) for the icon images.
Many thanks to everyone who gave feedback and helped so far!
Diffstat (limited to 'source/blender/imbuf/intern/png.c')
-rw-r--r-- | source/blender/imbuf/intern/png.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/source/blender/imbuf/intern/png.c b/source/blender/imbuf/intern/png.c index 46c5232a61a..bb48ff71bff 100644 --- a/source/blender/imbuf/intern/png.c +++ b/source/blender/imbuf/intern/png.c @@ -43,6 +43,7 @@ #include "IMB_allocimbuf.h" #include "IMB_cmap.h" +#include "IMB_imginfo.h" #include "IMB_png.h" typedef struct PNGReadStruct { @@ -100,6 +101,7 @@ short imb_savepng(struct ImBuf *ibuf, char *name, int flags) { png_structp png_ptr; png_infop info_ptr; + unsigned char *pixels = 0; unsigned char *from, *to; png_bytepp row_pointers = 0; @@ -219,6 +221,33 @@ short imb_savepng(struct ImBuf *ibuf, char *name, int flags) PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT); + /* image text info */ + if (ibuf->img_info) { + png_text* imginfo; + ImgInfo* iptr; + int num_text = 0; + iptr = ibuf->img_info; + while (iptr) { + num_text++; + iptr = iptr->next; + } + + imginfo = MEM_callocN(num_text*sizeof(png_text), "png_imginfo"); + iptr = ibuf->img_info; + 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; + num_text++; + iptr = iptr->next; + } + + png_set_text(png_ptr, info_ptr, imginfo, num_text); + MEM_freeN(imginfo); + + } + // write the file header information png_write_info(png_ptr, info_ptr); @@ -409,6 +438,15 @@ struct ImBuf *imb_loadpng(unsigned char *mem, int size, int flags) break; } + if (flags & IB_imginfo) { + 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; + } + } + png_read_end(png_ptr, info_ptr); } |