Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 16 May 2001 10:35:16 +0100
From:      Nik Clayton <nik@freebsd.org>
To:        Randy Pratt <rpratt@ezwv.com>
Cc:        bmah@FreeBSD.ORG, Nik Clayton <nik@FreeBSD.ORG>, freebsd-docs@FreeBSD.ORG, Doug Young <dougy@gargoyle.apana.org.au>, Murray Stokely <murray@osd.bsdi.com>, Jim Mock <jim@FreeBSD.ORG>
Subject:   Automatic text screenshots
Message-ID:  <20010516103515.A38101@catkin.nothing-going-on.org>
In-Reply-To: <01051515135804.00373@k6-2.weeble.com>; from rpratt@ezwv.com on Tue, May 15, 2001 at 03:13:58PM -0400
References:  <01051513051703.00373@k6-2.weeble.com> <200105151727.f4FHRos64816@bmah-freebsd-0.cisco.com> <01051515135804.00373@k6-2.weeble.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--ReaqsoxgOBHFXBhH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Randy (and anyone else that wants to complete this)

This is probably as good a time as any to bring this up;

On Tue, May 15, 2001 at 03:13:58PM -0400, Randy Pratt wrote:
> The versions prior to 4.3 used html tables as "screenshots" with a lot of=
=20
> formatting to produce views that were very close to that seen during=20
> installation.
>=20
> I used XV to capture the html table views and convert them to 8 bit png=
=20
> images. These were used instead of the html tables to ease the conversion=
 to=20
> sgml. If you take a look at the source of the 4.2 previews, the tables wo=
uld=20
> be difficult (if not impossible) to convert to sgml and a problem to main=
tain.

PC text mode video memory is typically arranged as a block of memory
where 2 bytes is allocated for every character that is being displayed.

The first byte is the characters display code (65 =3D=3D 'A', and so forth),
and the second byte is the character's colour attributes -- the first
nybble is the foreground colour (16 choices) and the second nybble is
the background colour.

It would be possible to add a new ioctl to syscons that dumped this text
video memory out to a userland program.

I've got some old software I got 90% of the way to completing which
might make your work much easier.  Specifically,

  1.  Some patches to syscons which add this ioctl -- these patches are
      against 2.2.x, but syscons hasn't changed drastically in the past
      few years.

  2.  A userland program, "scrshot", which you run like so;

        scrshot tty-device > filename

      For example, if you're running sysinstall on the first virtual
      console (/dev/ttyv0), and log in on the second virtual console
      (ALT-F2) and run

        scrshot /dev/ttyv0 > snapshot.scr

      then the text video memory will be dumped in to snapshot.scr.

  3.  A userland program, "shot2gif", which converts these screenshot
      files to GIF files.  Adaptation to write PNG files should be
      relatively trivial.

      Usage is

        shot2gif < snapshot.scr > snapshot.gif

Currently unwritten (although it would be trivial to do so) would be a
shot2txt program, which would write out just the text from the snapshot,
ignoring the colours.

This approach offers a couple of benefits over your current approach
of taking snapshots in X.

  1.  shot2gif can parse syscons font files -- the fonts that appear in
      the GIF file are identical to the ones that will appear on the
      user's screen.

  2.  If someone goes and writes shot2txt then we can include plain text
      snapshots very, very easily.  This is essential when producing the
      plain text version of the documentation.  Something like this:

       [ Something interesting is being displayed on ttyv0 ]

       # scrshot /dev/ttyv0 > shot.scr
       # shot2png < shot.scr > shot.png
       # shot2txt < shot.scr > shot.txt

      And in the DocBook source write:

      <!ENTITY shot.txt SYSTEM "shot.txt">

      ...

      <mediaobject>
        <imageobject>
	  <imagedata fileref=3D"shot" format=3D"PNG">
	</imageobject>

	<textobject>
	  <literallayout class=3D"monospaced">&shot.txt;</literallayout>
        </textobject>
      </mediaobject>

  3.  Someone who knows Postscript better than I could put together
      shot2ps -- since the font and colour information is taken direct
      from the source, the fidelity of any produced Postscript can be
      better than that acheived by converting GIFs or PNGs to EPS.

  4.  You don't need to be in X to do it.  If you, or anyone else wants
      to take snapshots of a text-only program, and you don't run X
      (don't need to, don't have the resources to, or whatever) then the
      snapshot stuff will do the trick, and it's much more light weight.

The source code for all this can be found in

    http://people.freebsd.org/~nik/syscons.tar.gz

N
--=20
FreeBSD: The Power to Serve             http://www.freebsd.org/
FreeBSD Documentation Project           http://www.freebsd.org/docproj/

          --- 15B8 3FFC DDB4 34B0 AA5F  94B7 93A8 0764 2C37 E375 ---

--ReaqsoxgOBHFXBhH
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.5 (FreeBSD)
Comment: For info see http://www.gnupg.org

iEYEARECAAYFAjsCScwACgkQk6gHZCw343WIIwCeLT/IHCk9uKJStT8yhImJrPx2
U9QAnRHfAR+ViPCyR2QZQrbJW/T0hwS3
=l2mi
-----END PGP SIGNATURE-----

--ReaqsoxgOBHFXBhH--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-doc" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010516103515.A38101>