in cpp/spectrum/requirements/CropAbsoluteToOrigin.cpp [47:80]
CropAbsoluteToOrigin::Values CropAbsoluteToOrigin::Values::rotate(
const Rotate& rotateRequirement,
const image::Size& size) const {
SPECTRUM_ERROR_STRING_IF(
rotateRequirement.flip() || rotateRequirement.forceUpOrientation,
error::CropCannotRotateWithRequirement,
rotateRequirement.string());
switch (rotateRequirement.sanitisedDegrees()) {
case 0:
return *this;
case 90:
return {
.top = left,
.left = size.height - bottom,
.bottom = right,
.right = size.height - top};
case 180:
return {
.top = size.height - bottom,
.left = size.width - right,
.bottom = size.height - top,
.right = size.width - left};
case 270:
return {
.top = size.width - right,
.left = top,
.bottom = size.width - left,
.right = bottom};
default:
SPECTRUM_ERROR_STRING(
error::CropCannotRotateWithRequirement, rotateRequirement.string());
}
}