Date: Sun, 1 Aug 2004 10:34:37 +0100 From: Matthew Seaman <m.seaman@infracaninophile.co.uk> To: Murray Stokely <murray@freebsd.org> Cc: doc@freebsd.org Subject: Re: Style for a long callout list Message-ID: <20040801093436.GA25901@happy-idiot-talk.infracaninophile.co.uk> In-Reply-To: <20040801061047.GC27954@hub.freebsd.org> References: <20040724092210.GA7369@comp.chem.msu.su> <20040724135202.GA24947@submonkey.net> <20040724140608.GE7369@comp.chem.msu.su> <20040801061047.GC27954@hub.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--RnlQjJ0d97Da+TV1 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Aug 01, 2004 at 06:10:47AM +0000, Murray Stokely wrote: > On Sat, Jul 24, 2004 at 06:06:09PM +0400, Yar Tikhiy wrote: > > > Stick with it for now. We're hoping to add callout images up to 25 s= ome > > > time soon. > >=20 > > I see, thanks! >=20 > Maybe you guys could help us out and just generate the little images > required? We only go up to 15 right now, as that is the most needed > by the Handbook. As Ceri said, we'd like to have images up to at > least 25. Since you are the first to need those images, how about > making them for us and committing them to the tree? =3D) >=20 > It should actually be possible to make these from the command line > with tools like ImageMagick. We just need a circle with a number on > top of it. It's Sunday. I was bored. Here's a script to generate those images: #!/usr/bin/perl -w use strict; use POSIX qw(floor ceil); use GD; $0 =3D~ s@^.*/@@; sub colourARGB($$$$) { my $alpha =3D shift; my $red =3D shift; my $green =3D shift; my $blue =3D shift; # Alpha is in range 0 (opaque) to 127 (fully transparent), # R, G, B in range 0 .. 255. Force values into range. $alpha &=3D 0x7f; $red &=3D 0xff; $green &=3D 0xff; $blue &=3D 0xff; return $alpha << 24 | $red << 16 | $green << 8 | $blue; } MAIN: { my $im; # The Image object my $xsize =3D 16; my $ysize =3D 16; my $font =3D "/usr/X11R6/lib/X11/fonts/bitstream-vera/VeraMoBd.ttf"; # Bitstream Vera Mono Bold. my $bgcol =3D colourARGB( 127, 255, 255, 255 ); # Transparent White my $fgcol =3D colourARGB( 0, 255, 204, 0 ); # Orange my $txcol =3D colourARGB( 0, 0, 0, 0 ); # Black #my $bgcol =3D colourARGB( 127, 255, 255, 255 ); # Transparen= t White #my $fgcol =3D colourARGB( 0, 153, 0, 0 ); # Daemon Red #my $txcol =3D colourARGB( 0, 255, 255, 255 ); # White my $text =3D "25"; # What to write onto the image my $fsize; # Font size my @bounds; # For compositing text onto image my $x; # Coords of LL of text my $y; # Coords of LL of text # Usage: calloutnum.pl [text [size]] $text =3D $ARGV[0] if ( defined $ARGV[0] ); $xsize =3D $ysize =3D $ARGV[1] if ( defined $ARGV[1] ); $fsize =3D $xsize / 2; $im =3D new GD::Image->newTrueColor( $xsize, $ysize ) || die "$0: Failed to create image -- $!\n"; $im->saveAlpha(1); # Fill image with background colour, center a circle of foreground # colour on top of that, and write a number centered in that. $im->alphaBlending(0); $im->filledRectangle( 0, 0, $xsize - 1, $ysize - 1, $bgcol ); $im->alphaBlending(1); $im->setAntiAliased($fgcol); $im->filledEllipse( $xsize / 2, $ysize / 2, $xsize - 2, $ysize - 2, gdAntiAliased ); # First, get the bounding box for the text. Choose fontsize so that # 2 characters will approx. fill image size. @bounds =3D GD::Image->stringFT( $txcol, $font, $fsize, 0, 0, 0, $text ) or die "$0: Can't render text -- $@\n"; $x =3D floor( 0.5 * ( $xsize + $bounds[0] - $bounds[2] - 1 ) ); $y =3D ceil( 0.5 * ( $ysize + $bounds[1] - $bounds[7] ) ); $im->stringFT( $txcol, $font, $fsize, 0, $x, $y, $text ) || die "$0: Can't write using TrueType font -- $@\n"; print $im->png; } # # That's All Folks! # Cheers, Matthew --=20 Dr Matthew J Seaman MA, D.Phil. 26 The Paddocks Savill Way PGP: http://www.infracaninophile.co.uk/pgpkey Marlow Tel: +44 1628 476614 Bucks., SL7 1TH UK --RnlQjJ0d97Da+TV1 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (FreeBSD) iD8DBQFBDLksiD657aJF7eIRAknfAJ9MaN6gOz7R0oS/T7V2xpo+In4aIQCgsK/Z bSItubknQsh5WNy6pp6ObKQ= =fhjD -----END PGP SIGNATURE----- --RnlQjJ0d97Da+TV1--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040801093436.GA25901>