[Date Index][Thread Index]
[Date Prev][Date Next][Thread Prev][Thread Next]

Automatic button generation (Was: Substitution of asteriks)

Fritz Zaucker <zaucker@ee.ethz.ch> writes:
> While Gimp gives you more features it also implies that you actually
> run Gimp (and the Gimp-Perl-Server) while processing your Website with
> WML. This forces you to do that while running X11.
> Stick to imagemagick if you can.

I won't stick to anything, I'm trying to keep as much liberty as
possible (this is perl, after all).

My last experiment involved something like:

    <navbar:define name="foobar" imgstyle="foo" nohints>

where the user would have to provide a coderef in a hash defined like:

    $imgstyles{foo} = sub {
	my ($file, $txt, $type, $level, $lang) = @_;
        # Do something

"# Do something" could be anything, although it might be a good idea
if it resulted in the production of an image named $file that contains
a nice representation of $txt in the appropriate style. This could use
any conceivable way to generate the image like PerlMagick or
use Gimp;
use Renderman;
if you wanted some really bloated animated 3D buttons, or do some
weird things with xmessage and xv -grab, or just use some standard
tools in a pipe as in my test code:

    my @cols=("white", "lightseagreen", "yellow");
    my @spc=("", "* ");

    $imgstyles{foo} = sub {
	my ($file, $txt, $type, $level, $lang) = @_;
	system ("(banner '". $spc[$level] . $txt . "' |\
                 asciitopgm 400 140 | pnmrotate 90 |\
                 pnmscale -height 20 -width 80 |\
                 pgmtoppm black-". $cols[$type]." | ppmtogif >" .
                 $file . ") >/dev/null 2>&1 >/dev/null");

If I find some more time to test (and document :-)) it, I will release
the code later this week.

Any suggestions for improvements?

Yours, Florian.
Website META Language (WML)                www.engelschall.com/sw/wml/
Official Support Mailing List                   sw-wml@engelschall.com
Automated List Manager                       majordomo@engelschall.com