--User changes

-Add two new options --width and --height to EmberRender and EmberAnimate to allow the user to specify absolute dimensions to render the image at.
This commit is contained in:
Person
2022-03-15 17:49:48 -06:00
parent 94c3e6bed3
commit bf706ac705
3 changed files with 42 additions and 4 deletions

View File

@ -262,6 +262,21 @@ bool EmberAnimate(int argc, _TCHAR* argv[], EmberOptions& opt)
const auto h = std::max<size_t>(size_t(ember.m_OrigFinalRasH * opt.HeightScale()), 10);
ember.SetSizeAndAdjustScale(w, h, false, scaleType);
}
else if (opt.Width() || opt.Height())
{
auto scaleType = eScaleType::SCALE_NONE;
if (ToLower(opt.ScaleType()) == "width")
scaleType = eScaleType::SCALE_WIDTH;
else if (ToLower(opt.ScaleType()) == "height")
scaleType = eScaleType::SCALE_HEIGHT;
else if (ToLower(opt.ScaleType()) != "none")
cout << "Scale type must be width height or none. Setting to none.\n";
auto w = opt.Width() ? opt.Width() : ember.m_OrigFinalRasW;
auto h = opt.Height() ? opt.Height() : ember.m_OrigFinalRasH;
ember.SetSizeAndAdjustScale(w, h, false, scaleType);
}
//Cast to double in case the value exceeds 2^32.
const auto imageMem = 4 * static_cast<double>(ember.m_FinalRasW)