summaryrefslogtreecommitdiffstats
path: root/generic/tkCanvImg.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2019-05-10 08:04:39 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2019-05-10 08:04:39 (GMT)
commitebee84d3759fbe688f9a527facf83e5dc30ae5a0 (patch)
tree9b196dabbce4109b631ce7307b57a7e821113912 /generic/tkCanvImg.c
parent2cf64c85fc09764112c6d2daa54f22c9b2c3b549 (diff)
parent50b390e8c37fc97708f980d5cdd9fb5480b64e4c (diff)
downloadtk-ebee84d3759fbe688f9a527facf83e5dc30ae5a0.zip
tk-ebee84d3759fbe688f9a527facf83e5dc30ae5a0.tar.gz
tk-ebee84d3759fbe688f9a527facf83e5dc30ae5a0.tar.bz2
Merge trunk
Diffstat (limited to 'generic/tkCanvImg.c')
-rw-r--r--generic/tkCanvImg.c39
1 files changed, 38 insertions, 1 deletions
diff --git a/generic/tkCanvImg.c b/generic/tkCanvImg.c
index 76b3689..19e1c70 100644
--- a/generic/tkCanvImg.c
+++ b/generic/tkCanvImg.c
@@ -94,6 +94,8 @@ static void DeleteImage(Tk_Canvas canvas,
static void DisplayImage(Tk_Canvas canvas,
Tk_Item *itemPtr, Display *display, Drawable dst,
int x, int y, int width, int height);
+static void RotateImage(Tk_Canvas canvas, Tk_Item *itemPtr,
+ double originX, double originY, double angleRad);
static void ScaleImage(Tk_Canvas canvas,
Tk_Item *itemPtr, double originX, double originY,
double scaleX, double scaleY);
@@ -126,7 +128,8 @@ Tk_ItemType tkImageType = {
NULL, /* insertProc */
NULL, /* dTextProc */
NULL, /* nextPtr */
- NULL, 0, NULL, NULL
+ RotateImage, /* rotateProc */
+ 0, NULL, NULL
};
/*
@@ -761,6 +764,40 @@ ImageToPostscript(
/*
*--------------------------------------------------------------
*
+ * RotateImage --
+ *
+ * This function is called to rotate an image's origin by a given amount.
+ * This does *not* rotate the contents of the image.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The position of the image anchor is rotated by angleRad radians about
+ * (originX, originY), and the bounding box is updated in the generic
+ * part of the item structure.
+ *
+ *--------------------------------------------------------------
+ */
+
+static void
+RotateImage(
+ Tk_Canvas canvas,
+ Tk_Item *itemPtr,
+ double originX,
+ double originY,
+ double angleRad)
+{
+ ImageItem *imgPtr = (ImageItem *) itemPtr;
+
+ TkRotatePoint(originX, originY, sin(angleRad), cos(angleRad),
+ &imgPtr->x, &imgPtr->y);
+ ComputeImageBbox(canvas, imgPtr);
+}
+
+/*
+ *--------------------------------------------------------------
+ *
* ScaleImage --
*
* This function is invoked to rescale an item.