29 for (
auto effect : clip->
Effects()) {
30 if (
auto crop_effect =
dynamic_cast<Crop*
>(effect)) {
31 if (crop_effect->resize) {
51 const float visible_width = std::max(0.01f, 1.0f - max_left - max_right);
52 const float visible_height = std::max(0.01f, 1.0f - max_top - max_bottom);
54 const double scaled_width = std::ceil(max_width / visible_width);
55 const double scaled_height = std::ceil(max_height / visible_height);
57 const double clamped_width = std::min<double>(source_width, scaled_width);
58 const double clamped_height = std::min<double>(source_height, scaled_height);
60 max_width =
static_cast<int>(std::min<double>(std::numeric_limits<int>::max(), clamped_width));
61 max_height =
static_cast<int>(std::min<double>(std::numeric_limits<int>::max(), clamped_height));
Shared helpers for Crop effect scaling logic.
Header file for Crop effect class.
This class represents a clip (used to arrange readers on the timeline)
std::list< openshot::EffectBase * > Effects()
Return the list of effects on the timeline.
double Y
The Y value of the coordinate (usually representing the value of the property being animated)
This class crops a frame image (from any side), and can be animated with openshot::Keyframe curves ov...
Keyframe right
Size of right bar.
Keyframe left
Size of left bar.
Keyframe bottom
Size of bottom bar.
Keyframe top
Size of top bar.
Point GetMaxPoint() const
Get max point (by Y coordinate)
Coordinate co
This is the primary coordinate.
This namespace is the default namespace for all code in the openshot library.
const Crop * FindResizingCropEffect(Clip *clip)
Return the first Crop effect on this clip that has resize enabled (if any)
void ApplyCropResizeScale(Clip *clip, int source_width, int source_height, int &max_width, int &max_height)
Scale the requested max_width / max_height based on the Crop resize amount, capped by source size.