Пример #1
0
void SShadeRect( IRect *irect , int darkcolor , int lightcolor )

{
	float xmin = XTRANS(irect->xmin);
	float ymax = YTRANS(irect->ymin);
	float xmax = XTRANS(irect->xmax);
	float ymin = YTRANS(irect->ymax);

	/* printf("SShadeRect (0) : %d %d %d %d\n",
		irect->xmin,irect->ymin,irect->xmax,irect->ymax); */
	/* printf("SShadeRect (1) : %f %f %f %f\n",xmin,ymin,xmax,ymax); */

	/* first pass */

	QNewPen(darkcolor);
	QLine( xmin , ymin , xmax , ymin );	/* top */
	QLine( xmax , ymin , xmax , ymax );	/* right */
	QNewPen(lightcolor);
	QLine( xmax , ymax , xmin , ymax );	/* bottom */
	QLine( xmin , ymax , xmin , ymin );	/* left */

	/* second pass -> thicken line */

	xmin += 1.; ymin += 1.;
	xmax -= 1.; ymax -= 1.;

	QNewPen(darkcolor);
	QLine( xmin , ymin , xmax , ymin );	/* top */
	QLine( xmax , ymin , xmax , ymax );	/* right */
	QNewPen(lightcolor);
	QLine( xmax , ymax , xmin , ymax );	/* bottom */
	QLine( xmin , ymax , xmin , ymin );	/* left */

	/* printf("SShadeRect (2) : %f %f %f %f\n",xmin,ymin,xmax,ymax); */
}
Пример #2
0
static PetscErrorCode PetscDrawArrow_Image(PetscDraw draw,PetscReal xl,PetscReal yl,PetscReal xr,PetscReal yr,int c)
{
  PetscImage img = (PetscImage)draw->data;
  PetscFunctionBegin;
  PetscDrawValidColor(c);
  {
    int x_1 = XTRANS(draw,img,xl), x_2 = XTRANS(draw,img,xr);
    int y_1 = YTRANS(draw,img,yl), y_2 = YTRANS(draw,img,yr);
    if (x_1 == x_2 && y_1 == y_2) PetscFunctionReturn(0);
    PetscImageDrawLine(img,x_1,y_1,x_2,y_2,c);
    if (x_1 == x_2 && PetscAbs(y_1 - y_2) > 7) {
      if (y_2 > y_1) {
        PetscImageDrawLine(img,x_2,y_2,x_2-3,y_2-3,c);
        PetscImageDrawLine(img,x_2,y_2,x_2+3,y_2-3,c);
      } else {
        PetscImageDrawLine(img,x_2,y_2,x_2-3,y_2+3,c);
        PetscImageDrawLine(img,x_2,y_2,x_2+3,y_2+3,c);
      }
    }
    if (y_1 == y_2 && PetscAbs(x_1 - x_2) > 7) {
      if (x_2 > x_1) {
        PetscImageDrawLine(img,x_2-3,y_2-3,x_2,y_2,c);
        PetscImageDrawLine(img,x_2-3,y_2+3,x_2,y_2,c);
      } else {
        PetscImageDrawLine(img,x_2,y_2,x_2+3,y_2-3,c);
        PetscImageDrawLine(img,x_2,y_2,x_2+3,y_2+3,c);
      }
    }
   }
  PetscFunctionReturn(0);
}
Пример #3
0
static PetscErrorCode PetscDrawRectangle_Win32(PetscDraw draw,PetscReal xl,PetscReal yl,PetscReal xr,PetscReal yr,int c1,int c2,int c3,int c4)
{
  PetscDraw_Win32 *windraw = (PetscDraw_Win32*)draw->data;
  HBRUSH          hbrush;
  RECT            rect;
  int             x1,yone,x2,y2;
  HDC             hdc;
  
  PetscFunctionBegin;
  x1 = XTRANS(draw,windraw,xl);
  x2 = XTRANS(draw,windraw,xr);
  yone = YTRANS(draw,windraw,yl);
  y2 = YTRANS(draw,windraw,yr);
  SetRect(&rect,x1,y2,x2,yone);        
  if (c1==c2 && c2==c3 && c3==c4) {         
    TranslateColor_Win32(draw,c1);
  } else {                                   
    AverageColorRectangle_Win32(draw,c1,c2,c3,c4);
  }
  hbrush = CreateSolidBrush(windraw->currentcolor);
  
  if(windraw->node->DoubleBuffered) {
    hdc = windraw->node->DoubleBuffer;
  } else {
    hdc = windraw->node->Buffer;
  }
  FillRect(hdc,&rect,hbrush);
  /* Forces a WM_PAINT message and erases background */
  InvalidateRect(windraw->hWnd,NULL,TRUE);
  UpdateWindow(windraw->hWnd);
  PetscFunctionReturn(0);
}
Пример #4
0
static PetscErrorCode PetscDrawLine_Win32(PetscDraw draw,PetscReal xl,PetscReal yl,PetscReal xr,PetscReal yr,int color)
{
  PetscDraw_Win32 *windraw = (PetscDraw_Win32*)draw->data;
  HPEN            hpen;
  int             x1,yone,x2,y2;
  HDC             hdc;
  
  PetscFunctionBegin;
  TranslateColor_Win32(draw,color);
  x1   = XTRANS(draw,windraw,xl);x2  = XTRANS(draw,windraw,xr); 
  yone   = YTRANS(draw,windraw,yl);y2  = YTRANS(draw,windraw,yr); 
  hpen = CreatePen (PS_SOLID, windraw->linewidth, windraw->currentcolor);
  if(windraw->node->DoubleBuffered) {
    hdc = windraw->node->DoubleBuffer;
  } else {
    hdc = windraw->node->Buffer;
  }
  SelectPen(hdc,hpen);
  MoveToEx(hdc,x1,yone,NULL);
  LineTo(hdc,x2,y2);
  /* Forces a WM_PAINT message and erases background */
  InvalidateRect(windraw->hWnd,NULL,TRUE);
  UpdateWindow(windraw->hWnd);
  PetscFunctionReturn(0);
}
Пример #5
0
void SFillRect( IRect *irect , int color )

