--- imgBMP.c	Sun Aug 13 06:08:30 2000
+++ imgBMP.c	Mon Dec  1 12:49:07 2003
@@ -235,5 +236,5 @@
     }
 
-    Tk_PhotoExpand(imageHandle, destX + width, destY + height);
+    Tk_PhotoExpand(interp, imageHandle, destX + width, destY + height);
 
     bytesPerLine = ((numBits * fileWidth + 31)/32)*4;
@@ -256,7 +256,7 @@
 	    for( y = height-1; y>=0; y--) {
 		ImgRead(handle, line, bytesPerLine);
-		Tk_PhotoPutBlock(imageHandle, &block, destX, destY+y,
+		Tk_PhotoPutBlock(interp, imageHandle, &block, destX, destY+y,
-			width,1);
+			width,1,TK_PHOTO_COMPOSITE_SET);
 	    }
 	    break;
 	case 8:
@@ -268,7 +268,7 @@
 		    expline += 3;
 		}
-		Tk_PhotoPutBlock(imageHandle, &block, destX, destY+y,
+		Tk_PhotoPutBlock(interp, imageHandle, &block, destX, destY+y,
-			width,1);
+			width,1,TK_PHOTO_COMPOSITE_SET);
 		expline = block.pixelPtr;
 	    }
 	    break;
@@ -287,7 +287,7 @@
 		    expline += 3;
 		}
-		Tk_PhotoPutBlock(imageHandle, &block, destX, destY+y,
+		Tk_PhotoPutBlock(interp, imageHandle, &block, destX, destY+y,
-			width,1);
+			width,1,TK_PHOTO_COMPOSITE_SET);
 		expline = block.pixelPtr;
 	    }
 	    break;
@@ -302,7 +302,7 @@
 		    expline += 3;
 		}
-		Tk_PhotoPutBlock(imageHandle, &block, destX, destY+y,
+		Tk_PhotoPutBlock(interp, imageHandle, &block, destX, destY+y,
-			width,1);
+			width,1,TK_PHOTO_COMPOSITE_SET);
 		expline = block.pixelPtr;
 	    }
 	    break;
--- imgGIF.c	Sun Aug 13 06:09:39 2000
+++ imgGIF.c	Mon Dec  1 12:50:19 2003
@@ -322,5 +322,5 @@
     }
 
-    Tk_PhotoExpand(imageHandle, destX + width, destY + height);
+    Tk_PhotoExpand(interp, imageHandle, destX + width, destY + height);
 
     block.pixelSize = 4;
@@ -482,7 +482,7 @@
     }
 
     if (transparent == -1) {
-	Tk_PhotoPutBlock(imageHandle, &block, destX, destY, width, height);
+	Tk_PhotoPutBlock(interp, imageHandle, &block, destX, destY, width, height, TK_PHOTO_COMPOSITE_SET);
     } else {
 	ImgPhotoPutBlock(imageHandle, &block, destX, destY, width, height);
     }
--- imgJPEG.c	Sun Aug 13 06:10:22 2000
+++ imgJPEG.c	Mon Dec  1 12:50:53 2003
@@ -1017,5 +711,5 @@
     block.offset[3] = block.offset[0];

-    Tk_PhotoExpand(imageHandle, destX + outWidth, destY + outHeight);
+    Tk_PhotoExpand(interp, imageHandle, destX + outWidth, destY + outHeight);

     /* Make a temporary one-row-high sample array */
@@ -1030,7 +1030,7 @@
     for (curY = 0; curY < stopY; curY++) {
       jpeg.read_scanlines(cinfo, buffer, 1);
       if (curY >= srcY) {
-	Tk_PhotoPutBlock(imageHandle, &block, destX, outY, outWidth, 1);
+	Tk_PhotoPutBlock(interp, imageHandle, &block, destX, outY, outWidth, 1, TK_PHOTO_COMPOSITE_SET);
 	outY++;
       }
     }
--- imgPS.c	Sun Aug 13 06:06:53 2000
+++ imgPS.c	Mon Dec  1 12:51:42 2003
@@ -365,5 +365,5 @@
        return TCL_OK;
     }
-    Tk_PhotoExpand(imageHandle, destX + width, destY + height);
+    Tk_PhotoExpand(interp, imageHandle, destX + width, destY + height);
 
     maxintensity = strtoul(p, &p, 0);
@@ -395,7 +395,7 @@
 	        for (j = 0; j < width; j++) {
 		    line3[j] = ((line[(j+srcX)/8]>>(7-(j+srcX)%8) & 1)) ? 0 : 255;
 	        }
-		Tk_PhotoPutBlock(imageHandle, &block, destX, destY++, width, 1);
+		Tk_PhotoPutBlock(interp, imageHandle, &block, destX, destY++, width, 1, TK_PHOTO_COMPOSITE_SET);
 	    }
 	    break;
 	case '5':
@@ -413,7 +413,7 @@
 			c++;
 		    }
 		}
-		Tk_PhotoPutBlock(imageHandle, &block, destX, destY++, width, 1);
+		Tk_PhotoPutBlock(interp, imageHandle, &block, destX, destY++, width, 1, TK_PHOTO_COMPOSITE_SET);
 	    }
 	    break;
 	case '6':
@@ -435,7 +435,7 @@
 			c++;
 		    }
 		}
-		Tk_PhotoPutBlock(imageHandle, &block, destX, destY++, width, 1);
+		Tk_PhotoPutBlock(interp, imageHandle, &block, destX, destY++, width, 1, TK_PHOTO_COMPOSITE_SET);
 	    }
 	    break;
     }
