PNGs on the fly: Examples
Description: Examples using Fly.

# fly: Documentation: Examples |

## Examples

If you are using fly from within a CGI program, here are some examples:

Perl

  If you use perl, you should really use Lincoln Stein's GD.pm.

  Nevertheless...

      #!/usr/local/bin/perl

      $flyprog = "/usr/local/bin/fly";
      $outfile = "temp.png";

      open(FLY,"| $flyprog -o $outfile ");
      print FLY "new\n";
      print FLY "size 256,256\n";
      print FLY "fill 1,1,255,255,255\n";
      print FLY "circle 128,128,180,0,0,0\n";
      print FLY "fill 128,128,255,255,0\n";
      print FLY "arc 128,128,120,120,0,180,0,0,0\n";
      print FLY "circle 96,96,10,0,0,0\n";
      print FLY "circle 160,96,10,0,0,0\n";
      print FLY "fill 96,96,0,0,0\n";
      print FLY "fill 160,96,0,0,0\n";
      close(FLY);

csh

      #!/bin/csh
      # test out fly!

      cat > /tmp/fly.$$ <<EOD
      new
      size 256,256
      fill 1,1,255,255,255
      circle 128,128,180,0,0,0
      fill 128,128,255,255,0
      arc 128,128,120,120,0,180,0,0,0
      circle 96,96,10,0,0,0
      circle 160,96,10,0,0,0
      fill 96,96,0,0,0
      fill 160,96,0,0,0
      EOD

      fly -i /tmp/fly.$$ -o test.png

Fly Scripts

  You can even create your own fly "scripts"!

      #!/usr/local/bin/fly -q
      new
      size 256,256
      fill 1,1,255,255,255
      <etc>

  Thanks to Andrew Finkenstadt <andyf@simutronics.com> for noting this unintentional feature of fly.

C
  If you're using C, then you might as well use gd!!

Can you guess what the above examples produce? Here's the answer!

I have created a Fly Tester CGI program that lets you test fly commands quickly in a convenient interface. The program is also included in the fly distribution.

    Created:       21 June 1995
    Last modified: 10 June 1999
    Access:        Unrestricted.
    Copyright © 1994-1998 The University of Melbourne.
    <URL:http://www.unimelb.edu.au/fly/>