Location: PHPKode > projects > PHP Cad and Drawing Program > phpcad/tutorial.htm
<table align=center>
  <tr align=center>
  <img src="fglogosm.jpg" alt="logo" width=644 height=112 align="middle" border=0>
  <b>How To Make The Above Picture</b>

<P>I chose the above picture as an example project because it is the best looking banner I could find.
It is the banner to Flightgear an awesome GPL flight simulator available on Linux although I have
never used it.   I am not actually
going to make this picture at this time. I will only explain how to make it, how to make pictures,
how to generate .pngs and .povs.</p>

<P>First you go into the file management box, and select "New" and click "Submit".  That will create a new
picture named "Picturexx.tob".   Suppose you already have "picture1.tob", so the program will make the
file "picture2.tob".   If you "picture2.tob" and hit "submit" it should be a empty 640x480 orange/brown
picture with a grid on it.
Now go to the file management box and click on "Edit .setup"  this will take you to a
area to make a .setup file for the picture.  Possibly keep 640x480 resoulution and maybe select a green
color scheme.   Hit submit and the computer will make "picture2.setup".  You would have to go into picture.setup
with a text editor to change the attributes to make the 644 x 112 picture above
(or rename it).  A 81-x and 28-y and a scale-4,
would work for this project.  Now you must make the include functions.  For each function you need you must
decide whether to allow it
to be a text editor based function, or a GUI based.  If GUI based, you must edit index.php and scriptmaker.php
so the function works with the GUI.  Below is to describe how to plan for the functions you will need.</P>

<P>At first sight the picture may be overwhelming but if you keep looking at it, it is not as complex as your first look.
First I would put the entire project in be one directory. To do the flags, you can download a bunch of
flags of the countries on the internet and write a PHP .inc routine with imagecopyresize to get them
to the right size.  Then you line up icons using the another routine and put them in same picture
and save them as a .png. if you ever want to edit the flags you would only have to edit this picture.
Well that takes care of the flags.</p>

<P> For the checkerboard, you have black and yellow squares.   This pattern is realitively easy. You probably just do an
for i=1 to 5 and j=1 to 20 and a size of 5.  If remainder of (i+j)/2=1 ? $color=$yellow : $color=$black;.  This would take
about 10 lines of code.  For the part where it changes from black to flag, you could write a function, or use a paint program
with smudge.  Save this entire piece as a .png file.  This would take care of the black and yellow checkboard andf the fade to

<P>For the blue horizontal lines it appears to be aqua blue, light blue, dark blue, aqua blue. ... You could make a line routine to
make this.  The shading at the top and bottom is done by changing the colors of the first 2 lines and last 2 lines.
Since this is the base rather than saving this as a .png, you would use this as the main base picture
and add the other icons/stamps to this. The shading caused by the letters is the hardest part of the
drawing.  I think GD 2.0.1. may allow blending of colors however,
you would probably have to write a routine to lighten the colors of a background based upon the truetype font,
although you never draw the font on screen. You might have to put every pixel of the "lightgear" in a array and blend
each pixel of the blue lines with a fader based upon the array.  I would write more but I think GD 2.0.1. may offer some help.
Another option is to put the letters down first and draw the aqua lines pixel by pixel.  If the pixel is black, it is shaded and gets
an optional color.</P>

The truetype text "F" and "lightgear" probably would best be done and lightened in a paint program.
It would probably be best to first make the image first and touch up in a paint program.
This will make easy to maintain the dimensions.  The window and plane are actually
rather easy.  The plane was either drawn or downloaded from the internet.  Basically any image with a constant same
color background can be bluescreened easily onto any picture.  The window can be made by a function that
make horizontal bars based upon length. The shadow caused by the window can be made by first drawing the
window slightly offset in baby blue, smudge, then drawing the window.  After the window is done,  the plane
is bluescreened on the base drawing, and the picture is saved as a .png.

Then all thats left to do is combine everything. Put down the blue lines, then the yellow and black checkerboard fading to black., then
the window with the plane, the the font shadows, then the fonts, and the flags.  So the main program would be a .tob script
about 20 lines long.  The other scripts to make the other stuff would be short.  If you didn't like a part you could
always edit that part of the script.  If you didn't like the painting part you could make a complex special effects function.</p>

Now after the picture is done, you want to save it as a .png, go into "View .png" and see the picture as
before.  This time you can right click on it and save it on your computer.   Maybe you want to "View POV".
Here is the real power, if you write POV functions for each of the .inc functions in pov.php you can have
access to almost any texture, transparency, camera angle, or pigment easily.  POV will actually simplify the
programming in this case because you can adjust the height of the lines and objects, and POV will
make the shading, and you can use just standard letters with different textures.  Basically you would use
simple .tob scripts to lay the picture out, and simple .pov script conversions to professionalize the picture.

Return current item: PHP Cad and Drawing Program