Lines Matching refs:masterPtr

184     PhotoMaster *masterPtr;	/* Pointer to master for image. */
358 Tcl_Interp *interp, PhotoMaster *masterPtr,
362 static void ImgPhotoSetSize _ANSI_ARGS_((PhotoMaster *masterPtr,
384 static void Dither _ANSI_ARGS_((PhotoMaster *masterPtr,
466 PhotoMaster *masterPtr;
474 masterPtr = (PhotoMaster *) ckalloc(sizeof(PhotoMaster));
475 memset((void *) masterPtr, 0, sizeof(PhotoMaster));
476 masterPtr->tkMaster = master;
477 masterPtr->interp = interp;
478 masterPtr->imageCmd = Tcl_CreateCommand(interp, name, ImgPhotoCmd,
479 (ClientData) masterPtr, ImgPhotoCmdDeletedProc);
480 masterPtr->palette = NULL;
481 masterPtr->pix24 = NULL;
482 masterPtr->instancePtr = NULL;
483 masterPtr->validRegion = TkCreateRegion();
489 if (ImgPhotoConfigureMaster(interp, masterPtr, argc, argv, 0) != TCL_OK) {
490 ImgPhotoDelete((ClientData) masterPtr);
503 Tcl_SetHashValue(entry, masterPtr);
505 *clientDataPtr = (ClientData) masterPtr;
535 PhotoMaster *masterPtr = (PhotoMaster *) clientData;
571 Tk_PhotoBlank(masterPtr);
586 (char *) masterPtr, argv[2], 0);
595 configSpecs, (char *) masterPtr, (char *) NULL, 0);
599 configSpecs, (char *) masterPtr, argv[2], 0);
601 return ImgPhotoConfigureMaster(interp, masterPtr, argc-2, argv+2,
683 ImgPhotoSetSize(masterPtr, options.toX2, options.toY2);
694 Tk_PhotoPutZoomedBlock((Tk_PhotoHandle) masterPtr, &block,
713 if ((x < 0) || (x >= masterPtr->width)
714 || (y < 0) || (y >= masterPtr->height)) {
724 pixelPtr = masterPtr->pix24 + (y * masterPtr->width + x) * 3;
815 Tk_PhotoPutBlock((ClientData)masterPtr, &block,
889 ImgPhotoSetSize(masterPtr, options.toX + width,
899 options.format, (Tk_PhotoHandle) masterPtr, options.toX,
914 x = masterPtr->ditherX;
915 y = masterPtr->ditherY;
916 if (masterPtr->ditherX != 0) {
917 Dither(masterPtr, x, y, masterPtr->width - x, 1);
919 if (masterPtr->ditherY < masterPtr->height) {
921 Dither(masterPtr, 0, masterPtr->ditherY, masterPtr->width,
922 masterPtr->height - masterPtr->ditherY);
925 if (y < masterPtr->height) {
930 Tk_ImageChanged(masterPtr->tkMaster, x, y,
931 (masterPtr->width - x), (masterPtr->height - y),
932 masterPtr->width, masterPtr->height);
959 if ((options.fromX > masterPtr->width)
960 || (options.fromY > masterPtr->height)
961 || (options.fromX2 > masterPtr->width)
962 || (options.fromY2 > masterPtr->height)) {
973 options.fromX2 = masterPtr->width;
974 options.fromY2 = masterPtr->height;
1014 Tk_PhotoGetImage((Tk_PhotoHandle) masterPtr, &block);
1265 * an error message is left in masterPtr->interp->result.
1275 ImgPhotoConfigureMaster(interp, masterPtr, argc, argv, flags)
1277 PhotoMaster *masterPtr; /* Pointer to data structure describing
1298 oldFileString = masterPtr->fileString;
1299 oldDataString = (oldFileString == NULL)? masterPtr->dataString: NULL;
1300 oldPaletteString = masterPtr->palette;
1301 oldGamma = masterPtr->gamma;
1308 argc, argv, (char *) masterPtr, flags) != TCL_OK) {
1317 if ((masterPtr->fileString != NULL) && (masterPtr->fileString[0] == 0)) {
1318 ckfree(masterPtr->fileString);
1319 masterPtr->fileString = NULL;
1321 if ((masterPtr->dataString != NULL) && (masterPtr->dataString[0] == 0)) {
1322 ckfree(masterPtr->dataString);
1323 masterPtr->dataString = NULL;
1325 if ((masterPtr->format != NULL) && (masterPtr->format[0] == 0)) {
1326 ckfree(masterPtr->format);
1327 masterPtr->format = NULL;
1335 ImgPhotoSetSize(masterPtr, masterPtr->width, masterPtr->height);
1342 if ((masterPtr->fileString != NULL)
1343 && (masterPtr->fileString != oldFileString)) {
1345 realFileName = Tcl_TranslateFileName(interp, masterPtr->fileString,
1354 masterPtr->fileString, "\": ", Tcl_PosixError(interp),
1358 if (MatchFileFormat(interp, f, masterPtr->fileString,
1359 masterPtr->format, &imageFormat, &imageWidth,
1364 ImgPhotoSetSize(masterPtr, imageWidth, imageHeight);
1365 result = (*imageFormat->fileReadProc)(interp, f, masterPtr->fileString,
1366 masterPtr->format, (Tk_PhotoHandle) masterPtr, 0, 0,
1373 masterPtr->flags |= IMAGE_CHANGED;
1376 if ((masterPtr->fileString == NULL) && (masterPtr->dataString != NULL)
1377 && (masterPtr->dataString != oldDataString)) {
1379 if (MatchStringFormat(interp, masterPtr->dataString,
1380 masterPtr->format, &imageFormat, &imageWidth,
1384 ImgPhotoSetSize(masterPtr, imageWidth, imageHeight);
1385 if ((*imageFormat->stringReadProc)(interp, masterPtr->dataString,
1386 masterPtr->format, (Tk_PhotoHandle) masterPtr,
1391 masterPtr->flags |= IMAGE_CHANGED;
1398 if (masterPtr->gamma <= 0) {
1399 masterPtr->gamma = 1.0;
1402 if ((masterPtr->gamma != oldGamma)
1403 || (masterPtr->palette != oldPaletteString)) {
1404 masterPtr->flags |= IMAGE_CHANGED;
1413 for (instancePtr = masterPtr->instancePtr; instancePtr != NULL;
1423 Tk_ImageChanged(masterPtr->tkMaster, 0, 0, masterPtr->width,
1424 masterPtr->height, masterPtr->width, masterPtr->height);
1425 masterPtr->flags &= ~IMAGE_CHANGED;
1455 PhotoMaster *masterPtr = instancePtr->masterPtr;
1468 if ((masterPtr->palette && masterPtr->palette[0])
1469 && IsValidPalette(instancePtr, masterPtr->palette)) {
1470 instancePtr->palette = masterPtr->palette;
1474 instancePtr->gamma = masterPtr->gamma;
1552 || (instancePtr->width != masterPtr->width)
1553 || (instancePtr->height != masterPtr->height)) {
1561 if ((masterPtr->flags & IMAGE_CHANGED)
1563 TkClipBox(masterPtr->validRegion, &validBox);
1599 PhotoMaster *masterPtr = (PhotoMaster *) masterData;
1638 for (instancePtr = masterPtr->instancePtr; instancePtr != NULL;
1669 instancePtr->masterPtr = masterPtr;
1680 instancePtr->nextPtr = masterPtr->instancePtr;
1681 masterPtr->instancePtr = instancePtr;
1739 white = Tk_GetColor(masterPtr->interp, tkwin, "white");
1740 black = Tk_GetColor(masterPtr->interp, tkwin, "black");
1760 Tk_ImageChanged(masterPtr->tkMaster, 0, 0, 0, 0,
1761 masterPtr->width, masterPtr->height);
1768 TkClipBox(masterPtr->validRegion, &validBox);
1819 * masterPtr->region describes which parts of the image contain
1825 TkSetRegion(display, instancePtr->gc, instancePtr->masterPtr->validRegion);
1907 PhotoMaster *masterPtr = (PhotoMaster *) masterData;
1910 while ((instancePtr = masterPtr->instancePtr) != NULL) {
1917 masterPtr->tkMaster = NULL;
1918 if (masterPtr->imageCmd != NULL) {
1919 Tcl_DeleteCommand(masterPtr->interp,
1920 Tcl_GetCommandName(masterPtr->interp, masterPtr->imageCmd));
1922 if (masterPtr->pix24 != NULL) {
1923 ckfree((char *) masterPtr->pix24);
1925 if (masterPtr->validRegion != NULL) {
1926 TkDestroyRegion(masterPtr->validRegion);
1928 Tk_FreeOptions(configSpecs, (char *) masterPtr, (Display *) NULL, 0);
1929 ckfree((char *) masterPtr);
1955 PhotoMaster *masterPtr = (PhotoMaster *) clientData;
1957 masterPtr->imageCmd = NULL;
1958 if (masterPtr->tkMaster != NULL) {
1959 Tk_DeleteImage(masterPtr->interp, Tk_NameOfImage(masterPtr->tkMaster));
1983 ImgPhotoSetSize(masterPtr, width, height)
1984 PhotoMaster *masterPtr;
1994 if (masterPtr->userWidth > 0) {
1995 width = masterPtr->userWidth;
1997 if (masterPtr->userHeight > 0) {
1998 height = masterPtr->userHeight;
2006 TkClipBox(masterPtr->validRegion, &validBox);
2015 TkIntersectRegion(masterPtr->validRegion, clipRegion,
2016 masterPtr->validRegion);
2018 TkClipBox(masterPtr->validRegion, &validBox);
2021 if ((width != masterPtr->width) || (height != masterPtr->height)
2022 || (masterPtr->pix24 == NULL)) {
2038 if ((masterPtr->pix24 != NULL)
2039 && ((width == masterPtr->width) || (width == validBox.width))) {
2052 if (masterPtr->pix24 != NULL) {
2059 if (width == masterPtr->width) {
2067 (VOID *) (masterPtr->pix24 + offset),
2077 srcPtr = masterPtr->pix24 + (validBox.y * masterPtr->width
2083 srcPtr += masterPtr->width * 3;
2087 ckfree((char *) masterPtr->pix24);
2090 masterPtr->pix24 = newPix24;
2091 masterPtr->width = width;
2092 masterPtr->height = height;
2100 masterPtr->ditherX = 0;
2101 masterPtr->ditherY = 0;
2103 if ((int) validBox.height < masterPtr->ditherY) {
2104 masterPtr->ditherX = 0;
2105 masterPtr->ditherY = validBox.height;
2108 if ((masterPtr->ditherY > 0)
2109 || ((int) validBox.width < masterPtr->ditherX)) {
2110 masterPtr->ditherX = validBox.width;
2111 masterPtr->ditherY = 0;
2120 for (instancePtr = masterPtr->instancePtr; instancePtr != NULL;
2150 PhotoMaster *masterPtr;
2157 masterPtr = instancePtr->masterPtr;
2158 TkClipBox(masterPtr->validRegion, &validBox);
2160 if ((instancePtr->width != masterPtr->width)
2161 || (instancePtr->height != masterPtr->height)
2166 (masterPtr->width > 0) ? masterPtr->width: 1,
2167 (masterPtr->height > 0) ? masterPtr->height: 1,
2193 if ((instancePtr->width != masterPtr->width)
2194 || (instancePtr->height != masterPtr->height)
2198 (masterPtr->height * masterPtr->width * 3 * sizeof(schar)));
2206 && ((instancePtr->width == masterPtr->width)
2207 || (validBox.width == masterPtr->width))) {
2210 (validBox.y * masterPtr->width * 3 * sizeof(schar)));
2213 if (h < masterPtr->height) {
2214 memset((VOID *) (newError + h * masterPtr->width * 3), 0,
2215 (size_t) ((masterPtr->height - h)
2216 * masterPtr->width * 3 * sizeof(schar)));
2220 (masterPtr->height * masterPtr->width * 3 * sizeof(schar)));
2230 if (masterPtr->width == instancePtr->width) {
2232 offset = validBox.y * masterPtr->width * 3;
2236 * masterPtr->width * 3 * sizeof(schar)));
2241 + (validBox.y * masterPtr->width + validBox.x) * 3;
2247 errDestPtr += masterPtr->width * 3;
2257 instancePtr->width = masterPtr->width;
2258 instancePtr->height = masterPtr->height;
2984 if (instancePtr->masterPtr->instancePtr == instancePtr) {
2985 instancePtr->masterPtr->instancePtr = instancePtr->nextPtr;
2987 for (prevPtr = instancePtr->masterPtr->instancePtr;
3234 register PhotoMaster *masterPtr;
3244 masterPtr = (PhotoMaster *) handle;
3246 if ((masterPtr->userWidth != 0) && ((x + width) > masterPtr->userWidth)) {
3247 width = masterPtr->userWidth - x;
3249 if ((masterPtr->userHeight != 0)
3250 && ((y + height) > masterPtr->userHeight)) {
3251 height = masterPtr->userHeight - y;
3258 if ((xEnd > masterPtr->width) || (yEnd > masterPtr->height)) {
3259 ImgPhotoSetSize(masterPtr, MAX(xEnd, masterPtr->width),
3260 MAX(yEnd, masterPtr->height));
3263 if ((y < masterPtr->ditherY) || ((y == masterPtr->ditherY)
3264 && (x < masterPtr->ditherX))) {
3268 masterPtr->ditherX = x;
3269 masterPtr->ditherY = y;
3280 masterPtr->flags |= COLOR_IMAGE;
3288 destLinePtr = masterPtr->pix24 + (y * masterPtr->width + x) * 3;
3289 pitch = masterPtr->width * 3;
3293 && ((height == 1) || ((x == 0) && (width == masterPtr->width)
3330 TkUnionRectWithRegion(&rect, masterPtr->validRegion,
3331 masterPtr->validRegion);
3337 Dither(masterPtr, x, y, width, height);
3343 Tk_ImageChanged(masterPtr->tkMaster, x, y, width, height, masterPtr->width,
3344 masterPtr->height);
3381 register PhotoMaster *masterPtr;
3400 masterPtr = (PhotoMaster *) handle;
3404 if ((masterPtr->userWidth != 0) && ((x + width) > masterPtr->userWidth)) {
3405 width = masterPtr->userWidth - x;
3407 if ((masterPtr->userHeight != 0)
3408 && ((y + height) > masterPtr->userHeight)) {
3409 height = masterPtr->userHeight - y;
3416 if ((xEnd > masterPtr->width) || (yEnd > masterPtr->height)) {
3417 int sameSrc = (blockPtr->pixelPtr == masterPtr->pix24);
3418 ImgPhotoSetSize(masterPtr, MAX(xEnd, masterPtr->width),
3419 MAX(yEnd, masterPtr->height));
3421 blockPtr->pixelPtr = masterPtr->pix24;
3425 if ((y < masterPtr->ditherY) || ((y == masterPtr->ditherY)
3426 && (x < masterPtr->ditherX))) {
3431 masterPtr->ditherX = x;
3432 masterPtr->ditherY = y;
3443 masterPtr->flags |= COLOR_IMAGE;
3470 destLinePtr = masterPtr->pix24 + (y * masterPtr->width + x) * 3;
3479 pitch = masterPtr->width * 3;
3517 TkUnionRectWithRegion(&rect, masterPtr->validRegion,
3518 masterPtr->validRegion);
3524 Dither(masterPtr, x, y, width, height);
3530 Tk_ImageChanged(masterPtr->tkMaster, x, y, width, height, masterPtr->width,
3531 masterPtr->height);
3548 * The fields in *masterPtr indicating which area of the image
3555 Dither(masterPtr, x, y, width, height)
3556 PhotoMaster *masterPtr; /* Image master whose instances are
3568 for (instancePtr = masterPtr->instancePtr; instancePtr != NULL;
3578 if (((y < masterPtr->ditherY)
3579 || ((y == masterPtr->ditherY) && (x <= masterPtr->ditherX)))
3580 && ((y + height) > (masterPtr->ditherY))) {
3585 * Furthermore this block extends into scanline masterPtr->ditherY.
3588 if ((x == 0) && (width == masterPtr->width)) {
3594 masterPtr->ditherX = 0;
3595 masterPtr->ditherY = y + height;
3603 if (x <= masterPtr->ditherX) {
3604 masterPtr->ditherX = x + width;
3605 if (masterPtr->ditherX >= masterPtr->width) {
3606 masterPtr->ditherX = 0;
3607 masterPtr->ditherY++;
3640 PhotoMaster *masterPtr;
3656 masterPtr = instancePtr->masterPtr;
3702 lineLength = masterPtr->width * 3;
3703 srcLinePtr = masterPtr->pix24 + yStart * lineLength + xStart * 3;
3754 if ((x + 1) < masterPtr->width) {
3825 if (x + 1 < masterPtr->width) {
3831 if ((masterPtr->flags & COLOR_IMAGE) == 0) {
3887 if (x + 1 < masterPtr->width) {
3893 if ((masterPtr->flags & COLOR_IMAGE) == 0) {
3960 PhotoMaster *masterPtr;
3963 masterPtr = (PhotoMaster *) handle;
3964 masterPtr->ditherX = masterPtr->ditherY = 0;
3965 masterPtr->flags = 0;
3971 if (masterPtr->validRegion != NULL) {
3972 TkDestroyRegion(masterPtr->validRegion);
3974 masterPtr->validRegion = TkCreateRegion();
3981 memset((VOID *) masterPtr->pix24, 0,
3982 (size_t) (masterPtr->width * masterPtr->height));
3983 for (instancePtr = masterPtr->instancePtr; instancePtr != NULL;
3986 (size_t) (masterPtr->width * masterPtr->height
3994 Tk_ImageChanged(masterPtr->tkMaster, 0, 0, masterPtr->width,
3995 masterPtr->height, masterPtr->width, masterPtr->height);
4025 PhotoMaster *masterPtr;
4027 masterPtr = (PhotoMaster *) handle;
4029 if (width <= masterPtr->width) {
4030 width = masterPtr->width;
4032 if (height <= masterPtr->height) {
4033 height = masterPtr->height;
4035 if ((width != masterPtr->width) || (height != masterPtr->height)) {
4036 ImgPhotoSetSize(masterPtr, MAX(width, masterPtr->width),
4037 MAX(height, masterPtr->height));
4038 Tk_ImageChanged(masterPtr->tkMaster, 0, 0, 0, 0, masterPtr->width,
4039 masterPtr->height);
4069 PhotoMaster *masterPtr;
4071 masterPtr = (PhotoMaster *) handle;
4072 *widthPtr = masterPtr->width;
4073 *heightPtr = masterPtr->height;
4102 PhotoMaster *masterPtr;
4104 masterPtr = (PhotoMaster *) handle;
4106 masterPtr->userWidth = width;
4107 masterPtr->userHeight = height;
4108 ImgPhotoSetSize(masterPtr, ((width > 0) ? width: masterPtr->width),
4109 ((height > 0) ? height: masterPtr->height));
4110 Tk_ImageChanged(masterPtr->tkMaster, 0, 0, 0, 0,
4111 masterPtr->width, masterPtr->height);
4143 PhotoMaster *masterPtr;
4145 masterPtr = (PhotoMaster *) handle;
4146 blockPtr->pixelPtr = masterPtr->pix24;
4147 blockPtr->width = masterPtr->width;
4148 blockPtr->height = masterPtr->height;
4149 blockPtr->pitch = masterPtr->width * 3;