示例#1
0
文件: gist.c 项目: MattWherry/yorick
int GpLines(long n, const GpReal *px, const GpReal *py)
{
  int value= 0;
  Engine *engine;
  int closed= gpCloseNext;
  int smooth= gpSmoothNext;
  int clip= gistClip && !gpClipDone;
  gpCloseNext= gpSmoothNext=  gpClipDone= 0;

  if (smooth) return SmoothLines(n, px, py, closed, smooth, clip);

  if (clip) InitializeClip();
  else gpClipInit= 0;

  if (!clip || ClipBegin(px, py, n, closed)) {
    for (engine=GpNextActive(0) ; engine ; engine=GpNextActive(engine))
      if (!engine->inhibit)
        value|= engine->DrawLines(engine, n, px, py, closed, smooth);
  } else while ((n=ClipMore())) {
    for (engine=GpNextActive(0) ; engine ; engine=GpNextActive(engine))
      if (!engine->inhibit)
        value|= engine->DrawLines(engine, n, xClip, yClip, 0, smooth);
  }

  return value;
}
示例#2
0
文件: gist.c 项目: MattWherry/yorick
static int SmoothLines(long n, const GpReal *px, const GpReal *py,
                       int closed, int smooth, int clip)
{
  int value= 0;
  Engine *engine;
  GpReal scalx, offx, scaly, offy;

  if (clip && !gpClipInit) InitializeClip();
  else gpClipInit= 0;

  /* Now that clip has been set up, can change coordiante transform--
     output from DoSmoothing is in normalized coordinates, while input
     is in world coordinates...  */
  SwapNormMap(&scalx, &offx, &scaly, &offy);

  if (!clip || ClipBegin(px, py, n, closed)) {
    DoSmoothing(&n, &px, &py, closed, smooth, scalx, offx, scaly, offy);
    /* Note: if closed, n= 3*n+1, last point same as first */
    for (engine=GpNextActive(0) ; engine ; engine=GpNextActive(engine))
      if (!engine->inhibit)
        value|= engine->DrawLines(engine, n, px, py, 0, smooth);
  } else while ((n=ClipMore())) {
    px= xClip;
    py= yClip;
    DoSmoothing(&n, &px, &py, 0, smooth, scalx, offx, scaly, offy);
    for (engine=GpNextActive(0) ; engine ; engine=GpNextActive(engine))
      if (!engine->inhibit)
        value|= engine->DrawLines(engine, n, px, py, 0, smooth);
  }

  SwapMapNorm();

  return value;
}
示例#3
0
文件: gist.c 项目: MattWherry/yorick
int GaLines(long n, const GpReal *px, const GpReal *py)
     /* Like GpLines, but includes GaAttributes fancy line attributes
        as well as the line attributes from GpAttributes.  */
{
  int value= 0;

  /* Redirect to polymarker if no line type */
  if (gistA.l.type==L_NONE) {
    /* if (!gistA.dl.marks) return 0;    makes no sense */
    return GpMarkers(n, px, py);
  }

  /* Use the (potentially faster) GpLines routine to draw
     an undecorated polyline.  */
  if (!gistA.dl.marks && !gistA.dl.rays) {
    gpCloseNext= gistA.dl.closed;
    gpSmoothNext= gistA.dl.smooth;
    return GpLines(n, px, py);
  }

  if (gistClip) InitializeClip();
  gpClipInit= 0;

  /* Note that a decorated line cannot be smooth... */
  if (!gistClip || ClipBegin(px, py, n, gistA.dl.closed)) {
    gpCloseNext= gistA.dl.closed;
    gpClipDone= 1;
    value= GpLines(n, px, py);
    DecorateLines(n, px, py, gistA.dl.closed);
  } else while ((n= ClipMore())) {
    gpClipDone= 1;
    value|= GpLines(n, xClip, yClip);
    DecorateLines(n, xClip, yClip, 0);
  }

  return value;
}
示例#4
0
//
//  FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM)
//
//  PURPOSE:  Processes messages for the main window.
//
//  WM_COMMAND	- process the application menu
//  WM_PAINT	- Paint the main window
//  WM_DESTROY	- post a quit message and return
//
//
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	int wmId, wmEvent;
	PAINTSTRUCT ps;
	HDC hdc;

	switch (message)
	{
    case WM_SIZE:
		 ResizeClip ();
		 break;
	case WM_COMMAND:
		wmId    = LOWORD(wParam);
		wmEvent = HIWORD(wParam);
		// Parse the menu selections:
		switch (wmId)
		{
		case IDM_ABOUT:
			 DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
			 break;

        case ID_OPEN_CLIP:
             OpenClip();
             break;

        case ID_CLOSE_CLIP:
             CloseClip();
             break;

		case ID_PAUSE:
             PausePlayClip();
             break;

        case ID_MUTE:
             MuteClip();
             break;

        case ID_SIZE_FULLSCREEN:
             FullScreen();
             break;

		case IDM_EXIT:
			 DestroyWindow(hWnd);
			 break;
		default:
			return DefWindowProc(hWnd, message, wParam, lParam);
		}
		break;
    case WM_KEYDOWN:
        switch(toupper((int) wParam))
        {
            case 'P':
                PausePlayClip();
                break;

            case 'S':
                break;

            case 'M':
                MuteClip();
                break;

            case 'F':
            case VK_RETURN:
                FullScreen();
                break;

			case 'B':
				ClipBegin ();
				break;

			case 'H':
                //InitVideoWindow(1,2);
                //CheckSizeMenu(wParam);
                break;
            case 'N':
                //InitVideoWindow(1,1);
                //CheckSizeMenu(wParam);
                break;
            case 'D':
                //InitVideoWindow(2,1);
                //CheckSizeMenu(wParam);
                break;
            case 'T':
                //InitVideoWindow(3,4);
                //CheckSizeMenu(wParam);
                break;

            case VK_ESCAPE:
				if (videoStream.IsValid() && videoStream->IsFullscreen())
				{
                    FullScreen();
				}
                else
				{
                    CloseClip();
				}
                break;

            case VK_F12:
            case 'Q':
            case 'X':
                CloseClip();
                break;
        }
        break;
	case WM_PAINT:
		{
			if (videoStream.IsValid())
			{
				//videoStream->Repaint();
			}
			else
			{
				hdc = BeginPaint(hWnd, &ps);
				// TODO: Add any drawing code here...
				RECT rcClient;
				//RECT rcToolbar;

				GetClientRect(hWnd, &rcClient);
				//GetClientRect(toolbar, &rcToolbar);

				HRGN hRgn1 = CreateRectRgnIndirect(&rcClient);
				//HRGN hRgn2 = CreateRectRgnIndirect(&rcToolbar);

				//CombineRgn(hRgn1, hRgn1, hRgn2, RGN_DIFF);

				//::PaintRgn(hdc, hRgn2);

				FillRgn(hdc, hRgn1, brush);

				DeleteObject(hRgn1);
				//DeleteObject(hRgn2);

				EndPaint(hWnd, &ps);
			}
		break;
		}
	case WM_DESTROY:
		PostQuitMessage(0);
		break;
	case DSHOW:
        // HandleGraphEvent();
        break;


	default:
		return DefWindowProc(hWnd, message, wParam, lParam);
	}
	return FALSE;
}