rework android-rmt display, add a few buttons
[goodguy/history.git] / cinelerra-5.0 / cinelerra / maskauto.C
index 869a948754e9da568993e0e55dbface939eecc56..b332fc751f24f2766bfd55dc5513822030552dee 100644 (file)
@@ -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;
+               }
+       }
+}