Example #1
0
void OSDRegion::DrawSomeText(CRect rect, const CString& txt, DWORD color, DWORD backcolor, int font, int iFontSize, 
							 DWORD dwFlags,
							 bool bTransparent)
{
	CDC* pDC = GetDC();

	CFont* theFont = CreateFont(font, iFontSize);
	CFont* oldFont = pDC->SelectObject(theFont);
	
	if (!bTransparent)
	{
		CSize sz = pDC->GetTextExtent(txt);
		sz.cx = min(sz.cx,rect.Width());
		DrawFilledBox(CRect(rect.TopLeft(), sz), backcolor, backcolor);
	}

	dwFlags|= DT_END_ELLIPSIS;

	pDC->SetBkMode(bTransparent ? TRANSPARENT : OPAQUE);
	pDC->SetBkColor(ConvertRGB(backcolor));
	pDC->SetTextColor(ConvertRGB(color));
	CString text = txt;
	text.Replace("&", "&&");
	pDC->DrawText(text, rect, dwFlags);
	pDC->SelectObject(oldFont);

	delete theFont;
	ReleaseDC();
}
Example #2
0
void 
ScrnInit(void)
{
    InitText();

    signal(SIGINT, SevereErrorSIGINT);
    signal(SIGSEGV, SevereErrorSIGSEGV);
#ifdef SIGQUIT
    signal(SIGQUIT, SevereErrorSIGQUIT);
#endif

    LastCheck = StartTime = (long)I_FloatTime();

    SetForeColor(ANSI_WHITE);
    SetBackColor(ANSI_BLUE);
    DrawFilledBox(0, 0, ScrnWidth, ScrnHeight);

    StatusLine = 5;

    MoveCurs(2, 1);
    SetForeColor(ANSI_WHITE);
    SetBackColor(ANSI_BLUE);
    DrawVLine(45, 5, ScrnHeight - 6);
    DrawHLine(1, 4, ScrnWidth - 2);
    DrawHLine(1, 2, ScrnWidth - 2);
    MoveCurs(2, 3);
    CPrintf("$f3Elapsed time: $f200:00:00                       $f7By Lee Smith <[email protected]$f7>$f3");
    remove("error.log");
}
Example #3
0
/*----------------------------------------------------------------------
  ComputeFilledBox :
  Modify Bounding Box according to opengl feedback mechanism
  (after transformation, coordinates may have changed)
  
  ----------------------------------------------------------------------*/
