#include <X11/Xlib.h>#include <X11/StringDefs.h>#include <X11/IntrinsicP.h>#include <X11/Xaw3d/XawInit.h>#include <X11/Xaw3d/ThreeDP.h>#include <X11/Xosdefs.h>Include dependency graph for ThreeD.c:

Go to the source code of this file.
Defines | |
| #define | XtNtopShadowPixmap "topShadowPixmap" |
| #define | XtCTopShadowPixmap "TopShadowPixmap" |
| #define | XtNbottomShadowPixmap "bottomShadowPixmap" |
| #define | XtCBottomShadowPixmap "BottomShadowPixmap" |
| #define | offset(field) XtOffsetOf(ThreeDRec, field) |
| #define | mbshadowpm_size 3 |
| #define | mtshadowpm_size 3 |
| #define | shadowpm_size 2 |
| #define | setPixel(p, dpy, scn) (p) |
| #define | MIN(x, y) (unsigned short) (x < y) ? x : y |
Functions | |
| static void | ClassPartInitialize () |
| static void | Initialize () |
| static void | Destroy () |
| static void | Redisplay () |
| static void | Realize () |
| static void | _Xaw3dDrawShadows () |
| static Boolean | SetValues () |
| static void | AllocTopShadowGC (Widget w) |
| static void | AllocBotShadowGC (Widget w) |
| static void | AllocTopShadowPixmap (Widget new) |
| static void | AllocBotShadowPixmap (Widget new) |
| void | Xaw3dComputeTopShadowRGB (Widget new, XColor *xcol_out) |
| static void | AllocTopShadowPixel (Widget new) |
| void | Xaw3dComputeBottomShadowRGB (Widget new, XColor *xcol_out) |
| static void | AllocBotShadowPixel (Widget new) |
| static void | ClassPartInitialize (WidgetClass wc) |
| static void | Initialize (Widget request, Widget new, ArgList args, Cardinal *num_args) |
| static void | Realize (Widget gw, XtValueMask *valueMask, XSetWindowAttributes *attrs) |
| static void | Destroy (Widget w) |
| static void | Redisplay (Widget w, XEvent *event, Region region) |
| static Boolean | SetValues (Widget gcurrent, Widget grequest, Widget gnew, ArgList args, Cardinal *num_args) |
| static void | _Xaw3dDrawShadows (Widget gw, XEvent *event, Region region, Boolean out) |
Variables | |
| static XtResource | resources [] |
| ThreeDClassRec | threeDClassRec |
| WidgetClass | threeDWidgetClass = (WidgetClass) &threeDClassRec |
| static char | mbshadowpm_bits [] = {0x05, 0x03, 0x06} |
| static char | mtshadowpm_bits [] = {0x02, 0x04, 0x01} |
| static char | shadowpm_bits [] = {0x02, 0x01} |
| #define mbshadowpm_size 3 |
| #define mtshadowpm_size 3 |
Definition at line 159 of file ThreeD.c.
Referenced by AllocBotShadowPixmap(), and AllocTopShadowPixmap().
| #define shadowpm_size 2 |
Definition at line 133 of file ThreeD.c.
Referenced by AllocBotShadowPixmap(), and AllocTopShadowPixmap().
| static void _Xaw3dDrawShadows | ( | Widget | gw, | |
| XEvent * | event, | |||
| Region | region, | |||
| Boolean | out | |||
| ) | [static] |
Definition at line 578 of file ThreeD.c.
References bot, ThreeDPart::bot_shadow_GC, CoordModeOrigin, _ThreeDRec::core, h, NULL, out(), pt, s, ThreeDPart::shadow_width, _ThreeDRec::threeD, top, ThreeDPart::top_shadow_GC, and w.
00583 { 00584 XPoint pt[6]; 00585 ThreeDWidget tdw = (ThreeDWidget) gw; 00586 Dimension s = tdw->threeD.shadow_width; 00587 /* 00588 * draw the shadows using the core part width and height, 00589 * and the threeD part shadow_width. 00590 * 00591 * no point to do anything if the shadow_width is 0 or the 00592 * widget has not been realized. 00593 */ 00594 if((s > 0) && XtIsRealized (gw)){ 00595 00596 Dimension h = tdw->core.height; 00597 Dimension w = tdw->core.width; 00598 Dimension wms = w - s; 00599 Dimension hms = h - s; 00600 Display *dpy = XtDisplay (gw); 00601 Window win = XtWindow (gw); 00602 GC top, bot; 00603 00604 if (out) { 00605 top = tdw->threeD.top_shadow_GC; 00606 bot = tdw->threeD.bot_shadow_GC; 00607 } else { 00608 top = tdw->threeD.bot_shadow_GC; 00609 bot = tdw->threeD.top_shadow_GC; 00610 } 00611 00612 /* top-left shadow */ 00613 if ((region == NULL) || 00614 (XRectInRegion (region, 0, 0, w, s) != RectangleOut) || 00615 (XRectInRegion (region, 0, 0, s, h) != RectangleOut)) { 00616 00617 pt[0].x = 0; pt[0].y = h; 00618 pt[1].x = pt[1].y = 0; 00619 pt[2].x = w; pt[2].y = 0; 00620 pt[3].x = wms; pt[3].y = s; 00621 pt[4].x = pt[4].y = s; 00622 pt[5].x = s; pt[5].y = hms; 00623 XFillPolygon (dpy, win, top, pt, 6,Complex,CoordModeOrigin); 00624 } 00625 00626 /* bottom-right shadow */ 00627 if ((region == NULL) || 00628 (XRectInRegion (region, 0, hms, w, s) != RectangleOut) || 00629 (XRectInRegion (region, wms, 0, s, h) != RectangleOut)) { 00630 00631 pt[0].x = 0; pt[0].y = h; 00632 pt[1].x = w; pt[1].y = h; 00633 pt[2].x = w; pt[2].y = 0; 00634 pt[3].x = wms; pt[3].y = s; 00635 pt[4].x = wms; pt[4].y = hms; 00636 pt[5].x = s; pt[5].y = hms; 00637 XFillPolygon (dpy, win, bot, pt,6, Complex,CoordModeOrigin); 00638 } 00639 } 00640 }
Here is the call graph for this function:

