with text_io ; with integer_text_io ; separate (Drei_D) procedure Gib_SIRDS_aus (SIRDS : in SIRDS_RT) is Schwarz : constant Pixel_T := 50 ; Breite : constant positive := (SIRDS.Bild'last (1) / 8) * 8 ; Hoehe : constant positive := (4 * Breite) / 5 ; Pixel : constant positive := 2560 / Breite ; Datei : text_io.file_type ; procedure Schreibe_Hexzahl (x, y : in positive) is Hexzahl : natural range 0..15 := 0 ; begin if SIRDS.Bild (x - 3, y) < Schwarz then Hexzahl := Hexzahl + 8 ; end if ; if SIRDS.Bild (x - 2, y) < Schwarz then Hexzahl := Hexzahl + 4 ; end if ; if SIRDS.Bild (x - 1, y) < Schwarz then Hexzahl := Hexzahl + 2 ; end if ; if SIRDS.Bild (x, y) < Schwarz then Hexzahl := Hexzahl + 1 ; end if ; case Hexzahl is when 0 => text_io.put (Datei, '0') ; when 1 => text_io.put (Datei, '1') ; when 2 => text_io.put (Datei, '2') ; when 3 => text_io.put (Datei, '3') ; when 4 => text_io.put (Datei, '4') ; when 5 => text_io.put (Datei, '5') ; when 6 => text_io.put (Datei, '6') ; when 7 => text_io.put (Datei, '7') ; when 8 => text_io.put (Datei, '8') ; when 9 => text_io.put (Datei, '9') ; when 10 => text_io.put (Datei, 'A') ; when 11 => text_io.put (Datei, 'B') ; when 12 => text_io.put (Datei, 'C') ; when 13 => text_io.put (Datei, 'D') ; when 14 => text_io.put (Datei, 'E') ; when others => text_io.put (Datei, 'F') ; end case ; end Schreibe_Hexzahl ; begin text_io.put_line ("Ausgeben von """ & SIRDS.Name.all & """: Start") ; if (Breite * Pixel /= 2560) or (Hoehe /= SIRDS.Bild'last (2)) then text_io.put ("Falsches Format: Breite = ") ; integer_text_io.put (SIRDS.Bild'last (1), 1) ; text_io.put (", Hoehe = ") ; integer_text_io.put (SIRDS.Bild'last (2), 1) ; text_io.new_line ; end if ; text_io.create (Datei, text_io.out_file, SIRDS.Name.all & ".ps") ; text_io.put_line (Datei, "%!PS-Adobe-1.0") ; text_io.put_line (Datei, "%PostScript Stereogram created by 3D (VAX)") ; text_io.put_line (Datei, "%written by Jochen Meyer-Hilberg Dezember 1993") ; text_io.put_line (Datei, "%") ; text_io.put_line (Datei, "/inch { 72 mul } def") ; text_io.put_line (Datei, "/Helvetica-Bold findfont 10 scalefont setfont") ; text_io.put_line (Datei, "gsave") ; text_io.put_line (Datei, "30 20 translate") ; text_io.put_line (Datei, "90 rotate") ; text_io.put_line (Datei, "0.5 inch 0 moveto") ; text_io.put_line (Datei, "(" & SIRDS.Titel.all & ") show") ; text_io.put_line (Datei, "9.5 inch 0 moveto") ; text_io.put_line (Datei, "(Created by 3D) show") ; text_io.put_line (Datei, "-90 rotate") ; text_io.put_line (Datei, "-30 -20 translate") ; text_io.put_line (Datei, "grestore") ; text_io.put_line (Datei, "/bitdump % stk: width, height, iscale") ; text_io.put (Datei, "% dump a bit image ") ; text_io.put_line (Datei, "with lower left corner at current origin,") ; text_io.put (Datei, "% scaling by iscale ") ; text_io.put_line (Datei, "(iscale=1 means 1/300 inch per pixel)") ; text_io.put_line (Datei, "{") ; text_io.put_line (Datei, "% read arguments") ; text_io.put_line (Datei, "/iscale exch def") ; text_io.put_line (Datei, "/height exch def") ; text_io.put_line (Datei, "/width exch def") ; text_io.put_line (Datei, "% scale appropriately") ; text_io.put_line (Datei, "10.0 inch 7.5 inch scale") ; text_io.put_line (Datei, "% allocate space for one scanline of input") ; text_io.put_line (Datei, "/picturestr % picturestr holds one scan line") ; text_io.put (Datei, "width 7 add 8 idiv ") ; text_io.put_line (Datei, "% width of image in bytes = ceiling(width/8)") ; text_io.put_line (Datei, "string") ; text_io.put_line (Datei, "def") ; text_io.put_line (Datei, "% read and dump the image") ; text_io.put_line (Datei, "width height 1 [width 0 0 height neg 0 height]") ; text_io.put_line (Datei, "{ currentfile picturestr readhexstring pop }") ; text_io.put_line (Datei, "image") ; text_io.put_line (Datei, "} def") ; text_io.put_line (Datei, "8.0 inch 0.75 inch translate") ; text_io.put_line (Datei, "90 rotate") ; integer_text_io.put (Datei, Breite, 1) ; text_io.put (Datei, " ") ; integer_text_io.put (Datei, Hoehe, 1) ; text_io.put (Datei, " ") ; integer_text_io.put (Datei, Pixel, 1) ; text_io.put_line (Datei, " bitdump") ; for y in 1..Hoehe loop for x in 1..(Breite / 4) loop Schreibe_Hexzahl (4 * x, y) ; end loop ; text_io.new_line (Datei) ; end loop ; text_io.put_line (Datei, "showpage") ; text_io.close (Datei) ; text_io.put_line ("Ausgeben von """ & SIRDS.Name.all & """: Ende") ; text_io.new_line ; end Gib_SIRDS_aus ;