Blender V2.61 - r43446

BKE_image.h

Go to the documentation of this file.
00001 /*
00002  * ***** BEGIN GPL LICENSE BLOCK *****
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License
00006  * as published by the Free Software Foundation; either version 2
00007  * of the License, or (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software Foundation,
00016  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017  *
00018  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
00019  * All rights reserved.
00020  *
00021  * The Original Code is: all of this file.
00022  *
00023  * Contributor(s): none yet.
00024  *
00025  * ***** END GPL LICENSE BLOCK *****
00026  */
00027 #ifndef BKE_IMAGE_H
00028 #define BKE_IMAGE_H
00029 
00036 #ifdef __cplusplus
00037 extern "C" {
00038 #endif
00039 
00040 struct Image;
00041 struct ImBuf;
00042 struct Tex;
00043 struct anim;
00044 struct Scene;
00045 struct Object;
00046 struct ImageFormatData;
00047 
00048 /* call from library */
00049 void    free_image(struct Image *me);
00050 
00051 void    BKE_stamp_info(struct Scene *scene, struct Object *camera, struct ImBuf *ibuf);
00052 void    BKE_stamp_buf(struct Scene *scene, struct Object *camera, unsigned char *rect, float *rectf, int width, int height, int channels);
00053 int     BKE_alphatest_ibuf(struct ImBuf *ibuf);
00054 int     BKE_write_ibuf_stamp(struct Scene *scene, struct Object *camera, struct ImBuf *ibuf, const char *name, struct ImageFormatData *imf);
00055 int     BKE_write_ibuf(struct ImBuf *ibuf, const char *name, struct ImageFormatData *imf);
00056 int     BKE_write_ibuf_as(struct ImBuf *ibuf, const char *name, struct ImageFormatData *imf, const short is_copy);
00057 void    BKE_makepicstring(char *string, const char *base, const char *relbase, int frame, char imtype, const short use_ext, const short use_frames);
00058 int     BKE_add_image_extension(char *string, const char imtype);
00059 char    BKE_ftype_to_imtype(const int ftype);
00060 int     BKE_imtype_to_ftype(char imtype);
00061 
00062 int     BKE_imtype_is_movie(const char imtype);
00063 int     BKE_imtype_supports_zbuf(const char imtype);
00064 int     BKE_imtype_supports_compress(const char imtype);
00065 int     BKE_imtype_supports_quality(const char imtype);
00066 char    BKE_imtype_valid_channels(const char imtype);
00067 char    BKE_imtype_valid_depths(const char imtype);
00068 
00069 char    BKE_imtype_from_arg(const char *arg);
00070 
00071 struct anim *openanim(const char *name, int flags, int streamindex);
00072 
00073 void    image_de_interlace(struct Image *ima, int odd);
00074 
00075 void    make_local_image(struct Image *ima);
00076 
00077 void    tag_image_time(struct Image *ima);
00078 void    free_old_images(void);
00079 
00080 /* ********************************** NEW IMAGE API *********************** */
00081 
00082 /* ImageUser is in Texture, in Nodes, Background Image, Image Window, .... */
00083 /* should be used in conjunction with an ID * to Image. */
00084 struct ImageUser;
00085 struct RenderPass;
00086 struct RenderResult;
00087 
00088 /* ima->source; where image comes from */
00089 #define IMA_SRC_CHECK       0
00090 #define IMA_SRC_FILE        1
00091 #define IMA_SRC_SEQUENCE    2
00092 #define IMA_SRC_MOVIE       3
00093 #define IMA_SRC_GENERATED   4
00094 #define IMA_SRC_VIEWER      5
00095 
00096 /* ima->type, how to handle/generate it */
00097 #define IMA_TYPE_IMAGE      0
00098 #define IMA_TYPE_MULTILAYER 1
00099         /* generated */
00100 #define IMA_TYPE_UV_TEST    2
00101         /* viewers */
00102 #define IMA_TYPE_R_RESULT   4
00103 #define IMA_TYPE_COMPOSITE  5
00104 
00105 /* ima->ok */
00106 #define IMA_OK              1
00107 #define IMA_OK_LOADED       2
00108 
00109 /* signals */
00110     /* reload only frees, doesn't read until image_get_ibuf() called */
00111 #define IMA_SIGNAL_RELOAD           0
00112 #define IMA_SIGNAL_FREE             1
00113     /* source changes, from image to sequence or movie, etc */
00114 #define IMA_SIGNAL_SRC_CHANGE       5
00115     /* image-user gets a new image, check settings */
00116 #define IMA_SIGNAL_USER_NEW_IMAGE   6
00117 
00118 #define IMA_CHAN_FLAG_BW    1
00119 #define IMA_CHAN_FLAG_RGB   2
00120 #define IMA_CHAN_FLAG_ALPHA 4
00121 
00122 /* depending Image type, and (optional) ImageUser setting it returns ibuf */
00123 /* always call to make signals work */
00124 struct ImBuf *BKE_image_get_ibuf(struct Image *ima, struct ImageUser *iuser);
00125 
00126 /* same as above, but can be used to retrieve images being rendered in
00127  * a thread safe way, always call both acquire and release */
00128 struct ImBuf *BKE_image_acquire_ibuf(struct Image *ima, struct ImageUser *iuser, void **lock_r);
00129 void BKE_image_release_ibuf(struct Image *ima, void *lock);
00130 
00131 /* returns existing Image when filename/type is same (frame optional) */
00132 struct Image *BKE_add_image_file(const char *name);
00133 
00134 /* adds image, adds ibuf, generates color or pattern */
00135 struct Image *BKE_add_image_size(unsigned int width, unsigned int height, const char *name, int depth, int floatbuf, short uvtestgrid, float color[4]);
00136 /* adds image from imbuf, owns imbuf */
00137 struct Image *BKE_add_image_imbuf(struct ImBuf *ibuf);
00138 
00139 /* for reload, refresh, pack */
00140 void BKE_image_signal(struct Image *ima, struct ImageUser *iuser, int signal);
00141 
00142 /* ensures an Image exists for viewing nodes or render */
00143 struct Image *BKE_image_verify_viewer(int type, const char *name);
00144 
00145 /* force an ImBuf to become part of Image */
00146 void BKE_image_assign_ibuf(struct Image *ima, struct ImBuf *ibuf);
00147 
00148 /* called on frame change or before render */
00149 void BKE_image_user_calc_frame(struct ImageUser *iuser, int cfra, int fieldnr);
00150 int BKE_image_user_get_frame(const struct ImageUser *iuser, int cfra, int fieldnr);
00151 
00152 /* fix things in ImageUser when new image gets assigned */
00153 void BKE_image_user_new_image(struct Image *ima, struct ImageUser *iuser);
00154 
00155 /* sets index offset for multilayer files */
00156 struct RenderPass *BKE_image_multilayer_index(struct RenderResult *rr, struct ImageUser *iuser);
00157 
00158 /* for multilayer images as well as for render-viewer */
00159 struct RenderResult *BKE_image_acquire_renderresult(struct Scene *scene, struct Image *ima);
00160 void BKE_image_release_renderresult(struct Scene *scene, struct Image *ima);
00161 
00162 /* for multiple slot render, call this before render */
00163 void BKE_image_backup_render(struct Scene *scene, struct Image *ima);
00164     
00165 /* goes over all textures that use images */
00166 void    BKE_image_free_all_textures(void);
00167 
00168 /* does one image! */
00169 void    BKE_image_free_anim_ibufs(struct Image *ima, int except_frame);
00170 
00171 /* does all images with type MOVIE or SEQUENCE */
00172 void BKE_image_all_free_anim_ibufs(int except_frame);
00173 
00174 void BKE_image_memorypack(struct Image *ima);
00175 
00176 /* prints memory statistics for images */
00177 void BKE_image_print_memlist(void);
00178 
00179 /* empty image block, of similar type and filename */
00180 struct Image *copy_image(struct Image *ima);
00181 
00182 /* merge source into dest, and free source */
00183 void BKE_image_merge(struct Image *dest, struct Image *source);
00184 
00185 /* check if texture has alpha (depth=32) */
00186 int BKE_image_has_alpha(struct Image *image);
00187 
00188 /* image_gen.c */
00189 void BKE_image_buf_fill_color(unsigned char *rect, float *rect_float, int width, int height, float color[4]);
00190 void BKE_image_buf_fill_checker(unsigned char *rect, float *rect_float, int height, int width);
00191 void BKE_image_buf_fill_checker_color(unsigned char *rect, float *rect_float, int height, int width);
00192 
00193 #ifdef __cplusplus
00194 }
00195 #endif
00196 
00197 #endif
00198