Scale a source size to a target size (given a specific scale-type)
| 1427 | |
| 1428 | // Scale a source size to a target size (given a specific scale-type) |
| 1429 | QSize Clip::scale_size(QSize source_size, ScaleType source_scale, int target_width, int target_height) { |
| 1430 | switch (source_scale) |
| 1431 | { |
| 1432 | case (SCALE_FIT): { |
| 1433 | source_size.scale(target_width, target_height, Qt::KeepAspectRatio); |
| 1434 | break; |
| 1435 | } |
| 1436 | case (SCALE_STRETCH): { |
| 1437 | source_size.scale(target_width, target_height, Qt::IgnoreAspectRatio); |
| 1438 | break; |
| 1439 | } |
| 1440 | case (SCALE_CROP): { |
| 1441 | source_size.scale(target_width, target_height, Qt::KeepAspectRatioByExpanding);; |
| 1442 | break; |
| 1443 | } |
| 1444 | } |
| 1445 | |
| 1446 | return source_size; |
| 1447 | } |
| 1448 | |
| 1449 | // Get QTransform from keyframes |
| 1450 | QTransform Clip::get_transform(std::shared_ptr<Frame> frame, int width, int height) |