flip, cw, ccw

This commit is contained in:
David Rose 2012-11-28 20:22:56 +00:00
parent b309198210
commit 93743e250d
2 changed files with 34 additions and 0 deletions

View File

@ -43,6 +43,26 @@ ImageTrans() : ImageFilter(true) {
"Apply the indicated color scale to each pixel of the image.",
&ImageTrans::dispatch_color, &_has_color_scale, &_color_scale);
add_option
("flip", "", 50,
"Flip the image vertically.",
&ImageTrans::dispatch_none, &_flip);
add_option
("mirror", "", 50,
"Reverse the image horizontally.",
&ImageTrans::dispatch_none, &_mirror);
add_option
("cw", "", 50,
"Rotate the image 90 degrees clockwise.",
&ImageTrans::dispatch_none, &_cw);
add_option
("ccw", "", 50,
"Rotate the image 90 degrees counter-clockwise.",
&ImageTrans::dispatch_none, &_ccw);
_channels = C_default;
_color_scale.set(1.0f, 1.0f, 1.0f, 1.0f);
}
@ -109,6 +129,19 @@ run() {
}
}
bool transpose = false;
if (_cw) {
_flip = !_flip;
transpose = !transpose;
}
if (_ccw) {
_mirror = !_mirror;
transpose = !transpose;
}
if (_flip || _mirror || transpose) {
_image.flip(_mirror, _flip, transpose);
}
write_image();
}

View File

@ -50,6 +50,7 @@ private:
Channels _channels;
LColor _color_scale;
bool _has_color_scale;
bool _flip, _mirror, _cw, _ccw;
};
#endif