예제 #1
0
파일: xf_gdi.c 프로젝트: hatim212/FreeRDP
void xf_gdi_polygon_sc(rdpContext* context, POLYGON_SC_ORDER* polygon_sc)
{
	int i, npoints;
	XPoint* points;
	UINT32 brush_color;
	xfContext* xfc = (xfContext*) context;

	xf_lock_x11(xfc, FALSE);

	xf_set_rop2(xfc, polygon_sc->bRop2);
	brush_color = freerdp_convert_gdi_order_color(polygon_sc->brushColor, context->settings->ColorDepth, xfc->format, xfc->palette);
	brush_color = xf_gdi_get_color(xfc, brush_color);

	npoints = polygon_sc->numPoints + 1;
	points = malloc(sizeof(XPoint) * npoints);

	points[0].x = polygon_sc->xStart;
	points[0].y = polygon_sc->yStart;

	for (i = 0; i < polygon_sc->numPoints; i++)
	{
		points[i + 1].x = polygon_sc->points[i].x;
		points[i + 1].y = polygon_sc->points[i].y;
	}

	switch (polygon_sc->fillMode)
	{
		case 1: /* alternate */
			XSetFillRule(xfc->display, xfc->gc, EvenOddRule);
			break;

		case 2: /* winding */
			XSetFillRule(xfc->display, xfc->gc, WindingRule);
			break;

		default:
			WLog_ERR(TAG,  "PolygonSC unknown fillMode: %d", polygon_sc->fillMode);
			break;
	}

	XSetFillStyle(xfc->display, xfc->gc, FillSolid);
	XSetForeground(xfc->display, xfc->gc, brush_color);

	XFillPolygon(xfc->display, xfc->drawing, xfc->gc,
			points, npoints, Complex, CoordModePrevious);

	if (xfc->drawing == xfc->primary)
	{
		XFillPolygon(xfc->display, xfc->drawable, xfc->gc,
				points, npoints, Complex, CoordModePrevious);
	}

	XSetFunction(xfc->display, xfc->gc, GXcopy);
	free(points);

	xf_unlock_x11(xfc, FALSE);
}
예제 #2
0
static void xf_floatbar_event_expose(xfFloatbar* floatbar, XEvent* event)
{
	GC gc, shape_gc;
	Pixmap pmap;
	XPoint shape[5], border[5];
	int len;
	Display* display = floatbar->xfc->display;
	/* create the pixmap that we'll use for shaping the window */
	pmap = XCreatePixmap(display, floatbar->handle, floatbar->width, floatbar->height, 1);
	gc = XCreateGC(display, floatbar->handle, 0, 0);
	shape_gc = XCreateGC(display, pmap, 0, 0);
	/* points for drawing the floatbar */
	shape[0].x = 0;
	shape[0].y = 0;
	shape[1].x = floatbar->width;
	shape[1].y = 0;
	shape[2].x = shape[1].x - FLOATBAR_BORDER;
	shape[2].y = FLOATBAR_HEIGHT;
	shape[3].x = shape[0].x + FLOATBAR_BORDER;
	shape[3].y = FLOATBAR_HEIGHT;
	shape[4].x = shape[0].x;
	shape[4].y = shape[0].y;
	/* points for drawing the border of the floatbar */
	border[0].x = shape[0].x;
	border[0].y = shape[0].y - 1;
	border[1].x = shape[1].x - 1;
	border[1].y = shape[1].y - 1;
	border[2].x = shape[2].x;
	border[2].y = shape[2].y - 1;
	border[3].x = shape[3].x - 1;
	border[3].y = shape[3].y - 1;
	border[4].x = border[0].x;
	border[4].y = border[0].y;
	/* Fill all pixels with 0 */
	XSetForeground(display, shape_gc, 0);
	XFillRectangle(display, pmap, shape_gc, 0, 0, floatbar->width,
	               floatbar->height);
	/* Fill all pixels which should be shown with 1 */
	XSetForeground(display, shape_gc, 1);
	XFillPolygon(display, pmap, shape_gc, shape, 5, 0, CoordModeOrigin);
	XShapeCombineMask(display, floatbar->handle, ShapeBounding, 0, 0, pmap, ShapeSet);
	/* draw the float bar */
	XSetForeground(display, gc, xf_floatbar_get_color(floatbar, FLOATBAR_COLOR_BACKGROUND));
	XFillPolygon(display, floatbar->handle, gc, shape, 4, 0, CoordModeOrigin);
	/* draw an border for the floatbar */
	XSetForeground(display, gc, xf_floatbar_get_color(floatbar, FLOATBAR_COLOR_BORDER));
	XDrawLines(display, floatbar->handle, gc, border, 5, CoordModeOrigin);
	/* draw the host name connected to */
	len = strlen(floatbar->title);
	XSetForeground(display, gc, xf_floatbar_get_color(floatbar, FLOATBAR_COLOR_FOREGROUND));
	XDrawString(display, floatbar->handle, gc, floatbar->width / 2 - len * 2, 15,
	            floatbar->title, len);
	XFreeGC(display, gc);
	XFreeGC(display, shape_gc);
}
예제 #3
0
파일: xf_gdi.c 프로젝트: Joyuan/FreeRDP
void xf_gdi_polygon_sc(rdpContext* context, POLYGON_SC_ORDER* polygon_sc)
{
	int i, npoints;
	XPoint* points;
	UINT32 brush_color;
	xfInfo* xfi = ((xfContext*) context)->xfi;

	xf_set_rop2(xfi, polygon_sc->bRop2);
	brush_color = freerdp_color_convert_var(polygon_sc->brushColor, ((xfContext*)context)->settings->ColorDepth, xfi->bpp, xfi->clrconv);

	npoints = polygon_sc->numPoints + 1;
	points = malloc(sizeof(XPoint) * npoints);

	points[0].x = polygon_sc->xStart;
	points[0].y = polygon_sc->yStart;

	for (i = 0; i < polygon_sc->numPoints; i++)
	{
		points[i + 1].x = polygon_sc->points[i].x;
		points[i + 1].y = polygon_sc->points[i].y;
	}

	switch (polygon_sc->fillMode)
	{
		case 1: /* alternate */
			XSetFillRule(xfi->display, xfi->gc, EvenOddRule);
			break;

		case 2: /* winding */
			XSetFillRule(xfi->display, xfi->gc, WindingRule);
			break;

		default:
			printf("PolygonSC unknown fillMode: %d\n", polygon_sc->fillMode);
			break;
	}

	XSetFillStyle(xfi->display, xfi->gc, FillSolid);
	XSetForeground(xfi->display, xfi->gc, brush_color);

	XFillPolygon(xfi->display, xfi->drawing, xfi->gc,
			points, npoints, Complex, CoordModePrevious);

	if (xfi->drawing == xfi->primary)
	{
		XFillPolygon(xfi->display, xfi->drawable, xfi->gc,
				points, npoints, Complex, CoordModePrevious);
	}

	XSetFunction(xfi->display, xfi->gc, GXcopy);
	free(points);
}
예제 #4
0
static void
tik_tak_drawobject(ModeInfo * mi, tik_takobject * object0 )
{
	Display    *display = MI_DISPLAY(mi);
	Window      window = MI_WINDOW(mi);
	tik_takstruct *tiktak = &tik_taks[MI_SCREEN(mi)];

   XFillPolygon(display, window, tiktak->gc, object0->xy ,
		object0->num_point * 2 + 2 , Complex , CoordModeOrigin);
   if ( object0->inner )
     XFillPolygon(display, window, tiktak->gc, object0->xy1 ,
		  object0->num_point1 * 2 + 2 , Complex , CoordModeOrigin);
}
예제 #5
0
void draw3DPane(UpdateTask *pt, Pixel bgc) {

  Pixel   tsc, bsc, fgc, slc;
  DisplayInfo *displayInfo = pt->displayInfo;
  Display *display = XtDisplay(displayInfo->drawingArea);
  GC      gc        = displayInfo->gc;
  Drawable drawable = XtWindow(displayInfo->drawingArea);
  int x = pt->rectangle.x;
  int y = pt->rectangle.y;
  int w = pt->rectangle.width;
  int h = pt->rectangle.height;

  XPoint  points[7];
  int n;
  int shadowThickness = 2;

#if 0
  XtVaGetValues(displayInfo->drawingArea,XmNshadowThickness,&shadowThickness,NULL);
#endif

  XmGetColors(XtScreen(displayInfo->drawingArea),cmap,bgc,&fgc,&tsc,&bsc,&slc);
  /* create the top shadow */
  n = 0;
  points[n].x = x;                       points[n].y = y;                       n++;
  points[n].x = x + w;                   points[n].y = y;                       n++;
  points[n].x = x + w - shadowThickness; points[n].y = y + shadowThickness;     n++;
  points[n].x = x + shadowThickness;     points[n].y = y + shadowThickness;     n++;
  points[n].x = x + shadowThickness;     points[n].y = y + h - shadowThickness; n++;
  points[n].x = x;                       points[n].y = y + h;                   n++;
  points[n].x = x;                       points[n].y = y;                       n++;
  XSetForeground(display,gc,tsc);
  XFillPolygon(display, drawable, gc, points, XtNumber(points),Nonconvex,CoordModeOrigin); 
  /* create the background pane */
  XSetForeground(display,gc,bgc);
  XFillRectangle(display, drawable, gc,
                          x+shadowThickness,y+shadowThickness,
                          w-2*shadowThickness,h-2*shadowThickness);
  /* create the bottom shadow */
  n = 0;
  points[n].x = x + shadowThickness;     points[n].y = y + h - shadowThickness; n++;
  points[n].x = x + w - shadowThickness; points[n].y = y + h - shadowThickness; n++;
  points[n].x = x + w - shadowThickness; points[n].y = y + shadowThickness;     n++;
  points[n].x = x + w;                   points[n].y = y;          n++;
  points[n].x = x + w;                   points[n].y = y + h;      n++;
  points[n].x = x;                       points[n].y = y + h;      n++;
  points[n].x = x + shadowThickness;     points[n].y = y + h - shadowThickness; n++;
  XSetForeground(display,gc,bsc);
  XFillPolygon(display, drawable, gc, points, XtNumber(points),Nonconvex,CoordModeOrigin); 
}
예제 #6
0
void Maze::DrawMaze()
{
    int x,y;
    XPoint Box[4];
    XSetForeground(dsp,gc,black);

    for(int i=0;i<numRows;i++)
        for (int j=0;j<numColumns;j++)
            if (squares[i][j]==WALL)
            {
                x = j*Pixel + Pixel/2;
                y = i*Pixel + Pixel/2;
                
                Box[0].x = x-Pixel/2; Box[0].y = y-Pixel/2;
                Box[1].x = x+Pixel/2; Box[1].y = y-Pixel/2;
                Box[2].x = x+Pixel/2; Box[2].y = y+Pixel/2;
                Box[3].x = x-Pixel/2; Box[3].y = y+Pixel/2;
                
                XFillPolygon(dsp,win,gc,Box,4,Complex,CoordModeOrigin);
            }
    XColor boxcolor;
    
    boxcolor.red = 0;boxcolor.green = 65000;boxcolor.blue = 0;
    boxcolor.flags = DoRed | DoGreen | DoBlue;
    XAllocColor(dsp,thecolormap,&boxcolor);
    XSetForeground(dsp,gc,boxcolor.pixel);
    
    x = start.getColumn()*Pixel + Pixel/2;
    y = start.getRow()*Pixel + Pixel/2;
    
    Box[0].x = x-Pixel/2; Box[0].y = y-Pixel/2;
    Box[1].x = x+Pixel/2; Box[1].y = y-Pixel/2;
    Box[2].x = x+Pixel/2; Box[2].y = y+Pixel/2;
    Box[3].x = x-Pixel/2; Box[3].y = y+Pixel/2;
    
    XFillPolygon(dsp,win,gc,Box,4,Complex,CoordModeOrigin);

    x = end.getColumn()*Pixel + Pixel/2;
    y = end.getRow()*Pixel + Pixel/2;
    
    Box[0].x = x-Pixel/2; Box[0].y = y-Pixel/2;
    Box[1].x = x+Pixel/2; Box[1].y = y-Pixel/2;
    Box[2].x = x+Pixel/2; Box[2].y = y+Pixel/2;
    Box[3].x = x-Pixel/2; Box[3].y = y+Pixel/2;
    
    XFillPolygon(dsp,win,gc,Box,4,Complex,CoordModeOrigin);

    XFlush(dsp);
}
예제 #7
0
/**********************************************************************
 *	XG_FILLTRIANGLE
 *	- fills a triangle
 **********************************************************************/
