X-Git-Url: http://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.0%2Fcinelerra%2Fmaskauto.C;h=b332fc751f24f2766bfd55dc5513822030552dee;hb=c0b71a7151437c681fe832d1e446924a49ab29aa;hp=869a948754e9da568993e0e55dbface939eecc56;hpb=2d99bb8ce591f05a31464b517d85dc2bc35b2abe;p=goodguy%2Fhistory.git diff --git a/cinelerra-5.0/cinelerra/maskauto.C b/cinelerra-5.0/cinelerra/maskauto.C index 869a9487..b332fc75 100644 --- a/cinelerra-5.0/cinelerra/maskauto.C +++ b/cinelerra-5.0/cinelerra/maskauto.C @@ -427,5 +427,29 @@ void MaskAuto::translate_submasks(float translate_x, float translate_y) } } +void MaskAuto::scale_submasks(int orig_scale, int new_scale) +{ + for(int i = 0; i < masks.size(); i++) + { + SubMask *mask = get_submask(i); + for (int j = 0; j < mask->points.total; j++) + { + float orig_x = mask->points.values[j]->x * orig_scale; + float orig_y = mask->points.values[j]->y * orig_scale; + mask->points.values[j]->x = orig_x / new_scale; + mask->points.values[j]->y = orig_y / new_scale; + + orig_x = mask->points.values[j]->control_x1 * orig_scale; + orig_y = mask->points.values[j]->control_y1 * orig_scale; + mask->points.values[j]->control_x1 = orig_x / new_scale; + mask->points.values[j]->control_y1 = orig_y / new_scale; + + orig_x = mask->points.values[j]->control_x2 * orig_scale; + orig_y = mask->points.values[j]->control_y2 * orig_scale; + mask->points.values[j]->control_x2 = orig_x / new_scale; + mask->points.values[j]->control_y2 = orig_y / new_scale; + } + } +}