Skip to content

Commit

Permalink
fix documentation about rotation direction. (#1062)
Browse files Browse the repository at this point in the history
as of the current implementation, positive numbers rotate counter-clockwise while negative numbers rotate clockwise.
changing the implementation would be a breaking change, so fixing the documentation probably is the better way.

refs #631
  • Loading branch information
fabb authored Feb 4, 2023
1 parent de36d7c commit 75284b2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/jimp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ image.convolute( kernel ); // applies a convolution kernel matrix to the
/* Flip and rotate */
image.flip( horz, vert ); // flip the image horizontally or vertically
image.mirror( horz, vert ); // an alias for flip
image.rotate( deg[, mode] ); // rotate the image clockwise by a number of degrees. Optionally, a resize mode can be passed. If `false` is passed as the second parameter, the image width and height will not be resized.
image.rotate( deg[, mode] ); // rotate the image counter-clockwise by a number of degrees. Optionally, a resize mode can be passed. If `false` is passed as the second parameter, the image width and height will not be resized.

/* Colour */
image.brightness( val ); // adjust the brighness by a value -1 to +1
Expand Down
4 changes: 2 additions & 2 deletions packages/plugin-rotate/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
<p>Rotate an image.</p>
</div>

Rotates the image clockwise by a number of degrees. By default the width and height of the image will be resized appropriately.
Rotates the image counter-clockwise by a number of degrees. By default the width and height of the image will be resized appropriately.

## Usage

- @param {number} deg the number of degrees to rotate the image by
- @param {number} deg the number of degrees to rotate the image by, counter-clockwise
- @param {string|boolean} mode (optional) resize mode or a boolean, if false then the width and height of the image will not be changed
- @param {function(Error, Jimp)} cb (optional) a callback for when complete

Expand Down
4 changes: 2 additions & 2 deletions packages/plugin-rotate/src/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { throwError, isNodePattern } from "@jimp/utils";

/**
* Rotates an image clockwise by an arbitrary number of degrees. NB: 'this' must be a Jimp object.
* Rotates an image counter-clockwise by an arbitrary number of degrees. NB: 'this' must be a Jimp object.
* @param {number} deg the number of degrees to rotate the image by
* @param {string|boolean} mode (optional) resize mode or a boolean, if false then the width and height of the image will not be changed
*/
Expand Down Expand Up @@ -112,7 +112,7 @@ function advancedRotate(deg, mode) {

export default () => ({
/**
* Rotates the image clockwise by a number of degrees. By default the width and height of the image will be resized appropriately.
* Rotates the image counter-clockwise by a number of degrees. By default the width and height of the image will be resized appropriately.
* @param {number} deg the number of degrees to rotate the image by
* @param {string|boolean} mode (optional) resize mode or a boolean, if false then the width and height of the image will not be changed
* @param {function(Error, Jimp)} cb (optional) a callback for when complete
Expand Down

0 comments on commit 75284b2

Please sign in to comment.