Image_Canvas
[ class tree: Image_Canvas ] [ index: Image_Canvas ] [ all elements ]

Class: Image_Canvas_Tool

Source Location: /Image_Canvas-0.3.5/Image/Canvas/Tool.php

Class Overview


This class contains a set of tool-functions.


Author(s):

Version:

  • Release: @package_version@

Copyright:

  • 2003-2009 The PHP Group

Methods


Inherited Variables

Inherited Methods


Class Details

[line 47]
This class contains a set of tool-functions.

These functions are all to be called statically



[ Top ]


Method Detail

bezier   [line 188]

double bezier( double $t, double $p1, double $p2, double $p3, double $p4)

Calculates a Bezier point, this function must be called for BOTH X and Y coordinates (will it work for 3D coordinates!?)
  • Return: The bezier value of the point t between $p2 and $p3 using $p1 and $p4 to calculate control points

Parameters:

double   $t   —  A position between $p2 and $p3, value between 0 and 1
double   $p1   —  Point to use for calculating control points
double   $p2   —  Point 1 to calculate bezier curve between
double   $p3   —  Point 2 to calculate bezier curve between
double   $p4   —  Point to use for calculating control points

[ Top ]

controlPoint   [line 162]

double controlPoint( double $p1, double $p2, double $factor, [double $smoothFactor = 0.75])

Calculates a Bezier control point, this function must be called for BOTH X and Y coordinates (will it work for 3D coordinates!?)
  • Return: P1 mirrored in P2 by Factor

Parameters:

double   $p1   —  1st point
double   $p2   —  Point to
double   $factor   —  ???
double   $smoothFactor   —  Smooth factor (???)

[ Top ]

fontMap   [line 72]

string fontMap( string $name, [string $type = '.ttf'])

Maps a font name to an actual font file (fx. a .ttf file)

Used to translate names (i.e. 'Courier New' to 'cour.ttf' or '/Windows/Fonts/Cour.ttf')

Font names are translated using the tab-separated file Image/Canvas/Tool/fontmap.txt.

The translated font-name (or the original if no translation) exists is then returned if it is an existing file, otherwise the file is searched first in the path specified by IMAGE_CANVAS_SYSTEM_FONT_PATH defined in Image/Canvas.php, then in the Image/Canvas/Fonts folder. If a font is still not found and the name is not beginning with a '/' the search is left to the library, otherwise the font is deemed non-existing.

  • Return: The filename of the font

Parameters:

string   $name   —  The name of the font
string   $type   —  The needed file type of the font

[ Top ]

getAngle   [line 208]

double getAngle( double $x0, double $y0, double $x1, double $y1)

Gets the angle / slope of a line relative to horizontal (left -> right)
  • Return: The angle in degrees of the line

Parameters:

double   $x0   —  The starting x point
double   $y0   —  The starting y point
double   $x1   —  The ending x point
double   $y1   —  The ending y point

[ Top ]

mid   [line 129]

double mid( double $p1, double $p2)

Return the average of 2 points
  • Return: The average of P1 and P2

Parameters:

double   $p1   —  1st point
double   $p2   —  2nd point

[ Top ]

mirror   [line 145]

double mirror( double $p1, double $p2, [double $factor = 1])

Mirrors P1 in P2 by a amount of Factor
  • Return: mirrored in $p2 by Factor

Parameters:

double   $p1   —  1st point, point to mirror
double   $p2   —  2nd point, mirror point
double   $factor   —  Mirror factor, 0 returns $p2, 1 returns a pure mirror, ie $p1 on the exact other side of $p2

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:49:21 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.