2011-02-18 13:05:18 +00:00
|
|
|
/*
|
2008-04-16 22:40:48 +00:00
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
2002-10-12 11:37:38 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
2008-04-16 22:40:48 +00:00
|
|
|
* of the License, or (at your option) any later version.
|
2002-10-12 11:37:38 +00:00
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
2010-02-12 13:34:04 +00:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2002-10-12 11:37:38 +00:00
|
|
|
*
|
|
|
|
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* The Original Code is: all of this file.
|
|
|
|
*
|
|
|
|
* Contributor(s): none yet.
|
|
|
|
*
|
2008-04-16 22:40:48 +00:00
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
2002-10-12 11:37:38 +00:00
|
|
|
*/
|
2012-02-17 18:59:41 +00:00
|
|
|
#ifndef __BKE_IMAGE_H__
|
|
|
|
#define __BKE_IMAGE_H__
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2011-02-18 13:05:18 +00:00
|
|
|
/** \file BKE_image.h
|
|
|
|
* \ingroup bke
|
|
|
|
* \since March 2001
|
|
|
|
* \author nzc
|
|
|
|
*/
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
struct Image;
|
|
|
|
struct ImBuf;
|
2015-07-13 13:58:17 +02:00
|
|
|
struct ImbFormatOptions;
|
2002-10-12 11:37:38 +00:00
|
|
|
struct anim;
|
2009-01-04 14:14:06 +00:00
|
|
|
struct Scene;
|
2011-04-30 05:26:09 +00:00
|
|
|
struct Object;
|
2011-11-21 20:19:58 +00:00
|
|
|
struct ImageFormatData;
|
2013-01-21 08:49:42 +00:00
|
|
|
struct ImagePool;
|
2012-06-04 10:41:18 +00:00
|
|
|
struct Main;
|
2015-04-06 10:40:12 -03:00
|
|
|
struct ReportList;
|
2015-04-21 18:33:33 +02:00
|
|
|
struct RenderResult;
|
2015-05-26 12:02:14 +02:00
|
|
|
struct StampData;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
images/movies from color space in which file is saved to Blender's linear
space (for float images, byte images are not internally converted, only input
space is stored for such images and used later).
This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
These are different ways to view the image on the same display device.
For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
display gamma.
- RGB curves are user-defined curves which are applying before display
transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
to support other spaces, but it's quite large project which isn't so
much important.
- Legacy Color Management option disabled is emulated by using None display.
It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
2012-09-15 10:05:07 +00:00
|
|
|
#define IMA_MAX_SPACE 64
|
|
|
|
|
2012-11-15 15:59:58 +00:00
|
|
|
void BKE_images_init(void);
|
|
|
|
void BKE_images_exit(void);
|
|
|
|
|
2015-04-06 10:40:12 -03:00
|
|
|
void BKE_image_free_packedfiles(struct Image *image);
|
|
|
|
void BKE_image_free_views(struct Image *image);
|
2014-05-22 17:40:35 +10:00
|
|
|
void BKE_image_free_buffers(struct Image *image);
|
2006-12-20 17:57:56 +00:00
|
|
|
/* call from library */
|
2014-05-22 11:58:07 +10:00
|
|
|
void BKE_image_free(struct Image *image);
|
2006-12-20 17:57:56 +00:00
|
|
|
|
2016-04-29 18:05:49 +02:00
|
|
|
void BKE_image_init(struct Image *image);
|
|
|
|
|
2015-07-01 15:23:09 +02:00
|
|
|
typedef void (StampCallback)(void *data, const char *propname, char *propvalue, int len);
|
2015-05-26 12:02:14 +02:00
|
|
|
|
2015-07-01 15:23:09 +02:00
|
|
|
void BKE_render_result_stamp_info(struct Scene *scene, struct Object *camera, struct RenderResult *rr, bool allocate_only);
|
2015-04-21 18:33:33 +02:00
|
|
|
void BKE_imbuf_stamp_info(struct RenderResult *rr, struct ImBuf *ibuf);
|
2015-07-01 15:23:09 +02:00
|
|
|
void BKE_stamp_info_from_imbuf(struct RenderResult *rr, struct ImBuf *ibuf);
|
|
|
|
void BKE_stamp_info_callback(void *data, struct StampData *stamp_data, StampCallback callback, bool noskip);
|
2016-01-11 12:01:08 +11:00
|
|
|
void BKE_image_stamp_buf(
|
2016-02-01 16:09:21 +01:00
|
|
|
struct Scene *scene, struct Object *camera, const struct StampData *stamp_data_template,
|
2016-01-11 12:01:08 +11:00
|
|
|
unsigned char *rect, float *rectf, int width, int height, int channels);
|
2014-01-22 02:48:11 +11:00
|
|
|
bool BKE_imbuf_alpha_test(struct ImBuf *ibuf);
|
2016-01-11 12:01:08 +11:00
|
|
|
int BKE_imbuf_write_stamp(
|
|
|
|
struct Scene *scene, struct RenderResult *rr, struct ImBuf *ibuf, const char *name,
|
|
|
|
const struct ImageFormatData *imf);
|
|
|
|
void BKE_imbuf_write_prepare(struct ImBuf *ibuf, const struct ImageFormatData *imf);
|
|
|
|
int BKE_imbuf_write(struct ImBuf *ibuf, const char *name, const struct ImageFormatData *imf);
|
2014-04-01 11:34:00 +11:00
|
|
|
int BKE_imbuf_write_as(struct ImBuf *ibuf, const char *name, struct ImageFormatData *imf, const bool is_copy);
|
2015-01-24 16:48:23 +11:00
|
|
|
void BKE_image_path_from_imformat(
|
|
|
|
char *string, const char *base, const char *relbase, int frame,
|
2015-04-06 10:40:12 -03:00
|
|
|
const struct ImageFormatData *im_format, const bool use_ext, const bool use_frames, const char *suffix);
|
2015-01-24 16:48:23 +11:00
|
|
|
void BKE_image_path_from_imtype(
|
|
|
|
char *string, const char *base, const char *relbase, int frame,
|
2015-04-06 10:40:12 -03:00
|
|
|
const char imtype, const bool use_ext, const bool use_frames, const char *suffix);
|
|
|
|
int BKE_image_path_ensure_ext_from_imformat(char *string, const struct ImageFormatData *im_format);
|
|
|
|
int BKE_image_path_ensure_ext_from_imtype(char *string, const char imtype);
|
2015-07-13 13:58:17 +02:00
|
|
|
char BKE_image_ftype_to_imtype(const int ftype, const struct ImbFormatOptions *options);
|
|
|
|
int BKE_image_imtype_to_ftype(const char imtype, struct ImbFormatOptions *r_options);
|
2012-05-12 20:39:39 +00:00
|
|
|
|
2013-03-09 05:35:49 +00:00
|
|
|
bool BKE_imtype_is_movie(const char imtype);
|
2012-05-12 20:39:39 +00:00
|
|
|
int BKE_imtype_supports_zbuf(const char imtype);
|
|
|
|
int BKE_imtype_supports_compress(const char imtype);
|
|
|
|
int BKE_imtype_supports_quality(const char imtype);
|
2012-09-24 11:56:07 +00:00
|
|
|
int BKE_imtype_requires_linear_float(const char imtype);
|
2014-03-31 14:20:55 +09:00
|
|
|
char BKE_imtype_valid_channels(const char imtype, bool write_file);
|
2012-05-12 20:39:39 +00:00
|
|
|
char BKE_imtype_valid_depths(const char imtype);
|
3D view orbit option: Around Active
This fixes the active object in place when orbiting the view.
Choppy 15fps demo can be seen there: http://www.elysiun.com/~theeth/bf/around_active.html
Image Memory Grabage Collection
This adds memory handling to the image code. An image is tagged each time it is used.
During a collection cycle (frequency of cycles is user defined), if an image is older
than a user defined limit, its buffer gets deallocated. This also applies to gl memory buffers.
Images that are loading in GL memory needs to go through two time outs before being fully deallocated: the first time out deallocated the gl memorry, the second the buffer in ram.
Notes:
Image buffer loaded from python gets tagged as permanent upon load. That tag is removed when python stops using the image.
I might have missed some tagging spots, especially in the rendering pipeline. Someone with more knowledge about this code should check to be careful.
Tagging is done on every access, for rendering, this will probably be a performance hit. A scheme should be developped to only tag when the rendering is completed.
Collecting is called in draw_object, most likely not the best place to do it.
Safe from undo, since using undo deallocates memory anyway (like when loading a blend file with one currently opened)
Userpref DNA changes:
I've changed a couple of flagging variables from short to int. Some because they needed more space, others to keep SDNA happy.
Info window changes:
I've grouped a couple of buttons in aligned blocks and changed the color of mutually exclusive options to make them clearer.
Matt didn't do any changes on that in tuhopuu, so hopefully I'm not stepping on anyone's feet with this.
Also changed double constants into floats with f in a couple of places (mostly space.c) to make compiler happier.
2005-07-06 00:33:41 +00:00
|
|
|
|
2011-11-24 05:18:26 +00:00
|
|
|
char BKE_imtype_from_arg(const char *arg);
|
|
|
|
|
2012-04-24 02:01:23 +00:00
|
|
|
void BKE_imformat_defaults(struct ImageFormatData *im_format);
|
2012-06-22 15:40:49 +00:00
|
|
|
void BKE_imbuf_to_image_format(struct ImageFormatData *im_format, const struct ImBuf *imbuf);
|
2012-04-24 02:01:23 +00:00
|
|
|
|
Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
images/movies from color space in which file is saved to Blender's linear
space (for float images, byte images are not internally converted, only input
space is stored for such images and used later).
This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
These are different ways to view the image on the same display device.
For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
display gamma.
- RGB curves are user-defined curves which are applying before display
transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
to support other spaces, but it's quite large project which isn't so
much important.
- Legacy Color Management option disabled is emulated by using None display.
It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
2012-09-15 10:05:07 +00:00
|
|
|
struct anim *openanim(const char *name, int flags, int streamindex, char colorspace[IMA_MAX_SPACE]);
|
2015-02-04 18:48:47 +01:00
|
|
|
struct anim *openanim_noload(const char *name, int flags, int streamindex, char colorspace[IMA_MAX_SPACE]);
|
2006-12-20 17:57:56 +00:00
|
|
|
|
2012-05-12 20:39:39 +00:00
|
|
|
void BKE_image_de_interlace(struct Image *ima, int odd);
|
2011-10-23 17:52:20 +00:00
|
|
|
|
2016-07-20 19:49:45 +02:00
|
|
|
void BKE_image_make_local(struct Main *bmain, struct Image *ima, const bool lib_local);
|
2011-10-23 17:52:20 +00:00
|
|
|
|
2012-05-12 20:39:39 +00:00
|
|
|
void BKE_image_tag_time(struct Image *ima);
|
2006-12-20 17:57:56 +00:00
|
|
|
|
|
|
|
/* ********************************** NEW IMAGE API *********************** */
|
|
|
|
|
|
|
|
/* ImageUser is in Texture, in Nodes, Background Image, Image Window, .... */
|
|
|
|
/* should be used in conjunction with an ID * to Image. */
|
|
|
|
struct ImageUser;
|
2015-04-06 10:40:12 -03:00
|
|
|
struct RenderData;
|
2006-12-20 17:57:56 +00:00
|
|
|
struct RenderPass;
|
|
|
|
struct RenderResult;
|
|
|
|
|
|
|
|
/* ima->source; where image comes from */
|
2012-05-12 20:39:39 +00:00
|
|
|
#define IMA_SRC_CHECK 0
|
|
|
|
#define IMA_SRC_FILE 1
|
|
|
|
#define IMA_SRC_SEQUENCE 2
|
|
|
|
#define IMA_SRC_MOVIE 3
|
|
|
|
#define IMA_SRC_GENERATED 4
|
|
|
|
#define IMA_SRC_VIEWER 5
|
2006-12-20 17:57:56 +00:00
|
|
|
|
|
|
|
/* ima->type, how to handle/generate it */
|
2012-05-12 20:39:39 +00:00
|
|
|
#define IMA_TYPE_IMAGE 0
|
|
|
|
#define IMA_TYPE_MULTILAYER 1
|
|
|
|
/* generated */
|
|
|
|
#define IMA_TYPE_UV_TEST 2
|
|
|
|
/* viewers */
|
2006-12-20 17:57:56 +00:00
|
|
|
#define IMA_TYPE_R_RESULT 4
|
2012-05-12 20:39:39 +00:00
|
|
|
#define IMA_TYPE_COMPOSITE 5
|
2006-12-20 17:57:56 +00:00
|
|
|
|
2012-08-29 08:17:38 +00:00
|
|
|
enum {
|
|
|
|
IMA_GENTYPE_BLANK = 0,
|
|
|
|
IMA_GENTYPE_GRID = 1,
|
|
|
|
IMA_GENTYPE_GRID_COLOR = 2
|
|
|
|
};
|
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
/* ima->ok */
|
2012-05-12 20:39:39 +00:00
|
|
|
#define IMA_OK 1
|
|
|
|
#define IMA_OK_LOADED 2
|
2006-12-20 17:57:56 +00:00
|
|
|
|
|
|
|
/* signals */
|
2012-05-12 20:39:39 +00:00
|
|
|
/* reload only frees, doesn't read until image_get_ibuf() called */
|
|
|
|
#define IMA_SIGNAL_RELOAD 0
|
|
|
|
#define IMA_SIGNAL_FREE 1
|
|
|
|
/* source changes, from image to sequence or movie, etc */
|
|
|
|
#define IMA_SIGNAL_SRC_CHANGE 5
|
|
|
|
/* image-user gets a new image, check settings */
|
|
|
|
#define IMA_SIGNAL_USER_NEW_IMAGE 6
|
2012-10-22 17:34:06 +00:00
|
|
|
#define IMA_SIGNAL_COLORMANAGE 7
|
2006-12-20 17:57:56 +00:00
|
|
|
|
2011-11-25 03:47:34 +00:00
|
|
|
#define IMA_CHAN_FLAG_BW 1
|
|
|
|
#define IMA_CHAN_FLAG_RGB 2
|
|
|
|
#define IMA_CHAN_FLAG_ALPHA 4
|
|
|
|
|
2012-11-15 15:59:58 +00:00
|
|
|
/* checks whether there's an image buffer for given image and user */
|
2014-02-03 18:55:59 +11:00
|
|
|
bool BKE_image_has_ibuf(struct Image *ima, struct ImageUser *iuser);
|
2006-12-20 17:57:56 +00:00
|
|
|
|
2009-09-30 18:18:32 +00:00
|
|
|
/* same as above, but can be used to retrieve images being rendered in
|
|
|
|
* a thread safe way, always call both acquire and release */
|
2015-05-08 07:25:39 +10:00
|
|
|
struct ImBuf *BKE_image_acquire_ibuf(struct Image *ima, struct ImageUser *iuser, void **r_lock);
|
2012-11-15 15:59:58 +00:00
|
|
|
void BKE_image_release_ibuf(struct Image *ima, struct ImBuf *ibuf, void *lock);
|
2009-09-30 18:18:32 +00:00
|
|
|
|
2013-01-21 08:49:42 +00:00
|
|
|
struct ImagePool *BKE_image_pool_new(void);
|
|
|
|
void BKE_image_pool_free(struct ImagePool *pool);
|
|
|
|
struct ImBuf *BKE_image_pool_acquire_ibuf(struct Image *ima, struct ImageUser *iuser, struct ImagePool *pool);
|
|
|
|
void BKE_image_pool_release_ibuf(struct Image *ima, struct ImBuf *ibuf, struct ImagePool *pool);
|
|
|
|
|
2013-02-19 08:37:08 +00:00
|
|
|
/* set an alpha mode based on file extension */
|
2014-01-31 03:09:01 +11:00
|
|
|
char BKE_image_alpha_mode_from_extension_ex(const char *filepath);
|
2013-02-19 08:37:08 +00:00
|
|
|
void BKE_image_alpha_mode_from_extension(struct Image *image);
|
|
|
|
|
2012-05-05 14:52:04 +00:00
|
|
|
/* returns a new image or NULL if it can't load */
|
2013-02-05 12:46:15 +00:00
|
|
|
struct Image *BKE_image_load(struct Main *bmain, const char *filepath);
|
2009-01-04 14:14:06 +00:00
|
|
|
/* returns existing Image when filename/type is same (frame optional) */
|
2014-11-23 22:00:26 +01:00
|
|
|
struct Image *BKE_image_load_exists_ex(const char *filepath, bool *r_exists);
|
2012-05-05 14:52:04 +00:00
|
|
|
struct Image *BKE_image_load_exists(const char *filepath);
|
2006-12-20 17:57:56 +00:00
|
|
|
|
|
|
|
/* adds image, adds ibuf, generates color or pattern */
|
2014-04-01 11:34:00 +11:00
|
|
|
struct Image *BKE_image_add_generated(
|
2016-01-11 12:01:08 +11:00
|
|
|
struct Main *bmain, unsigned int width, unsigned int height, const char *name,
|
|
|
|
int depth, int floatbuf, short gen_type, const float color[4], const bool stereo3d);
|
2010-03-08 20:08:04 +00:00
|
|
|
/* adds image from imbuf, owns imbuf */
|
2015-05-04 12:25:33 +10:00
|
|
|
struct Image *BKE_image_add_from_imbuf(struct ImBuf *ibuf, const char *name);
|
2006-12-20 17:57:56 +00:00
|
|
|
|
|
|
|
/* for reload, refresh, pack */
|
2015-04-06 10:40:12 -03:00
|
|
|
void BKE_image_init_imageuser(struct Image *ima, struct ImageUser *iuser);
|
2006-12-20 17:57:56 +00:00
|
|
|
void BKE_image_signal(struct Image *ima, struct ImageUser *iuser, int signal);
|
|
|
|
|
2012-06-04 10:41:18 +00:00
|
|
|
void BKE_image_walk_all_users(const struct Main *mainp, void *customdata,
|
|
|
|
void callback(struct Image *ima, struct ImageUser *iuser, void *customdata));
|
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
/* ensures an Image exists for viewing nodes or render */
|
|
|
|
struct Image *BKE_image_verify_viewer(int type, const char *name);
|
2015-04-06 10:40:12 -03:00
|
|
|
/* ensures the view node cache is compatible with the scene views */
|
|
|
|
void BKE_image_verify_viewer_views(const struct RenderData *rd, struct Image *ima, struct ImageUser *iuser);
|
2006-12-20 17:57:56 +00:00
|
|
|
|
|
|
|
/* called on frame change or before render */
|
2012-05-05 16:03:57 +00:00
|
|
|
void BKE_image_user_frame_calc(struct ImageUser *iuser, int cfra, int fieldnr);
|
2012-06-04 10:41:18 +00:00
|
|
|
void BKE_image_user_check_frame_calc(struct ImageUser *iuser, int cfra, int fieldnr);
|
2014-02-03 18:55:59 +11:00
|
|
|
int BKE_image_user_frame_get(const struct ImageUser *iuser, int cfra, int fieldnr, bool *r_is_in_range);
|
2012-06-10 07:35:45 +00:00
|
|
|
void BKE_image_user_file_path(struct ImageUser *iuser, struct Image *ima, char *path);
|
2013-05-22 22:17:07 +00:00
|
|
|
void BKE_image_update_frame(const struct Main *bmain, int cfra);
|
2006-12-20 17:57:56 +00:00
|
|
|
|
|
|
|
/* sets index offset for multilayer files */
|
|
|
|
struct RenderPass *BKE_image_multilayer_index(struct RenderResult *rr, struct ImageUser *iuser);
|
|
|
|
|
2015-04-06 10:40:12 -03:00
|
|
|
/* sets index offset for multiview files */
|
|
|
|
void BKE_image_multiview_index(struct Image *ima, struct ImageUser *iuser);
|
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
/* for multilayer images as well as for render-viewer */
|
2015-04-06 10:40:12 -03:00
|
|
|
bool BKE_image_is_multilayer(struct Image *ima);
|
2015-10-11 01:14:02 +02:00
|
|
|
bool BKE_image_is_multiview(struct Image *ima);
|
|
|
|
bool BKE_image_is_stereo(struct Image *ima);
|
2009-09-30 18:18:32 +00:00
|
|
|
struct RenderResult *BKE_image_acquire_renderresult(struct Scene *scene, struct Image *ima);
|
|
|
|
void BKE_image_release_renderresult(struct Scene *scene, struct Image *ima);
|
2010-03-27 15:35:34 +00:00
|
|
|
|
2015-04-06 10:40:12 -03:00
|
|
|
/* for multilayer images as well as for singlelayer */
|
|
|
|
bool BKE_image_is_openexr(struct Image *ima);
|
|
|
|
|
2010-03-27 15:35:34 +00:00
|
|
|
/* for multiple slot render, call this before render */
|
2015-11-30 00:51:30 +01:00
|
|
|
void BKE_image_backup_render(struct Scene *scene, struct Image *ima, bool free_current_slot);
|
2015-04-06 10:40:12 -03:00
|
|
|
|
|
|
|
/* for singlelayer openexr saving */
|
|
|
|
bool BKE_image_save_openexr_multiview(struct Image *ima, struct ImBuf *ibuf, const char *filepath, const int flags);
|
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
/* goes over all textures that use images */
|
2012-05-12 20:39:39 +00:00
|
|
|
void BKE_image_free_all_textures(void);
|
2006-12-20 17:57:56 +00:00
|
|
|
|
|
|
|
/* does one image! */
|
2012-05-12 20:39:39 +00:00
|
|
|
void BKE_image_free_anim_ibufs(struct Image *ima, int except_frame);
|
2006-12-20 17:57:56 +00:00
|
|
|
|
|
|
|
/* does all images with type MOVIE or SEQUENCE */
|
|
|
|
void BKE_image_all_free_anim_ibufs(int except_frame);
|
3D view orbit option: Around Active
This fixes the active object in place when orbiting the view.
Choppy 15fps demo can be seen there: http://www.elysiun.com/~theeth/bf/around_active.html
Image Memory Grabage Collection
This adds memory handling to the image code. An image is tagged each time it is used.
During a collection cycle (frequency of cycles is user defined), if an image is older
than a user defined limit, its buffer gets deallocated. This also applies to gl memory buffers.
Images that are loading in GL memory needs to go through two time outs before being fully deallocated: the first time out deallocated the gl memorry, the second the buffer in ram.
Notes:
Image buffer loaded from python gets tagged as permanent upon load. That tag is removed when python stops using the image.
I might have missed some tagging spots, especially in the rendering pipeline. Someone with more knowledge about this code should check to be careful.
Tagging is done on every access, for rendering, this will probably be a performance hit. A scheme should be developped to only tag when the rendering is completed.
Collecting is called in draw_object, most likely not the best place to do it.
Safe from undo, since using undo deallocates memory anyway (like when loading a blend file with one currently opened)
Userpref DNA changes:
I've changed a couple of flagging variables from short to int. Some because they needed more space, others to keep SDNA happy.
Info window changes:
I've grouped a couple of buttons in aligned blocks and changed the color of mutually exclusive options to make them clearer.
Matt didn't do any changes on that in tuhopuu, so hopefully I'm not stepping on anyone's feet with this.
Also changed double constants into floats with f in a couple of places (mostly space.c) to make compiler happier.
2005-07-06 00:33:41 +00:00
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
void BKE_image_memorypack(struct Image *ima);
|
2015-04-06 10:40:12 -03:00
|
|
|
void BKE_image_packfiles(struct ReportList *reports, struct Image *ima, const char *basepath);
|
2015-05-22 23:28:41 +02:00
|
|
|
void BKE_image_packfiles_from_mem(struct ReportList *reports, struct Image *ima, char *data, const size_t data_len);
|
3D view orbit option: Around Active
This fixes the active object in place when orbiting the view.
Choppy 15fps demo can be seen there: http://www.elysiun.com/~theeth/bf/around_active.html
Image Memory Grabage Collection
This adds memory handling to the image code. An image is tagged each time it is used.
During a collection cycle (frequency of cycles is user defined), if an image is older
than a user defined limit, its buffer gets deallocated. This also applies to gl memory buffers.
Images that are loading in GL memory needs to go through two time outs before being fully deallocated: the first time out deallocated the gl memorry, the second the buffer in ram.
Notes:
Image buffer loaded from python gets tagged as permanent upon load. That tag is removed when python stops using the image.
I might have missed some tagging spots, especially in the rendering pipeline. Someone with more knowledge about this code should check to be careful.
Tagging is done on every access, for rendering, this will probably be a performance hit. A scheme should be developped to only tag when the rendering is completed.
Collecting is called in draw_object, most likely not the best place to do it.
Safe from undo, since using undo deallocates memory anyway (like when loading a blend file with one currently opened)
Userpref DNA changes:
I've changed a couple of flagging variables from short to int. Some because they needed more space, others to keep SDNA happy.
Info window changes:
I've grouped a couple of buttons in aligned blocks and changed the color of mutually exclusive options to make them clearer.
Matt didn't do any changes on that in tuhopuu, so hopefully I'm not stepping on anyone's feet with this.
Also changed double constants into floats with f in a couple of places (mostly space.c) to make compiler happier.
2005-07-06 00:33:41 +00:00
|
|
|
|
2008-02-01 12:14:15 +00:00
|
|
|
/* prints memory statistics for images */
|
|
|
|
void BKE_image_print_memlist(void);
|
|
|
|
|
2009-01-27 19:32:44 +00:00
|
|
|
/* empty image block, of similar type and filename */
|
Refactor ID copying (and to some extent, ID freeing).
This will allow much finer controll over how we copy data-blocks, from
full copy in Main database, to "lighter" ones (out of Main, inside an
already allocated datablock, etc.).
This commit also transfers a llot of what was previously handled by
per-ID-type custom code to generic ID handling code in BKE_library.
Hopefully will avoid in future inconsistencies and missing bits we had
all over the codebase in the past.
It also adds missing copying handling for a few types, most notably
Scene (which where using a fully customized handling previously).
Note that the type of allocation used during copying (regular in Main,
allocated but outside of Main, or not allocated by ID handling code at
all) is stored in ID's, which allows to handle them correctly when
freeing. This needs to be taken care of with caution when doing 'weird'
unusual things with ID copying and/or allocation!
As a final note, while rather noisy, this commit will hopefully not
break too much existing branches, old 'API' has been kept for the main
part, as a wrapper around new code. Cleaning it up will happen later.
Design task : T51804
Phab Diff: D2714
2017-08-07 16:39:55 +02:00
|
|
|
void BKE_image_copy_data(struct Main *bmain, struct Image *ima_dst, const struct Image *ima_src, const int flag);
|
2017-06-14 22:36:30 +02:00
|
|
|
struct Image *BKE_image_copy(struct Main *bmain, const struct Image *ima);
|
2009-01-27 19:32:44 +00:00
|
|
|
|
|
|
|
/* merge source into dest, and free source */
|
|
|
|
void BKE_image_merge(struct Image *dest, struct Image *source);
|
|
|
|
|
2012-05-17 15:26:11 +00:00
|
|
|
/* scale the image */
|
2014-02-03 18:55:59 +11:00
|
|
|
bool BKE_image_scale(struct Image *image, int width, int height);
|
2012-05-17 15:26:11 +00:00
|
|
|
|
TexFace to Material Settings big patch
Summary:
========
The idea here is to move the texface options into the material panel.
For images with the change please visit:
http://code.blender.org/index.php/2011/09/bge-material-texface-changes
1 - Some of the legacy problems 2.49 and 2.5x has with the texface system:
==========================================================================
1.1) Shadow, Bilboard and Halo are mutual exclusive (in the code), yet you can
select a face to be more than one mode.
1.2) Sort only works for blend Alpha yet it's an option regardless of the
Transparency Blend you pick.
1.3) Shared doesn't affect anything in BGE.
1.4) ObColor only works for Text objects (old bitmap texts) when using Texture
Face Materials. (not address yet, I so far ignored obcolor)
2 - Notes:
============
2.1) Now "Use Face Textures" in material Option panel will work in Multitexture
even if there is no texture channel.
2.2) In FaceTexture mode it will use TexFace all the time, even if you don't
check the "Use Texture Face" option in the UI. It's a matter of decision, since
the code for either way is there. I decided by the solution that makes the
creation of a material fast - in this mode the user doesn't need to mess with
textures or this "Use Texture Face" option at all. I'm not strong in my opinion
here. But I think if we don't have this then what is the point of the Texture
Face mode?
2.3) I kept references for tface only when we need the image, UV or the tiling
setting. It should help later when/if we split the Image and UV layers from the
tface struct (Campbell and Brecht proposal).
3 - Changes in a Nutshell:
==========================
3.1) "Texture Face" panel (in the Mesh/Object Data panel) no longer exists. Those settings are all part of the material properties, visible when Game Render is set.
3.2) "Texture Face" Shading mode (in the Render panel) is now called “Single Texture”, it needs a material for special settings (e.g. Billboard, Alpha Sort, …).
3.3) New options in the Material Panel
* Shadeless option in the Material panel is now supported for all three Shading modes.
* Physics is now toggleable, this is the old Collision option.
* Two Side (on) is now called Back Culling (off).
* Alpha Sort is one of the Alpha options, together (and mutually exclusive) to Alpha Blend, Alpha Clip, Add and Opaque (i.e. solid).
* Shadow, Billboard and Halo are grouped in the “Face Orientation” property.
* "Face Textures" and "Face Textures Alpha" (under Options) can be used for all but GLSL shading mode (to be supported in GLSL eventually).
* The backend in the game engine is still the same as before. The only changes are in the interface and in the way you need to think your materials. The bottomline is: It’s no longer possible to share materials between faces that do not share the same game properties.
4 - Acknowledgment:
==================
Mike Pan for the design discussions, and testing along the whole development process.
Vitor Balbio for the first hands-on code with the interface changes. That helped me a lot to push me into work on that.
Benoit Bolsee and Brecht van Lommel for patch review (* no one reviewed the whole patch, or the latest iteractions, so I still hold liability for any problems).
Blender artists that gave feedback and helped testing the patch.
Patch review and original documentation can be found here:
http://wiki.blender.org/index.php/User:Dfelinto/TexFace
http://codereview.appspot.com/4289041/
2011-09-19 19:55:59 +00:00
|
|
|
/* check if texture has alpha (depth=32) */
|
2014-02-03 18:55:59 +11:00
|
|
|
bool BKE_image_has_alpha(struct Image *image);
|
TexFace to Material Settings big patch
Summary:
========
The idea here is to move the texface options into the material panel.
For images with the change please visit:
http://code.blender.org/index.php/2011/09/bge-material-texface-changes
1 - Some of the legacy problems 2.49 and 2.5x has with the texface system:
==========================================================================
1.1) Shadow, Bilboard and Halo are mutual exclusive (in the code), yet you can
select a face to be more than one mode.
1.2) Sort only works for blend Alpha yet it's an option regardless of the
Transparency Blend you pick.
1.3) Shared doesn't affect anything in BGE.
1.4) ObColor only works for Text objects (old bitmap texts) when using Texture
Face Materials. (not address yet, I so far ignored obcolor)
2 - Notes:
============
2.1) Now "Use Face Textures" in material Option panel will work in Multitexture
even if there is no texture channel.
2.2) In FaceTexture mode it will use TexFace all the time, even if you don't
check the "Use Texture Face" option in the UI. It's a matter of decision, since
the code for either way is there. I decided by the solution that makes the
creation of a material fast - in this mode the user doesn't need to mess with
textures or this "Use Texture Face" option at all. I'm not strong in my opinion
here. But I think if we don't have this then what is the point of the Texture
Face mode?
2.3) I kept references for tface only when we need the image, UV or the tiling
setting. It should help later when/if we split the Image and UV layers from the
tface struct (Campbell and Brecht proposal).
3 - Changes in a Nutshell:
==========================
3.1) "Texture Face" panel (in the Mesh/Object Data panel) no longer exists. Those settings are all part of the material properties, visible when Game Render is set.
3.2) "Texture Face" Shading mode (in the Render panel) is now called “Single Texture”, it needs a material for special settings (e.g. Billboard, Alpha Sort, …).
3.3) New options in the Material Panel
* Shadeless option in the Material panel is now supported for all three Shading modes.
* Physics is now toggleable, this is the old Collision option.
* Two Side (on) is now called Back Culling (off).
* Alpha Sort is one of the Alpha options, together (and mutually exclusive) to Alpha Blend, Alpha Clip, Add and Opaque (i.e. solid).
* Shadow, Billboard and Halo are grouped in the “Face Orientation” property.
* "Face Textures" and "Face Textures Alpha" (under Options) can be used for all but GLSL shading mode (to be supported in GLSL eventually).
* The backend in the game engine is still the same as before. The only changes are in the interface and in the way you need to think your materials. The bottomline is: It’s no longer possible to share materials between faces that do not share the same game properties.
4 - Acknowledgment:
==================
Mike Pan for the design discussions, and testing along the whole development process.
Vitor Balbio for the first hands-on code with the interface changes. That helped me a lot to push me into work on that.
Benoit Bolsee and Brecht van Lommel for patch review (* no one reviewed the whole patch, or the latest iteractions, so I still hold liability for any problems).
Blender artists that gave feedback and helped testing the patch.
Patch review and original documentation can be found here:
http://wiki.blender.org/index.php/User:Dfelinto/TexFace
http://codereview.appspot.com/4289041/
2011-09-19 19:55:59 +00:00
|
|
|
|
World textures displaying for viewport in BI.
This patch supports "Image or Movie" and "Environment map" types of world texture for the viewport.
It supports:
- "View", "AngMap" and "Equirectangular" types of mapping.
- Different types of texture blending (according to BI world render).
- Same color blending as when it lacked textures (but render via glsl).
{F207734}
{F207735}
Example: {F275180}
Original author: @valentin_b4w
Regards,
Alexander (Blend4Web Team).
Reviewers: sergey, valentin_b4w, brecht, merwin
Reviewed By: merwin
Subscribers: campbellbarton, merwin, blueprintrandom, youle, a.romanov, yurikovelenov, AlexKowel, Evgeny_Rodygin
Projects: #rendering, #opengl_gfx, #bf_blender:_next
Differential Revision: https://developer.blender.org/D1414
2016-01-27 12:06:57 +03:00
|
|
|
/* check if texture has gpu texture code */
|
|
|
|
bool BKE_image_has_bindcode(struct Image *ima);
|
|
|
|
|
2012-09-13 05:29:38 +00:00
|
|
|
void BKE_image_get_size(struct Image *image, struct ImageUser *iuser, int *width, int *height);
|
|
|
|
void BKE_image_get_size_fl(struct Image *image, struct ImageUser *iuser, float size[2]);
|
|
|
|
void BKE_image_get_aspect(struct Image *image, float *aspx, float *aspy);
|
|
|
|
|
2010-03-21 00:25:52 +00:00
|
|
|
/* image_gen.c */
|
2012-01-19 10:04:51 +00:00
|
|
|
void BKE_image_buf_fill_color(unsigned char *rect, float *rect_float, int width, int height, const float color[4]);
|
2010-03-21 00:25:52 +00:00
|
|
|
void BKE_image_buf_fill_checker(unsigned char *rect, float *rect_float, int height, int width);
|
|
|
|
void BKE_image_buf_fill_checker_color(unsigned char *rect, float *rect_float, int height, int width);
|
|
|
|
|
Movies support for Cycles
This adds support of movie textures for Cycles rendering.
Uses the same builtin images routines as packed/generated images,
but with some extra non-rna hookups from blender_session side.
Basically, it's not so clear how to give access to video frames
via C++ RNA -- it'll require exposing ImBuf to API, doing some
threading locks and so. Ended up adding two more functions which
are actually bad level call, but don't consider it's so much bad
-- we have few bad calls already, which are actually related.
Changed a bit how builtin images names are passing to image
manager. Now it's not just an ID datablock name, but also a frame
number concatenated via '@' character, which makes itpossible to
easily know frame number to be used for movie images, without
adding extra descriptors to image manager.
Decoding of builtin name is a bit slower now, but it should be
still nothing in comparison with rendering complexity.
Also exposed image user's frame_current to python API, which
is needed to get absolute frame number of movie from node's
image user.
P.S. Generated/packed images are also using bad level call but
only does it to make things more clear here. Either all images
are using C++ RNA here or no images does. That's the most clear
for now.
2013-01-16 17:07:25 +00:00
|
|
|
/* Cycles hookup */
|
|
|
|
unsigned char *BKE_image_get_pixels_for_frame(struct Image *image, int frame);
|
|
|
|
float *BKE_image_get_float_pixels_for_frame(struct Image *image, int frame);
|
|
|
|
|
2013-03-27 11:26:10 +00:00
|
|
|
/* Guess offset for the first frame in the sequence */
|
|
|
|
int BKE_image_sequence_guess_offset(struct Image *image);
|
2015-04-06 10:40:12 -03:00
|
|
|
bool BKE_image_has_anim(struct Image *image);
|
|
|
|
bool BKE_image_has_packedfile(struct Image *image);
|
2014-01-14 04:59:58 +11:00
|
|
|
bool BKE_image_is_animated(struct Image *image);
|
2013-12-13 16:22:08 +06:00
|
|
|
bool BKE_image_is_dirty(struct Image *image);
|
2015-07-13 13:58:17 +02:00
|
|
|
void BKE_image_file_format_set(struct Image *image, int ftype, const struct ImbFormatOptions *options);
|
2013-12-13 16:22:08 +06:00
|
|
|
bool BKE_image_has_loaded_ibuf(struct Image *image);
|
|
|
|
struct ImBuf *BKE_image_get_ibuf_with_name(struct Image *image, const char *name);
|
|
|
|
struct ImBuf *BKE_image_get_first_ibuf(struct Image *image);
|
2002-10-12 11:37:38 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|
2002-10-30 02:07:20 +00:00
|
|
|
|