Пример #1
0
/* EXPORT-> HDrawArc: Draw arc from stAngle thru arcAngle degrees */
void HDrawArc(int x0, int y0, int x1, int y1, int stAngle, int arcAngle)
{
   int Center_x = (x0+x1)/2;
   int Center_y = (y0+y1)/2;
   int StartArc_x, StartArc_y;
   int EndArc_x, EndArc_y;
   int radius; /* major axis */
   double startAngle, endAngle,convrt = PI/180; /* degrees to radians */
   HGDIOBJ oldObject = SelectObject(memDC,thePen);
   HDC dc = GetDC(theWindow);
     
   CheckCorners(&x0,&y0,&x1,&y1);
     
   startAngle = stAngle *convrt; 
   endAngle=(arcAngle+stAngle)*convrt;
     
   radius = (((x1-x0) > (y1-y0)) ? x1-x0 : y1-y0)/2;
   StartArc_x = Center_x + (int) (radius * cos((double) startAngle));
   StartArc_y = Center_y - (int) (radius * sin((double) startAngle));
   EndArc_x = Center_x + (int) (radius * cos((double) endAngle));
   EndArc_y = Center_y - (int) (radius * sin((double) endAngle));
     
   Arc(memDC,x0,y0,x1,y1,StartArc_x,StartArc_y,EndArc_x,EndArc_y);
   SelectObject(memDC,oldObject);
     
   oldObject = SelectObject(dc,thePen);
   Arc(dc,x0,y0,x1,y1,StartArc_x,StartArc_y,EndArc_x,EndArc_y);
   SelectObject(dc,oldObject);
   ReleaseDC(theWindow,dc);
}
Пример #2
0
	void BuildPlacements(const TileCorner& knight)
	{
		BuildHashes();

		// Now that we've got our hashes set up, start from the knight's corner
		// and search side objects, looking to see if any corners match any
		// inside mAllPlacements.
		CheckCorners(knight);
	}
Пример #3
0
/* EXPORT-> HFillArc: Draw filled arc from stAngle thru arcAngle degrees */
void HFillArc(int x0,int y0,int x1,int y1,int stAngle,int arcAngle)
{
   unsigned int rw, rh;
   
   CheckCorners(&x0,&y0,&x1,&y1);
   /* calculate width and height */
   rw = abs(x1 - x0); rh = abs(y1 - y0);
   /* the angles are signed integers in 64ths of a degree */
   stAngle *=64; arcAngle*=64;
   XFillArc(theDisp, theWindow, theGC, x0, y0, rw, rh, stAngle, arcAngle);
}
Пример #4
0
/* EXPORT-> HFillRectangle: fill a rectangle */
void HFillRectangle(int x0, int y0, int x1, int y1)
{
   HDC dc = GetDC(theWindow);
   HGDIOBJ oldBrush = SelectObject(memDC,theBrush);
   HGDIOBJ oldPen = SelectObject(memDC,thinPen);
     
   CheckCorners(&x0,&y0,&x1,&y1);
     
   Rectangle(memDC,x0,y0,x1,y1);
     
   SelectObject(memDC,oldBrush);
   SelectObject(memDC,oldPen);
     
   oldBrush = SelectObject(dc,theBrush);
   oldPen = SelectObject(dc,thinPen);
   Rectangle(dc,x0,y0,x1,y1);
   SelectObject(dc,oldBrush);
   SelectObject(dc,oldPen);
   ReleaseDC(theWindow,dc);
}
Пример #5
0
/* EXPORT-> HDrawRectangle: draw a rectangle */
void HDrawRectangle(int x0, int y0, int x1, int y1)
{
   POINT points[5];
   HGDIOBJ oldObject = SelectObject(memDC,thePen);
   HDC dc = GetDC(theWindow);
     
   CheckCorners(&x0,&y0,&x1,&y1);
   points[0].x = x0; points[0].y = y0;
   points[1].x = x0; points[1].y = y1;
   points[2].x = x1; points[2].y = y1;
   points[3].x = x1; points[3].y = y0;
   points[4].x = x0; points[4].y = y0;
     
   Polyline(memDC, points, 5);
   SelectObject(memDC,oldObject);
     
   oldObject = SelectObject(dc,thePen);
   Polyline(dc, points, 5);
   SelectObject(dc,oldObject);
   ReleaseDC(theWindow,dc);
}
Пример #6
0
/* EXPORT-> HFillArc: Draw filled arc from stAngle thru arcAngle degrees */
void HFillArc(int x0,int y0,int x1,int y1,int stAngle,int arcAngle)
{
   int radius;
   int Center_x = (x0+x1)/2;
   int Center_y = (y0+y1)/2;
   int StartArc_x,StartArc_y;
   int EndArc_x,EndArc_y;
   HGDIOBJ oldBrush = SelectObject(memDC,theBrush);
   HGDIOBJ oldPen = SelectObject(memDC,thinPen);
   HDC dc = GetDC(theWindow);
   double startAngle, endAngle,convrt = PI/180; /* degrees to radians */
     
   CheckCorners(&x0,&y0,&x1,&y1);
     
   /* calculate point locations */
     
   startAngle = stAngle*convrt; 
   endAngle = (stAngle+arcAngle)*convrt;
     
   radius = (((x1-x0) > (y1-y0)) ? x1-x0 : y1-y0)/2;
   StartArc_x = Center_x + (int) (radius * cos((double) startAngle));
   StartArc_y = Center_y - (int) (radius * sin((double) startAngle));
   EndArc_x = Center_x + (int) (radius * cos((double) endAngle));
   EndArc_y = Center_y - (int) (radius * sin((double) endAngle));
     
   Pie(memDC,x0,y0,x1,y1,StartArc_x,StartArc_y,EndArc_x,EndArc_y);
     
   SelectObject(memDC,oldBrush);
   SelectObject(memDC,oldPen);
     
   oldBrush = SelectObject(dc,theBrush);
   oldPen = SelectObject(dc,thinPen);
   Pie(dc,x0,y0,x1,y1,StartArc_x,StartArc_y,EndArc_x,EndArc_y);
   SelectObject(dc,oldBrush);
   SelectObject(dc,oldPen);
   ReleaseDC(theWindow,dc);
}
Пример #7
0
/* EXPORT-> HFillRectangle: fill a rectangle */
void HFillRectangle(int x0, int y0, int x1, int y1)
{
   CheckCorners(&x0,&y0,&x1,&y1);
   XFillRectangle(theDisp, theWindow, theGC, x0, y0, x1 - x0, y1 - y0);
}