mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 02:42:49 -04:00
flip, cw, ccw
This commit is contained in:
parent
b309198210
commit
93743e250d
@ -43,6 +43,26 @@ ImageTrans() : ImageFilter(true) {
|
|||||||
"Apply the indicated color scale to each pixel of the image.",
|
"Apply the indicated color scale to each pixel of the image.",
|
||||||
&ImageTrans::dispatch_color, &_has_color_scale, &_color_scale);
|
&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;
|
_channels = C_default;
|
||||||
_color_scale.set(1.0f, 1.0f, 1.0f, 1.0f);
|
_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();
|
write_image();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,6 +50,7 @@ private:
|
|||||||
Channels _channels;
|
Channels _channels;
|
||||||
LColor _color_scale;
|
LColor _color_scale;
|
||||||
bool _has_color_scale;
|
bool _has_color_scale;
|
||||||
|
bool _flip, _mirror, _cw, _ccw;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user