{
	float xmin = XTRANS(irect->xmin);
	float ymin = YTRANS(irect->ymin);
	float xmax = XTRANS(irect->xmax);
	float ymax = YTRANS(irect->ymax);

	QRectFill(xmin,ymin,xmax,ymax,color);
}
Пример #6
0
static PetscErrorCode PetscDrawLine_Image(PetscDraw draw,PetscReal xl,PetscReal yl,PetscReal xr,PetscReal yr,int c)
{
  PetscImage img = (PetscImage)draw->data;
  PetscFunctionBegin;
  {
    int x_1 = XTRANS(draw,img,xl), x_2 = XTRANS(draw,img,xr);
    int y_1 = YTRANS(draw,img,yl), y_2 = YTRANS(draw,img,yr);
    PetscImageDrawLine(img,x_1,y_1,x_2,y_2,c);
  }
  PetscFunctionReturn(0);
}
Пример #7
0
static PetscErrorCode PetscDrawEllipse_X(PetscDraw Win, PetscReal x, PetscReal y, PetscReal a, PetscReal b, int c)
{
  PetscDraw_X* XiWin = (PetscDraw_X*) Win->data;
  int          xA, yA, w, h;

  PetscFunctionBegin;
  PetscDrawXiSetColor(XiWin, c);
  xA = XTRANS(Win, XiWin, x - a/2.0); w = XTRANS(Win, XiWin, x + a/2.0) - xA;
  yA = YTRANS(Win, XiWin, y + b/2.0); h = PetscAbs(YTRANS(Win, XiWin, y - b/2.0) - yA);
  XFillArc(XiWin->disp, PetscDrawXiDrawable(XiWin), XiWin->gc.set, xA, yA, w, h, 0, 23040);
  PetscFunctionReturn(0);
}
Пример #8
0
static PetscErrorCode PetscDrawRectangle_X(PetscDraw draw,PetscReal xl,PetscReal yl,PetscReal xr,PetscReal yr,int c1,int c2,int c3,int c4)
{
  PetscDraw_X* XiWin = (PetscDraw_X*)draw->data;
  int          x1,y_1,w,h,c = (c1 + c2 + c3 + c4)/4;

  PetscFunctionBegin;
  PetscDrawXiSetColor(XiWin,c);
  x1 = XTRANS(draw,XiWin,xl);   w  = XTRANS(draw,XiWin,xr) - x1;
  y_1 = YTRANS(draw,XiWin,yr);   h  = YTRANS(draw,XiWin,yl) - y_1;
  if (w <= 0) w = 1; if (h <= 0) h = 1;
  XFillRectangle(XiWin->disp,PetscDrawXiDrawable(XiWin),XiWin->gc.set,x1,y_1,w,h);
  PetscFunctionReturn(0);
}
Пример #9
0
PetscErrorCode PetscDrawLine_X(PetscDraw draw,PetscReal xl,PetscReal yl,PetscReal xr,PetscReal yr,int cl)
{
  PetscDraw_X* XiWin = (PetscDraw_X*)draw->data;
  int          x1,y_1,x2,y2;

  PetscFunctionBegin;
  PetscDrawXiSetColor(XiWin,cl);
  x1 = XTRANS(draw,XiWin,xl);   x2  = XTRANS(draw,XiWin,xr);
  y_1 = YTRANS(draw,XiWin,yl);   y2  = YTRANS(draw,XiWin,yr);
  if (x1 == x2 && y_1 == y2) PetscFunctionReturn(0);
  XDrawLine(XiWin->disp,PetscDrawXiDrawable(XiWin),XiWin->gc.set,x1,y_1,x2,y2);
  PetscFunctionReturn(0);
}
Пример #10
0
void SPlotRect( IRect *irect )

