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:
authorTon Roosendaal <ton@blender.org>2006-12-20 20:57:56 +0300
committerTon Roosendaal <ton@blender.org>2006-12-20 20:57:56 +0300
commit253432bfc7c2a1dae224a03fb3055de19743ec67 (patch)
tree2cea30606f9f29be51d5366ddf0d3747b9649b90 /source/blender/blenkernel/intern/colortools.c
parent0a0753b409221b66f5003d8c257426043ada227e (diff)
The Big Image refactor!
Please read: http://www.blender3d.org/cms/Imaging.834.0.html Or in short: - adding MultiLayer Image support - recoded entire Image API - better integration of movie/sequence Images Was a whole load of work... went down for a week to do this. So, will need a lot of testing! Will be in irc all evening.
Diffstat (limited to 'source/blender/blenkernel/intern/colortools.c')
-rw-r--r--source/blender/blenkernel/intern/colortools.c44
1 files changed, 29 insertions, 15 deletions
diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c
index 93238137f95..6249bb2f21b 100644
--- a/source/blender/blenkernel/intern/colortools.c
+++ b/source/blender/blenkernel/intern/colortools.c
@@ -43,6 +43,7 @@
#include "BKE_curve.h"
#include "BKE_global.h"
#include "BKE_ipo.h"
+#include "BKE_image.h"
#include "BKE_main.h"
#include "BKE_utildefines.h"
@@ -623,30 +624,43 @@ void curvemapping_evaluate_premulRGBF(CurveMapping *cumap, float *vecout, const
#define FTOCHAR(val) val<=0.0f?0: (val>=1.0f?255: (char)(255.0f*val))
-void curvemapping_do_image(CurveMapping *cumap, Image *ima)
+void curvemapping_do_ibuf(CurveMapping *cumap, ImBuf *ibuf)
{
int pixel;
- if(ima==NULL || ima->ibuf==NULL)
+ if(ibuf==NULL)
return;
- if(ima->ibuf->rect_float==NULL)
- IMB_float_from_rect(ima->ibuf);
- else if(ima->ibuf->rect==NULL)
- imb_addrectImBuf(ima->ibuf);
+ if(ibuf->rect_float==NULL)
+ IMB_float_from_rect(ibuf);
+ else if(ibuf->rect==NULL)
+ imb_addrectImBuf(ibuf);
curvemapping_premultiply(cumap, 0);
- if(ima->ibuf->rect_float && ima->ibuf->rect) {
- float *pixf= ima->ibuf->rect_float;
+ if(ibuf->rect_float && ibuf->rect) {
+ float *pixf= ibuf->rect_float;
float col[3];
- char *pixc= (char *)ima->ibuf->rect;
+ int stride= 4;
+ char *pixc= (char *)ibuf->rect;
- for(pixel= ima->ibuf->x*ima->ibuf->y; pixel>0; pixel--, pixf+=4, pixc+=4) {
- curvemapping_evaluate_premulRGBF(cumap, col, pixf);
- pixc[0]= FTOCHAR(col[0]);
- pixc[1]= FTOCHAR(col[1]);
- pixc[2]= FTOCHAR(col[2]);
- pixc[3]= FTOCHAR(pixf[3]);
+ if(ibuf->channels)
+ stride= ibuf->channels;
+
+ for(pixel= ibuf->x*ibuf->y; pixel>0; pixel--, pixf+=stride, pixc+=4) {
+ if(stride<3) {
+ col[0]= curvemap_evaluateF(cumap->cm, *pixf);
+ pixc[1]= pixc[2]= pixc[3]= pixc[0]= FTOCHAR(col[0]);
+ }
+ else {
+ curvemapping_evaluate_premulRGBF(cumap, col, pixf);
+ pixc[0]= FTOCHAR(col[0]);
+ pixc[1]= FTOCHAR(col[1]);
+ pixc[2]= FTOCHAR(col[2]);
+ if(stride>3)
+ pixc[3]= FTOCHAR(pixf[3]);
+ else
+ pixc[3]= 255;
+ }
}
}