void ComputeFilledBox (PtrBox box, int frame, int xmin, int xmax,
                       int ymin, int ymax, ThotBool show_bgimage)
{
  GLfloat feedBuffer[4096];
  GLint   mode;
  int     size;
  
  if (NotFeedBackMode)
    {
      glGetIntegerv (GL_RENDER_MODE, &mode);
      box->BxBoundinBoxComputed = TRUE; 
      glFeedbackBuffer (4096, GL_2D, feedBuffer);
      glRenderMode (GL_FEEDBACK);
      NotFeedBackMode = FALSE;
      DrawFilledBox (box, box->BxAbstractBox, frame, NULL,
		     xmin, xmax, ymin, ymax, FALSE, TRUE, TRUE, show_bgimage);
      size = glRenderMode (mode);
      NotFeedBackMode = TRUE;
      if (size > 0)
        {
          box->BxClipX = -1;
          box->BxClipY = -1;
          getboundingbox (size, feedBuffer, frame,
                          &box->BxClipX,
                          &box->BxClipY,
                          &box->BxClipW,
                          &box->BxClipH);     
          box->BxBoundinBoxComputed = TRUE; 
          /* printBuffer (size, feedBuffer); */
        }
    }
}
Example #4
0
void OSDRegion::DrawTextInBox(CRect rect, const CString& text, DWORD dwForeColor, DWORD dwBackColor, DWORD dwBorderColor, int iFont, int iSize, DWORD dwFlags)
{
	DrawFilledBox(rect, dwBackColor, dwBorderColor);
	rect.top +=1;
	rect.bottom -=1;
	rect.left +=1;
	rect.right -=1;
	DrawSomeText(rect, text, dwForeColor, dwBackColor , iFont, iSize, dwFlags);
}
Example #5
0
int OSDRegion::FillBox(DWORD x, DWORD y, DWORD w, DWORD h, DWORD color)
{
	ASSERT(x<=m_w);
	ASSERT(y<=m_h);
	ASSERT(x+w<=m_w);
	ASSERT(y+h<=m_h);
	CRect rect(CPoint(x,y), CSize(w,h));
	rect.OffsetRect(CPoint(GetXOffs(), GetYOffs()));
	DrawFilledBox(rect,color, color);
	return 1;
}
Example #6
0
/***********************************************************************

  DrawLinks() - this function draws the current link hierarchy as stated 
		in the data structure 'data'.

***********************************************************************/
int 
DrawLinks(MyProgram *data)
{
   int i;

   if (data->redraw == TRUE)
      SetDrawMode(SANE_XOR);

   /*  draw each link 
    */
   for (i = 0; i < data->num_links; i++)
      DrawLine(data->links[i].start.x, InvertY(data->links[i].start.y), 
		data->links[i].visend.x, InvertY(data->links[i].visend.y));

   /*  draw end effector
    */
   switch(data->end_effect.type) {
      case ENDEFF_SQUARE:
         DrawFilledBox(data->end_effect.center.x, 
			InvertY(data->end_effect.center.y),
			ENDEFF_SIZE, ENDEFF_SIZE);
         break;
      case ENDEFF_CIRCLE:
         DrawFilledArc(data->end_effect.center.x, 
			InvertY(data->end_effect.center.y),
			ENDEFF_SIZE, ENDEFF_SIZE, 0, 360);
         break;
      case ENDEFF_TRIANGLE:
         break;
      default:
         break;
   }

   SetDrawMode(GXcopy);

   return(0);
} /* end of DrawLinks() */
Example #7
0
void Render(Matrix CTM, PointStr center)
{

  int i, j;
  int x = 0;
  int y = 1;
  float tvec[4];

  /* 
   *  Draw the initial blank screen 
   */

#ifdef OS_WIN32 
  DrawFilledBox(0, 0, Spw_WindowWidth, Spw_WindowHeight, 
                GetStockObject( WHITE_BRUSH ) );
#else
  DrawFilledBox(0, 0, Spw_WindowWidth, Spw_WindowHeight, Spw_Background);
#endif

  /*
   *  Transform and draw the center of rotation
   */

  tvec[0]=center.Coord[0];
  tvec[1]=center.Coord[1];
  tvec[2]=center.Coord[2];
  tvec[3]=(float)1.0;
  SPW_Mult14x44(tvec, tvec, CTM);
  Spw_DrawPoints[0].Coord[0] = tvec[0];
  Spw_DrawPoints[0].Coord[1] = tvec[1];
  Spw_DrawPoints[0].Coord[2] = tvec[2];

  SetColor(Spw_Foreground);
  DrawLine((int)(Spw_DrawPoints[0].Coord[0])-10,
           (int)(Spw_DrawPoints[0].Coord[1]),
           (int)(Spw_DrawPoints[0].Coord[0])+10,
           (int)(Spw_DrawPoints[0].Coord[1]));
  DrawLine((int)(Spw_DrawPoints[0].Coord[0]),
           (int)(Spw_DrawPoints[0].Coord[1])-10,
           (int)(Spw_DrawPoints[0].Coord[0]),
           (int)(Spw_DrawPoints[0].Coord[1])+10 );

  /*
   *  Store transformed points into drawing array
   */

  for (i=0; i < Spw_NPoints; i++)
    {
    tvec[0]=Spw_Points[i].Coord[0];
    tvec[1]=Spw_Points[i].Coord[1];
    tvec[2]=Spw_Points[i].Coord[2];
    tvec[3]=(float)1.0;
    SPW_Mult14x44(tvec, tvec, CTM);
    Spw_DrawPoints[i].Coord[0] = tvec[0];
    Spw_DrawPoints[i].Coord[1] = tvec[1];
    Spw_DrawPoints[i].Coord[2] = tvec[2];
  }

  /*
   * Draw the wireframe object 
   */

  SetColor(Spw_Foreground);
  for (j=0; j < Spw_NPolygons; j++)            /* Loop through the polygons */
    for (i=0; i < Spw_Polygons[j].Edges; i++){  /* Loop throught the edges   */
      /* Draw the points */
      DrawLine((int)Spw_DrawPoints[Spw_Edges[Spw_Polygons[j].EList[i]].Start].Coord[x], 
               (int)Spw_DrawPoints[Spw_Edges[Spw_Polygons[j].EList[i]].Start].Coord[y],
               (int)Spw_DrawPoints[Spw_Edges[Spw_Polygons[j].EList[i]].End].Coord[x], 
               (int)Spw_DrawPoints[Spw_Edges[Spw_Polygons[j].EList[i]].End].Coord[y]);
    }

} /* end of Render */