static void
_dxf_captureZoomBox(tdmInteractor I, void *udata, float rot[4][4])
{
  register long *bp, *image ;
  register int i, iw, ih, n, y2 ;
  int x1, x2, y1 ;
  static long buff[4096] ;
  DEFDATA(I, tdmZoomData) ;

  readsource(SRC_FRONT);

  iw = CDATA(iw) ;
  ih = CDATA(ih) ;
  image = (long *)CDATA(image) ;

  /* clip coords to image to avoid invalid raster positions */
  x1 = (PDATA(x1)<0 ? 0 : (PDATA(x1)>(iw-1) ? iw-1 : PDATA(x1))) ;
  x2 = (PDATA(x2)<0 ? 0 : (PDATA(x2)>(iw-1) ? iw-1 : PDATA(x2))) ;
  y1 = (PDATA(y1)<0 ? 0 : (PDATA(y1)>(ih-1) ? ih-1 : PDATA(y1))) ;
  y2 = (PDATA(y2)<0 ? 0 : (PDATA(y2)>(ih-1) ? ih-1 : PDATA(y2))) ;

  lrectread (x1, y1, x2, y1, (const unsigned long *)image+(x1 + y1*iw)) ;
  if (y1 < (ih+1))
      lrectread (x1, y1+1, x2, y1+1,
			(const unsigned long *)image+(x1 + (y1+1)*iw)) ;

  lrectread (x1, y2, x2, y2, (const unsigned long *)image+(x1 + y2*iw)) ;
  if (y2 < (ih+1))
      lrectread (x1, y2+1, x2, y2+1, 
			(const unsigned long *)image+(x1 + (y2+1)*iw)) ;

  lrectread (x1, y1, x1, y2, (const unsigned long *)buff) ;
  for (bp=buff, n=x1+(y1*iw), i=y1 ; i<=y2 ; i++, n+=iw)
      image[n] = *bp++;
  if (x1 < iw-1)
  {
      lrectread (x1+1, y1, x1+1, y2, (const unsigned long *)buff) ;
      for (bp=buff, n=(x1+1)+(y1*iw), i=y1 ; i<=y2 ; i++, n+=iw)
	  image[n] = *bp++;
  }

  lrectread (x2, y1, x2, y2, (const unsigned long *)buff) ;
  for (bp=buff, n=x2+(y1*iw), i=y1 ; i<=y2 ; i++, n+=iw)
      image[n] = *bp++;

  if (x2 < iw-1)
  {
      lrectread (x2+1, y1, x2+1, y2, (const unsigned long *)buff) ;
      for (bp=buff, n=(x2+1)+(y1*iw), i=y1 ; i<=y2 ; i++, n+=iw)
	  image[n] = *bp++;
  }
}
Exemple #2
0
static void drawslider(gl_slider *sl) {
    Int32 lw = getlwidth();
    Int32 cl = getcolor();
    Int32 oriwin = winget();
    long co;
    int i;
    Screencoord x, y;
    Int32 xo, yo;
    
    winset(sl->win);
    linewidth(1);
   
    update_slider_value(sl);
    locate_slider(sl);
    
    if (sl->txbg == -1) {
	/* first time, get bg color */
	cmov2(sl->x + sl->len + sl->thick, sl->y);
	getcpos(&x, &y);
	getorigin(&xo, &yo);
	x -= xo;
	y -= yo;
	i = lrectread(x, y, x, y, &co);
	sl->txbg = co;
#ifdef DEBUG
	printf("textbg = %d, bytes = %d x %d (soll %g) y %d (soll %g)\n",
	       co,i,x,sl->x + sl->len + sl->thick,
	       y,sl->y);	
#endif
    }
    color(sl->bg);
    rectf(sl->x, sl->y, sl->x+sl->thick+sl->len, sl->y+sl->height);
    color(sl->fg);
    rect (sl->x, sl->y, sl->x+sl->thick+sl->len, sl->y+sl->height);
    rectf(sl->x + sl->len * (sl->value - sl->min)/(sl->max - sl->min),
	  sl->y,
	  sl->x + sl->len * (sl->value - sl->min)/(sl->max - sl->min) + sl->thick,
	  sl->y + sl->height);
    if (sl->buf != NULL) {
	color(sl->txbg);
	cmov2(sl->x + sl->len + sl->thick, sl->y);
	charstr(sl->buf);
	color(sl->fg);
	sprintf(sl->buf + 1, sl->format, sl->value);
	cmov2(sl->x + sl->len + sl->thick, sl->y);
	charstr(sl->buf);
    }
    
    winset(oriwin);
    color(cl);
    linewidth(lw);
    
    sleep(0);
}
static void
_dxf_READ_BUFFER (void *ctx, int llx, int lly, int urx, int ury, void *buff)
{
  ENTRY(("_dxf_READ_BUFFER (0x%x, %d, %d, %d, %d, 0x%x)",
	 ctx, llx, lly, urx, ury, buff));

  readsource(SRC_FRONT) ;
  lrectread (llx, lly, urx, ury, (unsigned long *)buff) ;

  EXIT((""));
}