mango request - add alpha to histogram & sample line.
[blender.git] / source / blender / editors / space_image / image_ops.c
index 5075147869d836fd564e88b2f262c6c992247788..97f3bd744dcdf92f034a0e8db1e75b20b05aa46c 100644 (file)
@@ -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;
                        }
                }
        }