diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2019-03-13 19:16:12 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2019-03-13 19:16:12 (GMT) |
commit | 913c2ffec66a261d7cea357c21cdcda60132c0a5 (patch) | |
tree | 50834dfff8ea8a4494f981b6559bbfa604ee7707 /generic/tkCanvImg.c | |
parent | 87a95ec0329c9fd676ed4a5d9d10247eb245a4ec (diff) | |
download | tk-913c2ffec66a261d7cea357c21cdcda60132c0a5.zip tk-913c2ffec66a261d7cea357c21cdcda60132c0a5.tar.gz tk-913c2ffec66a261d7cea357c21cdcda60132c0a5.tar.bz2 |
Document. Factor out basic rotation function.
Diffstat (limited to 'generic/tkCanvImg.c')
-rw-r--r-- | generic/tkCanvImg.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/generic/tkCanvImg.c b/generic/tkCanvImg.c index 20fcd52..f2b73a6 100644 --- a/generic/tkCanvImg.c +++ b/generic/tkCanvImg.c @@ -789,16 +789,9 @@ RotateImage( double angleRad) { ImageItem *imgPtr = (ImageItem *) itemPtr; - double x, y, nx, ny; - double s = sin(angleRad); - double c = cos(angleRad); - - x = imgPtr->x - originX; - y = imgPtr->y - originY; - nx = x * c - y * s; - ny = x * s + y * c; - imgPtr->x = nx + originX; - imgPtr->y = ny + originY; + + TkRotatePoint(originX, originY, sin(angleRad), cos(angleRad), + &imgPtr->x, &imgPtr->y); ComputeImageBbox(canvas, imgPtr); } |