[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference noted::hackers_v1

Title:-={ H A C K E R S }=-
Notice:Write locked - see NOTED::HACKERS
Moderator:DIEHRD::MORRIS
Created:Thu Feb 20 1986
Last Modified:Mon Aug 03 1992
Last Successful Update:Fri Jun 06 1997
Number of topics:680
Total number of notes:5456

419.0. "ascii -> sixel" by CSCMA::CHISHOLM (Clueless...) Wed Mar 04 1987 17:25

    I don't know if this is the correct place for this request,
    but I'll blather on anyway in case someone knows of a source.
    
    I need a routine which will convert an alphanumeric string of
    length 1-40 into a sixel graphics equivalent.  It has to be
    callable ( a .exe or .com would be adequate ) and produce a
    file of some kind whose name is returned.
    
    For the curious, I'm working in VAX/DSM, and I need to convert
    an unknown string into 1/2 inch letters suitable for printing
    on an la100 or la210.  Yes, I realize that a. converting and
    b. printing the text will be very slow.
    
    I have experimented with concatenating the individual characters
    together, a line at a time, but the spacing gets scrambled...
    
    Jeff Chisholm, CAPS
T.RTitleUserPersonal
Name
DateLines
419.1regis to font conversion help ?VIDEO::OSMANand silos to fill before I feep, and silos to fill before I feepWed Mar 04 1987 18:4618
I don't know if what I have will help or not.

I have a command procedure and program that in conjunction with each
other make FONT out of any arbitrary graphics image.

The command procedure draws whatever graphics you want (you put in
the regis commands).  Then the terminal is directed to spit back
the SIXELs, which the program captures in a file.

The command procedure then parses the file and creates a font file.

So, for example, if you drew a set of circles of varying sizes, positioned
on the screen so as to be in separate 20x20 cells, you'd end up with
a font whose individual pairs of 10x20 characters make up a complete
circle (if you're on a 10x20 cell-size terminal).

Ask me if you want this procedure and program.  YOU NEED TO TWEAK IT,
IT WORKS BUT NOT FOR FREE !
419.2Here is some sample code in basic.BISTRO::HEINIf We don't Have it,You don't Need it!Thu Mar 05 1987 12:22101
    	As Osman said, a procedure to do this exists.... in the VT240.
     	Blast your big characters to a graphics terminal and ask it
    	to send the sixels back. If for your purposes 1/2 inch equals
    	two lines on the screen then you are in luck: Use the double
    	height escape sequence (<ESC>#3 for top half, #4 for bottom).
    	If not, you will have to dream up the regis sequence to do
    	so (manuals are extremely handy in those circumstances :-) or
    	use DECSLIDE once to make a regis file with the appropriate
    	text size and extract the regis from there.
    
    	Note that DECSLIDE can do the conversion for you, but is also
    	uses the terminal! INcluded is a sample program in BASIC.
    
    Regards,
    	Hein.
    
 1	OPTION TYPE = EXPLICIT
 !
 !	Basic source by Hein van den Heuvel, Valbonne oct-1985.
 	on error go to Hell !   
 !
 !	This program will read a VT125 or VT240/VT241's graphic screen
 !	and dump the information back to the computer into a file name
 !	specified by the user. The file will be in a SIXEL format that
 !	may then be spooled of to a graphic printer (LA50, LA100, LA12)
 !	
 !
 !	Note :   Do NOT type any characters on the terminal's keyboard
 !	         after the file name is supplied to this program, that
 !	         is,  until  the  operating  system prompt re-appears.
 !
	EXTERNAL LONG CONSTANT	SS$_NORMAL, IO$_READVBLK,	&
				IO$M_NOECHO, IO$M_ESCAPE
	EXTERNAL LONG FUNCTION	SYS$ASSIGN, SYS$QIOW
	DECLARE LONG CONSTANT	Io_Size = 200
	DECLARE STRING CONSTANT	Device		= 'TT:'		,&
				Gon		= ESC+'Pp'	,&
				Goff		= ESC+'\'	,&
				To_Computer	= ESC+'[?2i'	,&
				To_Printer 	= ESC+'[?0i'	,&
				Hard_Copy	= 'S(H)'
	DECLARE STRING	File_Name, LONG S
	MAP (X) WORD	Io_stat, Io_len, Fill, Trm_Len, Channel
	MAP (Y) STRING	Char = 1000

        DEF LONG FN.SYS ( STRING SYSCAL, LONG SYSSTAT )
	    IF ((SYSSTAT AND 1%) = 0%) THEN
		PRINT Goff; "SYS Error"; IO_STAT; " calling "; SYSCAL
	        CALL LIB$STOP ( SYSSTAT BY VALUE )
	    END IF
	    IF (IO_STAT <> SS$_NORMAL) THEN
		PRINT Goff; "IO Error"; IO_STAT; " calling "; SYSCAL
	        CALL LIB$STOP ( IO_STAT BY VALUE )
	    END IF
    	    FN.SYS = SYSSTAT
    	END DEF
	
 !	Get the terminal's channel number for the QIO.

	Io_Stat = SS$_NORMAL
	S=FN.SYS("Assign",Sys$Assign (Device,Channel,,))

 !	Ask for file name and create it, This would all probably be done
 !	differently in a permanent version.
 !
	PRINT ESC; "[23;1H"; ESC; "[JDump File name";
	INPUT LINE File_Name
	OPEN EDIT$(File_Name,6%) FOR OUTPUT AS FILE #1%, 		&
		RECORDTYPE NONE, MAP Y, EXTENDSIZE 9
	PRINT ESC; "[23;1H"; ESC; "[J";
 !
 !	Re-direct I/O from printer port to the communication port,
 !	enter ReGIS graphic mode on the terminal,
 !	issue the SIXEL dump command to the terminal for hardcopy.
 !
	PRINT To_Computer; Gon; Hard_Copy;
 !
 !	Get the initial data sent, synchronize on the first <ESC> \
 !	
	WHILE (Trm_Len<>2%) OR (SEG$(Char,Io_Len+1%,Io_Len+2%)<>Goff)
	    S=FN.SYS("GET INIT", Sys$QIOW (,Channel BY VALUE, 		&
		IO$_READVBLK+IO$M_NOECHO+IO$M_ESCAPE  BY VALUE, Io_Stat,,,&
		Char BY REF, Io_size by value,,,,))
	NEXT
 !
 !	Now get some real data (SIXEL bit map data and terminate on <ESC> \
 !
	Trm_Len = 0%
	WHILE (Trm_Len<>2%) OR (SEG$(Char,Io_Len+1%,Io_Len+2%)<>Goff)
	    S=FN.SYS("GET DATA", Sys$QIOW (,Channel BY VALUE, 		&
		IO$_READVBLK+IO$M_NOECHO+IO$M_ESCAPE BY VALUE, Io_Stat,,,&
		Char by ref, Io_size by value,,,,))
	    PUT #1%, COUNT Io_Len + Trm_Len
	NEXT
	PRINT Goff; To_Printer;
	GO TO 2
 HELL:
	PRINT Goff; ERT$(ERR)
	RESUME 2	

 2	END
419.3directly to sixelSNEAKY::KERRISKYellow_BeardFri Mar 06 1987 06:119
    I have a fortran program written for RSX converts text pictures
    to sixel graphics suitable for direct printing. If I remember
    it correctly there are no system calls so it should convert
    to vms easily. It will convert ascii pictures, text or 
    gothic files. Let me know if you can use it, and I'll send
    you my sources.
    
    							Dennis
    
419.4clues...CSCMA::CHISHOLMClueless...Fri Mar 06 1987 12:4629
    Additional Clues:
    
    I used DECSLIDE to produce a sixel file for each letter in the alphabet
    of appropriate size.  Half an inch high, etc.  I then merged these
    files and stuffed them into a DSM routine with tags that matched
    what was stored there.
    
    Given a string: "ABCDEFG"
    
    The outside FOR loop was 1:1:5 and concatenated the top line of
    sixel for each character in the string.  Then the second line, etc
    until five variables SIXEL(1) thru SIXEL(5) contained what was
    required for the entire string.  Write it out with another 1:1:5
    FOR loop with carriage control at the end of each line.
    
    This approach doesn't work well.  The spacing between characters
    gets really trashed, and is worse for longer strings.
    
    It is theoretically possible to conjure most of the permutations
    of characters, AB,AC,AD,AE,AF,AG...ZV,ZW,ZX,ZY,ZZ and correct the
    spacing between characters.  I haven't that much patience...
    
    What I really want is a method for taking a text fragment and
    *magically* producing the sixel for half inch letters in a file
    somewhere, print the file and then throw the file away.  No human
    intervention...
                   
    hacker notes is pretty appropriate, no?
    
419.5human proof I thinkSNEAKY::KERRISKYellow_BeardSat Mar 07 1987 19:076
    My fortran conversion program will do exactly what you want, convert
    to sixel with human intervention. The only thing it requires is
    an input file and an output file
    
    								Dennis
    
419.6And a human, presumably ;-)MDVAX3::COARA wretched hive of bugs and flamers.Fri Dec 04 1987 01:170