[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [59065] branches/soc-2013-paint/source/ blender/editors/sculpt_paint/paint_image_2d.c: Allow gradient fill color mixing with the background, now it does a
Antony Riakiotakis
kalast at gmail.com
Sun Aug 11 12:35:31 CEST 2013
Revision: 59065
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=59065
Author: psy-fi
Date: 2013-08-11 10:35:30 +0000 (Sun, 11 Aug 2013)
Log Message:
-----------
Allow gradient fill color mixing with the background, now it does a
regular over operation based on gradient alpha. Still no alpha influence
for gradient strokes.
Modified Paths:
--------------
branches/soc-2013-paint/source/blender/editors/sculpt_paint/paint_image_2d.c
Modified: branches/soc-2013-paint/source/blender/editors/sculpt_paint/paint_image_2d.c
===================================================================
--- branches/soc-2013-paint/source/blender/editors/sculpt_paint/paint_image_2d.c 2013-08-11 10:35:26 UTC (rev 59064)
+++ branches/soc-2013-paint/source/blender/editors/sculpt_paint/paint_image_2d.c 2013-08-11 10:35:30 UTC (rev 59065)
@@ -40,6 +40,7 @@
#include "BLI_math.h"
#include "BLI_rect.h"
+#include "BLI_math_color_blend.h"
#include "BKE_context.h"
#include "BKE_brush.h"
@@ -1340,7 +1341,11 @@
float f = dot_v2v2(p, tangent)*line_len_sq_inv;
do_colorband(br->gradient, f, color_f);
- copy_v4_v4(ibuf->rect_float + 4 * (j * ibuf->x + i), color_f);
+ /* convert to premultiplied */
+ mul_v3_fl(color_f, color_f[3]);
+ blend_color_mix_float(ibuf->rect_float + 4 * (j * ibuf->x + i),
+ ibuf->rect_float + 4 * (j * ibuf->x + i),
+ color_f);
}
}
}
@@ -1353,7 +1358,9 @@
do_colorband(br->gradient, f, color_f);
rgba_float_to_uchar((unsigned char *)&color_b, color_f);
- *(ibuf->rect + j * ibuf->x + i) = color_b;
+ blend_color_mix_byte((unsigned char *)(ibuf->rect + j * ibuf->x + i),
+ (unsigned char *)(ibuf->rect + j * ibuf->x + i),
+ (unsigned char *)&color_b);
}
}
}
More information about the Bf-blender-cvs
mailing list