|
Blender V2.27
|
00001 00041 /* 00042 * $Id: IMB_imbuf.h 33665 2010-12-14 18:02:41Z ton $ 00043 * 00044 * ***** BEGIN GPL LICENSE BLOCK ***** 00045 * 00046 * This program is free software; you can redistribute it and/or 00047 * modify it under the terms of the GNU General Public License 00048 * as published by the Free Software Foundation; either version 2 00049 * of the License, or (at your option) any later version. 00050 * 00051 * This program is distributed in the hope that it will be useful, 00052 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00053 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00054 * GNU General Public License for more details. 00055 * 00056 * You should have received a copy of the GNU General Public License 00057 * along with this program; if not, write to the Free Software Foundation, 00058 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00059 * 00060 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. 00061 * All rights reserved. 00062 * 00063 * The Original Code is: all of this file. 00064 * 00065 * Contributor(s): none yet. 00066 * 00067 * ***** END GPL LICENSE BLOCK ***** 00068 */ 00069 00070 #ifndef IMB_IMBUF_H 00071 #define IMB_IMBUF_H 00072 00077 struct ImBuf; 00078 00083 struct anim; 00084 00089 void IMB_init(void); 00090 void IMB_exit(void); 00091 00096 struct ImBuf *IMB_ibImageFromMemory(unsigned char *mem, size_t size, int flags); 00097 00102 struct ImBuf *IMB_testiffname(char *naam,int flags); 00103 00108 struct ImBuf *IMB_loadiffname(const char *naam, int flags); 00109 00114 void IMB_freeImBuf(struct ImBuf *ibuf); 00115 00120 struct ImBuf *IMB_allocImBuf(unsigned int x, unsigned int y, 00121 unsigned char d, unsigned int flags); 00122 00132 void IMB_refImBuf(struct ImBuf *ibuf); 00133 00138 void IMB_cache_limiter_insert(struct ImBuf *i); 00139 void IMB_cache_limiter_unmanage(struct ImBuf *i); 00140 void IMB_cache_limiter_touch(struct ImBuf *i); 00141 void IMB_cache_limiter_ref(struct ImBuf *i); 00142 void IMB_cache_limiter_unref(struct ImBuf *i); 00143 int IMB_cache_limiter_get_refcount(struct ImBuf *i); 00144 00145 void IMB_free_cache_limiter(void); 00146 00151 struct ImBuf *IMB_dupImBuf(struct ImBuf *ibuf1); 00152 00157 short addzbufImBuf(struct ImBuf *ibuf); 00158 short addzbuffloatImBuf(struct ImBuf *ibuf); 00159 00165 typedef enum IMB_BlendMode { 00166 IMB_BLEND_MIX = 0, 00167 IMB_BLEND_ADD = 1, 00168 IMB_BLEND_SUB = 2, 00169 IMB_BLEND_MUL = 3, 00170 IMB_BLEND_LIGHTEN = 4, 00171 IMB_BLEND_DARKEN = 5, 00172 IMB_BLEND_ERASE_ALPHA = 6, 00173 IMB_BLEND_ADD_ALPHA = 7, 00174 00175 IMB_BLEND_COPY = 1000, 00176 IMB_BLEND_COPY_RGB = 1001, 00177 IMB_BLEND_COPY_ALPHA = 1002 00178 } IMB_BlendMode; 00179 00180 unsigned int IMB_blend_color(unsigned int src1, unsigned int src2, int fac, 00181 IMB_BlendMode mode); 00182 void IMB_blend_color_float(float *dst, float *src1, float *src2, float fac, 00183 IMB_BlendMode mode); 00184 00185 void IMB_rectclip(struct ImBuf *dbuf, struct ImBuf *sbuf, int *destx, 00186 int *desty, int *srcx, int *srcy, int *width, int *height); 00187 void IMB_rectcpy(struct ImBuf *drect, struct ImBuf *srect, int destx, 00188 int desty, int srcx, int srcy, int width, int height); 00189 void IMB_rectblend(struct ImBuf *dbuf, struct ImBuf *sbuf, int destx, 00190 int desty, int srcx, int srcy, int width, int height, IMB_BlendMode mode); 00191 00195 int IMB_anim_get_duration(struct anim *anim); 00196 00201 struct anim *IMB_open_anim(const char *name, int ib_flags); 00202 void IMB_close_anim(struct anim *anim); 00203 00209 int ismovie(const char *name); 00210 void IMB_anim_set_preseek(struct anim *anim, int preseek); 00211 int IMB_anim_get_preseek(struct anim *anim); 00212 00218 struct ImBuf *IMB_anim_absolute(struct anim *anim, int position); 00219 00225 struct ImBuf *IMB_anim_previewframe(struct anim *anim); 00226 00231 void IMB_free_anim_ibuf(struct anim *anim); 00232 00237 void IMB_free_anim(struct anim *anim); 00238 00243 void IMB_filter(struct ImBuf *ibuf); 00244 void IMB_filterN(struct ImBuf *out, struct ImBuf *in); 00245 void IMB_filter_extend(struct ImBuf *ibuf, char *mask); 00246 void IMB_makemipmap(struct ImBuf *ibuf, int use_filter); 00247 void IMB_remakemipmap(struct ImBuf *ibuf, int use_filter); 00248 struct ImBuf *IMB_getmipmap(struct ImBuf *ibuf, int level); 00249 00255 void IMB_tile_cache_params(int totthread, int maxmem); 00256 unsigned int *IMB_gettile(struct ImBuf *ibuf, int tx, int ty, int thread); 00257 void IMB_tiles_to_rect(struct ImBuf *ibuf); 00258 00263 void IMB_filtery(struct ImBuf *ibuf); 00264 00269 struct ImBuf *IMB_onehalf(struct ImBuf *ibuf1); 00270 00275 struct ImBuf *IMB_scaleImBuf(struct ImBuf *ibuf, unsigned int newx, unsigned int newy); 00276 00281 struct ImBuf *IMB_scalefastImBuf(struct ImBuf *ibuf, unsigned int newx, unsigned int newy); 00282 00287 short IMB_saveiff(struct ImBuf *ibuf, const char *filepath, int flags); 00288 00294 short IMB_png_encode(struct ImBuf *ibuf, int file, int flags); 00295 00300 int IMB_ispic(const char *name); 00301 00306 int IMB_isanim(const char *name); 00307 00312 int imb_get_anim_type(const char *name); 00313 00318 void IMB_de_interlace(struct ImBuf *ibuf); 00319 void IMB_interlace(struct ImBuf *ibuf); 00320 void IMB_rect_from_float(struct ImBuf *ibuf); 00321 void IMB_float_from_rect(struct ImBuf *ibuf); 00322 void IMB_float_from_rect_simple(struct ImBuf *ibuf); /* no profile conversion */ 00323 /* note, check that the conversion exists, only some are supported */ 00324 void IMB_convert_profile(struct ImBuf *ibuf, int profile); 00325 float *IMB_float_profile_ensure(struct ImBuf *ibuf, int profile, int *alloc); 00326 00333 void IMB_convert_rgba_to_abgr(struct ImBuf *ibuf); 00334 00341 void IMB_convert_bgra_to_rgba(int size, unsigned int *rect); 00342 00347 void bicubic_interpolation(struct ImBuf *in, struct ImBuf *out, float u, float v, int xout, int yout); 00348 void neareast_interpolation(struct ImBuf *in, struct ImBuf *out, float u, float v, int xout, int yout); 00349 void bilinear_interpolation(struct ImBuf *in, struct ImBuf *out, float u, float v, int xout, int yout); 00350 00351 void bicubic_interpolation_color(struct ImBuf *in, unsigned char *col, float *col_float, float u, float v); 00352 void neareast_interpolation_color(struct ImBuf *in, unsigned char *col, float *col_float, float u, float v); 00353 void bilinear_interpolation_color(struct ImBuf *in, unsigned char *col, float *col_float, float u, float v); 00354 void bilinear_interpolation_color_wrap(struct ImBuf *in, unsigned char *col, float *col_float, float u, float v); 00355 00362 struct ImBuf *IMB_loadiffmem(int *mem, int flags); 00363 00370 struct ImBuf *IMB_loadifffile(int file, int flags); 00371 00376 struct ImBuf *IMB_half_x(struct ImBuf *ibuf1); 00377 00382 struct ImBuf *IMB_double_fast_x(struct ImBuf *ibuf1); 00383 00388 struct ImBuf *IMB_double_x(struct ImBuf *ibuf1); 00389 00394 struct ImBuf *IMB_half_y(struct ImBuf *ibuf1); 00395 00400 struct ImBuf *IMB_double_fast_y(struct ImBuf *ibuf1); 00401 00406 struct ImBuf *IMB_double_y(struct ImBuf *ibuf1); 00407 00412 void IMB_flipx(struct ImBuf *ibuf); 00413 void IMB_flipy(struct ImBuf *ibuf); 00414 00415 /* Premultiply alpha */ 00416 00417 void IMB_premultiply_alpha(struct ImBuf *ibuf); 00418 00423 void IMB_freezbufImBuf(struct ImBuf *ibuf); 00424 void IMB_freezbuffloatImBuf(struct ImBuf *ibuf); 00425 00430 void IMB_rectfill(struct ImBuf *drect, float col[4]); 00431 void IMB_rectfill_area(struct ImBuf *ibuf, float *col, int x1, int y1, int x2, int y2); 00432 00433 /* this should not be here, really, we needed it for operating on render data, IMB_rectfill_area calls it */ 00434 void buf_rectfill_area(unsigned char *rect, float *rectf, int width, int height, float *col, int x1, int y1, int x2, int y2); 00435 00436 /* defined in metadata.c */ 00437 int IMB_metadata_change_field(struct ImBuf *img, const char *key, const char *field); 00438 00439 /* exported for image tools in blender, to quickly allocate 32 bits rect */ 00440 short imb_addrectImBuf(struct ImBuf *ibuf); 00441 void imb_freerectImBuf(struct ImBuf *ibuf); 00442 00443 short imb_addrectfloatImBuf(struct ImBuf *ibuf); 00444 void imb_freerectfloatImBuf(struct ImBuf *ibuf); 00445 void imb_freemipmapImBuf(struct ImBuf *ibuf); 00446 00447 short imb_addtilesImBuf(struct ImBuf *ibuf); 00448 void imb_freetilesImBuf(struct ImBuf *ibuf); 00449 00450 #endif 00451
1.7.3