(interp, name, tkwin, pixmap, source, width, height)
| 310 | * |
| 311 | *---------------------------------------------------------------------- |
| 312 | */ |
| 313 | |
| 314 | int |
| 315 | Tk_DefinePixmap(interp, name, tkwin, pixmap, source, width, height) |
| 316 | Tcl_Interp *interp; /* Interpreter to use for error reporting. */ |
| 317 | Tk_Uid name; /* Name to use for bitmap. Must not already |
| 318 | * be defined as a bitmap. */ |
| 319 | Tk_Window tkwin; /* any window on screen where pixmap lives */ |
| 320 | Pixmap pixmap; /* pixmap to associate with name, |
| 321 | * or None to create a new pixmap */ |
| 322 | char *source; /* Address of bits for bitmap. */ |
| 323 | unsigned int width; /* Width of bitmap. */ |
| 324 | unsigned int height; /* Height of bitmap. */ |
| 325 | { |
| 326 | int new; |
| 327 | Tcl_HashEntry *predefHashPtr; |
| 328 | PredefBitmap *predefPtr; |
| 329 | NameKey key; |
| 330 | |
| 331 | if (!initialized) { |
| 332 | PixmapInit(tkwin); |
| 333 | } |
| 334 | |
| 335 | key.name = name; |
| 336 | key.screen = (pixmap != None) ? Tk_Screen(tkwin) : (Screen *)NULL; |
| 337 | predefHashPtr = Tcl_CreateHashEntry(&predefTable, (char *) &key, &new); |
| 338 | if (!new) { |
| 339 | Tcl_AppendResult(interp, "bitmap \"", name, |
| 340 | "\" is already defined", (char *) NULL); |
| 341 | return TCL_ERROR; |
| 342 | } |
| 343 | predefPtr = (PredefBitmap *) malloc(sizeof(PredefBitmap)); |
| 344 | predefPtr->source = source; |
| 345 | predefPtr->pixmap = pixmap; |
| 346 | predefPtr->width = width; |
| 347 | predefPtr->height = height; |
| 348 | Tcl_SetHashValue(predefHashPtr, predefPtr); |
| 349 | return TCL_OK; |
| 350 | } |
| 351 |
no test coverage detected