void xg_filltriangle(void *xgid, 
		int x1, int y1, int x2, int y2, int x3, int y3, 
		unsigned int pixel, int style)
{
	struct xg_graphic *graphic;
	GC *gc;
	XPoint points[3];
	int npoints = 3;
	int shape = Convex;
	int mode = CoordModeOrigin;

	graphic = (struct xg_graphic *) xgid;
	if (style == XG_SOLIDLINE)
		gc = &graphic->gc_solid;
	else
		gc = &graphic->gc_dash;
	points[0].x = (short) x1;
	points[0].y = (short) y1;
	points[1].x = (short) x2;
	points[1].y = (short) y2;
	points[2].x = (short) x3;
	points[2].y = (short) y3;
	XSetForeground(graphic->dpy, *gc, pixel);
	XFillPolygon(graphic->dpy, graphic->xid, *gc, 
		points, npoints, shape, mode);
}
예제 #8
0
파일: draw.c 프로젝트: lf94/Resurrection
void
menu_draw_arrow(Rwindow_t *window)
{
    unsigned int winw, winh;
    unsigned int dummyui;
    int dummyi;
    Window dummywin;
    XPoint points[3];

    if (window == NULL) {

	return;
    }

    XGetGeometry(window->app->display, window->id, &dummywin,
		 &dummyi, &dummyi, &winw, &winh, &dummyui, &dummyui);
    
    points[0].x = winw - winh / 4
	- MENU_RECTANGLE_OFFSET - MENU_DEFAULT_LINE_WIDTH - 4;
    points[0].y = MENU_RECTANGLE_OFFSET + MENU_DEFAULT_LINE_WIDTH + 4;

    points[1].x = winw - MENU_RECTANGLE_OFFSET - MENU_DEFAULT_LINE_WIDTH - 4;
    points[1].y = winh / 2;

    points[2].x = points[0].x;
    points[2].y = winh - MENU_RECTANGLE_OFFSET - MENU_DEFAULT_LINE_WIDTH - 5;
    
    XFillPolygon(window->app->display, window->id, window->gc,
		 points, 3, Convex, CoordModeOrigin);
    
    return;
}
예제 #9
0
static void ui_draw_arrowhead(int xfrom, int yfrom, int xto, int yto)
{
	XPoint arrowhead[5];
	arrowhead[0].x = -5;
	arrowhead[0].y = 0;

	arrowhead[1].x = -10;
	arrowhead[1].y = 15;

	arrowhead[2].x = 7;
	arrowhead[2].y = 0;

	arrowhead[3].x = -10;
	arrowhead[3].y = -15;

	arrowhead[4].x = -5;
	arrowhead[4].y = 0;

	/* calculate angle for vector */
	double angle = atan2( yto - yfrom, xto - xfrom );

	ui_rotate(arrowhead, 5, 0, 0, angle);

	for (int i = 0; i < 5; ++i) {
		arrowhead[i].x += xto;
		arrowhead[i].y += yto;
	}

	(void) XSetForeground(ui_display, ui_gcontext, UI_COL_HIGHLIGHT_SQUARE);
	(void) XFillPolygon(ui_display, ui_backbuf, ui_gcontext, arrowhead, 5, Complex, CoordModeOrigin);
}
예제 #10
0
파일: xgraph.c 프로젝트: EricPascolo/shyfem
void QAreaFill( int ndim , float *x , float *y )