--- imgUtil.c	Tue Jan 15 15:59:59 2002
+++ imgUtil.c	Thu Jun  9 20:51:49 2005
@@ -95,7 +95,7 @@
 		}
 		if (end > X) {
  		    blockPtr->pixelPtr =  rowPtr + blockPtr->pixelSize * X;
-		    Tk_PhotoPutBlock(handle, blockPtr, x+X, y+Y, end-X, 1);
+		    Tk_PhotoPutBlock(NULL, handle, blockPtr, x+X, y+Y, end-X, 1, TK_PHOTO_COMPOSITE_SET);
 		}
 		X = end;
 	    }
@@ -103,12 +103,12 @@
 	}
 	blockPtr->pixelPtr = imagePtr;
     } else {
-	Tk_PhotoPutBlock(handle,blockPtr,x,y,width,height);
+	Tk_PhotoPutBlock(NULL, handle,blockPtr,x,y,width,height,TK_PHOTO_COMPOSITE_SET);
     }
     return TCL_OK;
 }
 
-
+#if 0 /* OS run-time linker is better suited for this job { */
 /*
  *----------------------------------------------------------------------
  *
@@ -248,4 +248,5 @@
 	dlclose(*handlePtr);
     }
     *handlePtr = IMG_FAILED;
-}
\ No newline at end of file
+}
+#endif /* } */
--- imgWindow.c	Sat Jan 15 13:25:37 2000
+++ imgWindow.c	Mon Dec  1 12:52:11 2003
@@ -327,5 +327,5 @@
 #endif
 
-    Tk_PhotoExpand(imageHandle, destX + width, destY + height);
+    Tk_PhotoExpand(interp, imageHandle, destX + width, destY + height);
     block.offset[0] = 0;
     block.offset[3] = 0;
@@ -378,7 +378,7 @@
 	}
     }
 
-    Tk_PhotoPutBlock(imageHandle, &block, destX, destY, width, height);
+    Tk_PhotoPutBlock(interp, imageHandle, &block, destX, destY, width, height, TK_PHOTO_COMPOSITE_SET);
 
 #ifndef	__WIN32__
     XDestroyImage(ximage);
--- imgXPM.c	Sun Aug 13 06:41:31 2000
+++ imgXPM.c	Mon Dec  1 12:52:34 2003
@@ -438,5 +438,5 @@
     block.pub.pixelPtr = (unsigned char *) ckalloc((unsigned) block.pub.pixelSize * width);
 
-    Tk_PhotoExpand(imageHandle, destX + width, destY + height);
+    Tk_PhotoExpand(interp, imageHandle, destX + width, destY + height);
 
     i = srcY;
@@ -504,7 +504,7 @@
 			    col = (int)0;
 		    }
 		} while ((i < width) && col);
-		Tk_PhotoPutBlock(imageHandle, &block.pub, destX+j, destY, len, 1);
+		Tk_PhotoPutBlock(interp, imageHandle, &block.pub, destX+j, destY, len, 1, TK_PHOTO_COMPOSITE_SET);
 	    } else {
 	        p += byteSize;
 	        i++;
--- imgPNG.c	2002-01-15 16:00:08.000000000 -0500
+++ imgPNG.c	2011-09-14 02:26:32.000000000 -0400
@@ -96,5 +96,5 @@
 static int CommonMatchPNG _ANSI_ARGS_((MFile *handle, int *widthPtr,
 	int *heightPtr));
-static int CommonReadPNG _ANSI_ARGS_((png_structp png_ptr, Tcl_Obj *format,
+static int CommonReadPNG _ANSI_ARGS_((Tcl_Interp *interp, png_structp png_ptr, Tcl_Obj *format,
 	Tk_PhotoHandle imageHandle, int destX, int destY, int width,
 	int height, int srcX, int srcY));
@@ -345,4 +246,4 @@
 
-    return CommonReadPNG(png_ptr, format, imageHandle, destX, destY,
+    return CommonReadPNG(interp, png_ptr, format, imageHandle, destX, destY,
 	    width, height, srcX, srcY);
 }
@@ -377,4 +274,4 @@
 
-    return CommonReadPNG(png_ptr, format, imageHandle, destX, destY,
+    return CommonReadPNG(interp, png_ptr, format, imageHandle, destX, destY,
 	    width, height, srcX, srcY);
 }
@@ -388,6 +285,7 @@
 #define block bl.ck
 
-static int CommonReadPNG(png_ptr, format, imageHandle, destX, destY,
+static int CommonReadPNG(interp, png_ptr, format, imageHandle, destX, destY,
 	width, height, srcX, srcY)
+    Tcl_Interp *interp;
     png_structp png_ptr;
     Tcl_Obj *format;
@@ -443,5 +340,5 @@
     }
 
-    Tk_PhotoExpand(imageHandle, destX + width, destY + height);
+    Tk_PhotoExpand(interp, imageHandle, destX + width, destY + height);
 
     Tk_PhotoGetImage(imageHandle, &block);
--- imgXBM.c	2002-01-15 16:00:08.000000000 -0500
+++ imgXBM.c	2011-09-14 03:20:16.000000000 -0400
@@ -227,5 +227,5 @@
     }
 
-    Tk_PhotoExpand(imageHandle, destX + width, destY + height);
+    Tk_PhotoExpand(interp, imageHandle, destX + width, destY + height);
 
     numBytes = ((fileWidth+7)/8)*32;
