diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-06-10 16:33:27 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-06-10 16:33:27 +0400 |
commit | 219eca0f515f9a54953566539520fde37f2ea13b (patch) | |
tree | 55032be25b32e59e4281aeb67660e5b48ec861ee /source/blender/editors/space_image | |
parent | c27472c04ef294a1de6ab9804c3b87f5635a8fcd (diff) |
mango request - add alpha to histogram & sample line.
Diffstat (limited to 'source/blender/editors/space_image')
-rw-r--r-- | source/blender/editors/space_image/image_ops.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 5075147869d..97f3bd744dc 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -2150,7 +2150,7 @@ static int image_sample_line_exec(bContext *C, wmOperator *op) y = (int)(0.5f + y1 + (float)i * (y2 - y1) / 255.0f); if (x < 0 || y < 0 || x >= ibuf->x || y >= ibuf->y) { - hist->data_luma[i] = hist->data_r[i] = hist->data_g[i] = hist->data_b[i] = 0.0f; + hist->data_luma[i] = hist->data_r[i] = hist->data_g[i] = hist->data_b[i] = hist->data_a[i] = 0.0f; } else { if (ibuf->rect_float) { @@ -2161,17 +2161,19 @@ static int image_sample_line_exec(bContext *C, wmOperator *op) else copy_v3_v3(rgb, fp); - hist->data_r[i] = rgb[0]; - hist->data_g[i] = rgb[1]; - hist->data_b[i] = rgb[2]; - hist->data_luma[i] = rgb_to_luma(rgb); + hist->data_luma[i] = rgb_to_luma(rgb); + hist->data_r[i] = rgb[0]; + hist->data_g[i] = rgb[1]; + hist->data_b[i] = rgb[2]; + hist->data_a[i] = fp[3]; } else if (ibuf->rect) { cp = (unsigned char *)(ibuf->rect + y * ibuf->x + x); - hist->data_r[i] = (float)cp[0] / 255.0f; - hist->data_g[i] = (float)cp[1] / 255.0f; - hist->data_b[i] = (float)cp[2] / 255.0f; - hist->data_luma[i] = (float)rgb_to_luma_byte(cp) / 255.0f; + hist->data_luma[i] = (float)rgb_to_luma_byte(cp) / 255.0f; + hist->data_r[i] = (float)cp[0] / 255.0f; + hist->data_g[i] = (float)cp[1] / 255.0f; + hist->data_b[i] = (float)cp[2] / 255.0f; + hist->data_a[i] = (float)cp[3] / 255.0f; } } } |