Tk
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
pTk/mTk/generic/tkImgPhoto.c view on Meta::CPAN
/*
* Scan through the table of file format handlers to find
* one which can handle the image.
*/
matched = 0;
for (formatPtr = tsdPtr->formatList; formatPtr != NULL;
formatPtr = formatPtr->nextPtr) {
if (formatObj != NULL) {
if (strncasecmp(formatString,
formatPtr->name, strlen(formatPtr->name)) != 0) {
continue;
}
matched = 1;
if (formatPtr->stringMatchProc == NULL) {
Tcl_AppendResult(interp, "-data option isn't supported for ",
formatPtr->name, " images", (char *) NULL);
return TCL_ERROR;
}
}
if ((formatPtr->stringMatchProc != NULL)
&& (formatPtr->stringReadProc != NULL)
&& (*formatPtr->stringMatchProc)(data, formatObj,
widthPtr, heightPtr, interp)) {
break;
}
}
if (formatPtr == NULL) {
useoldformat = 1;
for (formatPtr = tsdPtr->oldFormatList; formatPtr != NULL;
formatPtr = formatPtr->nextPtr) {
if (formatObj != NULL) {
if (strncasecmp(formatString,
formatPtr->name, strlen(formatPtr->name)) != 0) {
continue;
}
matched = 1;
if (formatPtr->stringMatchProc == NULL) {
Tcl_AppendResult(interp, "-data option isn't supported",
" for ", formatString, " images", (char *) NULL);
return TCL_ERROR;
}
}
if ((formatPtr->stringMatchProc != NULL)
&& (formatPtr->stringReadProc != NULL)
&& (*formatPtr->stringMatchProc)(
(Tcl_Obj *) Tcl_GetString(data),
(Tcl_Obj *) formatString,
widthPtr, heightPtr, interp)) {
break;
}
}
}
if (formatPtr == NULL) {
if ((formatObj != NULL) && !matched) {
Tcl_AppendResult(interp, "image format \"", formatString,
"\" is not supported", (char *) NULL);
} else {
Tcl_AppendResult(interp, "couldn't recognize image data",
(char *) NULL);
}
return TCL_ERROR;
}
*imageFormatPtr = formatPtr;
*oldformat = useoldformat;
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
* Tk_FindPhoto --
*
* This procedure is called to get an opaque handle (actually a
* PhotoMaster *) for a given image, which can be used in
* subsequent calls to Tk_PhotoPutBlock, etc. The `name'
* parameter is the name of the image.
*
* Results:
* The handle for the photo image, or NULL if there is no
* photo image with the name given.
*
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
Tk_PhotoHandle
Tk_FindPhoto(interp, imageName)
Tcl_Interp *interp; /* Interpreter (application) in which image
* exists. */
CONST char *imageName; /* Name of the desired photo image. */
{
ClientData clientData;
Tk_ImageType *typePtr;
clientData = Tk_GetImageMasterData(interp, imageName, &typePtr);
if (typePtr != &tkPhotoImageType) {
return NULL;
}
return (Tk_PhotoHandle) clientData;
}
/*
*----------------------------------------------------------------------
*
* Tk_PhotoPutBlock --
*
* This procedure is called to put image data into a photo image.
*
* Results:
* None.
*
* Side effects:
* The image data is stored. The image may be expanded.
* The Tk image code is informed that the image has changed.
*
view all matches for this distributionview release on metacpan - search on metacpan
( run in 4.693 seconds using v1.00-cache-2.02-grep-82fe00e-cpan-1310916c57ae )