2 * blenlib/BKE_image.h (mar-2001 nzc)
6 * ***** BEGIN GPL LICENSE BLOCK *****
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software Foundation,
20 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
23 * All rights reserved.
25 * The Original Code is: all of this file.
27 * Contributor(s): none yet.
29 * ***** END GPL LICENSE BLOCK *****
44 /* call from library */
45 void free_image(struct Image *me);
47 void BKE_stamp_info(struct Scene *scene, struct ImBuf *ibuf);
48 void BKE_stamp_buf(struct Scene *scene, unsigned char *rect, float *rectf, int width, int height, int channels);
49 int BKE_write_ibuf(struct Scene *scene, struct ImBuf *ibuf, char *name, int imtype, int subimtype, int quality);
50 void BKE_makepicstring(char *string, char *base, int frame, int imtype, int use_ext);
51 void BKE_add_image_extension(char *string, int imtype);
52 int BKE_ftype_to_imtype(int ftype);
53 int BKE_imtype_to_ftype(int imtype);
54 int BKE_imtype_is_movie(int imtype);
56 struct anim *openanim(char * name, int flags);
58 void converttopremul(struct ImBuf *ibuf);
59 void image_de_interlace(struct Image *ima, int odd);
61 void tag_image_time(struct Image *ima);
62 void free_old_images(void);
64 /* ********************************** NEW IMAGE API *********************** */
66 /* ImageUser is in Texture, in Nodes, Background Image, Image Window, .... */
67 /* should be used in conjunction with an ID * to Image. */
72 /* ima->source; where image comes from */
73 #define IMA_SRC_CHECK 0
74 #define IMA_SRC_FILE 1
75 #define IMA_SRC_SEQUENCE 2
76 #define IMA_SRC_MOVIE 3
77 #define IMA_SRC_GENERATED 4
78 #define IMA_SRC_VIEWER 5
80 /* ima->type, how to handle/generate it */
81 #define IMA_TYPE_IMAGE 0
82 #define IMA_TYPE_MULTILAYER 1
84 #define IMA_TYPE_UV_TEST 2
86 #define IMA_TYPE_R_RESULT 4
87 #define IMA_TYPE_COMPOSITE 5
91 #define IMA_OK_LOADED 2
94 /* reload only frees, doesn't read until image_get_ibuf() called */
95 #define IMA_SIGNAL_RELOAD 0
96 #define IMA_SIGNAL_FREE 1
97 /* pack signals are executed */
98 #define IMA_SIGNAL_PACK 2
99 #define IMA_SIGNAL_REPACK 3
100 #define IMA_SIGNAL_UNPACK 4
101 /* source changes, from image to sequence or movie, etc */
102 #define IMA_SIGNAL_SRC_CHANGE 5
103 /* image-user gets a new image, check settings */
104 #define IMA_SIGNAL_USER_NEW_IMAGE 6
106 /* depending Image type, and (optional) ImageUser setting it returns ibuf */
107 /* always call to make signals work */
108 struct ImBuf *BKE_image_get_ibuf(struct Image *ima, struct ImageUser *iuser);
110 /* same as above, but can be used to retrieve images being rendered in
111 * a thread safe way, always call both acquire and release */
112 struct ImBuf *BKE_image_acquire_ibuf(struct Image *ima, struct ImageUser *iuser, void **lock_r);
113 void BKE_image_release_ibuf(struct Image *ima, void *lock);
115 /* returns existing Image when filename/type is same (frame optional) */
116 struct Image *BKE_add_image_file(const char *name, int frame);
118 /* adds image, adds ibuf, generates color or pattern */
119 struct Image *BKE_add_image_size(int width, int height, char *name, int floatbuf, short uvtestgrid, float color[4]);
121 /* for reload, refresh, pack */
122 void BKE_image_signal(struct Image *ima, struct ImageUser *iuser, int signal);
124 /* ensures an Image exists for viewing nodes or render */
125 struct Image *BKE_image_verify_viewer(int type, const char *name);
127 /* force an ImBuf to become part of Image */
128 void BKE_image_assign_ibuf(struct Image *ima, struct ImBuf *ibuf);
130 /* called on frame change or before render */
131 void BKE_image_user_calc_frame(struct ImageUser *iuser, int cfra, int fieldnr);
133 /* produce image export path */
134 int BKE_get_image_export_path(struct Image *im, const char *dest_dir, char *abs, int abs_size, char *rel, int rel_size);
136 /* fix things in ImageUser when new image gets assigned */
137 void BKE_image_user_new_image(struct Image *ima, struct ImageUser *iuser);
139 /* sets index offset for multilayer files */
140 struct RenderPass *BKE_image_multilayer_index(struct RenderResult *rr, struct ImageUser *iuser);
142 /* for multilayer images as well as for render-viewer */
143 struct RenderResult *BKE_image_acquire_renderresult(struct Scene *scene, struct Image *ima);
144 void BKE_image_release_renderresult(struct Scene *scene, struct Image *ima);
146 /* goes over all textures that use images */
147 void BKE_image_free_all_textures(void);
149 /* does one image! */
150 void BKE_image_free_anim_ibufs(struct Image *ima, int except_frame);
152 /* does all images with type MOVIE or SEQUENCE */
153 void BKE_image_all_free_anim_ibufs(int except_frame);
155 void BKE_image_memorypack(struct Image *ima);
157 /* prints memory statistics for images */
158 void BKE_image_print_memlist(void);
160 /* empty image block, of similar type and filename */
161 struct Image *BKE_image_copy(struct Image *ima);
163 /* merge source into dest, and free source */
164 void BKE_image_merge(struct Image *dest, struct Image *source);