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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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 *****
45 /* call from library */
46 void free_image(struct Image *me);
48 void BKE_stamp_info(struct Scene *scene, struct ImBuf *ibuf);
49 void BKE_stamp_buf(struct Scene *scene, unsigned char *rect, float *rectf, int width, int height, int channels);
50 int BKE_write_ibuf(struct Scene *scene, struct ImBuf *ibuf, char *name, int imtype, int subimtype, int quality);
51 void BKE_makepicstring(struct Scene *scene, char *string, char *base, int frame, int imtype);
52 void BKE_add_image_extension(struct Scene *scene, char *string, int imtype);
53 int BKE_ftype_to_imtype(int ftype);
54 int BKE_imtype_to_ftype(int imtype);
55 int BKE_imtype_is_movie(int imtype);
57 struct anim *openanim(char * name, int flags);
59 void converttopremul(struct ImBuf *ibuf);
60 void image_de_interlace(struct Image *ima, int odd);
62 void tag_image_time(struct Image *ima);
63 void free_old_images(void);
65 /* ********************************** NEW IMAGE API *********************** */
67 /* ImageUser is in Texture, in Nodes, Background Image, Image Window, .... */
68 /* should be used in conjunction with an ID * to Image. */
73 /* ima->source; where image comes from */
74 #define IMA_SRC_CHECK 0
75 #define IMA_SRC_FILE 1
76 #define IMA_SRC_SEQUENCE 2
77 #define IMA_SRC_MOVIE 3
78 #define IMA_SRC_GENERATED 4
79 #define IMA_SRC_VIEWER 5
81 /* ima->type, how to handle/generate it */
82 #define IMA_TYPE_IMAGE 0
83 #define IMA_TYPE_MULTILAYER 1
85 #define IMA_TYPE_UV_TEST 2
87 #define IMA_TYPE_R_RESULT 4
88 #define IMA_TYPE_COMPOSITE 5
92 #define IMA_OK_LOADED 2
95 /* reload only frees, doesn't read until image_get_ibuf() called */
96 #define IMA_SIGNAL_RELOAD 0
97 #define IMA_SIGNAL_FREE 1
98 /* pack signals are executed */
99 #define IMA_SIGNAL_PACK 2
100 #define IMA_SIGNAL_REPACK 3
101 #define IMA_SIGNAL_UNPACK 4
102 /* source changes, from image to sequence or movie, etc */
103 #define IMA_SIGNAL_SRC_CHANGE 5
104 /* image-user gets a new image, check settings */
105 #define IMA_SIGNAL_USER_NEW_IMAGE 6
107 /* depending Image type, and (optional) ImageUser setting it returns ibuf */
108 /* always call to make signals work */
109 struct ImBuf *BKE_image_get_ibuf(struct Image *ima, struct ImageUser *iuser);
111 /* returns existing Image when filename/type is same (frame optional) */
112 struct Image *BKE_add_image_file(const char *name, int frame);
114 /* adds image, adds ibuf, generates color or pattern */
115 struct Image *BKE_add_image_size(int width, int height, char *name, int floatbuf, short uvtestgrid, float color[4]);
117 /* for reload, refresh, pack */
118 void BKE_image_signal(struct Image *ima, struct ImageUser *iuser, int signal);
120 /* ensures an Image exists for viewing nodes or render */
121 struct Image *BKE_image_verify_viewer(int type, const char *name);
123 /* force an ImBuf to become part of Image */
124 void BKE_image_assign_ibuf(struct Image *ima, struct ImBuf *ibuf);
126 /* called on frame change or before render */
127 void BKE_image_user_calc_imanr(struct ImageUser *iuser, int cfra, int fieldnr);
129 /* fix things in ImageUser when new image gets assigned */
130 void BKE_image_user_new_image(struct Image *ima, struct ImageUser *iuser);
132 /* sets index offset for multilayer files */
133 struct RenderPass *BKE_image_multilayer_index(struct RenderResult *rr, struct ImageUser *iuser);
135 /* for multilayer images as well as for render-viewer */
136 struct RenderResult *BKE_image_get_renderresult(struct Scene *scene, struct Image *ima);
138 /* goes over all textures that use images */
139 void BKE_image_free_all_textures(void);
141 /* does one image! */
142 void BKE_image_free_anim_ibufs(struct Image *ima, int except_frame);
144 /* does all images with type MOVIE or SEQUENCE */
145 void BKE_image_all_free_anim_ibufs(int except_frame);
147 void BKE_image_memorypack(struct Image *ima);
149 /* prints memory statistics for images */
150 void BKE_image_print_memlist(void);
152 /* empty image block, of similar type and filename */
153 struct Image *BKE_image_copy(struct Image *ima);
155 /* merge source into dest, and free source */
156 void BKE_image_merge(struct Image *dest, struct Image *source);
158 /* copy image file to a directory rebuilding subdirectory structure */
159 int BKE_get_image_export_path(struct Image *im, const char *dest_dir, char *abs, int abs_size, char *rel, int rel_size);