Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-06 - 43,50416/bdisp.sai
There are 2 other files named bdisp.sai in the archive. Click here to see a list.
Entry;
COMMENT
.SEC(BDISP.SAI - BOUNDARY DISPLAY PACKAGE)
.INDEX(BDISP.SAI - BOUNDARY DISPLAY PACKAGE)
.;
Begin "BDISP.SAI"

Internal Procedure BDISP(Integer Array drawing;
			Integer first!row, last!row, first!column,
			    last!column;
			 String title;
			 Integer size;
			 Reference Real xpos, ypos;
			 String terminal;
			 Integer Savebox;
			 Integer npict);

Comment
	
		        Bruce Shapiro and Peter Lemkin
		             Image Processing Unit

		           National Cancer Institute
		         National Institutes of Health
		           Bethesda, Maryland 20014

Revised Aug 6, 1976-Lemkin, removed debug statment@
Revised June 18, 1976-Shapiro-added savebox
Revised April 21, 1976 - Shapiro fixed boundary title
			osition and added scale capability
Revised April 20, 1976- Shapiro added DWIND for
			4012 and GT40
Revised February 12, 1976- Shapiro -handle 4023
Revised February 13, 1976- added to  
Revised February 19, 1976- added TITLE printout
Revised February 26, 1976 Shapiro-added linpak and positioning
			           information for titles and
				   boundaries. Lemkin and Shapiro
				   added ASR33.
Revised February 27, 1976 - LEMKIN, FIXED REQUIRE TO 752.
Revised March 4, 1976 - Lemkin, Shapiro - redo 4023 scaling

	Introduction
	------------
	This procedure will display a line drawing of an object
when passed an array containing the x and Y coordinates of that
image. The arguments are the array to be displayed, the size of
the  array,  the  x  and  Y  position of the object in absolute
coordinates and the OMNI picture number if the display terminal
is  either a GT40 or 4012.  The 4023 and ASR33 terminals Do not
use  OMNI.  The  terminal  names  belong to the set of Strings:
4023, ASR33, 4012 and GT40.
;
Begin "BDISP"

Require "DEFINE.REQ" source!file;
Require "PRCMAX.REQ" source!file;
Require "PRCINV.REQ" source!file;
Require "LINPAK.REQ" Source!file;
Require "PPAK.REQ" Source!file;
Require "SYS:DISPRM.SAI" source!File;
Require "HLFTON.REQ" source!file;


Define set!4023!cursor="28";


  Own Integer
	Xmin,
	Ymin,
	Xmax,
	Ymax;
  Integer
	X,
	Y,
	Xprev,
	Yprev,
	I;
  Real
	border,
	scalex,
	scaley,
	xs,
	Ys;

#	-------------------------------------------------------;
If Equ(terminal,"GT40") or Equ(terminal,"4012")
	then 
	Begin "OMNI display"
	  "Find extrema rectangle for positioning if required"
	  If not Savebox then
	  FIND!REC(Drawing,Size,Xmin,Xmax,ymin,ymax);
	  If Equ(terminal,"GT40") then
          Begin "GT40"
	    Border_767*bnd!scale!fact;
	    DWIND(0,border,0,border);
	  End "GT40"
	  Else
	  Begin "4012"
   	    Border_779*bnd!scale!fact;
	    DWIND(0,border,0,border);
	  End "4012";
	  DOPEN(npict);
	  For i_0 Step 1 Until size-1 Do
	  Begin "Draw-Object"
	    xs_xpos-xmin+X!BND!FETCH(drawing,i);
	    Ys_Border-ypos+ymin-Y!BND!FETCH(drawing,i);
	    If i=0 then DMOVE(xs,Ys);
	    DDRAW(xs,Ys);
	  End "Draw-Object";

	  DMOVE(xpos,Border-ypos-(ymax-ymin)-24);
	  DTEXT("Title: "&Title);
	  DPOST(npict);
	  DDONE1;
	  Return;
	End "OMNI display";

#	-------------------------------------------------------;
If Equ(terminal,"4023")
	Then
	Begin "Display 4023"
	  FIND!REC(Drawing,Size,Xmin,Xmax,ymin,ymax);

	If (xmax-xmin) > 80
		Then scalex_(xmax)/80. else scalex_1;
	If (ymax-ymin) > 24
		Then scaley_(ymax)/24. else scaley_1;
	Xprev_-999;
	Yprev_-999;
	Outstr(12&12&12);
	For I_0 Step 1 Until size-1 Do
	Begin "Loop"
		x_xpos+(X!BND!FETCH(drawing,i)/Scalex)+32-(Xmin/Scalex);
		y_ypos+(Y!BND!FETCH(drawing,i)/Scaley)+32-(ymin/Scaley);
		If xprev=X and Yprev=Y then continue;
		If x > 111 or Y > 56 then continue;
		Xprev_X;
		Yprev_Y;
		Outstr(set!4023!cursor & X & Y & "+");
	End "Loop";

       "set coordinates for title"
        X_xpos+32;
        Y_ypos+1+(ymax/scaley)-(ymin/scaley)+32;
        Outstr(set!4023!cursor & X & Y);

       "output the title"
	Outstr("Title: "&Title&crlf);
	End "Display 4023";

If Equ(terminal,"ASR33")
	Then 
	Begin "Do ASR33"
	Integer 
		svimsiz,
		fr,
		lr,
		fc,
		lc,
		i,
		r,
		c,
		x0,
		y0,
		row!cross,
		column!cross,
		scaling;

	Integer Array Itemvar 
		image3;

"	before we make a 256x256 save the computing window"
	svimsiz_imsiz;
	fr_firstrow;
	fc_firstcolumn;
	lr_lastrow;
	lc_lastcolumn;
"	now set it to 255"
	PINI(-1,256);
	firstrow_fr;
	firstcolumn_fc;
	lastrow_lr;
	lastcolumn_lc;
"	now make a new 256x256 image"
	image3_PMAKIMAGE("TEMP");

"	now fill it up with line data"
	For i_0 step 1 until size-1 Do
		Begin "build pix"
		c_((0 Max X!BND!FETCH(drawing,i)) Min imsiz);
		r_((0 Max Y!BND!FETCH(drawing,i)) Min imsiz);
		PACK2D({Datum(image3)},r,c,trunc!max);
		End "build pix";
		
"	now display the pix"
	HLFTON(Datum(image3),firstrow,lastrow,firstcolumn,
		lastcolumn, sampled, title,
		x0, y0,  0,  trunc!max,  scaling,  1,  row!cross,
		column!cross, terminal);

"	now delete the TEMP item"
	PDELIMAGE("TEMP");

"	Restore the state"
	PINI(-1,svimsiz);
	firstrow_fr;
	firstcolumn_fc;
	lastrow_lr;
	lastcolumn_lc;
	End "Do ASR33";

End "BDISP";
End "BDISP.SAI";