| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
#include "bltInt.h" |
| 29 |
#include <X11/Xutil.h> |
| 30 |
#include "bltImage.h" |
| 31 |
|
| 32 |
#define WINDEBUG 0 |
| 33 |
|
| 34 |
static Blt_HashTable bitmapGCTable; |
| 35 |
static int initialized; |
| 36 |
|
| 37 |
int Blt_TextLayoutValue( TextLayout *textPtr, Tcl_DString *dStr) { |
| 38 |
register TextFragment *fragPtr; |
| 39 |
register int i; |
| 40 |
|
| 41 |
fragPtr = textPtr->fragArr; |
| 42 |
for (i = 0; i < textPtr->nFrags; i++, fragPtr++) { |
| 43 |
if (i) { |
| 44 |
Tcl_DStringAppend(dStr, "\n", -1); |
| 45 |
} |
| 46 |
Tcl_DStringAppend(dStr, fragPtr->text, fragPtr->count); |
| 47 |
} |
| 48 |
return i; |
| 49 |
} |
| 50 |
|
| 51 |
void |
| 52 |
Blt_AverageImage(im, w, h, d) |
| 53 |
XImage *im; |
| 54 |
unsigned int w, h, d; |
| 55 |
{ |
| 56 |
|
| 57 |
int i, j, k; |
| 58 |
unsigned int d2; |
| 59 |
unsigned long pixel, pixelave; |
| 60 |
|
| 61 |
d2 = (3*d)/4; |
| 62 |
for (i=0 ; i<w ; i++) { |
| 63 |
for (j=0 ; j<h ; j++) { |
| 64 |
pixel = XGetPixel(im, i, j); |
| 65 |
pixelave = pixel & 1; |
| 66 |
for (k=1 ; k<d ; k++) { |
| 67 |
pixel >>= 1; |
| 68 |
pixelave += pixel & 1; |
| 69 |
} |
| 70 |
pixelave = (pixelave + d2)/d; |
| 71 |
XPutPixel(im, i, j, pixelave); |
| 72 |
} |
| 73 |
} |
| 74 |
return; |
| 75 |
} |
| 76 |
|
| 77 |
#ifndef WIN32 |
| 78 |
static void |
| 79 |
Blt_DrawCharsBitmap(display, bitmap, w, width, height, gc, font, x, y, textPtr) |
| 80 |
Display *display; |
| 81 |
Drawable bitmap; |
| 82 |
Window w; |
| 83 |
unsigned int width, height; |
| 84 |
GC gc; |
| 85 |
Tk_Font font; |
| 86 |
register int x, y; |
| 87 |
TextLayout *textPtr; |
| 88 |
{ |
| 89 |
register TextFragment *fragPtr; |
| 90 |
register int i, j; |
| 91 |
|
| 92 |
XImage *bitmapimage, *pixmapimage; |
| 93 |
GC gcsave, gcp; |
| 94 |
Window winr; |
| 95 |
int xr, yr; |
| 96 |
unsigned int wr, hr, br, dr; |
| 97 |
Pixmap pixmap; |
| 98 |
unsigned long whitepixel; |
| 99 |
XGCValues gcvalues ; |
| 100 |
unsigned long valuemask, pixel ; |
| 101 |
|
| 102 |
|
| 103 |
gcsave = XCreateGC(display, bitmap, 0, NULL); |
| 104 |
XCopyGC(display, gc, 0, gcsave); |
| 105 |
|
| 106 |
XGetGeometry(display, w, &winr, &xr, &yr, &wr, &hr, &br, &dr); |
| 107 |
pixmap = Tk_GetPixmap(display, winr, width, height, dr); |
| 108 |
|
| 109 |
valuemask = (GCForeground|GCBackground) ; |
| 110 |
gcvalues.foreground = gcvalues.background = 0 ; |
| 111 |
gcp = XCreateGC(display, pixmap, valuemask, &gcvalues); |
| 112 |
XSetForeground(display, gcp, 0) ; |
| 113 |
XFillRectangle(display, pixmap, gcp, 0, 0, width, height); |
| 114 |
whitepixel = XWhitePixel(display, 0); |
| 115 |
XSetForeground(display, gcp, whitepixel) ; |
| 116 |
|
| 117 |
fragPtr = textPtr->fragArr; |
| 118 |
for (i = 0; i < textPtr->nFrags; i++, fragPtr++) { |
| 119 |
Tk_DrawChars(display, pixmap, gcp, font, fragPtr->text, |
| 120 |
fragPtr->count, x + fragPtr->x, y + fragPtr->y); |
| 121 |
} |
| 122 |
XFlush(display); |
| 123 |
|
| 124 |
pixmapimage = XGetImage(display, pixmap, 0, 0, width, height, |
| 125 |
AllPlanes, XYPixmap); |
| 126 |
|
| 127 |
Blt_AverageImage(pixmapimage, width, height, dr); |
| 128 |
|
| 129 |
bitmapimage = XGetImage(display, bitmap, 0, 0, width, height, |
| 130 |
1, XYPixmap); |
| 131 |
|
| 132 |
for (i=0 ; i<width ; i++) { |
| 133 |
for(j=0 ; j<height ; j++) { |
| 134 |
pixel = XGetPixel(pixmapimage, i, j); |
| 135 |
XPutPixel(bitmapimage, i, j, pixel); |
| 136 |
} |
| 137 |
} |
| 138 |
|
| 139 |
XSetForeground(display, gc, 1); |
| 140 |
XSetBackground(display, gc, 0); |
| 141 |
XSetClipMask(display, gc, None); |
| 142 |
XPutImage(display, bitmap, gc, bitmapimage, 0, 0, 0, 0, width, height); |
| 143 |
|
| 144 |
XCopyGC(display, gcsave, 0, gc); |
| 145 |
XFreeGC(display, gcp); |
| 146 |
XFreeGC(display, gcsave); |
| 147 |
XDestroyImage(bitmapimage); |
| 148 |
XDestroyImage(pixmapimage); |
| 149 |
Tk_FreePixmap(display, pixmap); |
| 150 |
return; |
| 151 |
} |
| 152 |
#endif |
| 153 |
|
| 154 |
static void |
| 155 |
DrawTextLayout(display, drawable, gc, font, x, y, textPtr, tsPtr) |
| 156 |
Display *display; |
| 157 |
Drawable drawable; |
| 158 |
GC gc; |
| 159 |
Tk_Font font; |
| 160 |
register int x, y; |
| 161 |
TextLayout *textPtr; |
| 162 |
TextStyle *tsPtr; |
| 163 |
{ |
| 164 |
register TextFragment *fragPtr; |
| 165 |
register int i; |
| 166 |
int n, u, ml, noxft = 0; |
| 167 |
|
| 168 |
n = 0, ml = 3000; |
| 169 |
fragPtr = textPtr->fragArr; |
| 170 |
|
| 171 |
for (i = 0; i < textPtr->nFrags; i++, fragPtr++) { |
| 172 |
|
| 173 |
|
| 174 |
#if HAVE_UTF |
| 175 |
if (textPtr->rotated == 0 || noxft ) { |
| 176 |
Tk_DrawChars(display, drawable, gc, font, fragPtr->text, |
| 177 |
fragPtr->count, x + fragPtr->x, y + fragPtr->y); |
| 178 |
} else { |
| 179 |
#ifdef WIN32 |
| 180 |
Tk_DrawChars(display, drawable, gc, font, fragPtr->text, |
| 181 |
fragPtr->count, x + fragPtr->x, y + fragPtr->y); |
| 182 |
#else |
| 183 |
|
| 184 |
|
| 185 |
|
| 186 |
|
| 187 |
|
| 188 |
|
| 189 |
|
| 190 |
|
| 191 |
Window w; |
| 192 |
int xd, yd; |
| 193 |
unsigned int wd, hd, bd, dd; |
| 194 |
XGetGeometry(display, drawable, &w, &xd, &yd, &wd, &hd, &bd, &dd); |
| 195 |
if ( dd == 1 ) { |
| 196 |
Blt_DrawCharsBitmap(display, drawable, w, wd, hd, gc, font, |
| 197 |
x, y, textPtr); |
| 198 |
return; |
| 199 |
} |
| 200 |
fragPtr = textPtr->fragArr; |
| 201 |
for (i = 0; i < textPtr->nFrags; i++, fragPtr++) { |
| 202 |
Tk_DrawChars(display, drawable, gc, font, fragPtr->text, |
| 203 |
fragPtr->count, x + fragPtr->x, y + fragPtr->y); |
| 204 |
} |
| 205 |
#endif |
| 206 |
} |
| 207 |
#else |
| 208 |
XDrawString(display, drawable, gc, x + fragPtr->x, y + fragPtr->y, |
| 209 |
fragPtr->text, fragPtr->count); |
| 210 |
#endif |
| 211 |
u = tsPtr->underline; |
| 212 |
if (u >= 0 && u < (n + fragPtr->count) && fragPtr->count>0) { |
| 213 |
int cw = (fragPtr->width / fragPtr->count); |
| 214 |
int x1a = x + fragPtr->x + (cw * (u - n)); |
| 215 |
int y1a = y + fragPtr->y + 2; |
| 216 |
int x2a = x1a + cw; |
| 217 |
int y2a = y1a; |
| 218 |
XDrawLine(display, drawable, gc, x1a, y1a, x2a, y2a); |
| 219 |
} |
| 220 |
if (i>ml) break; |
| 221 |
n += fragPtr->count; |
| 222 |
} |
| 223 |
} |
| 224 |
|
| 225 |
|
| 226 |
|
| 227 |
|
| 228 |
|
| 229 |
|
| 230 |
|
| 231 |
|
| 232 |
|
| 233 |
|
| 234 |
|
| 235 |
|
| 236 |
|
| 237 |
|
| 238 |
static TextLayout * |
| 239 |
bltGetTextLayoutStr(string, tsPtr, store) |
| 240 |
char string[]; |
| 241 |
TextStyle *tsPtr; |
| 242 |
int store; |
| 243 |
{ |
| 244 |
int maxHeight, maxWidth; |
| 245 |
int count; |
| 246 |
int nFrags; |
| 247 |
int width; |
| 248 |
TextFragment *fragPtr; |
| 249 |
TextLayout *textPtr; |
| 250 |
int lineHeight; |
| 251 |
int size, len, maxW, maxH, maxC; |
| 252 |
register char *p; |
| 253 |
register int i; |
| 254 |
Tk_FontMetrics fontMetrics; |
| 255 |
|
| 256 |
maxW = ((1<<(8*sizeof(fragPtr->width)))/2-101); |
| 257 |
maxH = ((1<<(8*sizeof(textPtr->height)))/2-101); |
| 258 |
maxC = ((1<<(8*sizeof(fragPtr->count)))/2-101); |
| 259 |
Tk_GetFontMetrics(tsPtr->font, &fontMetrics); |
| 260 |
lineHeight = fontMetrics.linespace + |
| 261 |
tsPtr->leader + tsPtr->shadow.offset; |
| 262 |
nFrags = 0; |
| 263 |
for (p = string; *p != '\0'; p++) { |
| 264 |
if (*p == '\n') { |
| 265 |
nFrags++; |
| 266 |
} |
| 267 |
} |
| 268 |
if ((p != string) && (*(p - 1) != '\n')) { |
| 269 |
nFrags++; |
| 270 |
} |
| 271 |
len = strlen(string); |
| 272 |
size = sizeof(TextLayout) + (sizeof(TextFragment) * (nFrags - 1)); |
| 273 |
if (store) { |
| 274 |
size += len+1; |
| 275 |
} |
| 276 |
textPtr = Blt_Calloc(1, size); |
| 277 |
if (store) { |
| 278 |
p = (char*)textPtr; |
| 279 |
strcpy(p+size-len-1, string); |
| 280 |
string = p+size-len-1; |
| 281 |
} |
| 282 |
if (tsPtr->theta != 0.0) { |
| 283 |
#ifndef WIN32 |
| 284 |
|
| 285 |
textPtr->rotated = 1; |
| 286 |
#endif |
| 287 |
} |
| 288 |
textPtr->nFrags = nFrags; |
| 289 |
nFrags = count = 0; |
| 290 |
width = maxWidth = 0; |
| 291 |
maxHeight = tsPtr->padTop; |
| 292 |
fragPtr = textPtr->fragArr; |
| 293 |
for (p = string; *p != '\0'; p++) { |
| 294 |
if (*p == '\n') { |
| 295 |
if (count > 0) { |
| 296 |
width = Tk_TextWidth(tsPtr->font, string, count) + |
| 297 |
tsPtr->shadow.offset; |
| 298 |
if (width >= maxW) { |
| 299 |
width = maxW; |
| 300 |
} |
| 301 |
if (width > maxWidth) { |
| 302 |
maxWidth = width; |
| 303 |
} |
| 304 |
} |
| 305 |
fragPtr->width = width; |
| 306 |
fragPtr->count = (count>maxC?maxC:count); |
| 307 |
fragPtr->y = maxHeight + fontMetrics.ascent; |
| 308 |
fragPtr->text = string; |
| 309 |
fragPtr++; |
| 310 |
nFrags++; |
| 311 |
maxHeight += lineHeight; |
| 312 |
string = p + 1; |
| 313 |
count = 0; |
| 314 |
if (maxHeight>0xff00 && (sizeof(tsPtr->height)==2)) break; |
| 315 |
continue; |
| 316 |
} |
| 317 |
count++; |
| 318 |
} |
| 319 |
if (nFrags < textPtr->nFrags) { |
| 320 |
width = Tk_TextWidth(tsPtr->font, string, count) + tsPtr->shadow.offset; |
| 321 |
if (width >= maxW) { |
| 322 |
width = maxW; |
| 323 |
} |
| 324 |
if (width > maxWidth) { |
| 325 |
maxWidth = width; |
| 326 |
} |
| 327 |
fragPtr->width = width; |
| 328 |
fragPtr->count = (count>maxC?maxC:count); |
| 329 |
fragPtr->y = maxHeight + fontMetrics.ascent; |
| 330 |
fragPtr->text = string; |
| 331 |
maxHeight += lineHeight; |
| 332 |
nFrags++; |
| 333 |
} |
| 334 |
maxHeight += tsPtr->padBottom; |
| 335 |
maxWidth += PADDING(tsPtr->padX); |
| 336 |
fragPtr = textPtr->fragArr; |
| 337 |
for (i = 0; i < nFrags; i++, fragPtr++) { |
| 338 |
switch (tsPtr->justify) { |
| 339 |
default: |
| 340 |
case TK_JUSTIFY_LEFT: |
| 341 |
|
| 342 |
fragPtr->x = tsPtr->padLeft; |
| 343 |
break; |
| 344 |
case TK_JUSTIFY_RIGHT: |
| 345 |
fragPtr->x = (maxWidth - fragPtr->width) - tsPtr->padRight; |
| 346 |
break; |
| 347 |
case TK_JUSTIFY_CENTER: |
| 348 |
fragPtr->x = (maxWidth - fragPtr->width) / 2; |
| 349 |
break; |
| 350 |
} |
| 351 |
} |
| 352 |
textPtr->width = maxWidth; |
| 353 |
if (maxHeight >= maxH) { |
| 354 |
maxHeight = maxH; |
| 355 |
} |
| 356 |
textPtr->height = maxHeight - tsPtr->leader; |
| 357 |
return textPtr; |
| 358 |
} |
| 359 |
|
| 360 |
TextLayout * |
| 361 |
Blt_GetTextLayoutStr(string, tsPtr) |
| 362 |
char string[]; |
| 363 |
TextStyle *tsPtr; |
| 364 |
{ |
| 365 |
return bltGetTextLayoutStr(string, tsPtr, 1); |
| 366 |
} |
| 367 |
|
| 368 |
TextLayout * |
| 369 |
Blt_GetTextLayout(string, tsPtr) |
| 370 |
char string[]; |
| 371 |
TextStyle *tsPtr; |
| 372 |
{ |
| 373 |
return bltGetTextLayoutStr(string, tsPtr, 0); |
| 374 |
} |
| 375 |
|
| 376 |
|
| 377 |
|
| 378 |
|
| 379 |
|
| 380 |
|
| 381 |
|
| 382 |
|
| 383 |
|
| 384 |
|
| 385 |
|
| 386 |
|
| 387 |
|
| 388 |
|
| 389 |
void |
| 390 |
Blt_GetTextExtents(tsPtr, string, widthPtr, heightPtr) |
| 391 |
TextStyle *tsPtr; |
| 392 |
char *string; |
| 393 |
int *widthPtr, *heightPtr; |
| 394 |
{ |
| 395 |
int count; |
| 396 |
int width, height; |
| 397 |
int w, lineHeight; |
| 398 |
register char *p; |
| 399 |
Tk_FontMetrics fontMetrics; |
| 400 |
|
| 401 |
if (string == NULL) { |
| 402 |
return; |
| 403 |
} |
| 404 |
Tk_GetFontMetrics(tsPtr->font, &fontMetrics); |
| 405 |
lineHeight = fontMetrics.linespace + tsPtr->leader + tsPtr->shadow.offset; |
| 406 |
count = 0; |
| 407 |
width = height = 0; |
| 408 |
for (p = string; *p != '\0'; p++) { |
| 409 |
if (*p == '\n') { |
| 410 |
if (count > 0) { |
| 411 |
w = Tk_TextWidth(tsPtr->font, string, count) + |
| 412 |
tsPtr->shadow.offset; |
| 413 |
if (w > width) { |
| 414 |
width = w; |
| 415 |
} |
| 416 |
} |
| 417 |
height += lineHeight; |
| 418 |
string = p + 1; |
| 419 |
count = 0; |
| 420 |
continue; |
| 421 |
} |
| 422 |
count++; |
| 423 |
} |
| 424 |
if ((count > 0) && (*(p - 1) != '\n')) { |
| 425 |
height += lineHeight; |
| 426 |
w = Tk_TextWidth(tsPtr->font, string, count) + tsPtr->shadow.offset; |
| 427 |
if (w > width) { |
| 428 |
width = w; |
| 429 |
} |
| 430 |
} |
| 431 |
*widthPtr = width + PADDING(tsPtr->padX); |
| 432 |
*heightPtr = height + PADDING(tsPtr->padY); |
| 433 |
} |
| 434 |
|
| 435 |
|
| 436 |
|
| 437 |
|
| 438 |
|
| 439 |
|
| 440 |
|
| 441 |
|
| 442 |
|
| 443 |
|
| 444 |
|
| 445 |
|
| 446 |
|
| 447 |
|
| 448 |
|
| 449 |
|
| 450 |
|
| 451 |
|
| 452 |
|
| 453 |
|
| 454 |
|
| 455 |
|
| 456 |
|
| 457 |
|
| 458 |
|
| 459 |
|
| 460 |
|
| 461 |
|
| 462 |
|
| 463 |
|
| 464 |
void |
| 465 |
Blt_GetBoundingBox(width, height, theta, rotWidthPtr, rotHeightPtr, bbox) |
| 466 |
int width, height; |
| 467 |
double theta; |
| 468 |
double *rotWidthPtr, *rotHeightPtr; |
| 469 |
Point2D *bbox; |
| 470 |
{ |
| 471 |
register int i; |
| 472 |
double sinTheta, cosTheta; |
| 473 |
double xMax, yMax; |
| 474 |
register double x, y; |
| 475 |
Point2D corner[4]; |
| 476 |
|
| 477 |
theta = FMOD(theta, 360.0); |
| 478 |
if (FMOD(theta, (double)90.0) == 0.0) { |
| 479 |
int ll, ur, ul, lr; |
| 480 |
double rotWidth, rotHeight; |
| 481 |
int quadrant; |
| 482 |
|
| 483 |
|
| 484 |
|
| 485 |
quadrant = (int)(theta / 90.0); |
| 486 |
switch (quadrant) { |
| 487 |
case ROTATE_270: |
| 488 |
ul = 3, ur = 0, lr = 1, ll = 2; |
| 489 |
rotWidth = (double)height; |
| 490 |
rotHeight = (double)width; |
| 491 |
break; |
| 492 |
case ROTATE_90: |
| 493 |
ul = 1, ur = 2, lr = 3, ll = 0; |
| 494 |
rotWidth = (double)height; |
| 495 |
rotHeight = (double)width; |
| 496 |
break; |
| 497 |
case ROTATE_180: |
| 498 |
ul = 2, ur = 3, lr = 0, ll = 1; |
| 499 |
rotWidth = (double)width; |
| 500 |
rotHeight = (double)height; |
| 501 |
break; |
| 502 |
default: |
| 503 |
case ROTATE_0: |
| 504 |
ul = 0, ur = 1, lr = 2, ll = 3; |
| 505 |
rotWidth = (double)width; |
| 506 |
rotHeight = (double)height; |
| 507 |
break; |
| 508 |
} |
| 509 |
if (bbox != NULL) { |
| 510 |
x = rotWidth * 0.5; |
| 511 |
y = rotHeight * 0.5; |
| 512 |
bbox[ll].x = bbox[ul].x = -x; |
| 513 |
bbox[ur].y = bbox[ul].y = -y; |
| 514 |
bbox[lr].x = bbox[ur].x = x; |
| 515 |
bbox[ll].y = bbox[lr].y = y; |
| 516 |
} |
| 517 |
*rotWidthPtr = rotWidth; |
| 518 |
*rotHeightPtr = rotHeight; |
| 519 |
return; |
| 520 |
} |
| 521 |
|
| 522 |
|
| 523 |
corner[1].x = corner[2].x = (double)width *0.5; |
| 524 |
corner[0].x = corner[3].x = -corner[1].x; |
| 525 |
corner[2].y = corner[3].y = (double)height *0.5; |
| 526 |
corner[0].y = corner[1].y = -corner[2].y; |
| 527 |
|
| 528 |
theta = (-theta / 180.0) * M_PI; |
| 529 |
sinTheta = sin(theta), cosTheta = cos(theta); |
| 530 |
xMax = yMax = 0.0; |
| 531 |
|
| 532 |
|
| 533 |
|
| 534 |
for (i = 0; i < 4; i++) { |
| 535 |
x = (corner[i].x * cosTheta) - (corner[i].y * sinTheta); |
| 536 |
y = (corner[i].x * sinTheta) + (corner[i].y * cosTheta); |
| 537 |
if (x > xMax) { |
| 538 |
xMax = x; |
| 539 |
} |
| 540 |
if (y > yMax) { |
| 541 |
yMax = y; |
| 542 |
} |
| 543 |
if (bbox != NULL) { |
| 544 |
bbox[i].x = x; |
| 545 |
bbox[i].y = y; |
| 546 |
} |
| 547 |
} |
| 548 |
|
| 549 |
|
| 550 |
|
| 551 |
|
| 552 |
|
| 553 |
*rotWidthPtr = xMax + xMax; |
| 554 |
*rotHeightPtr = yMax + yMax; |
| 555 |
} |
| 556 |
|
| 557 |
|
| 558 |
|
| 559 |
|
| 560 |
|
| 561 |
|
| 562 |
|
| 563 |
|
| 564 |
|
| 565 |
|
| 566 |
|
| 567 |
|
| 568 |
|
| 569 |
|
| 570 |
|
| 571 |
|
| 572 |
|
| 573 |
|
| 574 |
|
| 575 |
|
| 576 |
|
| 577 |
|
| 578 |
|
| 579 |
|
| 580 |
void |
| 581 |
Blt_TranslateAnchor(x, y, width, height, anchor, transXPtr, transYPtr) |
| 582 |
int x, y; |
| 583 |
int width, height; |
| 584 |
Tk_Anchor anchor; |
| 585 |
int *transXPtr, *transYPtr; |
| 586 |
{ |
| 587 |
switch (anchor) { |
| 588 |
case TK_ANCHOR_NW: |
| 589 |
break; |
| 590 |
case TK_ANCHOR_W: |
| 591 |
y -= (height / 2); |
| 592 |
break; |
| 593 |
case TK_ANCHOR_SW: |
| 594 |
y -= height; |
| 595 |
break; |
| 596 |
case TK_ANCHOR_N: |
| 597 |
x -= (width / 2); |
| 598 |
break; |
| 599 |
case TK_ANCHOR_CENTER: |
| 600 |
x -= (width / 2); |
| 601 |
y -= (height / 2); |
| 602 |
break; |
| 603 |
case TK_ANCHOR_S: |
| 604 |
x -= (width / 2); |
| 605 |
y -= height; |
| 606 |
break; |
| 607 |
case TK_ANCHOR_NE: |
| 608 |
x -= width; |
| 609 |
break; |
| 610 |
case TK_ANCHOR_E: |
| 611 |
x -= width; |
| 612 |
y -= (height / 2); |
| 613 |
break; |
| 614 |
case TK_ANCHOR_SE: |
| 615 |
x -= width; |
| 616 |
y -= height; |
| 617 |
break; |
| 618 |
} |
| 619 |
*transXPtr = x; |
| 620 |
*transYPtr = y; |
| 621 |
} |
| 622 |
|
| 623 |
|
| 624 |
|
| 625 |
|
| 626 |
|
| 627 |
|
| 628 |
|
| 629 |
|
| 630 |
|
| 631 |
|
| 632 |
|
| 633 |
|
| 634 |
|
| 635 |
|
| 636 |
|
| 637 |
|
| 638 |
|
| 639 |
|
| 640 |
|
| 641 |
|
| 642 |
|
| 643 |
|
| 644 |
|
| 645 |
|
| 646 |
Point2D |
| 647 |
Blt_TranslatePoint(pointPtr, width, height, anchor) |
| 648 |
Point2D *pointPtr; |
| 649 |
int width, height; |
| 650 |
Tk_Anchor anchor; |
| 651 |
{ |
| 652 |
Point2D trans; |
| 653 |
|
| 654 |
trans = *pointPtr; |
| 655 |
switch (anchor) { |
| 656 |
case TK_ANCHOR_NW: |
| 657 |
break; |
| 658 |
case TK_ANCHOR_W: |
| 659 |
trans.y -= (height * 0.5); |
| 660 |
break; |
| 661 |
case TK_ANCHOR_SW: |
| 662 |
trans.y -= height; |
| 663 |
break; |
| 664 |
case TK_ANCHOR_N: |
| 665 |
trans.x -= (width * 0.5); |
| 666 |
break; |
| 667 |
case TK_ANCHOR_CENTER: |
| 668 |
trans.x -= (width * 0.5); |
| 669 |
trans.y -= (height * 0.5); |
| 670 |
break; |
| 671 |
case TK_ANCHOR_S: |
| 672 |
trans.x -= (width * 0.5); |
| 673 |
trans.y -= height; |
| 674 |
break; |
| 675 |
case TK_ANCHOR_NE: |
| 676 |
trans.x -= width; |
| 677 |
break; |
| 678 |
case TK_ANCHOR_E: |
| 679 |
trans.x -= width; |
| 680 |
trans.y -= (height * 0.5); |
| 681 |
break; |
| 682 |
case TK_ANCHOR_SE: |
| 683 |
trans.x -= width; |
| 684 |
trans.y -= height; |
| 685 |
break; |
| 686 |
} |
| 687 |
return trans; |
| 688 |
} |
| 689 |
|
| 690 |
|
| 691 |
|
| 692 |
|
| 693 |
|
| 694 |
|
| 695 |
|
| 696 |
|
| 697 |
|
| 698 |
|
| 699 |
|
| 700 |
|
| 701 |
|
| 702 |
|
| 703 |
|
| 704 |
|
| 705 |
|
| 706 |
|
| 707 |
Pixmap |
| 708 |
Blt_CreateTextBitmap(tkwin, textPtr, tsPtr, bmWidthPtr, bmHeightPtr) |
| 709 |
Tk_Window tkwin; |
| 710 |
TextLayout *textPtr; |
| 711 |
TextStyle *tsPtr; |
| 712 |
|
| 713 |
int *bmWidthPtr; |
| 714 |
int *bmHeightPtr; |
| 715 |
{ |
| 716 |
int width, height; |
| 717 |
Pixmap bitmap; |
| 718 |
Display *display; |
| 719 |
Window root; |
| 720 |
GC gc; |
| 721 |
#ifdef WIN32 |
| 722 |
HDC hDC; |
| 723 |
TkWinDCState state; |
| 724 |
#endif |
| 725 |
display = Tk_Display(tkwin); |
| 726 |
|
| 727 |
width = textPtr->width; |
| 728 |
height = textPtr->height; |
| 729 |
|
| 730 |
|
| 731 |
root = RootWindow(display, Tk_ScreenNumber(tkwin)); |
| 732 |
bitmap = Tk_GetPixmap(display, root, width, height, 1); |
| 733 |
assert(bitmap != None); |
| 734 |
if (bitmap == None) { |
| 735 |
return None; |
| 736 |
} |
| 737 |
|
| 738 |
gc = Blt_GetBitmapGC(tkwin); |
| 739 |
#ifdef WIN32 |
| 740 |
hDC = TkWinGetDrawableDC(display, bitmap, &state); |
| 741 |
PatBlt(hDC, 0, 0, width, height, WHITENESS); |
| 742 |
TkWinReleaseDrawableDC(bitmap, hDC, &state); |
| 743 |
#else |
| 744 |
XSetForeground(display, gc, 0); |
| 745 |
XFillRectangle(display, bitmap, gc, 0, 0, width, height); |
| 746 |
#endif |
| 747 |
|
| 748 |
XSetFont(display, gc, Tk_FontId(tsPtr->font)); |
| 749 |
XSetForeground(display, gc, 1); |
| 750 |
DrawTextLayout(display, bitmap, gc, tsPtr->font, 0, 0, textPtr, tsPtr); |
| 751 |
|
| 752 |
#ifdef WIN32 |
| 753 |
|
| 754 |
|
| 755 |
|
| 756 |
|
| 757 |
hDC = TkWinGetDrawableDC(display, bitmap, &state); |
| 758 |
PatBlt(hDC, 0, 0, width, height, DSTINVERT); |
| 759 |
TkWinReleaseDrawableDC(bitmap, hDC, &state); |
| 760 |
#endif |
| 761 |
if (tsPtr->theta != 0.0) { |
| 762 |
Pixmap rotBitmap; |
| 763 |
|
| 764 |
|
| 765 |
|
| 766 |
rotBitmap = Blt_RotateBitmap(tkwin, bitmap, width, height, |
| 767 |
tsPtr->theta, bmWidthPtr, bmHeightPtr); |
| 768 |
assert(rotBitmap); |
| 769 |
if (rotBitmap != None) { |
| 770 |
Tk_FreePixmap(display, bitmap); |
| 771 |
return rotBitmap; |
| 772 |
} |
| 773 |
} |
| 774 |
*bmWidthPtr = textPtr->width, *bmHeightPtr = textPtr->height; |
| 775 |
return bitmap; |
| 776 |
} |
| 777 |
|
| 778 |
|
| 779 |
void |
| 780 |
Blt_InitTextStyle(tsPtr) |
| 781 |
TextStyle *tsPtr; |
| 782 |
{ |
| 783 |
|
| 784 |
tsPtr->activeColor = (XColor *)NULL; |
| 785 |
tsPtr->anchor = TK_ANCHOR_CENTER; |
| 786 |
tsPtr->color = (XColor *)NULL; |
| 787 |
tsPtr->font = NULL; |
| 788 |
tsPtr->justify = TK_JUSTIFY_CENTER; |
| 789 |
tsPtr->leader = 0; |
| 790 |
tsPtr->padLeft = tsPtr->padRight = 0; |
| 791 |
tsPtr->padTop = tsPtr->padBottom = 0; |
| 792 |
tsPtr->shadow.color = (XColor *)NULL; |
| 793 |
tsPtr->shadow.offset = 0; |
| 794 |
tsPtr->state = 0; |
| 795 |
tsPtr->theta = 0.0; |
| 796 |
tsPtr->underline = -1; |
| 797 |
} |
| 798 |
|
| 799 |
void |
| 800 |
Blt_SetDrawTextStyle(tsPtr, font, gc, normalColor, activeColor, shadowColor, |
| 801 |
theta, anchor, justify, leader, shadowOffset) |
| 802 |
TextStyle *tsPtr; |
| 803 |
Tk_Font font; |
| 804 |
GC gc; |
| 805 |
XColor *normalColor, *activeColor, *shadowColor; |
| 806 |
double theta; |
| 807 |
Tk_Anchor anchor; |
| 808 |
Tk_Justify justify; |
| 809 |
int leader, shadowOffset; |
| 810 |
{ |
| 811 |
Blt_InitTextStyle(tsPtr); |
| 812 |
tsPtr->activeColor = activeColor; |
| 813 |
tsPtr->anchor = anchor; |
| 814 |
tsPtr->color = normalColor; |
| 815 |
tsPtr->font = font; |
| 816 |
tsPtr->gc = gc; |
| 817 |
tsPtr->justify = justify; |
| 818 |
tsPtr->leader = leader; |
| 819 |
tsPtr->shadow.color = shadowColor; |
| 820 |
tsPtr->shadow.offset = shadowOffset; |
| 821 |
tsPtr->theta = theta; |
| 822 |
} |
| 823 |
|
| 824 |
void |
| 825 |
Blt_SetPrintTextStyle(tsPtr, font, fgColor, activeColor, shadowColor, theta, |
| 826 |
anchor, justify, leader, shadowOffset) |
| 827 |
TextStyle *tsPtr; |
| 828 |
Tk_Font font; |
| 829 |
XColor *fgColor, *activeColor, *shadowColor; |
| 830 |
double theta; |
| 831 |
Tk_Anchor anchor; |
| 832 |
Tk_Justify justify; |
| 833 |
int leader, shadowOffset; |
| 834 |
{ |
| 835 |
Blt_InitTextStyle(tsPtr); |
| 836 |
tsPtr->color = fgColor; |
| 837 |
tsPtr->activeColor = activeColor; |
| 838 |
tsPtr->shadow.color = shadowColor; |
| 839 |
tsPtr->font = font; |
| 840 |
tsPtr->theta = theta; |
| 841 |
tsPtr->anchor = anchor; |
| 842 |
tsPtr->justify = justify; |
| 843 |
tsPtr->leader = leader; |
| 844 |
tsPtr->shadow.offset = shadowOffset; |
| 845 |
} |
| 846 |
|
| 847 |
|
| 848 |
|
| 849 |
|
| 850 |
|
| 851 |
|
| 852 |
|
| 853 |
|
| 854 |
|
| 855 |
|
| 856 |
|
| 857 |
|
| 858 |
|
| 859 |
|
| 860 |
|
| 861 |
|
| 862 |
|
| 863 |
|
| 864 |
|
| 865 |
|
| 866 |
|
| 867 |
|
| 868 |
|
| 869 |
|
| 870 |
void |
| 871 |
Blt_DrawTextLayout(tkwin, drawable, textPtr, tsPtr, x, y) |
| 872 |
Tk_Window tkwin; |
| 873 |
Drawable drawable; |
| 874 |
TextLayout *textPtr; |
| 875 |
TextStyle *tsPtr; |
| 876 |
int x, y; |
| 877 |
{ |
| 878 |
int width, height; |
| 879 |
double theta; |
| 880 |
Display *display; |
| 881 |
Pixmap bitmap; |
| 882 |
int active; |
| 883 |
|
| •884 |
if (!textPtr) |
| 885 |
return; |
| 886 |
|
| 887 |
display = Tk_Display(tkwin); |
| 888 |
theta = FMOD(tsPtr->theta, (double)360.0); |
| 889 |
if (theta < 0.0) { |
| 890 |
theta += 360.0; |
| 891 |
} |
| 892 |
active = tsPtr->state & STATE_ACTIVE; |
| 893 |
if (theta == 0.0) { |
| 894 |
|
| 895 |
|
| 896 |
|
| 897 |
|
| 898 |
|
| 899 |
|
| 900 |
width = textPtr->width, height = textPtr->height; |
| 901 |
Blt_TranslateAnchor(x, y, width, height, tsPtr->anchor, &x, &y); |
| 902 |
if (tsPtr->state & (STATE_DISABLED | STATE_EMPHASIS)) { |
| 903 |
TkBorder *borderPtr = (TkBorder *) tsPtr->border; |
| 904 |
XColor *color1, *color2; |
| 905 |
|
| •906 |
color1 = borderPtr->lightColorPtr, color2 = borderPtr->darkColorPtr; |
| 907 |
if (tsPtr->state & STATE_EMPHASIS) { |
| 908 |
XColor *hold; |
| 909 |
|
| 910 |
hold = color1, color1 = color2, color2 = hold; |
| 911 |
} |
| 912 |
if (color1 != NULL) { |
| 913 |
XSetForeground(display, tsPtr->gc, color1->pixel); |
| 914 |
} |
| 915 |
DrawTextLayout(display, drawable, tsPtr->gc, tsPtr->font, x + 1, |
| 916 |
y + 1, textPtr, tsPtr); |
| 917 |
if (color2 != NULL) { |
| 918 |
XSetForeground(display, tsPtr->gc, color2->pixel); |
| 919 |
} |
| 920 |
DrawTextLayout(display, drawable, tsPtr->gc, tsPtr->font, x, y, |
| 921 |
textPtr, tsPtr); |
| 922 |
|
| 923 |
|
| 924 |
|
| 925 |
XSetForeground(display, tsPtr->gc, tsPtr->color->pixel); |
| 926 |
|
| 927 |
return; |
| 928 |
} |
| 929 |
if ((tsPtr->shadow.offset > 0) && (tsPtr->shadow.color != NULL)) { |
| 930 |
XSetForeground(display, tsPtr->gc, tsPtr->shadow.color->pixel); |
| 931 |
DrawTextLayout(display, drawable, tsPtr->gc, tsPtr->font, |
| 932 |
x + tsPtr->shadow.offset, y + tsPtr->shadow.offset, textPtr, |
| 933 |
tsPtr); |
| 934 |
XSetForeground(display, tsPtr->gc, tsPtr->color->pixel); |
| 935 |
} |
| 936 |
if (active) { |
| 937 |
XSetForeground(display, tsPtr->gc, tsPtr->activeColor->pixel); |
| 938 |
} |
| 939 |
DrawTextLayout(display, drawable, tsPtr->gc, tsPtr->font, x, y, |
| 940 |
textPtr, tsPtr); |
| 941 |
if (active) { |
| 942 |
XSetForeground(display, tsPtr->gc, tsPtr->color->pixel); |
| 943 |
} |
| 944 |
return; |
| 945 |
} |
| 946 |
#ifdef WIN32 |
| 947 |
if (Blt_DrawRotatedText(display, drawable, x, y, theta, tsPtr, textPtr)) { |
| 948 |
return; |
| 949 |
} |
| 950 |
#endif |
| 951 |
|
| 952 |
|
| 953 |
|
| 954 |
|
| 955 |
|
| 956 |
tsPtr->theta = theta; |
| 957 |
bitmap = Blt_CreateTextBitmap(tkwin, textPtr, tsPtr, &width, &height); |
| 958 |
if (bitmap == None) { |
| 959 |
return; |
| 960 |
} |
| 961 |
Blt_TranslateAnchor(x, y, width, height, tsPtr->anchor, &x, &y); |
| 962 |
#ifdef notdef |
| 963 |
theta = FMOD(theta, (double)90.0); |
| 964 |
#endif |
| 965 |
XSetClipMask(display, tsPtr->gc, bitmap); |
| 966 |
|
| 967 |
if (tsPtr->state & (STATE_DISABLED | STATE_EMPHASIS)) { |
| 968 |
TkBorder *borderPtr = (TkBorder *) tsPtr->border; |
| 969 |
XColor *color1, *color2; |
| 970 |
|
| •971 |
color1 = borderPtr->lightColorPtr, color2 = borderPtr->darkColorPtr; |
| 972 |
if (tsPtr->state & STATE_EMPHASIS) { |
| 973 |
XColor *hold; |
| 974 |
|
| 975 |
hold = color1, color1 = color2, color2 = hold; |
| 976 |
} |
| 977 |
if (color1 != NULL) { |
| 978 |
XSetForeground(display, tsPtr->gc, color1->pixel); |
| 979 |
} |
| 980 |
XSetClipOrigin(display, tsPtr->gc, x + 1, y + 1); |
| 981 |
XCopyPlane(display, bitmap, drawable, tsPtr->gc, 0, 0, width, |
| 982 |
height, x + 1, y + 1, 1); |
| 983 |
if (color2 != NULL) { |
| 984 |
XSetForeground(display, tsPtr->gc, color2->pixel); |
| 985 |
} |
| 986 |
XSetClipOrigin(display, tsPtr->gc, x, y); |
| 987 |
XCopyPlane(display, bitmap, drawable, tsPtr->gc, 0, 0, width, |
| 988 |
height, x, y, 1); |
| 989 |
XSetForeground(display, tsPtr->gc, tsPtr->color->pixel); |
| 990 |
} else { |
| 991 |
if ((tsPtr->shadow.offset > 0) && (tsPtr->shadow.color != NULL)) { |
| 992 |
XSetClipOrigin(display, tsPtr->gc, x + tsPtr->shadow.offset, |
| 993 |
y + tsPtr->shadow.offset); |
| 994 |
XSetForeground(display, tsPtr->gc, tsPtr->shadow.color->pixel); |
| 995 |
XCopyPlane(display, bitmap, drawable, tsPtr->gc, 0, 0, width, |
| 996 |
height, x + tsPtr->shadow.offset, y + tsPtr->shadow.offset, 1); |
| 997 |
XSetForeground(display, tsPtr->gc, tsPtr->color->pixel); |
| 998 |
} |
| 999 |
if (active) { |
| 1000 |
XSetForeground(display, tsPtr->gc, tsPtr->activeColor->pixel); |
| 1001 |
} |
| 1002 |
XSetClipOrigin(display, tsPtr->gc, x, y); |
| 1003 |
XCopyPlane(display, bitmap, drawable, tsPtr->gc, 0, 0, width, height, |
| 1004 |
x, y, 1); |
| 1005 |
if (active) { |
| 1006 |
XSetForeground(display, tsPtr->gc, tsPtr->color->pixel); |
| 1007 |
} |
| 1008 |
} |
| 1009 |
XSetClipMask(display, tsPtr->gc, None); |
| 1010 |
Tk_FreePixmap(display, bitmap); |
| 1011 |
} |
| 1012 |
|
| 1013 |
void |
| 1014 |
Blt_DrawText2(tkwin, drawable, string, tsPtr, x, y, areaPtr) |
| 1015 |
Tk_Window tkwin; |
| 1016 |
Drawable drawable; |
| 1017 |
char string[]; |
| 1018 |
TextStyle *tsPtr; |
| 1019 |
int x, y; |
| 1020 |
Dim2D *areaPtr; |
| 1021 |
{ |
| 1022 |
TextLayout *textPtr; |
| 1023 |
int width, height; |
| 1024 |
double theta; |
| 1025 |
|
| 1026 |
if ((string == NULL) || (*string == '\0')) { |
| 1027 |
return; |
| 1028 |
} |
| 1029 |
textPtr = Blt_GetTextLayout(string, tsPtr); |
| 1030 |
Blt_DrawTextLayout(tkwin, drawable, textPtr, tsPtr, x, y); |
| 1031 |
theta = FMOD(tsPtr->theta, (double)360.0); |
| 1032 |
if (theta < 0.0) { |
| 1033 |
theta += 360.0; |
| 1034 |
} |
| 1035 |
width = textPtr->width; |
| 1036 |
height = textPtr->height; |
| 1037 |
if (theta != 0.0) { |
| 1038 |
double rotWidth, rotHeight; |
| 1039 |
|
| 1040 |
Blt_GetBoundingBox(width, height, theta, &rotWidth, &rotHeight, |
| 1041 |
(Point2D *)NULL); |
| 1042 |
width = ROUND(rotWidth); |
| 1043 |
height = ROUND(rotHeight); |
| 1044 |
} |
| 1045 |
areaPtr->width = width; |
| 1046 |
areaPtr->height = height; |
| 1047 |
Blt_Free(textPtr); |
| 1048 |
} |
| 1049 |
|
| 1050 |
void |
| 1051 |
Blt_DrawText(tkwin, drawable, string, tsPtr, x, y) |
| 1052 |
Tk_Window tkwin; |
| 1053 |
Drawable drawable; |
| 1054 |
char string[]; |
| 1055 |
TextStyle *tsPtr; |
| 1056 |
int x, y; |
| 1057 |
{ |
| 1058 |
TextLayout *textPtr; |
| 1059 |
|
| 1060 |
if ((string == NULL) || (*string == '\0')) { |
| 1061 |
return; |
| 1062 |
} |
| 1063 |
textPtr = Blt_GetTextLayout(string, tsPtr); |
| 1064 |
Blt_DrawTextLayout(tkwin, drawable, textPtr, tsPtr, x, y); |
| 1065 |
tsPtr->width = textPtr->width; |
| 1066 |
tsPtr->height = textPtr->height; |
| 1067 |
Blt_Free(textPtr); |
| 1068 |
} |
| 1069 |
|
| 1070 |
GC |
| 1071 |
Blt_GetBitmapGC(tkwin) |
| 1072 |
Tk_Window tkwin; |
| 1073 |
{ |
| 1074 |
int isNew; |
| 1075 |
GC gc; |
| 1076 |
Display *display; |
| 1077 |
Blt_HashEntry *hPtr; |
| 1078 |
|
| 1079 |
if (!initialized) { |
| 1080 |
Blt_InitHashTable(&bitmapGCTable, BLT_ONE_WORD_KEYS); |
| 1081 |
initialized = TRUE; |
| 1082 |
} |
| 1083 |
display = Tk_Display(tkwin); |
| 1084 |
|
| 1085 |
|
| 1086 |
|
| 1087 |
hPtr = Blt_CreateHashEntry(&bitmapGCTable, Tk_PathName(tkwin), &isNew); |
| 1088 |
|
| 1089 |
if (isNew) { |
| 1090 |
Pixmap bitmap; |
| 1091 |
XGCValues gcValues; |
| 1092 |
unsigned long gcMask; |
| 1093 |
Window root; |
| 1094 |
|
| 1095 |
root = RootWindow(display, Tk_ScreenNumber(tkwin)); |
| 1096 |
bitmap = Tk_GetPixmap(display, root, 1, 1, 1); |
| 1097 |
gcValues.foreground = gcValues.background = 0; |
| 1098 |
gcMask = (GCForeground | GCBackground); |
| 1099 |
gc = Blt_GetPrivateGCFromDrawable(display, bitmap, gcMask, &gcValues); |
| 1100 |
Tk_FreePixmap(display, bitmap); |
| 1101 |
Blt_SetHashValue(hPtr, gc); |
| 1102 |
} else { |
| 1103 |
gc = (GC)Blt_GetHashValue(hPtr); |
| 1104 |
} |
| 1105 |
return gc; |
| 1106 |
} |
| 1107 |
|
| 1108 |
void |
| 1109 |
Blt_ResetTextStyle(tkwin, tsPtr) |
| 1110 |
Tk_Window tkwin; |
| 1111 |
TextStyle *tsPtr; |
| 1112 |
{ |
| 1113 |
GC newGC; |
| 1114 |
XGCValues gcValues; |
| 1115 |
unsigned long gcMask; |
| 1116 |
|
| 1117 |
gcMask = GCFont; |
| 1118 |
gcValues.font = Tk_FontId(tsPtr->font); |
| 1119 |
if (tsPtr->color != NULL) { |
| 1120 |
gcMask |= GCForeground; |
| 1121 |
gcValues.foreground = tsPtr->color->pixel; |
| 1122 |
} |
| 1123 |
newGC = Tk_GetGC(tkwin, gcMask, &gcValues); |
| 1124 |
if (tsPtr->gc != NULL) { |
| 1125 |
Tk_FreeGC(Tk_Display(tkwin), tsPtr->gc); |
| 1126 |
} |
| 1127 |
tsPtr->gc = newGC; |
| 1128 |
} |
| 1129 |
|
| 1130 |
void |
| 1131 |
Blt_FreeTextStyle(display, tsPtr) |
| 1132 |
Display *display; |
| 1133 |
TextStyle *tsPtr; |
| 1134 |
{ |
| 1135 |
if (tsPtr->gc != NULL) { |
| 1136 |
Tk_FreeGC(display, tsPtr->gc); |
| 1137 |
} |
| 1138 |
} |
| 1139 |
|
| 1140 |
void |
| 1141 |
Blt_DeleteAxisLabelsGC(tkwin) |
| 1142 |
Tk_Window tkwin; |
| 1143 |
{ |
| 1144 |
|
| 1145 |
Display *display; |
| 1146 |
GC gc; |
| 1147 |
Blt_HashEntry *hPtr; |
| 1148 |
|
| 1149 |
|
| 1150 |
|
| 1151 |
|
| 1152 |
|
| 1153 |
|
| 1154 |
if (!initialized) { |
| 1155 |
Blt_InitHashTable(&bitmapGCTable, BLT_ONE_WORD_KEYS); |
| 1156 |
initialized = TRUE; |
| 1157 |
} |
| 1158 |
|
| 1159 |
|
| 1160 |
hPtr = Blt_FindHashEntry(&bitmapGCTable, Tk_PathName(tkwin)); |
| 1161 |
|
| 1162 |
|
| 1163 |
if (hPtr) { |
| 1164 |
display = Tk_Display(tkwin); |
| 1165 |
gc = (GC)Blt_GetHashValue(hPtr); |
| 1166 |
XFreeGC(display,gc); |
| 1167 |
|
| 1168 |
|
| 1169 |
|
| 1170 |
|
| 1171 |
Blt_DeleteHashEntry(&bitmapGCTable, hPtr); |
| 1172 |
} |
| 1173 |
} |