mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 22:02:49 -06:00
[GH-ISSUE #66] ImageOp.cpp -> FlipImage #39
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/ultimatepp#39
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @lcineyes on GitHub (Mar 17, 2022).
Original GitHub issue: https://github.com/ultimatepp/ultimatepp/issues/66
Sorry, My English is very poor.
//ImageOp.cpp -> FlipImage
Image FlipImage(const Image& m, int mode)
{
return decode(mode,
FLIP_MIRROR_HORZ, MirrorHorz(m),
FLIP_ROTATE_180, Rotate180(m),
FLIP_MIRROR_VERT, MirrorVert(m),
FLIP_TRANSPOSE, Transpose(m),
FLIP_ROTATE_CLOCKWISE, RotateClockwise(m),
FLIP_TRANSVERSE, Transverse(m),
FLIP_ROTATE_ANTICLOCKWISE, RotateAntiClockwise(m),
m);
}
//Fh.h
template <class T, class V>
constexpr const V& decode(const T& sel, const V& def)
{
return def;
}
template <class T, class K, class V, typename... L>
constexpr V decode(const T& sel, const K& k, const V& v, const L& ...args)
{
return sel == k ? v : (V)decode(sel, args...);
}
In the FlipImage funciton, each conversion function is executed once before the mode hit.
@kov-serg commented on GitHub (Mar 18, 2022):
Yes of course. To RotateAntiClockwise it calls all previous transformations and trash them.
I wounder why not to use simple switch instead this crutches?