home *** CD-ROM | disk | FTP | other *** search
/ Turbo Toolbox / Turbo_Toolbox.iso / 1989 / 07 / vgraf / gr_edit3.inc < prev    next >
Encoding:
Text File  |  1989-02-16  |  6.2 KB  |  166 lines

  1. (* ------------------------------------------------------ *)
  2. (*                   GR-EDIT3.INC                         *)
  3. (*       Erweiterungen zum Programm VEKTORGRAPHIK         *)
  4. (*         (c) 1988 Helmut Wessels & TOOLBOX              *)
  5. (* ------------------------------------------------------ *)
  6.  
  7. {Einzufügen in Prozedur ZEICHNE:}
  8.       ref_zeichen:
  9.               begin
  10.                 zeichne(font,             {rekusiver Aufruf}
  11.                    (vect^[off] and $F) shl 8 +vect^[off+1],
  12.                    true,faktor*vect^[off+2]/16,
  13.                    (vect^[off+3]+drehung) mod 180);
  14.                 inc(off,2)
  15.               end; {ref_zeichen}
  16.       texte : begin
  17.                 w1:=vect^[off] and $F;
  18.                 w2:=(vect^[off+1] + drehung) mod 180;
  19.                 x1:=vect^[off+2];
  20.                       {Textausgabe mit Zeichensatz LIT1.CHR}
  21.                 for z:=1 to x1 do
  22.                    zeichne(outfont,vect^[off+2+z],false,
  23.                             w1*faktor/32,w2);
  24.                 inc(off,x1+1)
  25.               end;  {texte}
  26.       kreis : begin
  27.                 alp:=2*drehung+3*(vect^[off] and $F);
  28.                 x:=vect^[off+2]; y:=vect^[off+3];
  29.                 w1:=((x and $C0) shr 2)+(vect^[off+1] and $F);
  30.                 w2:=((y and $C0) shr 2)+(vect^[off+1] shr 4);
  31.                 x:=x and $3F; y:=y and $3F;
  32.                 if alp=0 then           {ELLIPSE von BORLAND}
  33.                   ellipse(gcx+x1,gcy-y1,6*w1,6*w2,
  34.                           round(xf*x),round(faktor*y))
  35.                 else begin
  36.                          {schräge Ellipse, nicht von BORLAND}
  37.                   pi180:=pi/180; alp:=alp*pi180;
  38.                   sina:=sin(alp); cosa:=cos(alp);
  39.                   if w2<=w1 then inc(w2,60);
  40.                   z1 := x*cos(6*w1*pi180);
  41.                   z2 := y*sin(6*w1*pi180);
  42.                   moveto(gcx+x1+round((z1*cosa-z2*sina)*xf),
  43.                      gcy-y1-round((z1*sina+z2*cosa)*faktor));
  44.                   for z:= w1+1 to w2 do begin
  45.                     z1 := x*cos(6*z*pi180);
  46.                     z2 := y*sin(6*z*pi180);
  47.                    lineto(gcx+x1+round((z1*cosa-z2*sina)*xf),
  48.                      gcy-y1-round((z1*sina+z2*cosa)*faktor));
  49.                   end {Wer den Bogen noch runder möchte, darf}
  50.                 end;  {eine schnelle INLINE-Routine schreiben}
  51.                 inc(off,2);
  52.                 moveto(gcx+x1,gcy-y1)
  53.               end {kreis}
  54.  
  55.  
  56. {folgende Prozeduren müssen anstelle der Dummy's in die
  57.  Prozedur EDIT eingefügt werden: }
  58.  
  59.  
  60.   procedure text_eingeben;          {Freier Text in Graphik}
  61.   var k:byte;
  62.   begin
  63.      bar(txof,2*ty,getMaxX,cy_g-ty-1);
  64.      moveto(txof,4*ty);
  65.      meintext(5,'Bitte Text eingeben!     ');
  66.      moveto(txof,6*ty);
  67.      meintext(5,'Ende des Textes --> [Ret]');
  68.      moveto(txof,7*ty);
  69.      meintext(5,'Zeichen löschen --> [<-]');
  70.      moveto(txof,9*ty);
  71.      meintext(5,'Drehen und Vergrößern    ');
  72.      moveto(txof,10*ty);
  73.      meintext(5,'nach Eingabe mit [V]     ');
  74.      k:=0; inc(akt); paar:=knoten[akt];
  75.      vector_plus_minus(2);
  76.      with userfont do begin               {Voreinstellung}
  77.        vect^[knoten[akt]]:=ord(texte) shl 4 + 8; {Größe 8}
  78.        vect^[knoten[akt]+1]:=0;                  {Drehung}
  79.        vect^[knoten[akt]+2]:=1;                   {Länge }
  80.        paar:=knoten[akt]+2;
  81.        repeat
  82.         if not f_taste(blink) then begin
  83.           if c<>#13 then begin
  84.             if (c=#8) and (k>0) then begin
  85.                vect^[paar+(k and 1)]:=32; dec(k);
  86.                if odd(k) then begin
  87.                   dec(vect^[knoten[akt]+2],2);
  88.                   vector_plus_minus(-1)
  89.                end
  90.             end;
  91.             if c<>#8 then begin
  92.               if odd(k) then begin
  93.                  inc(vect^[knoten[akt]+2],2);
  94.                  vector_plus_minus(1);
  95.                  vect^[paar+1]:=32
  96.               end;
  97.               inc(k);
  98.               vect^[paar+(k and 1)]:=ord(c)
  99.             end;
  100.             if not keypressed then bild_neu;
  101.          end
  102.         end
  103.        until c=#13
  104.      end; {with}
  105.      vector_neu
  106.   end;
  107.  
  108.   procedure referenz;           {Blendet andere Graphik ein}
  109.   var i:word;
  110.   begin
  111.      restoreCrtMode; clrscr;
  112.      writeln('Sie blenden nun ein anderes Bild in das '+
  113.              'aktuelle Bild ein');
  114.      writeln;
  115.      writeln('Welches Bild soll eingeblendet werden? '+
  116.              '(0=Ende) ');
  117.      i:=bildwahl;
  118.      if i>0 then with userfont do begin
  119.          inc(akt); paar:=knoten[akt];
  120.          vector_plus_minus(2);
  121.          vect^[knoten[akt]]:=ord(ref_zeichen) shl 4 + i shr 8;
  122.          vect^[knoten[akt]+1]:=i and $FF;
  123.          vect^[knoten[akt]+2]:=16;  {Größe 16/16}
  124.          vect^[knoten[akt]+3]:=0;   {Drehung}
  125.      end;
  126.      setGraphMode(GraphMode);
  127.      vector_neu
  128.   end;
  129.  
  130.  
  131.   procedure kreis_zeichnen;      {Kreise / Ellipsen / Bögen}
  132.   var x,y:byte; w1,w2:word;
  133.   begin
  134.      restoreCrtMode; clrscr;
  135.      writeln('Ellipse (Kreis) mit Mittelpunkt am zuletzt '+
  136.              'gewählten Punkt:');
  137.      write('Waagerechter Radius in Rastereinheiten: (Ende:0) ');
  138.      x:=liesz;
  139.      write('Senkrechter Radius in Rastereinheiten: (Ende:0) ');
  140.      y:=liesz;
  141.      if (x>0) or (y>0) then with userfont do begin
  142.         inc(akt); paar:=knoten[akt];
  143.         vector_plus_minus(2);
  144.         writeln('Bitte nun Anfangs- und Endwinkel eingeben '+
  145.                 '(entgegen Uhrzeigersinn, 0-360°)');
  146.         write('Anfangswinkel: (0-360) ');
  147.         w1:=(liesz+3) div 6;
  148.         write('Endwinkel: (0-360) ');
  149.         w2:=(liesz+3) div 6;
  150.         vect^[knoten[akt]]:= ord(kreis) shl 4;
  151.         vect^[knoten[akt]+2]:=
  152.                          (x and $3F) + ((w1 and $30) shl 2);
  153.                                        {waagerechter Radius}
  154.         vect^[knoten[akt]+3]:=
  155.                          (y and $3F) + ((w2 and $30) shl 2);
  156.                                         {senkrechter Radius}
  157.         vect^[knoten[akt]+1]:=
  158.                           (w1 and $F) + ((w2 and $F) shl 4);
  159.      end;
  160.      setGraphMode(GraphMode);
  161.      vector_neu
  162.   end;
  163.  
  164. (* ------------------------------------------------------ *)
  165. (*               Ende GR-EDIT3.INC                        *)
  166.