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>2012-07-12 00:18:46 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-07-12 00:18:46 +0400
commit83d2314edfe2c123c3151884a66c5a6ba2d849f6 (patch)
tree893a64f9a4add033cf0bdab7adeefcb19a687ada
parentb63b8ea69df1eff52d9a4cc8c4b320c1bc3f63b8 (diff)
ability to calculate mask curve and feather with predefined resolution (*_ex functions)
-rw-r--r--source/blender/blenkernel/BKE_mask.h5
-rw-r--r--source/blender/blenkernel/intern/mask.c28
2 files changed, 25 insertions, 8 deletions
diff --git a/source/blender/blenkernel/BKE_mask.h b/source/blender/blenkernel/BKE_mask.h
index 936628bf0e7..384bc327a81 100644
--- a/source/blender/blenkernel/BKE_mask.h
+++ b/source/blender/blenkernel/BKE_mask.h
@@ -67,9 +67,10 @@ struct MaskSpline *BKE_mask_spline_add(struct MaskLayer *masklay);
float (*BKE_mask_spline_differentiate(struct MaskSpline *spline, int *tot_diff_point))[2];
float (*BKE_mask_spline_feather_differentiated_points(struct MaskSpline *spline, int *tot_feather_point))[2];
+float (*BKE_mask_spline_differentiate_with_resolution_ex(struct MaskSpline *spline, const int resol, int *tot_diff_point))[2];
float (*BKE_mask_spline_differentiate_with_resolution(struct MaskSpline *spline, int width, int height, int *tot_diff_point))[2];
-float (*BKE_mask_spline_feather_differentiated_points_with_resolution(struct MaskSpline *spline,
- int width, int height, int *tot_feather_point))[2];
+float (*BKE_mask_spline_feather_differentiated_points_with_resolution_ex(struct MaskSpline *spline, const int resol, int *tot_feather_point))[2];
+float (*BKE_mask_spline_feather_differentiated_points_with_resolution(struct MaskSpline *spline, int width, int height, int *tot_feather_point))[2];
float (*BKE_mask_spline_feather_points(struct MaskSpline *spline, int *tot_feather_point))[2];
diff --git a/source/blender/blenkernel/intern/mask.c b/source/blender/blenkernel/intern/mask.c
index 6f6f15955cd..ea152e4c188 100644
--- a/source/blender/blenkernel/intern/mask.c
+++ b/source/blender/blenkernel/intern/mask.c
@@ -314,14 +314,14 @@ static int BKE_mask_spline_feather_resolution(MaskSpline *spline, int width, int
return resol;
}
-float (*BKE_mask_spline_differentiate_with_resolution(MaskSpline *spline, int width, int height,
- int *tot_diff_point))[2]
+float (*BKE_mask_spline_differentiate_with_resolution_ex(MaskSpline *spline, const int resol,
+ int *tot_diff_point))[2]
{
MaskSplinePoint *points_array = BKE_mask_spline_point_array(spline);
MaskSplinePoint *point, *prev;
float (*diff_points)[2], (*fp)[2];
- int a, len, resol = BKE_mask_spline_resolution(spline, width, height);
+ int a, len;
if (spline->tot_point <= 1) {
/* nothing to differentiate */
@@ -378,18 +378,26 @@ float (*BKE_mask_spline_differentiate_with_resolution(MaskSpline *spline, int wi
return diff_points;
}
+float (*BKE_mask_spline_differentiate_with_resolution(MaskSpline *spline, int width, int height,
+ int *tot_diff_point))[2]
+{
+ int resol = BKE_mask_spline_resolution(spline, width, height);
+
+ return BKE_mask_spline_differentiate_with_resolution_ex(spline, resol, tot_diff_point);
+}
+
float (*BKE_mask_spline_differentiate(MaskSpline *spline, int *tot_diff_point))[2]
{
return BKE_mask_spline_differentiate_with_resolution(spline, 0, 0, tot_diff_point);
}
-float (*BKE_mask_spline_feather_differentiated_points_with_resolution(MaskSpline *spline, int width, int height,
- int *tot_feather_point))[2]
+float (*BKE_mask_spline_feather_differentiated_points_with_resolution_ex(MaskSpline *spline, const int resol,
+ int *tot_feather_point))[2]
{
MaskSplinePoint *points_array = BKE_mask_spline_point_array(spline);
float (*feather)[2], (*fp)[2];
- int i, j, tot, resol = BKE_mask_spline_feather_resolution(spline, width, height);
+ int i, j, tot;
tot = resol * spline->tot_point;
feather = fp = MEM_mallocN(tot * sizeof(*feather), "mask spline feather diff points");
@@ -416,6 +424,14 @@ float (*BKE_mask_spline_feather_differentiated_points_with_resolution(MaskSpline
return feather;
}
+float (*BKE_mask_spline_feather_differentiated_points_with_resolution(MaskSpline *spline, int width, int height,
+ int *tot_feather_point))[2]
+{
+ int resol = BKE_mask_spline_feather_resolution(spline, width, height);
+
+ return BKE_mask_spline_feather_differentiated_points_with_resolution_ex(spline, resol, tot_feather_point);
+}
+
float (*BKE_mask_spline_feather_differentiated_points(MaskSpline *spline, int *tot_feather_point))[2]
{
return BKE_mask_spline_feather_differentiated_points_with_resolution(spline, 0, 0, tot_feather_point);