Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2010-03-08 23:08:04 +0300
committerCampbell Barton <ideasman42@gmail.com>2010-03-08 23:08:04 +0300
commitb356eb6a8bfad738028e67844c7755f5684f7ce3 (patch)
tree8f25c3ecec179fb6733f8586ef3f9165c4a8f12f /source/blender/blenkernel/intern/image.c
parent187b3bc1eba6822a0fb3b3fc5b5345d2d11ec34c (diff)
image re-project now uses offscreen render function and has input for render size.
unrelated changes that ended up being more trouble to commit separate... - removed BLI_split_dirfile(), was nasty, occasionaly modifying the source string, it could create directories and used the $CWD in some cases. was only used in 2 places in filesel.c, if this gives problems can address without bringing back this function. renamed BLI_split_dirfile_basic --> BLI_split_dirfile - view3d_operator_needs_opengl was being called for offscreen render when it wasnt needed.
Diffstat (limited to 'source/blender/blenkernel/intern/image.c')
-rw-r--r--source/blender/blenkernel/intern/image.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index accadb3d434..ac107212e30 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -563,10 +563,8 @@ static ImBuf *add_ibuf_size(int width, int height, char *name, int floatbuf, sho
/* adds new image block, creates ImBuf and initializes color */
Image *BKE_add_image_size(int width, int height, char *name, int floatbuf, short uvtestgrid, float color[4])
{
- Image *ima;
-
/* on save, type is changed to FILE in editsima.c */
- ima= image_alloc(name, IMA_SRC_GENERATED, IMA_TYPE_UV_TEST);
+ Image *ima= image_alloc(name, IMA_SRC_GENERATED, IMA_TYPE_UV_TEST);
if (ima) {
ImBuf *ibuf;
@@ -585,6 +583,23 @@ Image *BKE_add_image_size(int width, int height, char *name, int floatbuf, short
return ima;
}
+/* creates an image image owns the imbuf passed */
+Image *BKE_add_image_imbuf(ImBuf *ibuf)
+{
+ /* on save, type is changed to FILE in editsima.c */
+ char filename[sizeof(ibuf->name)];
+ BLI_split_dirfile(ibuf->name, NULL, filename);
+ Image *ima= image_alloc(filename, IMA_SRC_FILE, IMA_TYPE_IMAGE);
+
+ if (ima) {
+ BLI_strncpy(ima->name, ibuf->name, FILE_MAX);
+ image_assign_ibuf(ima, ibuf, IMA_NO_INDEX, 0);
+ ima->ok= IMA_OK_LOADED;
+ }
+
+ return ima;
+}
+
/* packs rect from memory as PNG */
void BKE_image_memorypack(Image *ima)
{