| static void _Xaw3dDrawShadows | ( | ) |
| static void AllocBotShadowGC | ( | Widget | w | ) | [static] |
Definition at line 184 of file ThreeD.c.
References ThreeDPart::be_nice_to_cmap, ThreeDPart::bot_shadow_GC, ThreeDPart::bot_shadow_pixel, ThreeDPart::bot_shadow_pxmap, and _ThreeDRec::threeD.
00186 { 00187 ThreeDWidget tdw = (ThreeDWidget) w; 00188 Screen *scn = XtScreen (w); 00189 XtGCMask valuemask; 00190 XGCValues myXGCV; 00191 00192 if (tdw->threeD.be_nice_to_cmap || DefaultDepthOfScreen (scn) == 1) { 00193 valuemask = GCTile | GCFillStyle; 00194 myXGCV.tile = tdw->threeD.bot_shadow_pxmap; 00195 myXGCV.fill_style = FillTiled; 00196 } else { 00197 valuemask = GCForeground; 00198 myXGCV.foreground = tdw->threeD.bot_shadow_pixel; 00199 } 00200 tdw->threeD.bot_shadow_GC = XtGetGC(w, valuemask, &myXGCV); 00201 }
| static void AllocBotShadowPixel | ( | Widget | new | ) | [static] |
Definition at line 402 of file ThreeD.c.
References ThreeDPart::bot_shadow_pixel, set_c(), _ThreeDRec::threeD, void(), and Xaw3dComputeBottomShadowRGB().
00404 { 00405 XColor set_c; 00406 ThreeDWidget tdw = (ThreeDWidget) new; 00407 Display *dpy = XtDisplay (new); 00408 Screen *scn = XtScreen (new); 00409 Colormap cmap = DefaultColormapOfScreen (scn); 00410 00411 Xaw3dComputeBottomShadowRGB (new, &set_c); 00412 (void) XAllocColor (dpy, cmap, &set_c); 00413 tdw->threeD.bot_shadow_pixel = set_c.pixel; 00414 }
Here is the call graph for this function:

