PageRenderTime 61ms CodeModel.GetById 31ms RepoModel.GetById 0ms app.codeStats 0ms

/hpc_kernel_samples/sparse_linear_algebra/casestudies/pagerank-petsc/petsc-2.3.2-p10/src/sys/draw/impls/x/frame.c.html

https://gitlab.com/Bulut81/CodeVault
HTML | 123 lines | 109 code | 14 blank | 0 comment | 0 complexity | 0994685e752c14bf01a2b9359424d199 MD5 | raw file
  1. <center><a href="frame.c">Actual source code: frame.c</a></center><br>
  2. <html>
  3. <head>
  4. <title></title>
  5. <meta name="generator" content="c2html 0.9.5">
  6. <meta name="date" content="2007-03-29T00:17:41+00:00">
  7. </head>
  8. <body bgcolor="#FFFFFF">
  9. <pre width="80"><a name="line1"> 1: </a><strong><font color="#228B22">#define PETSC_DLL</font></strong>
  10. <a name="line2"> 2: </a><font color="#B22222">/*</font>
  11. <a name="line3"> 3: </a><font color="#B22222"> This file contains routines to draw a 3-d like frame about a given </font>
  12. <a name="line4"> 4: </a><font color="#B22222"> box with a given width. Note that we might like to use a high/low</font>
  13. <a name="line5"> 5: </a><font color="#B22222"> color for highlights.</font>
  14. <a name="line7"> 7: </a><font color="#B22222"> The region has 6 parameters. These are the dimensions of the actual frame.</font>
  15. <a name="line8"> 8: </a><font color="#B22222"> */</font>
  16. <a name="line10"> 10: </a> #include <A href="../../../../../src/sys/draw/impls/x/ximpl.h.html">src/sys/draw/impls/x/ximpl.h</A>
  17. <a name="line12"> 12: </a><strong><font color="#4169E1">EXTERN PixVal XiGetColor(PetscDraw_X *,char *,int)</font></strong>;
  18. <a name="line14"> 14: </a><font color="#B22222">/* 50% grey stipple pattern */</font>
  19. <a name="line15"> 15: </a>static Pixmap grey50 = (Pixmap)0;
  20. <a name="line16"> 16: </a><strong><font color="#228B22">#define cboard50_width 8</font></strong>
  21. <a name="line17"> 17: </a><strong><font color="#228B22">#define cboard50_height 8</font></strong>
  22. <a name="line18"> 18: </a>static unsigned char cboard50_bits[] = {
  23. <a name="line19"> 19: </a> 0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa};
  24. <a name="line21"> 21: </a>static PixVal HiPix=0,LoPix=0;
  25. <a name="line22"> 22: </a><font color="#B22222">/* </font>
  26. <a name="line23"> 23: </a><font color="#B22222"> Set the colors for the highlights by name </font>
  27. <a name="line24"> 24: </a><font color="#B22222"> */</font>
  28. <a name="line27"> 27: </a><strong><font color="#4169E1"><a name="XiFrameColors"></a><A href="../../../../../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> XiFrameColors(PetscDraw_X* XiWin,XiDecoration *Rgn,char *Hi,char *Lo)</font></strong>
  29. <a name="line28"> 28: </a>{
  30. <a name="line30"> 30: </a> Rgn-&gt;Hi = XiGetColor(XiWin,Hi,1);
  31. <a name="line31"> 31: </a> Rgn-&gt;Lo = XiGetColor(XiWin,Lo,1);
  32. <a name="line32"> 32: </a> Rgn-&gt;HasColor = Rgn-&gt;Hi != Rgn-&gt;Lo;
  33. <a name="line33"> 33: </a> <font color="#4169E1">return</font>(0);
  34. <a name="line34"> 34: </a>}
  35. <a name="line38"> 38: </a><strong><font color="#4169E1"><a name="XiDrawFrame"></a><A href="../../../../../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> XiDrawFrame(PetscDraw_X *XiWin,XiDecoration *Rgn)</font></strong>
  36. <a name="line39"> 39: </a>{
  37. <a name="line40"> 40: </a> int xl = Rgn-&gt;Box.x,yl = Rgn-&gt;Box.y,xh = Rgn-&gt;Box.xh,yh = Rgn-&gt;Box.yh,
  38. <a name="line41"> 41: </a> o = Rgn-&gt;width;
  39. <a name="line42"> 42: </a> XPoint high[7],low[7];
  40. <a name="line43"> 43: </a> PixVal Hi,Lo;
  41. <a name="line46"> 46: </a> <font color="#B22222">/* High polygon */</font>
  42. <a name="line47"> 47: </a> high[0].x = xl; high[0].y = yh;
  43. <a name="line48"> 48: </a> high[1].x = xl + o; high[1].y = yh - o;
  44. <a name="line49"> 49: </a> high[2].x = xh - o; high[2].y = yh - o;
  45. <a name="line50"> 50: </a> high[3].x = xh - o; high[3].y = yl + o;
  46. <a name="line51"> 51: </a> high[4].x = xh; high[4].y = yl;
  47. <a name="line52"> 52: </a> high[5].x = xh; high[5].y = yh;
  48. <a name="line53"> 53: </a> high[6].x = xl; high[6].y = yh; <font color="#B22222">/* close path */</font>
  49. <a name="line55"> 55: </a> low[0].x = xl; low[0].y = yh;
  50. <a name="line56"> 56: </a> low[1].x = xl; low[1].y = yl;
  51. <a name="line57"> 57: </a> low[2].x = xh; low[2].y = yl;
  52. <a name="line58"> 58: </a> low[3].x = xh - o; low[3].y = yl + o;
  53. <a name="line59"> 59: </a> low[4].x = xl + o; low[4].y = yl + o;
  54. <a name="line60"> 60: </a> low[5].x = xl + o; low[5].y = yh - o;
  55. <a name="line61"> 61: </a> low[6].x = xl; low[6].y = yh; <font color="#B22222">/* close path */</font>
  56. <a name="line63"> 63: </a> <font color="#4169E1">if</font> (Rgn-&gt;HasColor) {
  57. <a name="line64"> 64: </a> <font color="#4169E1">if</font> (Rgn-&gt;Hi) Hi = Rgn-&gt;Hi;
  58. <a name="line65"> 65: </a> <font color="#4169E1">else</font> Hi = HiPix;
  59. <a name="line66"> 66: </a> <font color="#4169E1">if</font> (Rgn-&gt;Lo) Lo = Rgn-&gt;Lo;
  60. <a name="line67"> 67: </a> <font color="#4169E1">else</font> Lo = LoPix;
  61. <a name="line68"> 68: </a> XiSetPixVal(XiWin,(Rgn-&gt;is_in !=0) ? Hi : Lo);
  62. <a name="line69"> 69: </a> <font color="#4169E1">if</font> (o &lt;= 1)
  63. <a name="line70"> 70: </a> XDrawLines(XiWin-&gt;disp,XiDrawable(XiWin),XiWin-&gt;gc.set,
  64. <a name="line71"> 71: </a> high,7,CoordModeOrigin);
  65. <a name="line72"> 72: </a> <font color="#4169E1">else</font>
  66. <a name="line73"> 73: </a> XFillPolygon(XiWin-&gt;disp,XiDrawable(XiWin),XiWin-&gt;gc.set,
  67. <a name="line74"> 74: </a> high,7,Nonconvex,CoordModeOrigin);
  68. <a name="line75"> 75: </a> XiSetPixVal(XiWin,(Rgn-&gt;is_in !=0) ? Lo : Hi);
  69. <a name="line76"> 76: </a> <font color="#4169E1">if</font> (o &lt;= 1)
  70. <a name="line77"> 77: </a> XDrawLines(XiWin-&gt;disp,XiDrawable(XiWin),XiWin-&gt;gc.set,
  71. <a name="line78"> 78: </a> low,7,CoordModeOrigin);
  72. <a name="line79"> 79: </a> <font color="#4169E1">else</font>
  73. <a name="line80"> 80: </a> XFillPolygon(XiWin-&gt;disp,XiDrawable(XiWin),XiWin-&gt;gc.set,
  74. <a name="line81"> 81: </a> low,7,Nonconvex,CoordModeOrigin);
  75. <a name="line82"> 82: </a> <font color="#B22222">/* We could use additional highlights here,such as lines drawn</font>
  76. <a name="line83"> 83: </a><font color="#B22222"> connecting the mitred edges. */</font>
  77. <a name="line84"> 84: </a> }
  78. <a name="line85"> 85: </a> <font color="#4169E1">else</font> {
  79. <a name="line86"> 86: </a> <font color="#4169E1">if</font> (!grey50)
  80. <a name="line87"> 87: </a> grey50 = XCreatePixmapFromBitmapData(XiWin-&gt;disp,XiWin-&gt;win,
  81. <a name="line88"> 88: </a> (char *)cboard50_bits,
  82. <a name="line89"> 89: </a> cboard50_width,
  83. <a name="line90"> 90: </a> cboard50_height,1,0,1);
  84. <a name="line91"> 91: </a> XiSetPixVal(XiWin,Rgn-&gt;Hi);
  85. <a name="line92"> 92: </a> XFillPolygon(XiWin-&gt;disp,XiDrawable(XiWin),XiWin-&gt;gc.set,
  86. <a name="line93"> 93: </a> high,7,Nonconvex,CoordModeOrigin);
  87. <a name="line94"> 94: </a> <font color="#B22222">/* This can actually be done by using a stipple effect */</font>
  88. <a name="line95"> 95: </a> XSetFillStyle(XiWin-&gt;disp,XiWin-&gt;gc.set,FillStippled);
  89. <a name="line96"> 96: </a> XSetStipple(XiWin-&gt;disp,XiWin-&gt;gc.set,grey50);
  90. <a name="line97"> 97: </a> XFillPolygon(XiWin-&gt;disp,XiDrawable(XiWin),XiWin-&gt;gc.set,
  91. <a name="line98"> 98: </a> low,7,Nonconvex,CoordModeOrigin);
  92. <a name="line99"> 99: </a> XSetFillStyle(XiWin-&gt;disp,XiWin-&gt;gc.set,FillSolid);
  93. <a name="line100">100: </a> }
  94. <a name="line101">101: </a> <font color="#4169E1">return</font>(0);
  95. <a name="line102">102: </a>}
  96. <a name="line105">105: </a><font color="#B22222">/*</font>
  97. <a name="line106">106: </a><font color="#B22222"> Set the colors for the highlights by name </font>
  98. <a name="line107">107: </a><font color="#B22222"> */</font>
  99. <a name="line110">110: </a><strong><font color="#4169E1"><a name="XiFrameColorsByName"></a><A href="../../../../../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> XiFrameColorsByName(PetscDraw_X* XiWin,char *Hi,char *Lo)</font></strong>
  100. <a name="line111">111: </a>{
  101. <a name="line113">113: </a> <font color="#4169E1">if</font> (XiWin-&gt;numcolors &gt; 2) {
  102. <a name="line114">114: </a> HiPix = XiGetColor(XiWin,Hi,1);
  103. <a name="line115">115: </a> LoPix = XiGetColor(XiWin,Lo,1);
  104. <a name="line116">116: </a> }
  105. <a name="line117">117: </a> <font color="#4169E1">return</font>(0);
  106. <a name="line118">118: </a>}
  107. </pre>
  108. </body>
  109. </html>