PHP Classes
elePHPant
Icontem

shadowgd: Draw GD graphics shapes with drop shadows

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Info   View files View files (3)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings  
2003-01-24 (12 years ago) RSS 2.0 feedNot enough user ratingsTotal: 1,305 All time: 2,789 This week: 1,291Up
Version License Categories  
shadowgd 1.0GNU General Publi...Graphics
Description Author  

This class enables you to draw GD graphics shapes with drop shadows. You can set the drop shadow's size, direction and color.

Picture of Andrew Wilson
Name: Andrew Wilson <contact>
Classes: 1 package by
Country: ???
Age: ???
All time rank: 1860
Week rank: 1465 Up

Details provided by the author  
                            SHADOWGD CLASS
                            --------------


Intro
-----

The shadowgd class lets you draw the basic shapes in the GD graphics 
module-- rectangle, polygon, ellipse and arc --  with a drop shadow.
The user can set the drop shadow's size, color and direction, as well 
as specify whether an outline (and it's color) should be drawn around 
the shape.

The drop shadows are drawn using two shades of color. For a normal drop
shadow effect you would use two shades, one light and one dark, of the
same color. If you just want a solid drop shadow, you can assign the
same shade to both shadow color parameters or, for something entirely
different, use two different colors.




Set-up
------

To use the shadowgd class, you must first include or require the file
shadowgdclass.php in your script, like

    require "shadowgdclass.php";

After creating a gd image with one of the standard ImageCreate
functions, you create a new instance of the shadowgd class, passing it
the handle of the image you created, such as

    $grfx = new shadowgd($image);

When the shadowgd class is created, it initializes the drop shadow
parameters and the outline color to default values. You can draw
drop-shadow shapes with no further set-up or call the appropriate
functions to change these values at any time.




Using shadowgd class
--------------------

The function calls in shadowgd class to draw drop-shadow shapes are
similar to the corresponding standard gd functions. One main difference
is that for all the functions the coordinates for the shape should be in
an array. For most of the standard gd functions the coordinates are
supplied as individual values. All the shadowgd functions are listed
below. For the color arguments, you should allocate the desired colors
in your script and pass the color identifiers in the function calls. 

See the shadowgdclass.php file for more information on the functions.


shadowgd ($img)
        This is the constructor, used to create a shadowgd class

SetShadow ($size, $direction, $lt_shadow, $drk_shadow)
        This function is used to set the drop shadow parameters - size,
        direction, and color. The direction is specified as:


                                0
                          7           1
                
                
                        6               2
                
                            
                           5          3
                                4


SetOutlineColor ($outln_clr)
        This function is used to set the color of the outline if one is drawn

DrawShadowPolygon ($polygon_outline, $polygon_color, $show_outline = true)
        This function draws a filled polygon in the specified colot with
        a drop shadow

DrawShadowRectangle ($rect_coords, $rect_color, $show_outline = true)
        This function draws a filled rectangle in the specified colot
        with a drop shadow

DrawShadowEllipse ($ellipse_center, $ellipse_width, $ellipse_height, 
                    $ellipse_color, $show_outline = true)
        This function draws a filled ellipse in the specified colot with
        a drop shadow

DrawShadowArc ($arc_center, $arc_width, $arc_height, $arc_start, $arc_end, 
                $arc_color, $show_outline = true)
        This function draws a filled arc in the specified colot with a
        drop shadow. It always draws a pie wedge type arc.




Contact
-------

If you have any questions on shadowgd class, you can email me at
projects@ajwwebservices.com and I'll try to answer them. I would also be
interested in hearing how you use shadowgd class, and welcome any
suggestions for improving it.

Andrew Wilson
AJW Web Services
www.ajwwebservices.com
  Files folder image Files  
File Role Description
Accessible without login Plain text file README Doc. README
Plain text file shadowgdclass.php Class Main class definition
Accessible without login Plain text file shadowgd_demo.php Example Class demo

 Version Control Unique User Downloads Download Rankings  
 0%Total:1,305All time:2,789
 This week:0This week:1,291Up