Reference Index
|
Structures
構造
|
Data types
データ型
|
Setup functions
設定関数
|
Drawing functions
描画関数
|
Objects
オブジェクト
|
|---|---|---|---|---|
Structures
Using Functions
関数の使用
PHP Font Image Generator 2 has several functions. To do something, you call some functions. Function has a list of parameters. Each statement of calling function must be separated by ; (semicolon), and each parameters by , (comma).
PHP Font Image Generator 2 にはいくつかの関数が用意されています。何かをするには関数を呼び出さなくてはなりません。関数にはいくつかのパラメータがあります。関数の呼び出し文はそれぞれ ; (セミコロン) で、またパラメータは , (コンマ) で区切ります。
| Examples |
color 0x993333; fill; color 255, 255, 255, 50; rect 20, 20, 100, 100; |
||||||
|---|---|---|---|---|---|---|---|
| Syntax |
function; function argument1, argument2, ..., argumentN; |
||||||
| Parameters |
|
Using Constructors
コンストラクタの使用
A constructor creates a specific object. Constructor has a list of parameters as well as function. Each statement of calling constructor must be quoted by {} (parentheses), constructor and parameters are separated by : (collon), and each parameter by , (comma).
コンストラクタは一つのオブジェクトを生成します。コンストラクタには関数と同様にいくつかのパラメータがあります。コンストラクタの呼び出し文はそれぞれ {} (括弧) の中に書き、コンストラクタとパラメータは : (コロン) で、またパラメータはそれぞれ , (コンマ) で区切ります。
| Examples |
color {color: 0x993333}; fill; color {color: 255, 255, 255, 50}; rect {rectangle: 20, 20, 100, 100}; |
||||||
|---|---|---|---|---|---|---|---|
| Syntax |
{constructor:} {constructor: argument1, argument2, ..., argumentN} |
||||||
| Parameters |
|
Declaring Variables
変数の宣言
A variable binds a name (identifier) and a value, so that the value is accessed later by the name. Variable is defined in HTTP GET Method, so each statement of defining a variable is separated by & (ampersand), the name of a variable and the data is separated by = (assign).
変数とは名前と値を束ねるもので、そうすることで後で値を名前で取得することができます。変数は HTTP GET メソッド上で定義します。よって、変数の宣言文はそれぞれ & (アンパサンド) で区切り、名前と値の間には = (assign) を書きます。
| Examples |
alpha=90 &foreground={color: 255, 255, 0} &font={font: 'font/MinionDisplayBold.ttf', 15} |
||||||
|---|---|---|---|---|---|---|---|
| Syntax |
name1=value1 &name2=value2 &... &nameN=valueN |
||||||
| Parameters |
|
Using Variables
変数の使用
Each statement of accessing a variable is quoted by {} (paretheses). As the program loads all variables first, you don't have to declare variables before using those.
変数の取得文は {} (括弧) 内に書きます。プログラムはまず最初に全ての変数を読み込みますので、変数を宣言する前に変数を使用してもかまいません。
| Examples |
color {background}; fill; color {foreground}; rect {border}; &background=0xffffff &foreground={color: 255, 255, 0, {alpha}} &border={rectangle: 20, 20, 100, 100} &alpha=50 |
||||
|---|---|---|---|---|---|
| Syntax |
{variable} |
||||
| Parameters |
|
Accessing Property of Object
オブジェクト属性
An object datatype variable has some accessible properties. Each statement of accessing a property of a variable is quoted by {} (paretheses), and variable and property are separated by . (period).
オブジェクト型の変数からはいくつかの属性を取得できます。オブジェクト属性の取得文は {} (括弧) 内に書き、変数と属性は . (ピリオド) で区切ります。
| Examples |
color 0xffffff; fill; image {leftImg}, 0, 0; image {rightImg}, {leftImg.width}, 0; rect {border}; &leftImg={image: 'img/left_image.gif'} &rightImg={image: 'img/right_image.gif'} |
||||||
|---|---|---|---|---|---|---|---|
| Syntax |
{variable.property} |
||||||
| Parameters |
|
Data Types
number type
数字型
| Example |
223 -1.61 0xffffff 0X996633 #7f000000 0b1111000000000000000011111111 0B01011 |
|---|---|
| Description |
Datatype for integers and floating-point numbers. Integers can be as large as 2,147,483,647 and as low as -2,147,483,648. Floating-point numbers can be as large as 3.40282347E+38 and as low as -3.40282347E+38. It is also allowed that the use of hexadecimal notation and binary notation. Hexadecimal notation can be as large as 7fffffff, binary noation as a 31 sequence of 1, which is equivarent to 2,147,483,647 in decimal number. 整数と小数を格納するデータ型です。整数は最大で 2,147,483,647、最小で -2,147,483,648 の範囲を表せます。小数は最大で 3.40282347E+38、最小で -3.40282347E+38 の範囲を表せます。 また、16 進法の記述と、2 進法の記述をすることもできます。16 進法では最大で 7fffffff、2 進法では最大で 31 個の 1 が続いた数を表せます。これらは 10 進法での 2,147,483,647 と同等になります。 |
| Syntax |
integral_number floating_number 0xhexadecimal_notation 0Xhexadecimal_notation #hexadecimal_notation 0bbinary_notation 0Bbinary_notation |
string type
文字型
| Example |
'metaphysical' "\"Rock'n Roll\"" |
|---|---|
| Description |
A string is a sequence of characters. String datatype is defined inside "" (double quotes) or '' (single quotes). Actually, strings which contain any non-alphabetical character (from A to Z in uppercase and lowercase, including - (dash)) are automatically considered as string datatype, but you should always quote it because alphabetical strings including - (dash) without quotes are defined as constant datatype. 文字列とは文字が並んだものです。文字型は "" (ダブルクオート) か '' (シングルクオート) の中で定義します。実際の所、アルファベット以外の文字 (大文字小文字を含めた A から Z、但し - (ハイフン) を含む) 以外の文字を含んだ文字列は自動的に文字型として扱われるのですが、アルファベットか - (ハイフン) だけの文字列は定数型として扱われてしまうので、常にクオートの中に定義したほうが良いでしょう。 |
| Syntax |
"characters" 'characters' |
constant type
定数型
| Example |
left-adjust both |
|---|---|
| Description |
Constant datatype is described by a sequence of alphabetical characters (from A to Z in uppercase and lowercase) and - (dash) without quotes. 定数型はクオートされていないアルファベットか - (ハイフン) だけの文字列です。 |
| Syntax | constant_value |
Setup Functions
autoresize function
autoresize 関数
| Examples |
|
||||||
|---|---|---|---|---|---|---|---|
| Description |
Defines the trimming mode of the canvas. Once autoresize function called, it is ignored that the dimension of the canvas defined by size function, in order of the mode parameter, and to be fitted to the inner graphics contexts drawn. mode parameter specifies which dimension to be resized. For example, if you don't know about the length of text to be rendered, but the height of that is clear, you may use width. The discription of the 4 different trimming mode follows: none : the canvas is not trimmed (default) width : the width of the canvas is trimmed height : the height of the canvas is trimmed both : both height and width of the canvas are trimmed カンバスの切り抜き方法を定義します。一度 autoresize 関数が呼び出されれば、size 関数によって定義されたカンバスのサイズは mode パラメータに応じて無視され、描画されたグラフィクス内容に合わせられます。 mode パラメータは幅か高さのどちらを切り抜くかを指定します。例えば、描画したい文字列の高さは分かっているけども文字列の長さが分からないといった場合、width を使うのが良いでしょう。切り抜き方法には次の 4 つがあります。 none : 切り抜かない (デフォルト) width : カンバスの幅を切り抜く height : カンバスの高さを切り抜く both : カンバスの幅と高さを切り抜く |
||||||
| Syntax |
autoresize mode; |
||||||
| Parameters |
|
padding function
padding 関数
| Examples |
|
|||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Description |
Defines extra space from the sides of the canvas. This expands the dimension of the canvas defined by size function. For example, Notice that graphics context drawn by fill or pattern remains in the extra space. カンバスの周辺の余白を定義します。これは size 関数で定義されたカンバスのサイズを広げます。例えば また、fill 関数または pattern 関数で描画されたグラフィックス内容は余白部分に残ります。 |
|||||||||||||||||||||||||||
| Syntax |
padding insets; padding tlbr; padding tb, lr; padding top, left, bottom, right; |
|||||||||||||||||||||||||||
| Parameters |
|
size function
size 関数
| Examples |
|
|||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Description |
Defines the dimension of the canvas. You should call this at least once or call autoresize function to set the trimming mode as both, if not, the dimension of the canvas will be 1 x 1. If you call this many time, the last one overrides the others. This can be called in anywhere, after calling some drawing functions for example. カンバスのサイズを定義します。autoresize 関数で切り抜きを方法を both に設定していない限り、少なくとも一回はこの関数を呼び出さなければなりません。そうでなければカンバスサイズは 1 x 1 になってしまいます。もし複数回この関数を呼び出せば、最後に指定した値が前を上書きします。 この関数は、例えば描画関数を呼び出した後など、いつでも呼び出せます。 |
|||||||||
| Syntax |
size width, height; |
|||||||||
| Parameters |
|
type function
type 関数
| Examples |
|
||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Description |
Defines the type and other parameters of the image file to output. By default, the image file will be GIF type with 256 colors. type parameter has 3 different image type: gif, png and jpeg. The transparent parameter is applied only in gif and png mode. The meaning of the option parameter alters in order of the type parameter following: gif : option parameter specifies the number of color, from 1 to 256 png : option parameter specifies the number of color, from 1 to 256 jpeg : option parameter specifies the quality of compression, from 1 to 100 出力する画像形式や出力パラメータを定義します。デフォルトでは 256 色のパレットを持つ GIF 画像が出力されます。 type パラメータには 3 つの画像形式があり、gif、png、jpeg です。transparent パラメータは画像形式が gif か png の場合にのみ適用されます。option パラメータの定義するものは、以下に示した通り type パラメータの値によって変化します。gif : option パラメータは色数を定義します。値は 1 から 256 までです。 png : option パラメータは色数を定義します。値は 1 から 256 までです。 jpeg : option パラメータは圧縮率を定義します。値は 1 から 100 までです。 |
||||||||||||
| Syntax |
type type; type type, option; type type, transparent; type type, option, transparent; |
||||||||||||
| Parameters |
|
file function
| Examples | Not yet | ||||||
|---|---|---|---|---|---|---|---|
| Description |
Specifies whether to create the image file and the name of it. Once file is called, this tries to create an image file according to the file_path parameter and make a redirection to it, so that it is not rendered every time. If the file creation is failed (permission problem, for instance), this returns its data stream as usual. Notice that this does not make any directories or change permission. For example, Currently this function only supports relative path from the script file directory as the file_path argument. |
||||||
| Syntax |
file file_path; |
||||||
| Parameters |
|
debug function
debug 関数
| Examples |
|
|||
|---|---|---|---|---|
| Description |
Dumps a list of all variables, functions, and parameters defined or called. This can be called in anywhere, after calling some drawing functions for example. 定義された全ての変数と、呼び出された全ての関数とそのパラメータの一覧を出力します。 この関数は、例えば描画関数を呼び出した後など、いつでも呼び出せます。 |
|||
| Syntax |
debug; |
|||
| Parameters |
|
Drawing Functions
antialias function
antialias 関数
| Examples |
|
||||||
|---|---|---|---|---|---|---|---|
| Description |
Defines the quality of text antialias. Text renderer buffers the image of text multiplied by the antialias parameter, and resamples the buffered image to draw. By default, sampling multiplier is 4. If you set the antialias as 1, text is not antialiased. Be careful setting large number as multiplier because antialiasing is one of the most heavy process of all. 文字列のアンチエイリアス処理の品質を定義します。テキストレンダラーは antialias パラメータの値に基づいて乗算された文字列の画像をバッファリングし、それをリサンプリングして描画します。デフォルトではサンプリング乗数は 4 になります。antialias を 1 にすればアンチエイリアス処理は行われません。 アンチエイリアス処理は最も重い処理の一つですので、サンプリング乗数を大きな値にするときには注意してください。 |
||||||
| Syntax |
antialias multiplier; |
||||||
| Parameters |
|
color function
color 関数
| Examples |
|
||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Description |
Sets the color used to draw rectangle, fill and text. This has the same parameters as the color: constructor for convenience, except the color datatype. See also the description of the color: constructor for more detail. 矩形や塗りつぶし、文字列の描画に使う色を指定します。この関数には color データ型の値をパラメータに取れる以外に、利便性のために color: コンストラクタと同じパラメータが用意されています。詳しくは color: コンストラクタの説明を参照ください。 |
||||||||||||||||||||||||
| Syntax |
color color; color argb; color rgb, alpha; color red, green, blue; color red, green, blue, alpha; |
||||||||||||||||||||||||
| Parameters |
|
font function
font 関数
| Examples |
|
|||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Description |
Sets the font used to draw text. This has the same parameters as font: constructor for convenience, except the font datatype. See also the description of font: constructor for more detail. 文字列の描画に使うフォントを指定します。この関数には font データ型の値をパラメータに取れる以外に、利便性のために font: コンストラクタと同じパラメータが用意されています。詳しくは font: コンストラクタの説明を参照ください。 |
|||||||||||||||
| Syntax |
font font; font fontfile; font fontfile, size; font fontfile, size, leading; |
|||||||||||||||
| Parameters |
|
translate function
translate 関数
| Examples | Not yet | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Description |
Scecifies an amount to displace objects within the canvas. The dx parameter specifies left/right translation, and the dy parameter specifies up/down translation. Transformations apply to everything that happens after and subsequent calls to the function accumulates the effect. For example, calling |
|||||||||
| Syntax |
translate dx, dy; |
|||||||||
| Parameters |
|
fill function
| Examples | Not yet | |||
|---|---|---|---|---|
| Description |
Draws a fill to the canvas. |
|||
| Syntax |
fill |
|||
| Parameters |
|
pattern function
| Examples | Not yet | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Description |
Draws a pattern to the canvas. The image parameter sets the pattern image. The repeat parameter specifies whether the image is repeated, and how. The discription of the 4 different repeat mode follows: no-repeat : the image is not repeated repeat-x : the image is repeated horizontally only repeat-y : the image is repeated vertically only repeat : the image is repeated both horizontally and vertically (default) |
|||||||||
| Syntax |
pattern image; pattern image, repeat; |
|||||||||
| Parameters |
|
rect function
| Examples | Not yet | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Description |
Draws a rectangle to the canvas. A rectangle has 4 lines. The first two parameters set the location, the third sets the width, and the fourth sets the height. |
||||||||||||||||||
| Syntax |
rect rectangle; rect x, y, width, height; |
||||||||||||||||||
| Parameters |
|
fillrect function
| Examples | Not yet | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Description |
Draws a filled rectangle to the canvas. A rectangle has 4 lines and a fill. The first two parameters set the location, the third sets the width, and the fourth sets the height. |
||||||||||||||||||
| Syntax |
fillrect rectangle; fillrect x, y, width, height; |
||||||||||||||||||
| Parameters |
|
patternrect function
| Examples | Not yet | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Description |
Draws a patterned rectangle to the canvas. A rectangle has 4 lines and a pattern. The image parameter sets the pattern image. The repeat parameter specifies whether the image is repeated, and how. The discription of the 4 different repeat mode follows: no-repeat : the image is not repeated repeat-x : the image is repeated horizontally only repeat-y : the image is repeated vertically only repeat : the image is repeated both horizontally and vertically (default) |
||||||||||||||||||||||||
| Syntax |
patternrect image, rectangle; patternrect image, rectangle, repeat; patternrect image, x, y, width, height; patternrect image, x, y, width, height, constant repeat; |
||||||||||||||||||||||||
| Parameters |
|
image function
| Examples | Not yet | ||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Description | Not yet | ||||||||||||||||||||||||||||||||||||||||||
| Syntax |
image image, x, y; image image, x, y, width, height; image image, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2; |
||||||||||||||||||||||||||||||||||||||||||
| Parameters |
|
string function
| Examples | Not yet | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Description | Not yet | ||||||||||||||||||||||||
| Syntax |
string text; string text, x, y; string text, x, y, width; string text, x, y, width, align; string text, x, y, width, height; string text, x, y, width, height, align, valign; |
||||||||||||||||||||||||
| Parameters |
|
Objects
image object
| Examples | Not yet | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Description | Not yet | |||||||||
| Constructor Syntax |
{image: imagefile} |
|||||||||
| Constructor Parameters |
|
|||||||||
| Properties |
|
font object
| Examples | Not yet | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Description | Not yet | ||||||||||||
| Constructor Syntax |
{font: fontfile} {font: fontfile, size} {font: fontfile, size, leading} |
||||||||||||
| Constructor Parameters |
|
||||||||||||
| Properties |
|
color object
| Examples | Not yet | |||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Description | Not yet | |||||||||||||||||||||
| Constructor Syntax |
{color: argb} {color: rgb, alpha} {color: red, green, blue} {color: red, green, blue, alpha} |
|||||||||||||||||||||
| Constructor Parameters |
|
|||||||||||||||||||||
| Properties |
|
rectangle object
| Examples | Not yet | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Description | Not yet | Constructor Syntax |
{rectangle: x, y, width, height} |
|||||||||||||
| Constructor Parameters |
|
|||||||||||||||
| Properties |
|
insets object
| Examples | Not yet | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Description | Not yet | ||||||||||||||||||||||||
| Constructor Syntax |
{insets:} {insets: tlbr} {insets: tb, lr} {insets: top, left, bottom, right} |
||||||||||||||||||||||||
| Constructor Parameters |
|
||||||||||||||||||||||||
| Properties |
|
point object
| Examples | Not yet | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Description | Not yet | |||||||||
| Constructor Syntax |
{point:} {point: x, y} |
|||||||||
| Constructor Parameters |
|
|||||||||
| Properties |
|
dimension object
| Examples | Not yet | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Description | Not yet | |||||||||
| Constructor Syntax |
{dimension:} {dimension: width, height} |
|||||||||
| Constructor Parameters |
|
|||||||||
| Properties |
|