{
	float xmin = XTRANS(irect->xmin);
	float ymin = YTRANS(irect->ymin);
	float xmax = XTRANS(irect->xmax);
	float ymax = YTRANS(irect->ymax);

	QMove( xmin , ymin );
	QPlot( xmin , ymax );
	QPlot( xmax , ymax );
	QPlot( xmax , ymin );
	QPlot( xmin , ymin );
}
Пример #11
0
static PetscErrorCode PetscDrawTriangle_Image(PetscDraw draw,PetscReal X_1,PetscReal Y_1,PetscReal X_2,PetscReal Y_2,PetscReal X_3,PetscReal Y_3,int c1,int c2,int c3)
{
  PetscImage img = (PetscImage)draw->data;
  PetscFunctionBegin;
  PetscDrawValidColor(c1);
  PetscDrawValidColor(c2);
  PetscDrawValidColor(c3);
  {
    int x_1 = XTRANS(draw,img,X_1), x_2 = XTRANS(draw,img,X_2), x_3 = XTRANS(draw,img,X_3);
    int y_1 = YTRANS(draw,img,Y_1), y_2 = YTRANS(draw,img,Y_2), y_3 = YTRANS(draw,img,Y_3);
    PetscImageDrawTriangle(img,x_1,y_1,c1,x_2,y_2,c2,x_3,y_3,c3);
  }
  PetscFunctionReturn(0);
}
Пример #12
0
static PetscErrorCode PetscDrawEllipse_Image(PetscDraw draw,PetscReal x,PetscReal y,PetscReal a,PetscReal b,int c)
{
  PetscImage img = (PetscImage)draw->data;
  PetscFunctionBegin;
  PetscDrawValidColor(c);
  a = PetscAbsReal(a);
  b = PetscAbsReal(b);
  {
    int xc = XTRANS(draw,img,x), w = XTRANS(draw,img,x + a/2) + 0 - xc;
    int yc = YTRANS(draw,img,y), h = YTRANS(draw,img,y - b/2) + 0 - yc;
    if (PetscAbsReal(a-b) <= 0)  w = h = PetscMin(w,h); /* workaround truncation errors */
    PetscImageDrawEllipse(img,xc,yc,w,h,c);
  }
  PetscFunctionReturn(0);
}
Пример #13
0
static PetscErrorCode PetscDrawPoint_Win32(PetscDraw draw,PetscReal x,PetscReal y,int color)
{       
  PetscDraw_Win32 *windraw = (PetscDraw_Win32*)draw->data;
  HBRUSH          hbrush;
  HRGN            hrgn;
  int             radius;
  int             x1,yone;
  HDC             hdc;
  
  PetscFunctionBegin;
  TranslateColor_Win32(draw,color);
  x1     = XTRANS(draw,windraw,x);   
  yone     = YTRANS(draw,windraw,y);
  hbrush = CreateSolidBrush(windraw->currentcolor);
  if(windraw->node->DoubleBuffered) {
    hdc = windraw->node->DoubleBuffer;
  } else {
    hdc = windraw->node->Buffer;
  }
  /* desired size is one logical pixel so just turn it on */
  if (windraw->pointdiameter == 1) {
    SetPixelV(hdc,x1,yone,windraw->currentcolor);
  } else {
    /* draw point around position determined */
    radius = windraw->pointdiameter/2; /* integer division */
    hrgn   = CreateEllipticRgn(x1-radius,yone-radius,x1+radius,yone+radius);
    FillRgn(hdc,hrgn,hbrush);
  }
  /* Forces a WM_PAINT and erases background */
  InvalidateRect(windraw->hWnd,NULL,TRUE);
  UpdateWindow(windraw->hWnd);
  PetscFunctionReturn(0);
}
Пример #14
0
static PetscErrorCode PetscDrawString_X(PetscDraw draw,PetscReal x,PetscReal  y,int c,const char chrs[])
{
  PetscErrorCode ierr;
  int            xx,yy;
  size_t         len;
  PetscDraw_X    *XiWin = (PetscDraw_X*)draw->data;
  char           *substr;
  PetscToken     token;

  PetscFunctionBegin;
  xx = XTRANS(draw,XiWin,x);  yy = YTRANS(draw,XiWin,y);
  PetscDrawXiSetColor(XiWin,c);

  ierr = PetscTokenCreate(chrs,'\n',&token);CHKERRQ(ierr);
  ierr = PetscTokenFind(token,&substr);CHKERRQ(ierr);
  ierr = PetscStrlen(substr,&len);CHKERRQ(ierr);
  XDrawString(XiWin->disp,PetscDrawXiDrawable(XiWin),XiWin->gc.set,xx,yy - XiWin->font->font_descent,substr,len);
  ierr = PetscTokenFind(token,&substr);CHKERRQ(ierr);
  while (substr) {
    yy  += 4*XiWin->font->font_descent;
    ierr = PetscStrlen(substr,&len);CHKERRQ(ierr);
    XDrawString(XiWin->disp,PetscDrawXiDrawable(XiWin),XiWin->gc.set,xx,yy - XiWin->font->font_descent,substr,len);
    ierr = PetscTokenFind(token,&substr);CHKERRQ(ierr);
  }
  ierr = PetscTokenDestroy(&token);CHKERRQ(ierr);

  PetscFunctionReturn(0);
}
Пример #15
0
static PetscErrorCode PetscDrawRectangle_Image(PetscDraw draw,PetscReal xl,PetscReal yl,PetscReal xr,PetscReal yr,int c1,int c2,int c3,int c4)
{
  PetscImage img = (PetscImage)draw->data;
  PetscFunctionBegin;
  PetscDrawValidColor(c1);
  PetscDrawValidColor(c2);
  PetscDrawValidColor(c3);
  PetscDrawValidColor(c4);
  {
    int x = XTRANS(draw,img,xl), w = XTRANS(draw,img,xr) + 1 - x;
    int y = YTRANS(draw,img,yr), h = YTRANS(draw,img,yl) + 1 - y;
    int c  = (c1 + c2 + c3 + c4)/4;
    PetscImageDrawRectangle(img,x,y,w,h,c);
  }
  PetscFunctionReturn(0);
}
Пример #16
0
static PetscErrorCode PetscDrawCoordinateToPixel_Image(PetscDraw draw,PetscReal x,PetscReal y,int *i,int *j)
{
  PetscImage img = (PetscImage)draw->data;
  PetscFunctionBegin;
  if (i) *i = XTRANS(draw,img,x);
  if (j) *j = YTRANS(draw,img,y);
  PetscFunctionReturn(0);
}
Пример #17
0
PetscErrorCode PetscDrawCoordinateToPixel_X(PetscDraw draw,PetscReal x,PetscReal y,PetscInt *i,PetscInt *j)
{
  PetscDraw_X*   XiWin = (PetscDraw_X*)draw->data;

  PetscFunctionBegin;
  *i = XTRANS(draw,XiWin,x);
  *j = YTRANS(draw,XiWin,y);
  PetscFunctionReturn(0);
}
Пример #18
0
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);
}
Пример #19
0
PetscErrorCode PetscDrawArrow_X(PetscDraw draw,PetscReal xl,PetscReal yl,PetscReal xr,PetscReal yr,int cl)
{
  PetscDraw_X* XiWin = (PetscDraw_X*)draw->data;
  int          x1,y_1,x2,y2;

  PetscFunctionBegin;
  PetscDrawXiSetColor(XiWin,cl);
  x1 = XTRANS(draw,XiWin,xl);   x2  = XTRANS(draw,XiWin,xr);
  y_1 = YTRANS(draw,XiWin,yl);   y2  = YTRANS(draw,XiWin,yr);
  if (x1 == x2 && y_1 == y2) PetscFunctionReturn(0);
  XDrawLine(XiWin->disp,PetscDrawXiDrawable(XiWin),XiWin->gc.set,x1,y_1,x2,y2);
  if (x1 == x2 && PetscAbs(y_1 - y2) > 7) {
    if (y2 > y_1) {
       XDrawLine(XiWin->disp,PetscDrawXiDrawable(XiWin),XiWin->gc.set,x2,y2,x2-3,y2-3);
       XDrawLine(XiWin->disp,PetscDrawXiDrawable(XiWin),XiWin->gc.set,x2,y2,x2+3,y2-3);
    } else {
       XDrawLine(XiWin->disp,PetscDrawXiDrawable(XiWin),XiWin->gc.set,x2,y2,x2-3,y2+3);
       XDrawLine(XiWin->disp,PetscDrawXiDrawable(XiWin),XiWin->gc.set,x2,y2,x2+3,y2+3);
    }
  }
  PetscFunctionReturn(0);
}
Пример #20
0
static PetscErrorCode PetscDrawTriangle_Win32(PetscDraw draw,PetscReal x1,PetscReal yone,PetscReal x2,PetscReal y2,
			      PetscReal x3,PetscReal y3,int c1,int c2,int c3)
{       
  PetscDraw_Win32 *windraw = (PetscDraw_Win32*)draw->data;
  HBRUSH          hbrush;
  HPEN            hpen;
  int             p1x,p1y,p2x,p2y,p3x,p3y;
  HDC             bit;
  
  PetscFunctionBegin;
  AverageColorTriangle_Win32(draw,c1,c2,c3); 
  hbrush = CreateSolidBrush(windraw->currentcolor);
  hpen   = CreatePen(PS_SOLID,0,windraw->currentcolor);
  p1x = XTRANS(draw,windraw,x1);
  p2x = XTRANS(draw,windraw,x2);
  p3x = XTRANS(draw,windraw,x3);
  p1y = YTRANS(draw,windraw,yone);
  p2y = YTRANS(draw,windraw,y2);
  p3y = YTRANS(draw,windraw,y3);
  
  if(windraw->node->DoubleBuffered) {
    bit = windraw->node->DoubleBuffer;
  } else {
    bit = windraw->node->Buffer;
  }
  BeginPath(bit);
  MoveToEx(bit,p1x,p1y,NULL);
  LineTo(bit,p2x,p2y);
  LineTo(bit,p3x,p3y);
  LineTo(bit,p1x,p1y);
  EndPath(bit);
  SelectPen(bit,hpen);
  SelectBrush(bit,hbrush);
  StrokeAndFillPath(bit);
  /* Forces a WM_PAINT message and erases background */
  InvalidateRect(windraw->hWnd,NULL,TRUE);
  UpdateWindow(windraw->hWnd);
  PetscFunctionReturn(0);
}
Пример #21
0
static PetscErrorCode PetscDrawPoint_Image(PetscDraw draw,PetscReal x,PetscReal y,int c)
{
  PetscImage img = (PetscImage)draw->data;
  PetscFunctionBegin;
  PetscDrawValidColor(c);
  {
    int j, xx = XTRANS(draw,img,x);
    int i, yy = YTRANS(draw,img,y);
    for (i=-1; i<=1; i++)
      for (j=-1; j<=1; j++)
        PetscImageDrawPixel(img,xx+j,yy+i,c);
  }
  PetscFunctionReturn(0);
}
Пример #22
0
static PetscErrorCode PetscDrawPoint_X(PetscDraw draw,PetscReal x,PetscReal  y,int c)
{
  int          xx,yy,i,j;
  PetscDraw_X* XiWin = (PetscDraw_X*)draw->data;

  PetscFunctionBegin;
  xx = XTRANS(draw,XiWin,x);  yy = YTRANS(draw,XiWin,y);
  PetscDrawXiSetColor(XiWin,c);
  for (i=-1; i<2; i++) {
    for (j=-1; j<2; j++) {
      XDrawPoint(XiWin->disp,PetscDrawXiDrawable(XiWin),XiWin->gc.set,xx+i,yy+j);
    }
  }
  PetscFunctionReturn(0);
}
Пример #23
0
static PetscErrorCode PetscDrawStringVertical_Image(PetscDraw draw,PetscReal x,PetscReal y,int c,const char text[])
{
  PetscImage img = (PetscImage)draw->data;
  PetscFunctionBegin;
  PetscDrawValidColor(c);
  {
    char chr[2] = {0, 0};
    int  xx = XTRANS(draw,img,x);
    int  yy = YTRANS(draw,img,y);
    int  offset = PetscImageFontHeight;
    while ((chr[0] = *text++)) {
      PetscImageDrawText(img,xx,yy+offset,c,chr);
      yy += PetscImageFontHeight;
    }
  }
  PetscFunctionReturn(0);
}
Пример #24
0
static PetscErrorCode PetscDrawStringVertical_Win32(PetscDraw draw,PetscReal x,PetscReal y,int color,const char *text)
{       
  PetscDraw_Win32 *windraw = (PetscDraw_Win32*)draw->data;
  RECT            r;
  HFONT           hfont;                                                                                    
  LOGFONT         logfont;
  int             x1,yone;
  HDC             hdc;
  
  PetscFunctionBegin;
  x1           = XTRANS(draw,windraw,x);
  yone           = YTRANS(draw,windraw,y);
  r.left       = x1;
  r.bottom     = yone + 30;
  r.right      = x1 + 1;
  r.top        = yone - 30;
  logfont.lfEscapement     = 2700; /* Causes verticle text drawing */
  logfont.lfHeight         = windraw->stringheight;
  logfont.lfWidth          = windraw->stringwidth;
  logfont.lfOrientation    = 0;
  logfont.lfCharSet        = DEFAULT_CHARSET;
  logfont.lfClipPrecision  = 0;
  logfont.lfItalic         = 0;
  logfont.lfOutPrecision   = 0;
  logfont.lfPitchAndFamily = DEFAULT_PITCH;
  logfont.lfQuality        = DEFAULT_QUALITY;
  logfont.lfStrikeOut      = 0;
  logfont.lfUnderline      = 0;
  logfont.lfWeight         = FW_NORMAL;
  hfont = CreateFontIndirect(&logfont);
  TranslateColor_Win32(draw,color);
  if(windraw->node->DoubleBuffered) {
    hdc = windraw->node->DoubleBuffer;
  } else {
    hdc = windraw->node->Buffer;
  }
  SelectFont(hdc,hfont);
  SetTextColor(hdc,windraw->currentcolor);
  DrawText(hdc,text,lstrlen(text),&r,DT_NOCLIP | DT_SINGLELINE );
  DeleteObject(hfont);
  /* Forces a WM_PAINT message and erases background */
  InvalidateRect(windraw->hWnd,NULL,TRUE);
  UpdateWindow(windraw->hWnd);
  PetscFunctionReturn(0);
}
Пример #25
0
PetscErrorCode PetscDrawStringVertical_X(PetscDraw draw,PetscReal x,PetscReal  y,int c,const char chrs[])
{
  PetscErrorCode ierr;
  int            xx,yy;
  PetscDraw_X    *XiWin = (PetscDraw_X*)draw->data;
  char           tmp[2];
  PetscReal      tw,th;
  size_t         i,n;

  PetscFunctionBegin;
  ierr   = PetscStrlen(chrs,&n);CHKERRQ(ierr);
  tmp[1] = 0;
  PetscDrawXiSetColor(XiWin,c);
  ierr = PetscDrawStringGetSize_X(draw,&tw,&th);CHKERRQ(ierr);
  xx = XTRANS(draw,XiWin,x);
  for (i=0; i<n; i++) {
    tmp[0] = chrs[i];
    yy = YTRANS(draw,XiWin,y-th*i);
    XDrawString(XiWin->disp,PetscDrawXiDrawable(XiWin),XiWin->gc.set, xx,yy - XiWin->font->font_descent,tmp,1);
  }
  PetscFunctionReturn(0);
}
Пример #26
0
static PetscErrorCode PetscDrawString_Image(PetscDraw draw,PetscReal x,PetscReal y,int c,const char text[])
{
  PetscImage     img = (PetscImage)draw->data;
  PetscToken     token;
  char           *subtext;
  PetscErrorCode ierr;
  PetscFunctionBegin;
  PetscDrawValidColor(c);
  {
    int xx = XTRANS(draw,img,x);
    int yy = YTRANS(draw,img,y);
    ierr = PetscTokenCreate(text,'\n',&token);CHKERRQ(ierr);
    ierr = PetscTokenFind(token,&subtext);CHKERRQ(ierr);
    while (subtext) {
      PetscImageDrawText(img,xx,yy,c,subtext);
      yy += PetscImageFontHeight;
      ierr = PetscTokenFind(token,&subtext);CHKERRQ(ierr);
    }
    ierr = PetscTokenDestroy(&token);CHKERRQ(ierr);
  }
  PetscFunctionReturn(0);
}
Пример #27
0
void SMove( int x , int y )

{
	QMove( XTRANS(x) , YTRANS(y) );
}
Пример #28
0
void SLine( int x1 , int y1 , int x2 , int y2 )

{
	QLine( XTRANS(x1) , YTRANS(y1) , XTRANS(x2) , YTRANS(y2) );
}
Пример #29
0
void SPlot( int x , int y )

{
	QPlot( XTRANS(x) , YTRANS(y) );
}
Пример #30
0
void SText( int x , int y , char *s )

{
	QText( XTRANS(x) , YTRANS(y) , s );
}