[BACK]Return to plotp.c CVS log [TXT][DIR] Up to [local] / OpenXM_contrib2 / asir2000 / plot

Diff for /OpenXM_contrib2/asir2000/plot/plotp.c between version 1.13 and 1.14

version 1.13, 2005/12/21 23:18:16 version 1.14, 2011/08/10 04:51:58
Line 45 
Line 45 
  * DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE,   * DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE,
  * PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE.   * PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE.
  *   *
  * $OpenXM: OpenXM_contrib2/asir2000/plot/plotp.c,v 1.12 2005/05/18 03:27:00 noro Exp $   * $OpenXM: OpenXM_contrib2/asir2000/plot/plotp.c,v 1.13 2005/12/21 23:18:16 noro Exp $
 */  */
 #include "ca.h"  #include "ca.h"
 #include "parse.h"  #include "parse.h"
Line 62 
Line 62 
 #if defined(VISUAL)  #if defined(VISUAL)
 static POINT oldpos;  static POINT oldpos;
 #endif  #endif
   
   unsigned long GetColor(Display *, char *);
   
   unsigned long GetColor(Display *dis, char *color_name)
   {
           Colormap cmap;
           XColor near_color, true_color;
   
           cmap = DefaultColormap( dis, 0 );
           XAllocNamedColor( dis, cmap, color_name, &near_color, &true_color );
           return( near_color.pixel );
   }
   
   void area_print(DISPLAY *display, int **mask, struct canvas *can, int GXcode)
   {
           int ix, iy;
           XImage *image;
           unsigned long color, black, white;
           int wc;
   
           flush();
           black = GetColor(display, "black");
           white = GetColor(display, "white");
           image = XGetImage(display, can->pix, 0, 0, can->width, can->height,
                   -1, ZPixmap);
           for(iy = 0; iy < can->height; iy++){
                   for(ix = 0; ix < can->width; ix++){
                           color = XGetPixel(image, ix, iy);
                           if (color == white) wc = -1;
                           else if (color == black) wc = 0;
                           else wc = 1;
                           if ( wc != 0 ) {//XPutPixel(image,ix,iy,black);
                                   if ( mask[iy][ix] == 0 ) XPutPixel(image, ix, iy, black);
                                   else {
                                           switch (GXcode) {
                                           case 3: /* copy case */
                                                   if (mask[iy][ix] == 1 ) XPutPixel(image, ix, iy, can->color);
                                                   else XPutPixel(image, ix, iy, BackPixel);
                                                   break;
                                           case 1: /* and case */
                                                   if ((mask[iy][ix] == 1) && (wc == 1))
                                                           XPutPixel(image, ix, iy, can->color);
                                                   else XPutPixel(image, ix, iy, BackPixel);
                                                   break;
                                           case 7: /* or case */
                                                   if ((mask[iy][ix] == 1) || (wc == 1))
                                                           XPutPixel(image, ix, iy, can->color);
                                                   else XPutPixel(image, ix, iy, BackPixel);
                                                   break;
                                           case 6: /* xor case */
                                                   if ((mask[iy][ix] == 1) ^ (wc == 1))
                                                           XPutPixel(image, ix, iy, can->color);
                                                   else XPutPixel(image, ix, iy, BackPixel);
                                                   break;
                                           }
                                   }
                           }
                   }
           }
           XPutImage(display,can->pix,drawGC,image,0,0,0,0,can->width, can->height);
           count_and_flush();
           flush();
   }
   
 void if_print(DISPLAY *display,double **tab,struct canvas *can)  void if_print(DISPLAY *display,double **tab,struct canvas *can)
 {  {

Legend:
Removed from v.1.13  
changed lines
  Added in v.1.14

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>