/usr/share/nip2/compat/7.8/Rotate.def is in nip2 7.28.4-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | /* rotate images and matricies by fixed angles
*/
Rotate_fixed = class {
/* rotate image clockwise in 90 degree increments
*/
_rotate_widget default a
= map_unary widget a
{
widget image = class
Image value {
_check_args = [
[image, "image", check_Image]
] ++ super._check_args;
_vislevel = 3;
angle = Option "Rotate by" [
"Don't rotate",
"90 degrees clockwise",
"180 degrees",
"90 degrees anticlockwise"
] default;
value = [
image.value,
rot90 image.value,
rot180 image.value,
rot270 image.value
] ? angle;
}
}
/* clockwise rotate by 90 degrees
*/
R90 x = _rotate_widget 1 x;
/* rotate by 180 degrees
*/
R180 x = _rotate_widget 2 x;
/* clockwise rotate by 270 degrees
*/
R270 x = _rotate_widget 3 x;
/* rotate by 45 degrees ... square, odd-length-sides, matrices only
*/
R45 x = map_unary rot45 x;
}
/* rotate image anticlockwise by any angle
*/
Rotate_free a
= map_unary widget a
{
widget image = class
Image value {
_check_args = [
[image, "image", check_Image]
] ++ super._check_args;
_vislevel = 3;
angle = Slider 0 360 0;
value = rotate angle image.value;
}
}
#separator
/* mirror left/right or up/down
*/
Flip = class {
/* mirror object up/down
*/
Up_down x = map_unary flipud x;
/* mirror object left/right
*/
Left_right x = map_unary fliplr x;
}
/* swap rows and columns
*/
Transpose x = map_unary transpose x;
#separator
/* smallest rotate that gets arrow vertical or horizontal
*/
Straighten_arrow x
= map_unary straighten x
{
straighten arrow
= rotate angle'' arrow.image
{
x = arrow.width;
y = arrow.height;
angle = im (polar (x, y));
angle'
= angle - 360, angle > 315
= angle - 180, angle > 135
= angle;
angle''
= -angle', angle' >= (-45) && angle' < 45
= 90 - angle';
}
}
|