summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorhobbs <hobbs>2000-02-08 11:31:28 (GMT)
committerhobbs <hobbs>2000-02-08 11:31:28 (GMT)
commitacfa815d400ff9f351e628c2dd24089170b2bfe3 (patch)
treeaaba98591be690b73fe87702aaa4023a89457083 /generic
parent4a0d1284957db786ed4b02c4a426b3681212565f (diff)
downloadtk-acfa815d400ff9f351e628c2dd24089170b2bfe3.zip
tk-acfa815d400ff9f351e628c2dd24089170b2bfe3.tar.gz
tk-acfa815d400ff9f351e628c2dd24089170b2bfe3.tar.bz2
* generic/tkDecls.h:
* generic/tk.decls: * generic/tk.h: moved new public functions created in dash patch to the stubs interface [Bug: 4062] * generic/tk.h: * doc/CrtImgType.3: * doc/CrtPhImgFmt.3: * generic/tk.h: * generic/tkImgGIF.c: * generic/tkImgPhoto.c: * generic/tkStubImg.c (new file): * generic/tkTest.c: * unix/Makefile.in: * win/Makefile.in: * win/makefile.vc: improved support for moving from the old style image C API to the new obj'ified one with new Tk_InitImageArgs command and stub'ing of image code. See docs for how to make the transition. [Bug: 4060]
Diffstat (limited to 'generic')
-rw-r--r--generic/tk.decls71
-rw-r--r--generic/tk.h79
-rw-r--r--generic/tkDecls.h159
-rw-r--r--generic/tkImgGIF.c18
-rw-r--r--generic/tkImgPhoto.c51
-rw-r--r--generic/tkStubImg.c74
-rw-r--r--generic/tkStubInit.c22
-rw-r--r--generic/tkTest.c51
8 files changed, 412 insertions, 113 deletions
diff --git a/generic/tk.decls b/generic/tk.decls
index db8314a..f152cbd 100644
--- a/generic/tk.decls
+++ b/generic/tk.decls
@@ -10,7 +10,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: tk.decls,v 1.5 1999/12/14 06:52:24 hobbs Exp $
+# RCS: @(#) $Id: tk.decls,v 1.6 2000/02/08 11:31:32 hobbs Exp $
library tk
@@ -1052,6 +1052,75 @@ declare 217 generic {
# VOID *Tk_GetCanvasVisitor(Tcl_Interp *interp, CONST char *name)
#}
+declare 220 generic {
+ int Tk_GetDash(Tcl_Interp *interp, CONST char *value, Tk_Dash *dash)
+}
+declare 221 generic {
+ void Tk_CreateOutline(Tk_Outline *outline)
+}
+declare 222 generic {
+ void Tk_DeleteOutline(Display *display, Tk_Outline *outline)
+}
+declare 223 generic {
+ int Tk_ConfigOutlineGC(XGCValues *gcValues, Tk_Canvas canvas, \
+ Tk_Item *item, Tk_Outline *outline)
+}
+declare 224 generic {
+ int Tk_ChangeOutlineGC(Tk_Canvas canvas, Tk_Item *item, \
+ Tk_Outline *outline)
+}
+declare 225 generic {
+ int Tk_ResetOutlineGC(Tk_Canvas canvas, Tk_Item *item, \
+ Tk_Outline *outline)
+}
+declare 226 generic {
+ int Tk_CanvasPsOutline(Tk_Canvas canvas, Tk_Item *item, \
+ Tk_Outline *outline)
+}
+declare 227 generic {
+ void Tk_SetTSOrigin(Tk_Window tkwin, GC gc, int x, int y)
+}
+declare 228 generic {
+ int Tk_CanvasGetCoordFromObj(Tcl_Interp *interp, Tk_Canvas canvas, \
+ Tcl_Obj *obj, double *doublePtr)
+}
+declare 229 generic {
+ void Tk_CanvasSetOffset(Tk_Canvas canvas, GC gc, Tk_TSOffset *offset)
+}
+declare 230 generic {
+ void Tk_DitherPhoto(Tk_PhotoHandle handle, int x, int y, int width, \
+ int height)
+}
+declare 231 generic {
+ int Tk_PostscriptBitmap(Tcl_Interp *interp, Tk_Window tkwin, \
+ Tk_PostscriptInfo psInfo, Pixmap bitmap, int startX, \
+ int startY, int width, int height)
+}
+declare 232 generic {
+ int Tk_PostscriptColor(Tcl_Interp *interp, Tk_PostscriptInfo psInfo, \
+ XColor *colorPtr)
+}
+declare 233 generic {
+ int Tk_PostscriptFont(Tcl_Interp *interp, Tk_PostscriptInfo psInfo, \
+ Tk_Font font)
+}
+declare 234 generic {
+ int Tk_PostscriptImage(Tk_Image image, Tcl_Interp *interp, \
+ Tk_Window tkwin, Tk_PostscriptInfo psinfo, int x, int y, \
+ int width, int height, int prepass)
+}
+declare 235 generic {
+ void Tk_PostscriptPath(Tcl_Interp *interp, Tk_PostscriptInfo psInfo, \
+ double *coordPtr, int numPoints)
+}
+declare 236 generic {
+ int Tk_PostscriptStipple(Tcl_Interp *interp, Tk_Window tkwin, \
+ Tk_PostscriptInfo psInfo, Pixmap bitmap)
+}
+declare 237 generic {
+ double Tk_PostscriptY(double y, Tk_PostscriptInfo psInfo)
+}
+
# Define the platform specific public Tk interface. These functions are
# only available on the designated platform.
diff --git a/generic/tk.h b/generic/tk.h
index 5bc1320..7596e0b 100644
--- a/generic/tk.h
+++ b/generic/tk.h
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tk.h,v 1.37 2000/02/08 10:00:44 hobbs Exp $
+ * RCS: @(#) $Id: tk.h,v 1.38 2000/02/08 11:31:32 hobbs Exp $
*/
#ifndef _TK
@@ -1065,27 +1065,6 @@ typedef struct Tk_Outline {
Pixmap disabledStipple; /* Outline Stipple pattern if state is disabled. */
} Tk_Outline;
-/*
- * Some functions handy for Dashing and Outlines (in tkCanvUtil.c).
- */
-
-EXTERN int Tk_GetDash _ANSI_ARGS_((Tcl_Interp *interp,
- CONST char *value, Tk_Dash *dash));
-EXTERN void Tk_CreateOutline _ANSI_ARGS_((Tk_Outline *outline));
-EXTERN void Tk_DeleteOutline _ANSI_ARGS_((Display *display,
- Tk_Outline *outline));
-EXTERN int Tk_ConfigOutlineGC _ANSI_ARGS_((XGCValues *gcValues,
- Tk_Canvas canvas ,Tk_Item *item,
- Tk_Outline *outline));
-EXTERN int Tk_ChangeOutlineGC _ANSI_ARGS_((Tk_Canvas canvas,
- Tk_Item *item, Tk_Outline *outline));
-EXTERN int Tk_ResetOutlineGC _ANSI_ARGS_((Tk_Canvas canvas,
- Tk_Item *item, Tk_Outline *outline));
-EXTERN int Tk_CanvasPsOutline _ANSI_ARGS_((Tk_Canvas canvas,
- Tk_Item *item, Tk_Outline *outline));
-EXTERN void Tk_SetTSOrigin _ANSI_ARGS_((Tk_Window tkwin, GC gc, int x,
- int y));
-
/*
*--------------------------------------------------------------
@@ -1215,23 +1194,22 @@ typedef int (Tk_ImageStringWriteProc) _ANSI_ARGS_((Tcl_Interp *interp,
Tk_PhotoImageBlock *blockPtr));
#else
typedef int (Tk_ImageFileMatchProc) _ANSI_ARGS_((Tcl_Channel chan,
- char *fileName, Tcl_Obj *format, int *widthPtr,
+ CONST char *fileName, Tcl_Obj *format, int *widthPtr,
int *heightPtr, Tcl_Interp *interp));
typedef int (Tk_ImageStringMatchProc) _ANSI_ARGS_((Tcl_Obj *dataObj,
Tcl_Obj *format, int *widthPtr, int *heightPtr,
Tcl_Interp *interp));
typedef int (Tk_ImageFileReadProc) _ANSI_ARGS_((Tcl_Interp *interp,
- Tcl_Channel chan, char *fileName, Tcl_Obj *format,
+ Tcl_Channel chan, CONST char *fileName, Tcl_Obj *format,
Tk_PhotoHandle imageHandle, int destX, int destY,
int width, int height, int srcX, int srcY));
typedef int (Tk_ImageStringReadProc) _ANSI_ARGS_((Tcl_Interp *interp,
Tcl_Obj *dataObj, Tcl_Obj *format, Tk_PhotoHandle imageHandle,
int destX, int destY, int width, int height, int srcX, int srcY));
typedef int (Tk_ImageFileWriteProc) _ANSI_ARGS_((Tcl_Interp *interp,
- char *fileName, Tcl_Obj *format, Tk_PhotoImageBlock *blockPtr));
+ CONST char *fileName, Tcl_Obj *format, Tk_PhotoImageBlock *blockPtr));
typedef int (Tk_ImageStringWriteProc) _ANSI_ARGS_((Tcl_Interp *interp,
- Tcl_DString *dataPtr, Tcl_Obj *format,
- Tk_PhotoImageBlock *blockPtr));
+ Tcl_Obj *format, Tk_PhotoImageBlock *blockPtr));
#endif
/*
@@ -1273,7 +1251,7 @@ EXTERN void Tk_CreateOldImageType _ANSI_ARGS_((
EXTERN void Tk_CreateOldPhotoImageFormat _ANSI_ARGS_((
Tk_PhotoImageFormat *formatPtr));
-#ifdef USE_OLD_IMAGE
+#if !defined(USE_TK_STUBS) && defined(USE_OLD_IMAGE)
#define Tk_CreateImageType Tk_CreateOldImageType
#define Tk_CreatePhotoImageFormat Tk_CreateOldPhotoImageFormat
#endif
@@ -1337,6 +1315,14 @@ char *Tk_InitStubs _ANSI_ARGS_((Tcl_Interp *interp, char *version, int exact));
#endif
+void Tk_InitImageArgs _ANSI_ARGS_((Tcl_Interp *interp, int argc, char ***argv));
+
+#if !defined(USE_TK_STUBS) || !defined(USE_OLD_IMAGE)
+
+#define Tk_InitImageArgs(interp, argc, argv) /**/
+
+#endif
+
/*
*--------------------------------------------------------------
@@ -1360,43 +1346,6 @@ typedef Tk_RestrictAction (Tk_RestrictProc) _ANSI_ARGS_((
typedef int (Tk_SelectionProc) _ANSI_ARGS_((ClientData clientData,
int offset, char *buffer, int maxBytes));
-/*
- *--------------------------------------------------------------
- *
- * Exported procedures introduced by dash-patch.
- *
- *--------------------------------------------------------------
- */
-
-EXTERN int Tk_CanvasGetCoordFromObj _ANSI_ARGS_((
- Tcl_Interp *interp, Tk_Canvas canvas, Tcl_Obj *obj,
- double *doublePtr));
-EXTERN void Tk_CanvasSetOffset _ANSI_ARGS_((
- Tk_Canvas canvas, GC gc, Tk_TSOffset *offset));
-EXTERN void Tk_CreatePhotoOption _ANSI_ARGS_((Tcl_Interp *interp,
- CONST char *name, Tcl_ObjCmdProc *proc));
-EXTERN void Tk_DitherPhoto _ANSI_ARGS_((Tk_PhotoHandle handle,
- int x, int y, int width, int height));
-EXTERN int Tk_PostscriptBitmap _ANSI_ARGS_((Tcl_Interp *interp,
- Tk_Window tkwin, Tk_PostscriptInfo psInfo,
- Pixmap bitmap, int startX, int startY,
- int width, int height));
-EXTERN int Tk_PostscriptColor _ANSI_ARGS_((Tcl_Interp *interp,
- Tk_PostscriptInfo psInfo, XColor *colorPtr));
-EXTERN int Tk_PostscriptFont _ANSI_ARGS_((Tcl_Interp *interp,
- Tk_PostscriptInfo psInfo, Tk_Font font));
-EXTERN int Tk_PostscriptImage _ANSI_ARGS_((Tk_Image image,
- Tcl_Interp *interp, Tk_Window tkwin,
- Tk_PostscriptInfo psinfo, int x, int y,
- int width, int height, int prepass));
-EXTERN void Tk_PostscriptPath _ANSI_ARGS_((Tcl_Interp *interp,
- Tk_PostscriptInfo psInfo, double *coordPtr,
- int numPoints));
-EXTERN int Tk_PostscriptStipple _ANSI_ARGS_((Tcl_Interp *interp,
- Tk_Window tkwin, Tk_PostscriptInfo psInfo,
- Pixmap bitmap));
-EXTERN double Tk_PostscriptY _ANSI_ARGS_((double y,
- Tk_PostscriptInfo psInfo));
/*
*--------------------------------------------------------------
diff --git a/generic/tkDecls.h b/generic/tkDecls.h
index e9b7dc0..0a0820d 100644
--- a/generic/tkDecls.h
+++ b/generic/tkDecls.h
@@ -8,7 +8,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkDecls.h,v 1.7 2000/01/12 11:45:02 hobbs Exp $
+ * RCS: @(#) $Id: tkDecls.h,v 1.8 2000/02/08 11:31:32 hobbs Exp $
*/
#ifndef _TKDECLS
@@ -752,6 +752,69 @@ EXTERN int Tk_CreateConsoleWindow _ANSI_ARGS_((
EXTERN void Tk_CreateSmoothMethod _ANSI_ARGS_((
Tcl_Interp * interp,
Tk_SmoothMethod * method));
+/* Slot 218 is reserved */
+/* Slot 219 is reserved */
+/* 220 */
+EXTERN int Tk_GetDash _ANSI_ARGS_((Tcl_Interp * interp,
+ CONST char * value, Tk_Dash * dash));
+/* 221 */
+EXTERN void Tk_CreateOutline _ANSI_ARGS_((Tk_Outline * outline));
+/* 222 */
+EXTERN void Tk_DeleteOutline _ANSI_ARGS_((Display * display,
+ Tk_Outline * outline));
+/* 223 */
+EXTERN int Tk_ConfigOutlineGC _ANSI_ARGS_((XGCValues * gcValues,
+ Tk_Canvas canvas, Tk_Item * item,
+ Tk_Outline * outline));
+/* 224 */
+EXTERN int Tk_ChangeOutlineGC _ANSI_ARGS_((Tk_Canvas canvas,
+ Tk_Item * item, Tk_Outline * outline));
+/* 225 */
+EXTERN int Tk_ResetOutlineGC _ANSI_ARGS_((Tk_Canvas canvas,
+ Tk_Item * item, Tk_Outline * outline));
+/* 226 */
+EXTERN int Tk_CanvasPsOutline _ANSI_ARGS_((Tk_Canvas canvas,
+ Tk_Item * item, Tk_Outline * outline));
+/* 227 */
+EXTERN void Tk_SetTSOrigin _ANSI_ARGS_((Tk_Window tkwin, GC gc,
+ int x, int y));
+/* 228 */
+EXTERN int Tk_CanvasGetCoordFromObj _ANSI_ARGS_((
+ Tcl_Interp * interp, Tk_Canvas canvas,
+ Tcl_Obj * obj, double * doublePtr));
+/* 229 */
+EXTERN void Tk_CanvasSetOffset _ANSI_ARGS_((Tk_Canvas canvas,
+ GC gc, Tk_TSOffset * offset));
+/* 230 */
+EXTERN void Tk_DitherPhoto _ANSI_ARGS_((Tk_PhotoHandle handle,
+ int x, int y, int width, int height));
+/* 231 */
+EXTERN int Tk_PostscriptBitmap _ANSI_ARGS_((Tcl_Interp * interp,
+ Tk_Window tkwin, Tk_PostscriptInfo psInfo,
+ Pixmap bitmap, int startX, int startY,
+ int width, int height));
+/* 232 */
+EXTERN int Tk_PostscriptColor _ANSI_ARGS_((Tcl_Interp * interp,
+ Tk_PostscriptInfo psInfo, XColor * colorPtr));
+/* 233 */
+EXTERN int Tk_PostscriptFont _ANSI_ARGS_((Tcl_Interp * interp,
+ Tk_PostscriptInfo psInfo, Tk_Font font));
+/* 234 */
+EXTERN int Tk_PostscriptImage _ANSI_ARGS_((Tk_Image image,
+ Tcl_Interp * interp, Tk_Window tkwin,
+ Tk_PostscriptInfo psinfo, int x, int y,
+ int width, int height, int prepass));
+/* 235 */
+EXTERN void Tk_PostscriptPath _ANSI_ARGS_((Tcl_Interp * interp,
+ Tk_PostscriptInfo psInfo, double * coordPtr,
+ int numPoints));
+/* 236 */
+EXTERN int Tk_PostscriptStipple _ANSI_ARGS_((
+ Tcl_Interp * interp, Tk_Window tkwin,
+ Tk_PostscriptInfo psInfo, Pixmap bitmap));
+/* 237 */
+EXTERN double Tk_PostscriptY _ANSI_ARGS_((double y,
+ Tk_PostscriptInfo psInfo));
typedef struct TkStubHooks {
struct TkPlatStubs *tkPlatStubs;
@@ -982,6 +1045,26 @@ typedef struct TkStubs {
void (*tk_InitConsoleChannels) _ANSI_ARGS_((Tcl_Interp * interp)); /* 215 */
int (*tk_CreateConsoleWindow) _ANSI_ARGS_((Tcl_Interp * interp)); /* 216 */
void (*tk_CreateSmoothMethod) _ANSI_ARGS_((Tcl_Interp * interp, Tk_SmoothMethod * method)); /* 217 */
+ void *reserved218;
+ void *reserved219;
+ int (*tk_GetDash) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * value, Tk_Dash * dash)); /* 220 */
+ void (*tk_CreateOutline) _ANSI_ARGS_((Tk_Outline * outline)); /* 221 */
+ void (*tk_DeleteOutline) _ANSI_ARGS_((Display * display, Tk_Outline * outline)); /* 222 */
+ int (*tk_ConfigOutlineGC) _ANSI_ARGS_((XGCValues * gcValues, Tk_Canvas canvas, Tk_Item * item, Tk_Outline * outline)); /* 223 */
+ int (*tk_ChangeOutlineGC) _ANSI_ARGS_((Tk_Canvas canvas, Tk_Item * item, Tk_Outline * outline)); /* 224 */
+ int (*tk_ResetOutlineGC) _ANSI_ARGS_((Tk_Canvas canvas, Tk_Item * item, Tk_Outline * outline)); /* 225 */
+ int (*tk_CanvasPsOutline) _ANSI_ARGS_((Tk_Canvas canvas, Tk_Item * item, Tk_Outline * outline)); /* 226 */
+ void (*tk_SetTSOrigin) _ANSI_ARGS_((Tk_Window tkwin, GC gc, int x, int y)); /* 227 */
+ int (*tk_CanvasGetCoordFromObj) _ANSI_ARGS_((Tcl_Interp * interp, Tk_Canvas canvas, Tcl_Obj * obj, double * doublePtr)); /* 228 */
+ void (*tk_CanvasSetOffset) _ANSI_ARGS_((Tk_Canvas canvas, GC gc, Tk_TSOffset * offset)); /* 229 */
+ void (*tk_DitherPhoto) _ANSI_ARGS_((Tk_PhotoHandle handle, int x, int y, int width, int height)); /* 230 */
+ int (*tk_PostscriptBitmap) _ANSI_ARGS_((Tcl_Interp * interp, Tk_Window tkwin, Tk_PostscriptInfo psInfo, Pixmap bitmap, int startX, int startY, int width, int height)); /* 231 */
+ int (*tk_PostscriptColor) _ANSI_ARGS_((Tcl_Interp * interp, Tk_PostscriptInfo psInfo, XColor * colorPtr)); /* 232 */
+ int (*tk_PostscriptFont) _ANSI_ARGS_((Tcl_Interp * interp, Tk_PostscriptInfo psInfo, Tk_Font font)); /* 233 */
+ int (*tk_PostscriptImage) _ANSI_ARGS_((Tk_Image image, Tcl_Interp * interp, Tk_Window tkwin, Tk_PostscriptInfo psinfo, int x, int y, int width, int height, int prepass)); /* 234 */
+ void (*tk_PostscriptPath) _ANSI_ARGS_((Tcl_Interp * interp, Tk_PostscriptInfo psInfo, double * coordPtr, int numPoints)); /* 235 */
+ int (*tk_PostscriptStipple) _ANSI_ARGS_((Tcl_Interp * interp, Tk_Window tkwin, Tk_PostscriptInfo psInfo, Pixmap bitmap)); /* 236 */
+ double (*tk_PostscriptY) _ANSI_ARGS_((double y, Tk_PostscriptInfo psInfo)); /* 237 */
} TkStubs;
#ifdef __cplusplus
@@ -1870,6 +1953,80 @@ extern TkStubs *tkStubsPtr;
#define Tk_CreateSmoothMethod \
(tkStubsPtr->tk_CreateSmoothMethod) /* 217 */
#endif
+/* Slot 218 is reserved */
+/* Slot 219 is reserved */
+#ifndef Tk_GetDash
+#define Tk_GetDash \
+ (tkStubsPtr->tk_GetDash) /* 220 */
+#endif
+#ifndef Tk_CreateOutline
+#define Tk_CreateOutline \
+ (tkStubsPtr->tk_CreateOutline) /* 221 */
+#endif
+#ifndef Tk_DeleteOutline
+#define Tk_DeleteOutline \
+ (tkStubsPtr->tk_DeleteOutline) /* 222 */
+#endif
+#ifndef Tk_ConfigOutlineGC
+#define Tk_ConfigOutlineGC \
+ (tkStubsPtr->tk_ConfigOutlineGC) /* 223 */
+#endif
+#ifndef Tk_ChangeOutlineGC
+#define Tk_ChangeOutlineGC \
+ (tkStubsPtr->tk_ChangeOutlineGC) /* 224 */
+#endif
+#ifndef Tk_ResetOutlineGC
+#define Tk_ResetOutlineGC \
+ (tkStubsPtr->tk_ResetOutlineGC) /* 225 */
+#endif
+#ifndef Tk_CanvasPsOutline
+#define Tk_CanvasPsOutline \
+ (tkStubsPtr->tk_CanvasPsOutline) /* 226 */
+#endif
+#ifndef Tk_SetTSOrigin
+#define Tk_SetTSOrigin \
+ (tkStubsPtr->tk_SetTSOrigin) /* 227 */
+#endif
+#ifndef Tk_CanvasGetCoordFromObj
+#define Tk_CanvasGetCoordFromObj \
+ (tkStubsPtr->tk_CanvasGetCoordFromObj) /* 228 */
+#endif
+#ifndef Tk_CanvasSetOffset
+#define Tk_CanvasSetOffset \
+ (tkStubsPtr->tk_CanvasSetOffset) /* 229 */
+#endif
+#ifndef Tk_DitherPhoto
+#define Tk_DitherPhoto \
+ (tkStubsPtr->tk_DitherPhoto) /* 230 */
+#endif
+#ifndef Tk_PostscriptBitmap
+#define Tk_PostscriptBitmap \
+ (tkStubsPtr->tk_PostscriptBitmap) /* 231 */
+#endif
+#ifndef Tk_PostscriptColor
+#define Tk_PostscriptColor \
+ (tkStubsPtr->tk_PostscriptColor) /* 232 */
+#endif
+#ifndef Tk_PostscriptFont
+#define Tk_PostscriptFont \
+ (tkStubsPtr->tk_PostscriptFont) /* 233 */
+#endif
+#ifndef Tk_PostscriptImage
+#define Tk_PostscriptImage \
+ (tkStubsPtr->tk_PostscriptImage) /* 234 */
+#endif
+#ifndef Tk_PostscriptPath
+#define Tk_PostscriptPath \
+ (tkStubsPtr->tk_PostscriptPath) /* 235 */
+#endif
+#ifndef Tk_PostscriptStipple
+#define Tk_PostscriptStipple \
+ (tkStubsPtr->tk_PostscriptStipple) /* 236 */
+#endif
+#ifndef Tk_PostscriptY
+#define Tk_PostscriptY \
+ (tkStubsPtr->tk_PostscriptY) /* 237 */
+#endif
#endif /* defined(USE_TK_STUBS) && !defined(USE_TK_STUB_PROCS) */
diff --git a/generic/tkImgGIF.c b/generic/tkImgGIF.c
index 87a90c7..e3a4085 100644
--- a/generic/tkImgGIF.c
+++ b/generic/tkImgGIF.c
@@ -29,7 +29,7 @@
* | provided "as is" without express or implied warranty. |
* +-------------------------------------------------------------------+
*
- * RCS: @(#) $Id: tkImgGIF.c,v 1.10 2000/01/27 16:58:42 ericm Exp $
+ * RCS: @(#) $Id: tkImgGIF.c,v 1.11 2000/02/08 11:31:33 hobbs Exp $
*/
/*
@@ -78,11 +78,11 @@ static Tcl_ThreadDataKey dataKey;
* The format record for the GIF file format:
*/
-static int FileMatchGIF _ANSI_ARGS_((Tcl_Channel chan, char *fileName,
+static int FileMatchGIF _ANSI_ARGS_((Tcl_Channel chan, CONST char *fileName,
Tcl_Obj *format, int *widthPtr, int *heightPtr,
Tcl_Interp *interp));
static int FileReadGIF _ANSI_ARGS_((Tcl_Interp *interp,
- Tcl_Channel chan, char *fileName, Tcl_Obj *format,
+ Tcl_Channel chan, CONST char *fileName, Tcl_Obj *format,
Tk_PhotoHandle imageHandle, int destX, int destY,
int width, int height, int srcX, int srcY));
static int StringMatchGIF _ANSI_ARGS_(( Tcl_Obj *dataObj,
@@ -93,14 +93,14 @@ static int StringReadGIF _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Obj *dataObj,
int destX, int destY, int width, int height,
int srcX, int srcY));
static int FileWriteGIF _ANSI_ARGS_((Tcl_Interp *interp,
- char *filename, Tcl_Obj *format,
+ CONST char *filename, Tcl_Obj *format,
Tk_PhotoImageBlock *blockPtr));
static int CommonWriteGIF _ANSI_ARGS_((Tcl_Interp *interp,
Tcl_Channel handle, Tcl_Obj *format,
Tk_PhotoImageBlock *blockPtr));
Tk_PhotoImageFormat tkImgFmtGIF = {
- "GIF", /* name */
+ "gif", /* name */
FileMatchGIF, /* fileMatchProc */
StringMatchGIF, /* stringMatchProc */
FileReadGIF, /* fileReadProc */
@@ -177,7 +177,7 @@ static void mInit _ANSI_ARGS_((unsigned char *string,
static int
FileMatchGIF(chan, fileName, format, widthPtr, heightPtr, interp)
Tcl_Channel chan; /* The image file, open for reading. */
- char *fileName; /* The name of the image file. */
+ CONST char *fileName; /* The name of the image file. */
Tcl_Obj *format; /* User-specified format object, or NULL. */
int *widthPtr, *heightPtr; /* The dimensions of the image are
* returned here if the file is a valid
@@ -212,7 +212,7 @@ FileReadGIF(interp, chan, fileName, format, imageHandle, destX, destY,
width, height, srcX, srcY)
Tcl_Interp *interp; /* Interpreter to use for reporting errors. */
Tcl_Channel chan; /* The image file, open for reading. */
- char *fileName; /* The name of the image file. */
+ CONST char *fileName; /* The name of the image file. */
Tcl_Obj *format; /* User-specified format object, or NULL. */
Tk_PhotoHandle imageHandle; /* The photo image to write into. */
int destX, destY; /* Coordinates of top-left pixel in
@@ -1323,14 +1323,14 @@ static int no_bits _ANSI_ARGS_((int colors));
static int
FileWriteGIF (interp, filename, format, blockPtr)
Tcl_Interp *interp; /* Interpreter to use for reporting errors. */
- char *filename;
+ CONST char *filename;
Tcl_Obj *format;
Tk_PhotoImageBlock *blockPtr;
{
Tcl_Channel chan = NULL;
int result;
- chan = Tcl_OpenFileChannel(interp, filename, "w", 0644);
+ chan = Tcl_OpenFileChannel(interp, (char *) filename, "w", 0644);
if (!chan) {
return TCL_ERROR;
}
diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c
index 33fc954..9b2519a 100644
--- a/generic/tkImgPhoto.c
+++ b/generic/tkImgPhoto.c
@@ -15,7 +15,7 @@
* Department of Computer Science,
* Australian National University.
*
- * RCS: @(#) $Id: tkImgPhoto.c,v 1.16 2000/01/31 18:38:26 ericm Exp $
+ * RCS: @(#) $Id: tkImgPhoto.c,v 1.17 2000/02/08 11:31:33 hobbs Exp $
*/
#include "tkInt.h"
@@ -371,7 +371,7 @@ static void ImgPhotoSetSize _ANSI_ARGS_((PhotoMaster *masterPtr,
static void ImgPhotoInstanceSetSize _ANSI_ARGS_((
PhotoInstance *instancePtr));
static int ImgStringWrite _ANSI_ARGS_((Tcl_Interp *interp,
- Tcl_DString *dataPtr, Tcl_Obj *formatString,
+ Tcl_Obj *formatString,
Tk_PhotoImageBlock *blockPtr));
static char * ImgGetPhoto _ANSI_ARGS_((PhotoMaster *masterPtr,
Tk_PhotoImageBlock *blockPtr,
@@ -462,8 +462,13 @@ Tk_CreatePhotoImageFormat(formatPtr)
*copyPtr = *formatPtr;
copyPtr->name = (char *) ckalloc((unsigned) (strlen(formatPtr->name) + 1));
strcpy(copyPtr->name, formatPtr->name);
- copyPtr->nextPtr = tsdPtr->formatList;
- tsdPtr->formatList = copyPtr;
+ if (isupper((unsigned char) *formatPtr->name)) {
+ copyPtr->nextPtr = tsdPtr->oldFormatList;
+ tsdPtr->oldFormatList = copyPtr;
+ } else {
+ copyPtr->nextPtr = tsdPtr->formatList;
+ tsdPtr->formatList = copyPtr;
+ }
}
/*
@@ -796,9 +801,7 @@ ImgPhotoCmd(clientData, interp, objc, objv)
break;
}
case PHOTO_DATA: {
- Tcl_DString buffer;
char *data;
- Tcl_Obj *formatObj;
/*
* photo data command - first parse and check any options given.
@@ -854,19 +857,6 @@ ImgPhotoCmd(clientData, interp, objc, objv)
}
}
if (stringWriteProc == NULL) {
- oldformat = 1;
- for (imageFormat = tsdPtr->oldFormatList; imageFormat != NULL;
- imageFormat = imageFormat->nextPtr) {
- if ((strncasecmp(Tcl_GetString(options.format),
- imageFormat->name, strlen(imageFormat->name)) == 0)) {
- if (imageFormat->stringWriteProc != NULL) {
- stringWriteProc = imageFormat->stringWriteProc;
- break;
- }
- }
- }
- }
- if (stringWriteProc == NULL) {
Tcl_AppendResult(interp, "image string format \"",
Tcl_GetString(options.format),
"\" is not supported", (char *) NULL);
@@ -882,25 +872,16 @@ ImgPhotoCmd(clientData, interp, objc, objv)
*/
data = ImgGetPhoto(masterPtr, &block, &options);
- Tcl_DStringInit(&buffer);
- formatObj = options.format;
- if (oldformat && formatObj) {
- formatObj = (Tcl_Obj *) Tcl_GetString(options.format);
- }
- result = stringWriteProc(interp, &buffer,
- formatObj, &block);
+ result = ((int (*) _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Obj *formatString,
+ Tk_PhotoImageBlock *blockPtr, VOID *dummy))) stringWriteProc)
+ (interp, options.format, &block, (VOID *) NULL);
if (options.background) {
Tk_FreeColor(options.background);
}
if (data) {
ckfree(data);
}
- if (result == TCL_OK) {
- Tcl_DStringResult(interp, &buffer);
- } else {
- Tcl_DStringFree(&buffer);
- }
return result;
break;
}
@@ -4908,9 +4889,8 @@ ImgGetPhoto(masterPtr, blockPtr, optPtr)
*/
static int
-ImgStringWrite(interp, dataPtr, formatString, blockPtr)
+ImgStringWrite(interp, formatString, blockPtr)
Tcl_Interp *interp;
- Tcl_DString *dataPtr;
Tcl_Obj *formatString;
Tk_PhotoImageBlock *blockPtr;
{
@@ -4918,10 +4898,12 @@ ImgStringWrite(interp, dataPtr, formatString, blockPtr)
char *line, *linePtr;
unsigned char *pixelPtr;
int greenOffset, blueOffset;
+ Tcl_DString data;
greenOffset = blockPtr->offset[1] - blockPtr->offset[0];
blueOffset = blockPtr->offset[2] - blockPtr->offset[0];
+ Tcl_DStringInit(&data);
if ((blockPtr->width > 0) && (blockPtr->height > 0)) {
line = (char *) ckalloc((unsigned int) ((8 * blockPtr->width) + 2));
for (row=0; row<blockPtr->height; row++) {
@@ -4934,10 +4916,11 @@ ImgStringWrite(interp, dataPtr, formatString, blockPtr)
pixelPtr += blockPtr->pixelSize;
linePtr += 8;
}
- Tcl_DStringAppendElement(dataPtr, line+1);
+ Tcl_DStringAppendElement(&data, line+1);
}
ckfree (line);
}
+ Tcl_DStringResult(interp, &data);
return TCL_OK;
}
diff --git a/generic/tkStubImg.c b/generic/tkStubImg.c
new file mode 100644
index 0000000..7e1e23f
--- /dev/null
+++ b/generic/tkStubImg.c
@@ -0,0 +1,74 @@
+/*
+ * tkStubImg.c --
+ *
+ * Stub object that will be statically linked into extensions that wish
+ * to access Tk.
+ *
+ * Copyright (c) 1999 Jan Nijtmans.
+ * Copyright (c) 1998-1999 by Scriptics Corporation.
+ *
+ * See the file "license.terms" for information on usage and redistribution
+ * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ *
+ * RCS: @(#) $Id: tkStubImg.c,v 1.1 2000/02/08 11:31:33 hobbs Exp $
+ */
+
+#include "tcl.h"
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * Tk_InitImageArgs --
+ *
+ * Performs the necessary conversion from Tcl_Obj's to strings
+ * in the createProc for Tcl_CreateImageType. If running under
+ * Tk 8.2 or earlier without the Img-patch, this function has
+ * no effect.
+ *
+ * Results:
+ * argvPtr will point to an argument list which is guaranteed to
+ * contain strings, no matter what Tk version is running.
+ *
+ * Side effects:
+ * None
+ *
+ *----------------------------------------------------------------------
+ */
+
+#ifdef Tk_InitImageArgs
+#undef Tk_InitImageArgs
+#endif
+
+void
+Tk_InitImageArgs(interp, argc, argvPtr)
+ Tcl_Interp *interp;
+ int argc;
+ char ***argvPtr;
+{
+ static useNewImage = -1;
+ static char **argv = NULL;
+
+ if (argv) {
+ tclStubsPtr->tcl_Free((char *) argv);
+ argv = NULL;
+ }
+
+ if (useNewImage < 0) {
+ Tcl_CmdInfo cmdInfo;
+ if (!tclStubsPtr->tcl_GetCommandInfo(interp,"image", &cmdInfo)) {
+ tclStubsPtr->tcl_Panic("cannot find the \"image\" command");
+ }
+ if (cmdInfo.isNativeObjectProc == 1) {
+ useNewImage = 1; /* Tk uses the new image interface */
+ }
+ }
+ if (useNewImage && (argc > 0)) {
+ int i;
+ argv = (char **) tclStubsPtr->tcl_Alloc(argc * sizeof(char *));
+ for (i = 0; i < argc; i++) {
+ argv[i] = tclStubsPtr->tcl_GetString((Tcl_Obj *)(*argvPtr)[i]);
+ }
+ *argvPtr = (char **) argv;
+ }
+}
diff --git a/generic/tkStubInit.c b/generic/tkStubInit.c
index 38f47e5..c1f2607 100644
--- a/generic/tkStubInit.c
+++ b/generic/tkStubInit.c
@@ -8,7 +8,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkStubInit.c,v 1.15 2000/01/12 11:45:03 hobbs Exp $
+ * RCS: @(#) $Id: tkStubInit.c,v 1.16 2000/02/08 11:31:33 hobbs Exp $
*/
#include "tkInt.h"
@@ -919,6 +919,26 @@ TkStubs tkStubs = {
Tk_InitConsoleChannels, /* 215 */
Tk_CreateConsoleWindow, /* 216 */
Tk_CreateSmoothMethod, /* 217 */
+ NULL, /* 218 */
+ NULL, /* 219 */
+ Tk_GetDash, /* 220 */
+ Tk_CreateOutline, /* 221 */
+ Tk_DeleteOutline, /* 222 */
+ Tk_ConfigOutlineGC, /* 223 */
+ Tk_ChangeOutlineGC, /* 224 */
+ Tk_ResetOutlineGC, /* 225 */
+ Tk_CanvasPsOutline, /* 226 */
+ Tk_SetTSOrigin, /* 227 */
+ Tk_CanvasGetCoordFromObj, /* 228 */
+ Tk_CanvasSetOffset, /* 229 */
+ Tk_DitherPhoto, /* 230 */
+ Tk_PostscriptBitmap, /* 231 */
+ Tk_PostscriptColor, /* 232 */
+ Tk_PostscriptFont, /* 233 */
+ Tk_PostscriptImage, /* 234 */
+ Tk_PostscriptPath, /* 235 */
+ Tk_PostscriptStipple, /* 236 */
+ Tk_PostscriptY, /* 237 */
};
/* !END!: Do not edit above this line. */
diff --git a/generic/tkTest.c b/generic/tkTest.c
index d1c23bf..755bc1b 100644
--- a/generic/tkTest.c
+++ b/generic/tkTest.c
@@ -13,9 +13,13 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkTest.c,v 1.9 1999/12/14 06:52:31 hobbs Exp $
+ * RCS: @(#) $Id: tkTest.c,v 1.10 2000/02/08 11:31:34 hobbs Exp $
*/
+#ifdef MAC_TCL
+#define USE_OLD_IMAGE
+#endif
+
#include "tkInt.h"
#include "tkPort.h"
#include "tkText.h"
@@ -61,10 +65,17 @@ typedef struct TImageInstance {
* The type record for test images:
*/
+#ifdef USE_OLD_IMAGE
+static int ImageCreate _ANSI_ARGS_((Tcl_Interp *interp,
+ char *name, int argc, char **argv,
+ Tk_ImageType *typePtr, Tk_ImageMaster master,
+ ClientData *clientDataPtr));
+#else
static int ImageCreate _ANSI_ARGS_((Tcl_Interp *interp,
char *name, int argc, Tcl_Obj *CONST objv[],
Tk_ImageType *typePtr, Tk_ImageMaster master,
ClientData *clientDataPtr));
+#endif
static ClientData ImageGet _ANSI_ARGS_((Tk_Window tkwin,
ClientData clientData));
static void ImageDisplay _ANSI_ARGS_((ClientData clientData,
@@ -78,7 +89,7 @@ static void ImageDelete _ANSI_ARGS_((ClientData clientData));
static Tk_ImageType imageType = {
"test", /* name */
- ImageCreate, /* createProc */
+ (Tk_ImageCreateProc *) ImageCreate, /* createProc */
ImageGet, /* getProc */
ImageDisplay, /* displayProc */
ImageFree, /* freeProc */
@@ -1557,6 +1568,41 @@ TestfontObjCmd(clientData, interp, objc, objv)
*/
/* ARGSUSED */
+#ifdef USE_OLD_IMAGE
+static int
+ImageCreate(interp, name, argc, argv, typePtr, master, clientDataPtr)
+ Tcl_Interp *interp; /* Interpreter for application containing
+ * image. */
+ char *name; /* Name to use for image. */
+ int argc; /* Number of arguments. */
+ char **argv; /* Argument strings for options (doesn't
+ * include image name or type). */
+ Tk_ImageType *typePtr; /* Pointer to our type record (not used). */
+ Tk_ImageMaster master; /* Token for image, to be used by us in
+ * later callbacks. */
+ ClientData *clientDataPtr; /* Store manager's token for image here;
+ * it will be returned in later callbacks. */
+{
+ TImageMaster *timPtr;
+ char *varName;
+ int i;
+
+ Tk_InitImageArgs(interp, argc, &argv);
+ varName = "log";
+ for (i = 0; i < argc; i += 2) {
+ if (strcmp(argv[i], "-variable") != 0) {
+ Tcl_AppendResult(interp, "bad option name \"",
+ argv[i], "\"", (char *) NULL);
+ return TCL_ERROR;
+ }
+ if ((i+1) == argc) {
+ Tcl_AppendResult(interp, "no value given for \"",
+ argv[i], "\" option", (char *) NULL);
+ return TCL_ERROR;
+ }
+ varName = argv[i+1];
+ }
+#else
static int
ImageCreate(interp, name, objc, objv, typePtr, master, clientDataPtr)
Tcl_Interp *interp; /* Interpreter for application containing
@@ -1589,6 +1635,7 @@ ImageCreate(interp, name, objc, objv, typePtr, master, clientDataPtr)
}
varName = Tcl_GetString(objv[i+1]);
}
+#endif
timPtr = (TImageMaster *) ckalloc(sizeof(TImageMaster));
timPtr->master = master;
timPtr->interp = interp;