couldn't find HOME environment variable to expand path
while executing
"file normalize $dir"
(procedure "cache" line 3)
invoked from within
"cache [file join ~ .critcl [platform::identify]]"
(procedure "setconfig" line 66)
invoked from within
"setconfig "" "
(procedure "readconfig" line 176)
invoked from within
"readconfig [file join $mydir Config]"
(procedure "::critcl::Initialize" line 39)
invoked from within
"::critcl::Initialize"
(file "/commun/linux/local/ActiveTcl-8.6.11/lib/tcl8.6/critcl3.1.17/critcl.tcl" line 5924)
invoked from within
"source /commun/linux/local/ActiveTcl-8.6.11/lib/tcl8.6/critcl3.1.17/critcl.tcl"
("package ifneeded critcl 3.1.17" script)
invoked from within
"package require critcl"
(in namespace eval "::request" script line 9)
invoked from within
"namespace eval ::request $script"
("::try" body line 12)
OUTPUT BUFFER:
# LRIPhoto.tcl
#
# Xavier Garreau , xavier@larochelle-innovation.com, Sep. 7 2005
# XG: Sep. 9 2005
# - added scalex and scaley args
#
package provide LRIPhoto 1.1
package require critcl
critcl::tk
switch $::tcl_platform(platform) {
windows {set platform "win"}
unix {set platform "unix"}
}
set tcl_prefix [file normalize [file join [pwd] tcl8.4.18]]
set tk_prefix [file normalize [file join [pwd] tk8.4.18]]
switch $::tcl_platform(platform) {
windows {
critcl::cheaders -I$tk_prefix/generic -I$tk_prefix/xlib -I$tk_prefix/$platform -I$tk_prefix -I$tcl_prefix/generic -I$tcl_prefix/$platform -I$tcl_prefix -I[pwd]
}
default {
# critcl::cheaders -I$tk_prefix/generic -I$tk_prefix/xlib -I$tk_prefix/$platform -I$tk_prefix -I$tcl_prefix/generic -I$tcl_prefix/$platform -I$tcl_prefix -I[pwd] -L/usr/lib64 -lX11
# critcl::clibraries -lX11 -L/usr/lib64
}
}
# Functions are stored in this file
::critcl::csources LRIPhoto.c
# put everything in LRI namespace
namespace eval LRI {
critcl::ccommand imgtransform {dummy interp objc objv} {
Tk_PhotoHandle destimg;
int scale=-1;
int scalex=-1;
int scaley=-1;
int angle=-1;
int bw = 0;
int gray = 0;
char* param;
int plength;
int err;
int i;
if (objc <= 3) {
Tcl_WrongNumArgs(interp, 1, objv, "image ?-scale %? ?-scalex %? ?-scaley %? ?-rotate angle? ?-gray bool? ?-bw bool?");
return TCL_ERROR;
}
destimg = Tk_FindPhoto (interp, Tcl_GetString(objv[1]));
if (!destimg) {
Tcl_WrongNumArgs(interp, 1, objv, "image ?-scale %? ?-scalex %? ?-scaley %? ?-rotate angle? ?-gray bool? ?-bw bool?");
return TCL_ERROR;
}
for (i=2; i=objc) {
Tcl_WrongNumArgs(interp, 1, objv, "image ?-scale %? ?-scalex %? ?-scaley %? ?-rotate angle? ?-gray bool? ?-bw bool?");
return TCL_ERROR;
} else {
++i;
if (0==strcmp(param, "-scale"))
err = Tcl_GetInt(interp, Tcl_GetString(objv[i]), &scale);
else if (0==strcmp(param, "-scalex"))
err = Tcl_GetInt(interp, Tcl_GetString(objv[i]), &scalex);
else if (0==strcmp(param, "-scaley"))
err = Tcl_GetInt(interp, Tcl_GetString(objv[i]), &scaley);
else if (0==strcmp(param, "-rotate"))
err = Tcl_GetInt(interp, Tcl_GetString(objv[i]), &angle);
else if (0==strcmp(param, "-bw"))
err = Tcl_GetBoolean(interp, Tcl_GetString(objv[i]), &bw);
else if (0==strcmp(param, "-gray"))
err = Tcl_GetBoolean(interp, Tcl_GetString(objv[i]), &gray);
else {
Tcl_WrongNumArgs(interp, 1, objv, "image ?-scale %? ?-scalex %? ?-scaley %? ?-rotate angle? ?-gray bool? ?-bw bool?");
return TCL_ERROR;
}
if (TCL_OK != err ) return TCL_ERROR;
}
}
if (scalex>0 && scaley==-1) scaley=100;
if (scaley>0 && scalex==-1) scalex=100;
if (scalex>0 && scaley>0 && (scalex!=100 || scaley!=100)) {
if (TCL_OK != LRI_scaleXYTkImg (destimg, scalex, scaley)) return TCL_ERROR;
} else if (scale>0 && scale<100) {
if (TCL_OK != LRI_scaleTkImg (destimg, scale)) return TCL_ERROR;
}
if ((angle == 90) || (angle == 180) || (angle == 270)) {
if (TCL_OK != LRI_rotateTkImg (destimg, angle)) return TCL_ERROR;
}
if (scale>0 && scale>100 && scaley==-1 && scalex==-1) {
if (TCL_OK != LRI_scaleTkImg (destimg, scale)) return TCL_ERROR;
}
if (bw) {
LRI_BWTkImg(destimg);
} else if (gray) {
LRI_grayTkImg (destimg);
}
return TCL_OK;
}
critcl::ccommand imgcopy {dummy interp objc objv} {
Tk_PhotoHandle destimg, srcimg;
Tk_PhotoImageBlock imgblock;
int scale=-1;
int scalex=-1;
int scaley=-1;
int angle=-1;
int bw = 0;
int gray = 0;
char* param;
int plength;
int err;
int i;
if (objc < 3) {
Tcl_WrongNumArgs(interp, 1, objv, "src_image dest_image ?-scale %? ?-scalex %? ?-scaley %? ?-rotate angle? ?-gray bool? ?-bw bool?");
return TCL_ERROR;
}
srcimg = Tk_FindPhoto (interp, Tcl_GetString(objv[1]));
if (!srcimg) {
Tcl_WrongNumArgs(interp, 1, objv, "src_image dest_image ?-scale %? ?-scalex %? ?-scaley %? ?-rotate angle? ?-gray bool? ?-bw bool?");
return TCL_ERROR;
}
destimg = Tk_FindPhoto (interp, Tcl_GetString(objv[2]));
if (!destimg) {
Tcl_WrongNumArgs(interp, 1, objv, "src_image dest_image ?-scale %? ?-scalex %? ?-scaley %? ?-rotate angle? ?-gray bool? ?-bw bool?");
return TCL_ERROR;
}
/* retieve command params */
for (i=3; i=objc) {
Tcl_WrongNumArgs(interp, 1, objv, "src_image dest_image ?-scale %? ?-scalex %? ?-scaley %? ?-rotate angle? ?-gray bool? ?-bw bool?");
return TCL_ERROR;
} else {
++i;
if (0==strcmp(param, "-scale"))
err = Tcl_GetInt(interp, Tcl_GetString(objv[i]), &scale);
else if (0==strcmp(param, "-scalex"))
err = Tcl_GetInt(interp, Tcl_GetString(objv[i]), &scalex);
else if (0==strcmp(param, "-scaley"))
err = Tcl_GetInt(interp, Tcl_GetString(objv[i]), &scaley);
else if (0==strcmp(param, "-rotate"))
err = Tcl_GetInt(interp, Tcl_GetString(objv[i]), &angle);
else if (0==strcmp(param, "-bw"))
err = Tcl_GetBoolean(interp, Tcl_GetString(objv[i]), &bw);
else if (0==strcmp(param, "-gray"))
err = Tcl_GetBoolean(interp, Tcl_GetString(objv[i]), &gray);
else {
Tcl_WrongNumArgs(interp, 1, objv, "src_image dest_image ?-scale %? ?-scalex %? ?-scaley %? ?-rotate angle? ?-gray bool? ?-bw bool?");
return TCL_ERROR;
}
if (TCL_OK != err ) return TCL_ERROR;
}
}
/* Photo copy */
Tk_PhotoGetImage(srcimg, &imgblock);
Tk_PhotoSetSize(destimg, imgblock.width, imgblock.height);
Tk_PhotoPutBlock (destimg, &imgblock, 0, 0, imgblock.width, imgblock.height, TK_PHOTO_COMPOSITE_SET);
/* do the job */
if (scalex>0 && scaley==-1) scaley=100;
if (scaley>0 && scalex==-1) scalex=100;
if (scalex>0 && scaley>0 && (scalex!=100 || scaley!=100)) {
if (TCL_OK != LRI_scaleXYTkImg (destimg, scalex, scaley)) return TCL_ERROR;
} else if (scale>0 && scale<100) {
if (TCL_OK != LRI_scaleTkImg (destimg, scale)) return TCL_ERROR;
}
if ((angle == 90) || (angle == 180) || (angle == 270)) {
if (TCL_OK != LRI_rotateTkImg (destimg, angle)) return TCL_ERROR;
}
if (scale>0 && scale>100) {
if (TCL_OK != LRI_scaleTkImg (destimg, scale)) return TCL_ERROR;
}
if (bw) {
LRI_BWTkImg(destimg);
} else if (gray) {
LRI_grayTkImg (destimg);
}
return TCL_OK;
}
}