| static void AllocBotShadowPixmap | ( | Widget | new | ) | [static] |
Definition at line 267 of file ThreeD.c.
References ThreeDPart::be_nice_to_cmap, ThreeDPart::bot_shadow_pxmap, _ThreeDRec::core, FALSE, mbshadowpm_size, NULL, setPixel, shadowpm_size, _ThreeDRec::threeD, and TRUE.
00269 { 00270 ThreeDWidget tdw = (ThreeDWidget) new; 00271 Display *dpy = XtDisplay (new); 00272 Screen *scn = XtScreen (new); 00273 unsigned long bot_fg_pixel = 0, bot_bg_pixel = 0; 00274 char *pm_data = NULL; 00275 Boolean create_pixmap = FALSE; 00276 unsigned int pm_size; 00277 00278 if (DefaultDepthOfScreen (scn) == 1) { 00279 bot_fg_pixel = BlackPixelOfScreen (scn); 00280 bot_bg_pixel = WhitePixelOfScreen (scn); 00281 pm_data = mbshadowpm_bits; 00282 pm_size = mbshadowpm_size; 00283 create_pixmap = TRUE; 00284 } else if (tdw->threeD.be_nice_to_cmap) { 00285 if (tdw->core.background_pixel == WhitePixelOfScreen (scn)) { 00286 bot_fg_pixel = WhitePixelOfScreen (scn); 00287 bot_bg_pixel = setPixel( BlackPixelOfScreen (scn), dpy, scn); 00288 } else if (tdw->core.background_pixel == BlackPixelOfScreen (scn)) { 00289 bot_fg_pixel = setPixel( BlackPixelOfScreen (scn), dpy, scn); 00290 bot_bg_pixel = BlackPixelOfScreen (scn); 00291 } else { 00292 bot_fg_pixel = tdw->core.background_pixel; 00293 bot_bg_pixel = BlackPixelOfScreen (scn); 00294 } 00295 #ifndef USEGRAY 00296 if (tdw->core.background_pixel == WhitePixelOfScreen (scn) || 00297 tdw->core.background_pixel == BlackPixelOfScreen (scn)) { 00298 pm_data = mbshadowpm_bits; 00299 pm_size = mbshadowpm_size; 00300 } else 00301 #endif 00302 { 00303 pm_data = shadowpm_bits; 00304 pm_size = shadowpm_size; 00305 } 00306 create_pixmap = TRUE; 00307 } else { 00308 pm_size = 0; /* keep gcc happy */ 00309 } 00310 00311 if (create_pixmap) 00312 tdw->threeD.bot_shadow_pxmap = XCreatePixmapFromBitmapData (dpy, 00313 RootWindowOfScreen (scn), 00314 pm_data, 00315 pm_size, 00316 pm_size, 00317 bot_fg_pixel, 00318 bot_bg_pixel, 00319 DefaultDepthOfScreen (scn)); 00320 }
| static void AllocTopShadowGC | ( | Widget | w | ) | [static] |
Definition at line 164 of file ThreeD.c.
References ThreeDPart::be_nice_to_cmap, _ThreeDRec::threeD, ThreeDPart::top_shadow_GC, ThreeDPart::top_shadow_pixel, and ThreeDPart::top_shadow_pxmap.
00166 { 00167 ThreeDWidget tdw = (ThreeDWidget) w; 00168 Screen *scn = XtScreen (w); 00169 XtGCMask valuemask; 00170 XGCValues myXGCV; 00171 00172 if (tdw->threeD.be_nice_to_cmap || DefaultDepthOfScreen (scn) == 1) { 00173 valuemask = GCTile | GCFillStyle; 00174 myXGCV.tile = tdw->threeD.top_shadow_pxmap; 00175 myXGCV.fill_style = FillTiled; 00176 } else { 00177 valuemask = GCForeground; 00178 myXGCV.foreground = tdw->threeD.top_shadow_pixel; 00179 } 00180 tdw->threeD.top_shadow_GC = XtGetGC(w, valuemask, &myXGCV); 00181 }
| static void AllocTopShadowPixel | ( | Widget | new | ) | [static] |
Definition at line 356 of file ThreeD.c.
References set_c(), _ThreeDRec::threeD, ThreeDPart::top_shadow_pixel, void(), and Xaw3dComputeTopShadowRGB().
00358 { 00359 XColor set_c; 00360 ThreeDWidget tdw = (ThreeDWidget) new; 00361 Display *dpy = XtDisplay (new); 00362 Screen *scn = XtScreen (new); 00363 Colormap cmap = DefaultColormapOfScreen (scn); 00364 00365 Xaw3dComputeTopShadowRGB (new, &set_c); 00366 (void) XAllocColor (dpy, cmap, &set_c); 00367 tdw->threeD.top_shadow_pixel = set_c.pixel; 00368 }
Here is the call graph for this function:

| static void AllocTopShadowPixmap | ( | Widget | new | ) | [static] |
Definition at line 204 of file ThreeD.c.
References ThreeDPart::be_nice_to_cmap, _ThreeDRec::core, FALSE, mtshadowpm_size, NULL, setPixel, shadowpm_size, _ThreeDRec::threeD, ThreeDPart::top_shadow_pxmap, and TRUE.
00206 { 00207 ThreeDWidget tdw = (ThreeDWidget) new; 00208 Display *dpy = XtDisplay (new); 00209 Screen *scn = XtScreen (new); 00210 unsigned long top_fg_pixel = 0, top_bg_pixel = 0; 00211 char *pm_data = NULL; 00212 Boolean create_pixmap = FALSE; 00213 unsigned int pm_size; 00214 00215 /* 00216 * I know, we're going to create two pixmaps for each and every 00217 * shadow'd widget. Yeuck. I'm semi-relying on server side 00218 * pixmap cacheing. 00219 */ 00220 00221 if (DefaultDepthOfScreen (scn) == 1) { 00222 top_fg_pixel = BlackPixelOfScreen (scn); 00223 top_bg_pixel = WhitePixelOfScreen (scn); 00224 pm_data = mtshadowpm_bits; 00225 pm_size = mtshadowpm_size; 00226 create_pixmap = TRUE; 00227 } else if (tdw->threeD.be_nice_to_cmap) { 00228 if (tdw->core.background_pixel == WhitePixelOfScreen (scn)) { 00229 top_fg_pixel = setPixel( WhitePixelOfScreen (scn), dpy, scn); 00230 top_bg_pixel = BlackPixelOfScreen (scn); 00231 } else if (tdw->core.background_pixel == BlackPixelOfScreen (scn)) { 00232 top_fg_pixel = BlackPixelOfScreen (scn); 00233 top_bg_pixel = setPixel( WhitePixelOfScreen (scn), dpy, scn); 00234 } else { 00235 top_fg_pixel = tdw->core.background_pixel; 00236 top_bg_pixel = WhitePixelOfScreen (scn); 00237 } 00238 #ifndef USEGRAY 00239 if (tdw->core.background_pixel == WhitePixelOfScreen (scn) || 00240 tdw->core.background_pixel == BlackPixelOfScreen (scn)) { 00241 pm_data = mtshadowpm_bits; 00242 pm_size = mtshadowpm_size; 00243 } else 00244 #endif 00245 { 00246 pm_data = shadowpm_bits; 00247 pm_size = shadowpm_size; 00248 } 00249 00250 create_pixmap = TRUE; 00251 } else { 00252 pm_size = 0; /* keep gcc happy */ 00253 } 00254 00255 if (create_pixmap) 00256 tdw->threeD.top_shadow_pxmap = XCreatePixmapFromBitmapData (dpy, 00257 RootWindowOfScreen (scn), 00258 pm_data, 00259 pm_size, 00260 pm_size, 00261 top_fg_pixel, 00262 top_bg_pixel, 00263 DefaultDepthOfScreen (scn)); 00264 }
| static void ClassPartInitialize | ( | WidgetClass | wc | ) | [static] |
Definition at line 418 of file ThreeD.c.
References _ThreeDClassRec::core_class, ThreeDClassPart::shadowdraw, _ThreeDClassRec::threeD_class, and XtInheritXaw3dShadowDraw.
00421 { 00422 ThreeDClassRec *tdwc = (ThreeDClassRec*) wc; 00423 ThreeDClassRec *super = (ThreeDClassRec*) tdwc->core_class.superclass; 00424 00425 if (tdwc->threeD_class.shadowdraw == XtInheritXaw3dShadowDraw) 00426 tdwc->threeD_class.shadowdraw = super->threeD_class.shadowdraw; 00427 }
| static void ClassPartInitialize | ( | ) | [static] |
| static void Destroy | ( | Widget | w | ) | [static] |
Definition at line 473 of file ThreeD.c.
References ThreeDPart::bot_shadow_GC, ThreeDPart::bot_shadow_pxmap, _ThreeDRec::threeD, ThreeDPart::top_shadow_GC, and ThreeDPart::top_shadow_pxmap.
00475 { 00476 ThreeDWidget tdw = (ThreeDWidget) w; 00477 XtReleaseGC (w, tdw->threeD.top_shadow_GC); 00478 XtReleaseGC (w, tdw->threeD.bot_shadow_GC); 00479 if (tdw->threeD.top_shadow_pxmap) 00480 XFreePixmap (XtDisplay (w), tdw->threeD.top_shadow_pxmap); 00481 if (tdw->threeD.bot_shadow_pxmap) 00482 XFreePixmap (XtDisplay (w), tdw->threeD.bot_shadow_pxmap); 00483 }
| static void Destroy | ( | ) |
| static void Initialize | ( | Widget | request, | |
| Widget | new, | |||
| ArgList | args, | |||
| Cardinal * | num_args | |||
| ) | [static] |
Definition at line 431 of file ThreeD.c.
References AllocBotShadowGC(), AllocBotShadowPixel(), AllocBotShadowPixmap(), AllocTopShadowGC(), AllocTopShadowPixel(), AllocTopShadowPixmap(), ThreeDPart::be_nice_to_cmap, ThreeDPart::bot_shadow_pixel, ThreeDPart::bot_shadow_pxmap, _ThreeDRec::threeD, ThreeDPart::top_shadow_pixel, and ThreeDPart::top_shadow_pxmap.
00435 { 00436 ThreeDWidget tdw = (ThreeDWidget) new; 00437 Screen *scr = XtScreen (new); 00438 00439 if (tdw->threeD.be_nice_to_cmap || DefaultDepthOfScreen (scr) == 1) { 00440 AllocTopShadowPixmap (new); 00441 AllocBotShadowPixmap (new); 00442 } else { 00443 if (tdw->threeD.top_shadow_pixel == tdw->threeD.bot_shadow_pixel) { 00444 /* 00445 Eeek. We're probably going to XQueryColor() twice 00446 for each widget. Necessary because you can set the 00447 top and bottom shadows independent of each other in 00448 SetValues. Some cacheing would certainly help... 00449 */ 00450 AllocTopShadowPixel (new); 00451 AllocBotShadowPixel (new); 00452 } 00453 tdw->threeD.top_shadow_pxmap = tdw->threeD.bot_shadow_pxmap = (Pixmap) 0; 00454 } 00455 AllocTopShadowGC (new); 00456 AllocBotShadowGC (new); 00457 }
Here is the call graph for this function:

| static void Initialize | ( | void | ) |
Initialisation of Scilab
| static void Realize | ( | Widget | gw, | |
| XtValueMask * | valueMask, | |||
| XSetWindowAttributes * | attrs | |||
| ) | [static] |
Definition at line 459 of file ThreeD.c.
00463 { 00464 /* 00465 * This is necessary because Simple doesn't have a realize method 00466 * XtInheritRealize in the ThreeD class record doesn't work. This 00467 * daisychains through Simple to the Core class realize method 00468 */ 00469 (*threeDWidgetClass->core_class.superclass->core_class.realize) 00470 (gw, valueMask, attrs); 00471 }
| static void Realize | ( | ) |
| static void Redisplay | ( | Widget | w, | |
| XEvent * | event, | |||
| Region | region | |||
| ) | [static] |
Definition at line 486 of file ThreeD.c.
References _Xaw3dDrawShadows().
00490 { 00491 _Xaw3dDrawShadows (w, event, region, True); 00492 }
Here is the call graph for this function:

| static void Redisplay | ( | ) | [static] |
| static Boolean SetValues | ( | Widget | gcurrent, | |
| Widget | grequest, | |||
| Widget | gnew, | |||
| ArgList | args, | |||
| Cardinal * | num_args | |||
| ) | [static] |
Definition at line 495 of file ThreeD.c.
References AllocBotShadowGC(), AllocBotShadowPixel(), AllocBotShadowPixmap(), AllocTopShadowGC(), AllocTopShadowPixel(), AllocTopShadowPixmap(), ThreeDPart::be_nice_to_cmap, ThreeDPart::bot_shadow_contrast, ThreeDPart::bot_shadow_GC, ThreeDPart::bot_shadow_pixel, FALSE, NULL, ThreeDPart::shadow_width, _ThreeDRec::threeD, ThreeDPart::top_shadow_contrast, ThreeDPart::top_shadow_GC, ThreeDPart::top_shadow_pixel, and TRUE.
00499 { 00500 ThreeDWidget current = (ThreeDWidget) gcurrent; 00501 ThreeDWidget new = (ThreeDWidget) gnew; 00502 Boolean redisplay = FALSE; 00503 Boolean alloc_top_pixel = FALSE; 00504 Boolean alloc_bot_pixel = FALSE; 00505 Boolean alloc_top_pxmap = FALSE; 00506 Boolean alloc_bot_pxmap = FALSE; 00507 00508 (*threeDWidgetClass->core_class.superclass->core_class.set_values) 00509 (gcurrent, grequest, gnew, NULL, 0); 00510 if (new->threeD.shadow_width != current->threeD.shadow_width) 00511 redisplay = TRUE; 00512 if (new->threeD.be_nice_to_cmap != current->threeD.be_nice_to_cmap) { 00513 if (new->threeD.be_nice_to_cmap) { 00514 alloc_top_pxmap = TRUE; 00515 alloc_bot_pxmap = TRUE; 00516 } else { 00517 alloc_top_pixel = TRUE; 00518 alloc_bot_pixel = TRUE; 00519 } 00520 redisplay = TRUE; 00521 } 00522 if (!new->threeD.be_nice_to_cmap && 00523 new->threeD.top_shadow_contrast != current->threeD.top_shadow_contrast) 00524 alloc_top_pixel = TRUE; 00525 if (!new->threeD.be_nice_to_cmap && 00526 new->threeD.bot_shadow_contrast != current->threeD.bot_shadow_contrast) 00527 alloc_bot_pixel = TRUE; 00528 if (alloc_top_pixel) 00529 AllocTopShadowPixel (gnew); 00530 if (alloc_bot_pixel) 00531 AllocBotShadowPixel (gnew); 00532 if (alloc_top_pxmap) 00533 AllocTopShadowPixmap (gnew); 00534 if (alloc_bot_pxmap) 00535 AllocBotShadowPixmap (gnew); 00536 if (!new->threeD.be_nice_to_cmap && 00537 new->threeD.top_shadow_pixel != current->threeD.top_shadow_pixel) 00538 alloc_top_pixel = TRUE; 00539 if (!new->threeD.be_nice_to_cmap && 00540 new->threeD.bot_shadow_pixel != current->threeD.bot_shadow_pixel) 00541 alloc_bot_pixel = TRUE; 00542 if (new->threeD.be_nice_to_cmap) { 00543 if (alloc_top_pxmap) { 00544 XtReleaseGC (gcurrent, current->threeD.top_shadow_GC); 00545 AllocTopShadowGC (gnew); 00546 redisplay = True; 00547 } 00548 if (alloc_bot_pxmap) { 00549 XtReleaseGC (gcurrent, current->threeD.bot_shadow_GC); 00550 AllocBotShadowGC (gnew); 00551 redisplay = True; 00552 } 00553 } else { 00554 if (alloc_top_pixel) { 00555 if (new->threeD.top_shadow_pxmap) { 00556 XFreePixmap (XtDisplay (gnew), new->threeD.top_shadow_pxmap); 00557 new->threeD.top_shadow_pxmap = (Pixmap) NULL; 00558 } 00559 XtReleaseGC (gcurrent, current->threeD.top_shadow_GC); 00560 AllocTopShadowGC (gnew); 00561 redisplay = True; 00562 } 00563 if (alloc_bot_pixel) { 00564 if (new->threeD.bot_shadow_pxmap) { 00565 XFreePixmap (XtDisplay (gnew), new->threeD.bot_shadow_pxmap); 00566 new->threeD.bot_shadow_pxmap = (Pixmap) NULL; 00567 } 00568 XtReleaseGC (gcurrent, current->threeD.bot_shadow_GC); 00569 AllocBotShadowGC (gnew); 00570 redisplay = True; 00571 } 00572 } 00573 return (redisplay); 00574 }
Here is the call graph for this function:

| static Boolean SetValues | ( | ) | [static] |
| void Xaw3dComputeBottomShadowRGB | ( | Widget | new, | |
| XColor * | xcol_out | |||
| ) |
Definition at line 371 of file ThreeD.c.
References ThreeDPart::bot_shadow_contrast, _ThreeDRec::core, and _ThreeDRec::threeD.
Referenced by AllocBotShadowPixel().
00374 { 00375 if (XtIsSubclass (new, threeDWidgetClass)) { 00376 ThreeDWidget tdw = (ThreeDWidget) new; 00377 XColor get_c; 00378 double contrast; 00379 Display *dpy = XtDisplay (new); 00380 Screen *scn = XtScreen (new); 00381 Colormap cmap = DefaultColormapOfScreen (scn); 00382 00383 get_c.pixel = tdw->core.background_pixel; 00384 if (get_c.pixel == WhitePixelOfScreen (scn) || 00385 get_c.pixel == BlackPixelOfScreen (scn)) { 00386 contrast = tdw->threeD.bot_shadow_contrast / 100.0; 00387 xcol_out->red = contrast * 65535.0; 00388 xcol_out->green = contrast * 65535.0; 00389 xcol_out->blue = contrast * 65535.0; 00390 } else { 00391 XQueryColor (dpy, cmap, &get_c); 00392 contrast = (100 - tdw->threeD.bot_shadow_contrast) / 100.0; 00393 xcol_out->red = contrast * get_c.red; 00394 xcol_out->green = contrast * get_c.green; 00395 xcol_out->blue = contrast * get_c.blue; 00396 } 00397 } else 00398 xcol_out->red = xcol_out->green = xcol_out->blue = 0; 00399 }
Here is the caller graph for this function:

| void Xaw3dComputeTopShadowRGB | ( | Widget | new, | |
| XColor * | xcol_out | |||
| ) |
Definition at line 323 of file ThreeD.c.
References _ThreeDRec::core, MIN, _ThreeDRec::threeD, and ThreeDPart::top_shadow_contrast.
Referenced by AllocTopShadowPixel().
00326 { 00327 if (XtIsSubclass (new, threeDWidgetClass)) { 00328 ThreeDWidget tdw = (ThreeDWidget) new; 00329 XColor get_c; 00330 double contrast; 00331 Display *dpy = XtDisplay (new); 00332 Screen *scn = XtScreen (new); 00333 Colormap cmap = DefaultColormapOfScreen (scn); 00334 00335 get_c.pixel = tdw->core.background_pixel; 00336 if (get_c.pixel == WhitePixelOfScreen (scn) || 00337 get_c.pixel == BlackPixelOfScreen (scn)) { 00338 contrast = (100 - tdw->threeD.top_shadow_contrast) / 100.0; 00339 xcol_out->red = contrast * 65535.0; 00340 xcol_out->green = contrast * 65535.0; 00341 xcol_out->blue = contrast * 65535.0; 00342 } else { 00343 contrast = 1.0 + tdw->threeD.top_shadow_contrast / 100.0; 00344 XQueryColor (dpy, cmap, &get_c); 00345 #define MIN(x,y) (unsigned short) (x < y) ? x : y 00346 xcol_out->red = MIN (65535, (int) (contrast * (double) get_c.red)); 00347 xcol_out->green = MIN (65535, (int) (contrast * (double) get_c.green)); 00348 xcol_out->blue = MIN (65535, (int) (contrast * (double) get_c.blue)); 00349 #undef MIN 00350 } 00351 } else 00352 xcol_out->red = xcol_out->green = xcol_out->blue = 0; 00353 }
Here is the caller graph for this function:

char mbshadowpm_bits[] = {0x05, 0x03, 0x06} [static] |
char mtshadowpm_bits[] = {0x02, 0x04, 0x01} [static] |
XtResource resources[] [static] |
Initial value:
{
{XtNshadowWidth, XtCShadowWidth, XtRDimension, sizeof(Dimension),
offset(threeD.shadow_width), XtRImmediate, (XtPointer) 2},
{XtNtopShadowPixel, XtCTopShadowPixel, XtRPixel, sizeof(Pixel),
offset(threeD.top_shadow_pixel), XtRString, XtDefaultForeground},
{XtNbottomShadowPixel, XtCBottomShadowPixel, XtRPixel, sizeof(Pixel),
offset(threeD.bot_shadow_pixel), XtRString, XtDefaultForeground},
{XtNtopShadowPixmap, XtCTopShadowPixmap, XtRPixmap, sizeof(Pixmap),
offset(threeD.top_shadow_pxmap), XtRImmediate, (XtPointer) NULL},
{XtNbottomShadowPixmap, XtCBottomShadowPixmap, XtRPixmap, sizeof(Pixmap),
offset(threeD.bot_shadow_pxmap), XtRImmediate, (XtPointer) NULL},
{XtNtopShadowContrast, XtCTopShadowContrast, XtRInt, sizeof(int),
offset(threeD.top_shadow_contrast), XtRImmediate, (XtPointer) 20},
{XtNbottomShadowContrast, XtCBottomShadowContrast, XtRInt, sizeof(int),
offset(threeD.bot_shadow_contrast), XtRImmediate, (XtPointer) 40},
{XtNuserData, XtCUserData, XtRPointer, sizeof(XtPointer),
offset(threeD.user_data), XtRPointer, (XtPointer) NULL},
{XtNbeNiceToColormap, XtCBeNiceToColormap, XtRBoolean, sizeof(Boolean),
offset(threeD.be_nice_to_cmap), XtRImmediate, (XtPointer) True},
{XtNborderWidth, XtCBorderWidth, XtRDimension, sizeof(Dimension),
XtOffsetOf(RectObjRec,rectangle.border_width), XtRImmediate,
(XtPointer)0}
}
char shadowpm_bits[] = {0x02, 0x01} [static] |
| WidgetClass threeDWidgetClass = (WidgetClass) &threeDClassRec |
1.5.1