summaryrefslogtreecommitdiffstats
path: root/generic/tkTest.c
diff options
context:
space:
mode:
authorsimonbachmann <simonbachmann@bluewin.ch>2017-03-23 19:12:40 (GMT)
committersimonbachmann <simonbachmann@bluewin.ch>2017-03-23 19:12:40 (GMT)
commit5234049f9b7cab7c95ba9fc0ddaea86a860cc5ac (patch)
treec64f106f39315963c9d40a6adaf7327b7c310394 /generic/tkTest.c
parentba477221d7bc5c8035b9c2ef056f00e2ec72be81 (diff)
downloadtk-5234049f9b7cab7c95ba9fc0ddaea86a860cc5ac.zip
tk-5234049f9b7cab7c95ba9fc0ddaea86a860cc5ac.tar.gz
tk-5234049f9b7cab7c95ba9fc0ddaea86a860cc5ac.tar.bz2
Added -withalpha option to [imageName get].
The list-of-lists-of-pixel-data format now is a registered format as the others. Thanks to this change, [imageName data] now can return data that includes the alpha channel. Changed the position of the '-alpha' and '-boolean' options to [imageName transparency set]. Updated doc Updated test suite
Diffstat (limited to 'generic/tkTest.c')
-rw-r--r--generic/tkTest.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/generic/tkTest.c b/generic/tkTest.c
index 1f801be..bd7b948 100644
--- a/generic/tkTest.c
+++ b/generic/tkTest.c
@@ -203,6 +203,9 @@ static int TrivialConfigObjCmd(ClientData dummy,
Tcl_Obj * const objv[]);
static void TrivialEventProc(ClientData clientData,
XEvent *eventPtr);
+static int TestPhotoStringMatchCmd(ClientData dummy,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj * const objv[]);
/*
*----------------------------------------------------------------------
@@ -265,6 +268,9 @@ Tktest_Init(
(ClientData) Tk_MainWindow(interp), NULL);
Tcl_CreateObjCommand(interp, "testtext", TkpTesttextCmd,
(ClientData) Tk_MainWindow(interp), NULL);
+ Tcl_CreateObjCommand(interp, "testphotostringmatch",
+ TestPhotoStringMatchCmd, (ClientData) Tk_MainWindow(interp),
+ NULL);
#if defined(_WIN32) || defined(MAC_OSX_TK)
Tcl_CreateObjCommand(interp, "testmetrics", TestmetricsObjCmd,
@@ -2066,6 +2072,54 @@ CustomOptionFree(
ckfree(*(char **)internalPtr);
}
}
+/*
+ *----------------------------------------------------------------------
+ *
+ * TestPhotoStringMatchCmd --
+ *
+ * This function implements the "testphotostringmatch" command. It
+ * provides a way from Tcl to call the string match function for the
+ * default image handler directly.
+ *
+ * Results:
+ * A standard Tcl result. If data is in the proper format, the result in
+ * interp will contain width and height as a list. If the data cannot be
+ * parsed as default image format, returns TCL_ERROR and leaves an
+ * appropriate error message in interp.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+ /* ARGSUSED */
+static int
+TestPhotoStringMatchCmd(
+ ClientData clientData, /* Main window for application. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *const objv[]) /* Argument strings. */
+{
+ Tcl_Obj *dummy = NULL;
+ Tcl_Obj *resultObj[2];
+ int width, height;
+
+ if (objc != 2) {
+ Tcl_WrongNumArgs(interp, 1, objv, "imageData");
+ return TCL_ERROR;
+ }
+ if (TkDebugPhotoStringMatchDef(interp, objv[1], dummy, &width, &height)) {
+ resultObj[0] = Tcl_NewIntObj(width);
+ resultObj[1] = Tcl_NewIntObj(height);
+ Tcl_SetObjResult(interp, Tcl_NewListObj(2, resultObj));
+ return TCL_OK;
+ } else {
+ return TCL_ERROR;
+ }
+}
+
+
/*
* Local Variables: