phpDocumentor SMap
[ class tree: SMap ] [ index: SMap ] [ all elements ]

Class: SMap_Canvas

Source Location: /SMap.php

Class SMap_Canvas

Direct descendents
Child Class Description
SMap_Canvas_Cache A class for caching tiles

[ Top ]
Property Summary
resource   $img   Image bitmap resource
integer   $imgRefCount   Keep track of references to the image resource
object   $tile   The tile which this canvas is drawing

[ Top ]
Method Summary
static integer   fontHeight()   Find a font height in pixels
static integer   fontWidth()   Find a font width in pixels
SMap_Canvas   __construct()   Create a canvas which fits the current tile
void   __destruct()   Destroy image also
integer   allocColor()   Allocate a color for an image
resource   allocImage()   Allocate an image
void   composite()   Composite another canvas atop this one
void   compositeRes()   Composite an image resource
void   display()   Display an image
void   filledPolygon()   Draw a filled polygon
void   filledRectangle()   Draw a filled rectangle
void   line()   Draw a line
boolean   load()   Load an image from file
resource   loadRaw()   Load an image from file
void   polygon()   Draw a polygon
void   rectangle()   Draw a rectangle
void   setPixel()   Set a single pixel
void   str()   Draw a string
mixed   __get()   Access useful vars read-only

[ Top ]
Properties
resource   $img = null [line 1503]

Image bitmap resource

API Tags:
Access:  protected


[ Top ]
integer   $imgRefCount = 0 [line 1510]

Keep track of references to the image resource

API Tags:
Access:  protected


[ Top ]
object   $tile [line 1517]

The tile which this canvas is drawing

API Tags:
Access:  protected


[ Top ]
Methods
static method fontHeight  [line 1887]

  static integer fontHeight( integer $font, string $str  )

Find a font height in pixels

Parameters:
integer   $font:  Font resource
string   $str:  Text to measure

API Tags:
Return:  Font height in pixels
Access:  public


[ Top ]
static method fontWidth  [line 1876]

  static integer fontWidth( integer $font, string $str  )

Find a font width in pixels

Parameters:
integer   $font:  Font resource
string   $str:  Text to measure

API Tags:
Return:  Font width in pixels
Access:  public


[ Top ]
Constructor __construct  [line 1523]

  SMap_Canvas __construct( SMap_Tile $tile  )

Create a canvas which fits the current tile

Parameters:
SMap_Tile   $tile: 


Redefined in descendants as:

[ Top ]
Destructor __destruct  [line 1553]

  void __destruct( )

Destroy image also

"If I go down, I'm taking this image with me!"

"Don't do it man! Noooooooo!!!!"



[ Top ]
allocColor  [line 1599]

  integer allocColor( array $color  )

Allocate a color for an image

Parameters:
array   $color:  Color in RGB or RGBA

API Tags:
Return:  A color handle
Access:  public


[ Top ]
allocImage  [line 1571]

  resource allocImage( )

Allocate an image

Allocates a true color image and initialazes it to be clear.


API Tags:
Return:  A GD image resource
Access:  protected


[ Top ]
composite  [line 1623]

  void composite( SMap_Canvas $atop  )

Composite another canvas atop this one

Parameters:
object Top   $atop:  canvas

API Tags:
Access:  public
Uses:  SMap_Canvas::compositeRes()


[ Top ]
compositeRes  [line 1642]

  void compositeRes( resource $res, $dstX, $dstY, $dstW, $dstH  )

Composite an image resource

Parameters:
resource   $res: 
   $dstX: 
   $dstY: 
   $dstW: 
   $dstH: 

API Tags:
Usedby:  SMap_Canvas::load()
Usedby:  SMap_Canvas::composite()
Access:  protected


[ Top ]
display  [line 1740]

  void display( integer $fmt  )

Display an image

Parameters:
integer   $fmt:  Requested format

API Tags:
Access:  public


Redefined in descendants as:

[ Top ]
filledPolygon  [line 1840]

  void filledPolygon( array &$pts, integer $numPts, integer $col  )

Draw a filled polygon

Parameters:
array   &$pts:  Pairs of points
integer   $numPts:  Number of points
integer   $col:  Color to draw

API Tags:
Access:  public


[ Top ]
filledRectangle  [line 1812]

  void filledRectangle( integer $x1, integer $y1, integer $x2, integer $y2, integer $col  )

Draw a filled rectangle

Parameters:
integer   $x1:  Upper left corner X
integer   $y1:  Upper left corner Y
integer   $x2:  Lower right corner X
integer   $y2:  Lower right corner Y
integer   $col:  Color handle

API Tags:
Access:  public


[ Top ]
line  [line 1780]

  void line( integer $begX, integer $begY, integer $endX, integer $endY, integer $col  )

Draw a line

Parameters:
integer   $begX:  Beginning X
integer   $begY:  Beginning Y
integer   $endX:  Ending X
integer   $endY:  Ending Y
integer   $col:  Color handle

API Tags:
Access:  public


[ Top ]
load  [line 1673]

  boolean load( integer $ftype, string $fname, integer $dstX, integer $dstY, integer $srcX, integer $srcY, integer $width, integer $height  )

Load an image from file

Parameters:
integer   $ftype:  File type
string   $fname:  File name
integer   $dstX:  Place at X
integer   $dstY:  Place at Y
integer   $srcX:  Load from X
integer   $srcY:  Load from Y
integer   $width:  Load width
integer   $height:  Load height

API Tags:
Return:  Image loaded
Access:  public
Uses:  SMap_Canvas::loadRaw()
Uses:  SMap_Canvas::compositeRes()


[ Top ]
loadRaw  [line 1704]

  resource loadRaw( integer $ftype, string $fname, integer $srcX, integer $srcY, integer $width, integer $height  )

Load an image from file

Parameters:
integer   $ftype:  File type
string   $fname:  File name
integer   $srcX:  Load from X
integer   $srcY:  Load from Y
integer   $width:  Load width
integer   $height:  Load height

API Tags:
Return:  GD Image
Usedby:  SMap_Canvas::load()
Access:  protected


[ Top ]
polygon  [line 1826]

  void polygon( array &$pts, integer $numPts, integer $col  )

Draw a polygon

Parameters:
array   &$pts:  Pairs of points
integer   $numPts:  Number of points
integer   $col:  Color to draw

API Tags:
Access:  public


[ Top ]
rectangle  [line 1796]

  void rectangle( integer $x1, integer $y1, integer $x2, integer $y2, integer $col  )

Draw a rectangle

Parameters:
integer   $x1:  Upper left corner X
integer   $y1:  Upper left corner Y
integer   $x2:  Lower right corner X
integer   $y2:  Lower right corner Y
integer   $col:  Color handle

API Tags:
Access:  public


[ Top ]
setPixel  [line 1764]

  void setPixel( integer $x, integer $y, integer $col  )

Set a single pixel

Parameters:
integer   $x:  X dim
integer   $y:  Y dim
integer   $col:  Color handle

API Tags:
Access:  public


[ Top ]
str  [line 1856]

  void str( float $ang, resource $font, integer $x, integer $y, integer $text, $col  )

Draw a string

Parameters:
float   $ang:  Angle to draw the text at
resource   $font:  Font to use
integer   $x:  X Position to draw text
integer   $y:  Y Position to draw text
integer   $text:  Color to draw
   $col: 

API Tags:
Access:  public


[ Top ]
__get  [line 1535]

  mixed __get( string $nm  )

Access useful vars read-only

Creates the image resource on demand

Parameters:
string   $nm:  Name of member

API Tags:
Return:  Value of member


[ Top ]

Documentation generated on Mon, 09 Apr 2007 18:55:57 -0500 by phpDocumentor 1.3.0