diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-05-10 08:04:39 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-05-10 08:04:39 (GMT) |
commit | ebee84d3759fbe688f9a527facf83e5dc30ae5a0 (patch) | |
tree | 9b196dabbce4109b631ce7307b57a7e821113912 /generic/tkCanvWind.c | |
parent | 2cf64c85fc09764112c6d2daa54f22c9b2c3b549 (diff) | |
parent | 50b390e8c37fc97708f980d5cdd9fb5480b64e4c (diff) | |
download | tk-ebee84d3759fbe688f9a527facf83e5dc30ae5a0.zip tk-ebee84d3759fbe688f9a527facf83e5dc30ae5a0.tar.gz tk-ebee84d3759fbe688f9a527facf83e5dc30ae5a0.tar.bz2 |
Merge trunk
Diffstat (limited to 'generic/tkCanvWind.c')
-rw-r--r-- | generic/tkCanvWind.c | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/generic/tkCanvWind.c b/generic/tkCanvWind.c index a57d428..59e81af 100644 --- a/generic/tkCanvWind.c +++ b/generic/tkCanvWind.c @@ -77,6 +77,8 @@ static void DeleteWinItem(Tk_Canvas canvas, static void DisplayWinItem(Tk_Canvas canvas, Tk_Item *itemPtr, Display *display, Drawable dst, int x, int y, int width, int height); +static void RotateWinItem(Tk_Canvas canvas, Tk_Item *itemPtr, + double originX, double originY, double angleRad); static void ScaleWinItem(Tk_Canvas canvas, Tk_Item *itemPtr, double originX, double originY, double scaleX, double scaleY); @@ -130,7 +132,8 @@ Tk_ItemType tkWindowType = { NULL, /* insertProc */ NULL, /* dTextProc */ NULL, /* nextPtr */ - NULL, 0, NULL, NULL + RotateWinItem, /* rotateProc */ + 0, NULL, NULL }; /* @@ -915,6 +918,40 @@ CanvasPsWindow( /* *-------------------------------------------------------------- * + * RotateWinItem -- + * + * This function is called to rotate a window item by a given amount + * about a point. Note that this does *not* rotate the window of the + * item. + * + * Results: + * None. + * + * Side effects: + * The position of the window anchor is rotated by angleRad about (originX, + * originY), and the bounding box is updated in the generic part of the + * item structure. + * + *-------------------------------------------------------------- + */ + +static void +RotateWinItem( + Tk_Canvas canvas, /* Canvas containing item. */ + Tk_Item *itemPtr, /* Item that is being rotated. */ + double originX, double originY, + double angleRad) /* Amount by which item is to be rotated. */ +{ + WindowItem *winItemPtr = (WindowItem *) itemPtr; + + TkRotatePoint(originX, originY, sin(angleRad), cos(angleRad), + &winItemPtr->x, &winItemPtr->y); + ComputeWindowBbox(canvas, winItemPtr); +} + +/* + *-------------------------------------------------------------- + * * ScaleWinItem -- * * This function is invoked to rescale a window item. |