{
	static int  nalloc=0;
	static XPoint *points=NULL;
	int i;

    if( nalloc == 0 ) {
	nalloc = ndim;
	points = (XPoint *) malloc( ndim * sizeof( XPoint ) );
    } else if( nalloc < ndim ) {
	free( points );
	nalloc = ndim;
	points = (XPoint *) malloc( ndim * sizeof( XPoint ) );
    }

    if( points == NULL ) {
	printf("QAreaFill : Cannot allocate array\n");
	exit(1);
    }

    for(i=0;i<ndim;i++) {
	points[i].x = QxWtoV(x[i]);
	points[i].y = QyWtoV(y[i]);
    }

    XFillPolygon(MyDisplay,MyWindow,MyGc,points,ndim,Complex,CoordModeOrigin);
}
예제 #11
0
static void
make_mask (int shape, int x, int y, int width, int height)
{
  XPoint cone[ 3 ];

  grow_pixmap_mask (width, height);

  /* Clear mask */
  XSetForeground (b_dpy, b_maskGC, 0);
  XFillRectangle (b_dpy, b_mask, b_maskGC,
                  0, 0, width, height);

  /* Enable text area */
  XSetForeground (b_dpy, b_maskGC, 1);
  XFillRectangle (b_dpy, b_mask, b_maskGC, 0,
		  shape & SHAPE_CONE_TOP ? CONE_HEIGHT : 0, width, height - CONE_HEIGHT);

  /* Enable for cone area */
  cone[0].x = (shape & SHAPE_CONE_LEFT) ? CONE_WIDTH / 2 : width - (CONE_WIDTH / 2);
  cone[0].y = (shape & SHAPE_CONE_TOP)  ? CONE_HEIGHT    : height - CONE_HEIGHT;
  cone[1].x = (shape & SHAPE_CONE_LEFT) ? 0              : width;
  cone[1].y = (shape & SHAPE_CONE_TOP)  ? 0              : height;
  cone[2].x = (shape & SHAPE_CONE_LEFT) ? CONE_WIDTH     : width - CONE_WIDTH;
  cone[2].y = (shape & SHAPE_CONE_TOP)  ? CONE_HEIGHT    : height - CONE_HEIGHT;

  XFillPolygon (b_dpy, b_mask, b_maskGC, cone, 3, Nonconvex, CoordModeOrigin);

}
예제 #12
0
void iupDrawPolygon(IdrawCanvas* dc, int* points, int count, unsigned char r, unsigned char g, unsigned char b, int style)
{
    int i;
    XPoint* pnt = (XPoint*)malloc(count*sizeof(XPoint)); /* XPoint uses short for coordinates */

    for (i = 0; i < count; i++)
    {
        pnt[i].x = (short)points[2*i];
        pnt[i].y = (short)points[2*i+1];
    }

    XSetForeground(iupmot_display, dc->pixmap_gc, iupmotColorGetPixel(r, g, b));

    if (style==IUP_DRAW_FILL)
        XFillPolygon(iupmot_display, dc->pixmap, dc->pixmap_gc, pnt, count, Complex, CoordModeOrigin);
    else
    {
        XGCValues gcval;
        if (style==IUP_DRAW_STROKE_DASH)
            gcval.line_style = LineOnOffDash;
        else
            gcval.line_style = LineSolid;
        XChangeGC(iupmot_display, dc->pixmap_gc, GCLineStyle, &gcval);

        XDrawLines(iupmot_display, dc->pixmap, dc->pixmap_gc, pnt, count, CoordModeOrigin);
    }

    free(pnt);
}
예제 #13
0
// Draw a pixel around (x,y) with the given RGB color
void Maze::DrawBox (int x, int y, char c)
{
    x*=Pixel;
    x+=Pixel/2;
    y*=Pixel;
    y+=Pixel/2;
    
    XColor boxcolor;
    XPoint Box[4];
    Box[0].x = x-Pixel/2; Box[0].y = y-Pixel/2;
    Box[1].x = x+Pixel/2; Box[1].y = y-Pixel/2;
    Box[2].x = x+Pixel/2; Box[2].y = y+Pixel/2;
    Box[3].x = x-Pixel/2; Box[3].y = y+Pixel/2;
    
    if (c==VISITED)
    { boxcolor.red = 65000;boxcolor.green = 0;boxcolor.blue = 0; }

    else
    { boxcolor.red = 0;boxcolor.green = 65000;boxcolor.blue = 0; }

    boxcolor.flags = DoRed | DoGreen | DoBlue;

    XAllocColor(dsp,thecolormap,&boxcolor);
    XSetForeground(dsp,gc,boxcolor.pixel);
    XFillPolygon(dsp,win,gc,Box,4,Complex,CoordModeOrigin);
}
예제 #14
0
파일: X_graphics.c 프로젝트: javins/fpt
int Draw_Triangle_X_UN (double x0, double y0,
                         double x1, double y1,
                         double x2, double y2)
// this has been superseded
{
    XPoint Points[4];

    Points[0].x = x0 ;
    Points[0].y = y0 ;
    Points[1].x = x1 ;
    Points[1].y = y1 ;
    Points[2].x = x2 ;
    Points[2].y = y2 ;

    XFillPolygon(TheDisplay, TheDrawable, ThePixmapContext, Points, 3,
					Convex, CoordModeOrigin);

    /*
    XDrawLines(TheDisplay, TheDrawable, ThePixmapContext, Points, 4,
					CoordModeOrigin);
    */

    /*
    XDrawPoints(TheDisplay, TheDrawable, ThePixmapContext, Points, 3,
							CoordModeOrigin);
    */

}
예제 #15
0
void S3DTetraeder::draw(S3DDevice *d,S3DSurface w,S3DContext g)
{
	XSetForeground(d,g,color);
	for(int i=0;i<3;i++)
	{
		XDrawLine(d,w,g,
			PLANAR_DISTANCE*(vertices[i].x/vertices[i].z),
			PLANAR_DISTANCE*(vertices[i].y/vertices[i].z),
			PLANAR_DISTANCE*(vertices[(i+1)%3].x/vertices[(i+1)%3].z),
			PLANAR_DISTANCE*(vertices[(i+1)%3].y/vertices[(i+1)%3].z));
	}
	double x = PLANAR_DISTANCE*(vertices[3].x/vertices[3].z);
	double y = PLANAR_DISTANCE*(vertices[3].y/vertices[3].z);
	
	for(int i=0;i<3;i++)
	{ 
		XDrawLine(d,w,g,x,y,
			PLANAR_DISTANCE*(vertices[i].x/vertices[i].z),
			PLANAR_DISTANCE*(vertices[i].y/vertices[i].z));	  
	}
	
	
	if(isFilled)
	{
		XPoint p[4];
		for(int i=0;i<4;i++)
		{
			p[i].x = PLANAR_DISTANCE*(vertices[i].x/vertices[i].z);
			p[i].y = PLANAR_DISTANCE*(vertices[i].y/vertices[i].z);
		}
		XFillPolygon(d,w,g,p,4,Complex,CoordModeOrigin);
	}

}
예제 #16
0
void draw_rect(float x, float y, float width, float height, int fc, float intensity)
{
    
    XPoint ppoly[5];
    vertex polygon[4];
    
    polygon[0].x = x;
    polygon[0].y = y;
    
    polygon[1].x = x+width;
    polygon[1].y = y;
    
    polygon[2].x = x+width;
    polygon[2].y = y+height;
    
    polygon[3].x = x;
    polygon[3].y = y+height;
    
    shade = (int)(intensity*SHADES);
    if(shade>SHADES-1)shade=SHADES-1;   // shouldn't happen
    fore = colors[fc][shade];
    set_color();
    ppoly[0] = screen_coord(polygon[0]);
    ppoly[1] = screen_coord(polygon[1]);
    ppoly[2] = screen_coord(polygon[2]);
    ppoly[3] = screen_coord(polygon[3]);
    ppoly[4] = ppoly[0];
    XFillPolygon(theDisplay, theWindow, theGC,ppoly,4, Convex, CoordModeOrigin);
    XFlush(theDisplay);
    
    
}
예제 #17
0
// Draw arrow head at POS
void LineGraphEdge::drawArrowHead(Widget w,
				  const BoxRegion& /* exposed */,
				  const GraphGC& gc,
				  const BoxPoint& pos,
				  double alpha) const
{
    if (!gc.drawArrowHeads || to()->isHint())
	return;

    const double offset = gc.arrowAngle * PI / 180;	// Angle
    const int length    = gc.arrowLength;		// Length

    // Get coordinates
    XPoint points[3];
    points[0].x = pos[X];
    points[0].y = pos[Y];
    points[1].x = short(pos[X] + length * cos(alpha + offset / 2));
    points[1].y = short(pos[Y] + length * sin(alpha + offset / 2));
    points[2].x = short(pos[X] + length * cos(alpha - offset / 2));
    points[2].y = short(pos[Y] + length * sin(alpha - offset / 2));

#if 0
	clog << "\nangle = " << (alpha / (PI * 2.0)) * 360.0  << "\n";
	for (int i = 0; i < 3; i++)
	    clog << "points[" << i << "] = "
		 << BoxPoint(points[i].x, points[i].y) << "\n";
#endif

    XFillPolygon(XtDisplay(w), XtWindow(w), gc.edgeGC, points,
		 XtNumber(points), Convex, CoordModeOrigin);
}
예제 #18
0
파일: tk3d.c 프로젝트: aosm/tcl
void
Tk_Fill3DPolygon(
    Tk_Window tkwin,		/* Window for which border was allocated. */
    Drawable drawable,		/* X window or pixmap in which to draw. */
    Tk_3DBorder border,		/* Token for border to draw. */
    XPoint *pointPtr,		/* Array of points describing polygon. All
				 * points must be absolute
				 * (CoordModeOrigin). */
    int numPoints,		/* Number of points at *pointPtr. */
    int borderWidth,		/* Width of border, measured in pixels to the
				 * left of the polygon's trajectory. May be
				 * negative. */
    int leftRelief)		/* Indicates 3D effect of left side of
				 * trajectory relative to right:
				 * TK_RELIEF_FLAT, TK_RELIEF_RAISED, or
				 * TK_RELIEF_SUNKEN. */
{
    register TkBorder *borderPtr = (TkBorder *) border;

    XFillPolygon(Tk_Display(tkwin), drawable, borderPtr->bgGC,
	    pointPtr, numPoints, Complex, CoordModeOrigin);
    if (leftRelief != TK_RELIEF_FLAT) {
	Tk_Draw3DPolygon(tkwin, drawable, border, pointPtr, numPoints,
		borderWidth, leftRelief);
    }
}
예제 #19
0
static void
drawCorner(WIcon *icon)
{
    WScreen *scr = icon->core->screen_ptr;
    XPoint points[3];

    points[0].x = 1;
    points[0].y = 1;
    points[1].x = 12;
    points[1].y = 1;
    points[2].x = 1;
    points[2].y = 12;
    XFillPolygon(dpy, icon->core->window, scr->icon_title_texture->normal_gc,
                 points, 3, Convex, CoordModeOrigin);
    XDrawLine(dpy, icon->core->window, scr->icon_title_texture->light_gc,
              0, 0, 0, 12);
    XDrawLine(dpy, icon->core->window, scr->icon_title_texture->light_gc,
              0, 0, 12, 0);
    /* drawing the second line gives a weird concave look. -Dan */
#if 0
    XDrawLine(dpy, icon->core->window, scr->icon_title_texture->light_gc,
              1, 1, 1, 11);
    XDrawLine(dpy, icon->core->window, scr->icon_title_texture->light_gc,
              1, 1, 11, 1);
#endif
}
예제 #20
0
파일: xops.c 프로젝트: erdc-cm/petsc-dev
static PetscErrorCode PetscDrawTriangle_X(PetscDraw draw,PetscReal X1,PetscReal Y_1,PetscReal X2,PetscReal Y2,PetscReal X3,PetscReal Y3,int c1,int c2,int c3)
{
  PetscDraw_X*   XiWin = (PetscDraw_X*)draw->data;
  PetscErrorCode ierr;

  PetscFunctionBegin;
  if (c1 == c2 && c2 == c3) {
    XPoint pt[3];
    PetscDrawXiSetColor(XiWin,c1);
    pt[0].x = XTRANS(draw,XiWin,X1);
    pt[0].y = YTRANS(draw,XiWin,Y_1);
    pt[1].x = XTRANS(draw,XiWin,X2);
    pt[1].y = YTRANS(draw,XiWin,Y2);
    pt[2].x = XTRANS(draw,XiWin,X3);
    pt[2].y = YTRANS(draw,XiWin,Y3);
    XFillPolygon(XiWin->disp,PetscDrawXiDrawable(XiWin),XiWin->gc.set,pt,3,Convex,CoordModeOrigin);
  } else {
    int x1,y_1,x2,y2,x3,y3;
    x1   = XTRANS(draw,XiWin,X1);
    y_1  = YTRANS(draw,XiWin,Y_1);
    x2   = XTRANS(draw,XiWin,X2);
    y2   = YTRANS(draw,XiWin,Y2);
    x3   = XTRANS(draw,XiWin,X3);
    y3   = YTRANS(draw,XiWin,Y3);
    ierr = PetscDrawInterpolatedTriangle_X(XiWin,x1,y_1,c1,x2,y2,c2,x3,y3,c3);CHKERRQ(ierr);
  }
  PetscFunctionReturn(0);
}
예제 #21
0
int Fill_Polygon_DX (double *x, double *y, int npts)
{
   XPoint xpoint[1000] ;
   int k ;

   if (npts <= 0) return 0 ;

   if (npts > 1000) {
      printf("\nFill_Polygon_X has been asked to deal with %d points.\n",
             npts) ;
      printf("Points past first 1000 ignored.\n") ;
      npts = 1000 ;
   }

   for (k = 0 ; k < npts ; k++) {
        xpoint[k].x = (int)x[k] ; 
        xpoint[k].y = (int)(TheHeight -1 - y[k]) ;
   }


   XFillPolygon(TheDisplay,TheDrawable,ThePixmapContext,
                xpoint,npts,Nonconvex,CoordModeOrigin);   


   return 1 ;
}
예제 #22
0
  void drawPolygon(XPoint *points, int npoints, Color fill_color, bool fill, unsigned int line_width, int line_style, int cap_style, int join_style, int fill_rule, int function){

    gc_vals.foreground = fill_color;
    gc_vals.line_width = line_width;
    gc_vals.fill_rule = fill_rule;
    XChangeGC(display, gc, GCForeground | GCLineWidth | GCFillRule, &gc_vals);

    //  XSync(display, false);


    if(fill)
      XFillPolygon(display, curr_d, gc, points, npoints, 
		   Complex, CoordModeOrigin);
    else{

      XPoint pts[npoints + 1];
      int iter;

      // Create array with closed list
      for(iter = 0; iter < npoints; iter ++){
	pts[iter] = points[iter];
      }

      pts[iter] = points[0];

      XDrawLines(display, curr_d, gc, pts, npoints + 1, CoordModeOrigin);
    }

    //XSync(display, false);

  }
예제 #23
0
static void
draw_cell (state *st, cell *c)
{
  XPoint points[20];
  int i, j;
  for (j = 0; j <= 1; j++)
    {
      int r = (j == 0 ? c->radius : c->i);
      for (i = 0; i < c->sides; i++)
        {
          double th = i * M_PI * 2 / c->sides;
          points[i].x = c->cx + r * cos (th + c->th) + 0.5;
          points[i].y = c->cy + r * sin (th + c->th) + 0.5;
        }
      XSetForeground (st->dpy, st->gc, st->colors[c->colors[j]].pixel);
      XFillPolygon (st->dpy, st->window, st->gc, points, c->sides,
                    Convex, CoordModeOrigin);
    }

  c->i -= c->speed;
  if (c->i < 0)
    {
      c->i = c->radius;
      c->colors[1] = c->colors[0];
      if (c != &st->cells[0])
        c->colors[0] = st->cells[0].colors[0];
      else
        c->colors[0] = random() % st->ncolors;
    }
}
예제 #24
0
static void
draw_thin_arrow (struct state *st, Drawable d, struct disc *disc,
                 int x, int y, int radius)
{
  XPoint points[3];
  double th;
  int radius2;
  double tick = ((M_PI * 2) / 72) * 2;

  radius *= 0.9;
  radius2 = radius - (radius / 8) * 3;

  th = 2 * M_PI * (disc->theta / ((double) 360*64));

  points[0].x = x + radius * cos(th);		/* tip */
  points[0].y = y + radius * sin(th);

  points[1].x = x + radius2 * cos(th - tick);	/* tip left */
  points[1].y = y + radius2 * sin(th - tick);

  points[2].x = x + radius2 * cos(th + tick);	/* tip right */
  points[2].y = y + radius2 * sin(th + tick);

  XDrawLine (st->dpy, d, disc->gc,
             (int) (x + radius2 * cos(th)),
             (int) (y + radius2 * sin(th)),
             (int) (x + -radius * cos(th)),
             (int) (y + -radius * sin(th)));

  XFillPolygon (st->dpy, d, disc->gc, points, 3, Convex, CoordModeOrigin);
}
예제 #25
0
/*public*/
void TtkFillArrow(
    Display *display, Drawable d, GC gc, Ttk_Box b, ArrowDirection dir)
{
    XPoint points[4];
    ArrowPoints(b, dir, points);
    XFillPolygon(display, d, gc, points, 3, Convex, CoordModeOrigin);
    XDrawLines(display, d, gc, points, 4, CoordModeOrigin);
}
예제 #26
0
파일: Graphics.cpp 프로젝트: HeliWang/cs349
 void Graphics::FillPolygon(const vector<Point> & vertices)
 {
   this->PrepareGraphicsContext();
   XPoint* xPoints = this->GetTransformedXPoints(vertices);
   XFillPolygon(this->display, this->window, this->gc, xPoints, vertices.size(), Complex, CoordModeOrigin);
   delete[] xPoints;
   DebugDelay(string("FillPolygon"));
 }
예제 #27
0
파일: XSpadFill.c 프로젝트: acralfs/fricas
void
XSpadFillPolygon(Display *dsply, Drawable drawable, XPoint * points,
                 int npoints, int shape, int mode, int hue, int theshade)
{
    XFillPolygon(dsply, drawable,
                        SpadFillGC(dsply, hue, theshade, "XSpadFillRectangle"),
                        points, npoints, shape, mode);

}
예제 #28
0
void XWindow::FillPolygon(int x1, int y1, int x2, int y2, int x3, int y3)
{
  XPoint points[3]{
    {static_cast<short>(x1), static_cast<short>(y1)},
    {static_cast<short>(x2), static_cast<short>(y2)},
    {static_cast<short>(x3), static_cast<short>(y3)}
  };
  XFillPolygon(m_pDisplay, m_window, m_gc, points, 3, Convex, CoordModeOrigin);
}
예제 #29
0
파일: fillpoly.c 프로젝트: GregBowyer/wmii
void
fillpoly(Image *dst, Point *pt, int np, Color *col) {
	XPoint *xp;

	xp = convpts(pt, np);
	setgccol(dst, col);
	XFillPolygon(display, dst->xid, dst->gc, xp, np, Complex, CoordModeOrigin);
	free(xp);
}
예제 #30
0
static void Paint_world_radar_new(void)
{
    int i, j, xoff, yoff;
    ipos_t min, max;
    static XPoint poly[10000];
    
    /* what the heck is this? */
    radar_exposures = 2;

    if (radarPixmap2 == radarPixmap)
	XSetPlaneMask(dpy, radarGC, AllPlanes & (~(dpl_1[0] | dpl_1[1])));

    if (radarPixmap2 != radarWindow) {
	/* Clear radar */
	XSetForeground(dpy, radarGC, colors[BLACK].pixel);
	XFillRectangle(dpy, radarPixmap2, radarGC, 0, 0, 256, RadarHeight);
    } else
	XClearWindow(dpy, radarWindow);
        
    XSetForeground(dpy, radarGC, colors[wallRadarColor].pixel);
    
    /* loop through all the polygons */
    for (i = 0; i < num_polygons; i++) {
	if (BIT(polygon_styles[polygons[i].style].flags,
		STYLE_INVISIBLE_RADAR)) continue;
	Compute_radar_bounds(&min, &max, &polygons[i].bounds);
	for (xoff = min.x; xoff <= max.x; xoff++) {
	    for (yoff = min.y; yoff <= max.y; yoff++) {
		int x, y;

		x = xoff * Setup->width;
		y = yoff * Setup->height;
		
		/* loop through the points in the current polygon */
		for (j = 0; j < polygons[i].num_points; j++) {		    
		    x += polygons[i].points[j].x;
		    y += polygons[i].points[j].y;
		    poly[j].x = (x * 256) / Setup->width;
		    poly[j].y = (int)RadarHeight 
			- ((y * (int)RadarHeight) / Setup->height);
		}

		XSetForeground(dpy, radarGC, fullColor ?
			       polygon_styles[polygons[i].style].color :
			       colors[wallRadarColor].pixel);
		XFillPolygon(dpy, radarPixmap2, radarGC, poly,
			     polygons[i].num_points,
			     Nonconvex, CoordModeOrigin);
	    }
	}
    }
    
    if (radarPixmap2 == radarPixmap)
	XSetPlaneMask(dpy, radarGC, AllPlanes & (~(dpl_2[0] | dpl_2[1])));
}