ruby-gd 0.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Changes +54 -0
- data/GD.c +2602 -0
- data/doc/INSTALL.en +83 -0
- data/doc/INSTALL.ja +91 -0
- data/doc/manual.html +891 -0
- data/doc/manual.rd +969 -0
- data/doc/manual_index.html +146 -0
- data/extconf.rb +79 -0
- data/readme.en +55 -0
- data/readme.ja +74 -0
- data/sample/example.rb +28 -0
- data/sample/gdtestttf.png +0 -0
- data/sample/gdtestttf.rb +62 -0
- data/sample/webpng.rb +111 -0
- metadata +59 -0
data/doc/INSTALL.en
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
= Installation Guide
|
2
|
+
|
3
|
+
== Requirements
|
4
|
+
|
5
|
+
Ruby/GD requires version 1.6.0 or later of the gd library, and
|
6
|
+
Ruby-1.4.0 or later.
|
7
|
+
|
8
|
+
The latest version of gd is available from:
|
9
|
+
http://www.boutell.com/gd/
|
10
|
+
|
11
|
+
The latest version of Ruby is available from:
|
12
|
+
http://www.ruby-lang.org/
|
13
|
+
|
14
|
+
To build the extension library, at least the following libraries
|
15
|
+
must be correctly installed in your system.
|
16
|
+
|
17
|
+
* libpng
|
18
|
+
* zlib
|
19
|
+
|
20
|
+
= Install
|
21
|
+
|
22
|
+
1. To generate the Makefile with which Ruby/GD is build, issue this
|
23
|
+
command from your prompt:
|
24
|
+
|
25
|
+
ruby extconf.rb [options...]
|
26
|
+
|
27
|
+
The following options can be specified:
|
28
|
+
|
29
|
+
* --with-xpm
|
30
|
+
|
31
|
+
If your gd has support for XPM format images, add this option. Note
|
32
|
+
that libX11 and libXpm must be correctly installed in your system.
|
33
|
+
|
34
|
+
* --with-ttf
|
35
|
+
|
36
|
+
If your gd has support for TrueType fonts, add this option. Note that
|
37
|
+
Freetype library must be correctly installed in your system.
|
38
|
+
|
39
|
+
* --with-freetype
|
40
|
+
|
41
|
+
If you want use the newest feature of font rendering provided by
|
42
|
+
gd-1.8.4, add this option along with '--with-ttf'.
|
43
|
+
Note that Freetype library must be correctly installed in your system.
|
44
|
+
|
45
|
+
* --with-jpeg
|
46
|
+
|
47
|
+
If your gd has support for JPEG format images, add this option. Note that
|
48
|
+
libjpeg-6b or later must be correctly installed in your system.
|
49
|
+
|
50
|
+
* --with-gd-include=[dir], --with-gd-lib=[dir]
|
51
|
+
|
52
|
+
You can specify explicitly the location in which gd library is
|
53
|
+
installed.
|
54
|
+
|
55
|
+
EXAMPLE
|
56
|
+
the case libgd.a and header files exist in "/home/foo/gd-1.8.4":
|
57
|
+
|
58
|
+
$ ruby extconf.rb --with-gd-include=/home/foo/gd-1.8.4 --with-gd-lib=/home/foo/gd-1.8.4
|
59
|
+
|
60
|
+
* --enable-gd2_0
|
61
|
+
|
62
|
+
If you want to use the newest features (support for truecolor
|
63
|
+
images, alpha channels, etc.) provided by gd-2.0.x from Ruby/GD,
|
64
|
+
add this option. gd-2.0.x must be correctly installed on your system.
|
65
|
+
|
66
|
+
2. Build the extension library
|
67
|
+
|
68
|
+
issue this command:
|
69
|
+
|
70
|
+
$ make
|
71
|
+
|
72
|
+
If successful, the library named "GD.so" is generated.
|
73
|
+
|
74
|
+
3. Install in your system
|
75
|
+
|
76
|
+
type (if needed, as superuser)
|
77
|
+
|
78
|
+
# make install
|
79
|
+
or,
|
80
|
+
# make site-install
|
81
|
+
|
82
|
+
and GD.so will be correctly installed in your system. This finishes
|
83
|
+
the installation.
|
data/doc/INSTALL.ja
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
= Ruby/GD �Υ��ȡ�����ˡ
|
2
|
+
|
3
|
+
== ɬ�פʥ饤�֥��γ�ǧ
|
4
|
+
|
5
|
+
�ޤ������Ȥ���gd�饤�֥���version���ǧ���Ʋ�������Ruby/GD���������
|
6
|
+
�ˤ�PNG�����Ϥ���ǽ��gd-1.6.0�ʾ夬ɬ�פǤ����ޤ���Ruby��1.4�ʾ�����
|
7
|
+
���Ʋ�������
|
8
|
+
|
9
|
+
�ǿ��Ǥ�gd�饤�֥��ϼ���Web�����Ȥ������ꤹ�뤳�Ȥ��Ǥ��ޤ���
|
10
|
+
http://www.boutell.com/gd/
|
11
|
+
�����Ǥ�gd�饤�֥��κ�����ˡ�ˤĤ��ƤϽҤ٤ޤ����ξܺ٤�ź�դ���
|
12
|
+
�Ƥ���Makefile���ɤ�Dz�������
|
13
|
+
|
14
|
+
Ruby�κǿ��Ǥϼ���Web�����Ȥ������ꤹ�뤳�Ȥ��Ǥ��ޤ���
|
15
|
+
http://www.ruby-lang.org/
|
16
|
+
|
17
|
+
�Ǿ���ɬ�פʳ����饤�֥��ϼ����̤�Ǥ���
|
18
|
+
|
19
|
+
PNG�饤�֥��(libpng)��zlib�饤�֥��
|
20
|
+
|
21
|
+
== ���ȡ���
|
22
|
+
|
23
|
+
1. ��ĥ�饤�֥������Ѥ�Makefile��������롥
|
24
|
+
|
25
|
+
�ץ���ץȤ���
|
26
|
+
|
27
|
+
$ ruby extconf.rb [options...]
|
28
|
+
|
29
|
+
���ǤäƤ���������
|
30
|
+
|
31
|
+
[options...] �ˤϰʲ��Υ��ץ�������ꤹ�뤳�Ȥ��Ǥ��ޤ���
|
32
|
+
|
33
|
+
* --with-xpm
|
34
|
+
|
35
|
+
���Ȥ��� gd �� version 1.7�ʾ�ǡ�Xpm �ե����뤫������Ϥݡ��Ȥ�
|
36
|
+
�Ƥ���ʤ�С����Υ��ץ������ղä��Ʋ�������X11�饤�֥�ꡤXpm�饤��
|
37
|
+
��꤬���������ȡ��뤵��Ƥ���ɬ�פ�����ޤ���
|
38
|
+
|
39
|
+
* --with-ttf
|
40
|
+
|
41
|
+
���Ȥ��� gd �� TrueType�ե���Ȥμ�갷���ݡ��Ȥ��Ƥ���ʤ�С���
|
42
|
+
�Υ��ץ������ղä��Ʋ�������Freetype�饤�֥�꤬���������ȡ��뤵
|
43
|
+
��Ƥ���ɬ�פ�����ޤ���
|
44
|
+
|
45
|
+
* --with-freetype
|
46
|
+
|
47
|
+
gd-1.8.4 ���顢TruetType�ե���Ȥ��Ѥ�����ˡ�FreeType 2.x ������
|
48
|
+
���������٤�ʸ��������褬��ǽ�Ȥʤ�ޤ�����
|
49
|
+
���ε�ǽ�����Ѥ�����ˤϡ�'--with-ttf' ���ץ����ȤȤ�ˡ�
|
50
|
+
���Υ��ץ������ɲä��Ʋ�������
|
51
|
+
FreeType 2.x �饤�֥�꤬���������ȡ��뤵�졢gd �����Υ饤�֥���
|
52
|
+
�����Ƥ���ɬ�פ�����ޤ���
|
53
|
+
|
54
|
+
* --with-jpeg
|
55
|
+
|
56
|
+
���Ȥ��� gd �� version 1.8 �ʾ�ǡ�Jpeg�ե����뤫��������Ϥ��б�����
|
57
|
+
����ʤ�С����Υ��ץ������ղä��Ʋ�������libjpeg-6b�ʹߤ�����������
|
58
|
+
���ȡ��뤵��Ƥ���ɬ�פ�����ޤ���
|
59
|
+
|
60
|
+
* --with-gd-include=[dir], --with-gd-lib=[dir]
|
61
|
+
|
62
|
+
gd.h��libgd.a����¸�ߤ������2�Ĥˤ�ä�����Ū�˻��ꤹ�뤳�Ȥ��
|
63
|
+
��ޤ���
|
64
|
+
|
65
|
+
��)
|
66
|
+
/home/foo/gd-1.8.3 ��libgd.a��إå��ե����뤬������
|
67
|
+
$ ruby extconf.rb --with-gd-include=/home/foo/gd-1.8.3 --with-gd-lib=/home/foo/gd-1.8.3
|
68
|
+
|
69
|
+
* --enable-gd2_0
|
70
|
+
|
71
|
+
gd-2.0.x�Ǥϡ�TrueColor������䡢����ե�����ͥ��Ŭ�ڤ˰�
|
72
|
+
�������¿���ε�ǽ���ɲä���Ƥ��ޤ���Ruby/GD���餳���ε�ǽ�����Ѥ������
|
73
|
+
���Υ��ץ������ղä��Ʋ�������gd-2.0.x �����������ȡ��뤵��Ƥ���
|
74
|
+
ɬ�פ�����ޤ���
|
75
|
+
|
76
|
+
2. ��ĥ�饤�֥���������롥
|
77
|
+
|
78
|
+
�ץ���ץȤ���
|
79
|
+
|
80
|
+
$ make
|
81
|
+
|
82
|
+
���ǤäƤ����������ӥ�ɤ���������� "GD.so" ����������ޤ���
|
83
|
+
|
84
|
+
3. ���ȡ���
|
85
|
+
|
86
|
+
# make install
|
87
|
+
�ޤ���
|
88
|
+
# make site-install
|
89
|
+
|
90
|
+
���ǤƤС���ĥ�饤�֥��Υ��ȡ��뤬��λ���ޤ��������ѡ��桼����
|
91
|
+
���¤�ɬ�פ��⤷��ޤ���
|
data/doc/manual.html
ADDED
@@ -0,0 +1,891 @@
|
|
1
|
+
<?xml version="1.0" ?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"DTD/xhtml1-strict.dtd">
|
5
|
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
6
|
+
<head>
|
7
|
+
<title>manual</title>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
<h1><a name="label:0" id="label:0">Ruby/GD Version 0.7.4</a></h1><!-- RDLabel: "Ruby/GD Version 0.7.4" -->
|
11
|
+
<p>Ruby extension library for using Thomas Boutell's gd
|
12
|
+
library(http://www.boutell.com/gd/).</p>
|
13
|
+
<p>Originally written by Yukihiro Matsumoto (matz@ruby-lang.org)</p>
|
14
|
+
<p>Current maintainer: Ryuichi Tamura (tam@kais.kyoto-u.ac.jp)</p>
|
15
|
+
<p><em> If gd-2.0.x is installed in your system, and Ruby/GD is compiled
|
16
|
+
with <code>--enable-gd2_0</code> option, you can use those constants or
|
17
|
+
methods described in the subsection "gd-2.0.0 or higher"</em></p>
|
18
|
+
<h2><a name="label:1" id="label:1">Module/Class Hierarchy</a></h2><!-- RDLabel: "Module/Class Hierarchy" -->
|
19
|
+
<pre>GD -+
|
20
|
+
|
|
21
|
+
+- GD::Image
|
22
|
+
|
|
23
|
+
+- GD::Polygon
|
24
|
+
|
|
25
|
+
+- GD::Font</pre>
|
26
|
+
<h1><a name="label:2" id="label:2">Module GD</a></h1><!-- RDLabel: "Module GD" -->
|
27
|
+
<p>Module that defines some constants refered by GD::Image or GD::Polygon
|
28
|
+
instances.</p>
|
29
|
+
<h2><a name="label:3" id="label:3">Constants</a></h2><!-- RDLabel: "Constants" -->
|
30
|
+
<dl>
|
31
|
+
<dt><a name="label:4" id="label:4"><code>GD::Brushed</code></a><!-- RDLabel: "GD::Brushed" -->
|
32
|
+
</dl>
|
33
|
+
<p>If this constant is used as the color when invoking a line-drawing
|
34
|
+
method such as <a href="#label:67">GD::Image#line</a> or <a href="#label:69">GD::Image#rectangle</a>, the
|
35
|
+
line to be drawn is the brush image that has been set with
|
36
|
+
<a href="#label:70">GD::Image#setBrush</a>.</p>
|
37
|
+
<dl>
|
38
|
+
<dt><a name="label:5" id="label:5"><code>GD::Styled</code></a><!-- RDLabel: "GD::Styled" -->
|
39
|
+
</dl>
|
40
|
+
<p>If this constant is used as the color when invoking a line-drawing
|
41
|
+
method such as <a href="#label:67">GD::Image#line</a> or <a href="#label:69">GD::Image#rectangle</a>, the
|
42
|
+
colors of the pixels are drawn successively from the style that has
|
43
|
+
been set with <a href="#label:72">GD::Image#setStyle</a>. If the color of a pixel is
|
44
|
+
equal to <a href="#label:8">GD::Transparent</a>, that pixel is not altered.</p>
|
45
|
+
<dl>
|
46
|
+
<dt><a name="label:6" id="label:6"><code>GD::StyledBrushed</code></a><!-- RDLabel: "GD::StyledBrushed" -->
|
47
|
+
</dl>
|
48
|
+
<p>If this constant is used as the color when invoking a line-drawing
|
49
|
+
method such as <a href="#label:67">GD::Image#line</a> or <a href="#label:69">GD::Image#rectangle</a>, the
|
50
|
+
brush set with <a href="#label:70">GD::Image#setBrush</a> is drawn wherever the color
|
51
|
+
specified in <a href="#label:72">GD::Image#setStyle</a> is neither zero nor
|
52
|
+
<a href="#label:8">GD::Transparent</a>.</p>
|
53
|
+
<dl>
|
54
|
+
<dt><a name="label:7" id="label:7"><code>GD::Tiled</code></a><!-- RDLabel: "GD::Tiled" -->
|
55
|
+
</dl>
|
56
|
+
<p>If this constant is used as the color when invoking a filling method
|
57
|
+
such as <a href="#label:65">GD::Image#filledRectangle</a>,
|
58
|
+
<a href="#label:64">GD::Image#filledPolygon</a>, <a href="#label:63">GD::Image#fill</a>, and
|
59
|
+
<a href="#label:66">GD::Image#fillToBorder</a>. The area is filled with a tile image set
|
60
|
+
with <a href="#label:73">GD::Image#setTile</a>.</p>
|
61
|
+
<dl>
|
62
|
+
<dt><a name="label:8" id="label:8"><code>GD::Transparent</code></a><!-- RDLabel: "GD::Transparent" -->
|
63
|
+
</dl>
|
64
|
+
<p>Used in place of a normal color in a style to be set with
|
65
|
+
<a href="#label:72">GD::Image#setStyle</a>. This constant is not the transparent color
|
66
|
+
index of the image; for that functionality, see
|
67
|
+
<a href="#label:59">GD::Image#transparent</a>.</p>
|
68
|
+
<dl>
|
69
|
+
<dt><a name="label:9" id="label:9"><code>GD::GD2_FMT_COMPRESSED</code></a><!-- RDLabel: "GD::GD2_FMT_COMPRESSED" -->
|
70
|
+
</dl>
|
71
|
+
<p>specifies Gd2 image to be compressed. This constant is used in
|
72
|
+
<a href="#label:102">GD::Image#gd2</a>.</p>
|
73
|
+
<dl>
|
74
|
+
<dt><a name="label:10" id="label:10"><code>GD::GD2_FMT_RAW</code></a><!-- RDLabel: "GD::GD2_FMT_RAW" -->
|
75
|
+
</dl>
|
76
|
+
<p>specifies Gd2 image to be uncompressed. This constant is used in
|
77
|
+
<a href="#label:102">GD::Image#gd2</a>.</p>
|
78
|
+
<h3><a name="label:11" id="label:11">gd-2.0.0 or higher</a></h3><!-- RDLabel: "gd-2.0.0 or higher" -->
|
79
|
+
<dl>
|
80
|
+
<dt><a name="label:12" id="label:12"><code>GD::AlphaTransparent</code></a><!-- RDLabel: "GD::AlphaTransparent" -->
|
81
|
+
<dt><a name="label:13" id="label:13"><code>GD::AlphaOpaque</code></a><!-- RDLabel: "GD::AlphaOpaque" -->
|
82
|
+
</dl>
|
83
|
+
<p>These constants are used in <a href="#label:45">GD::Image.trueColorAlpha</a>, and each
|
84
|
+
defines the upper(127) and lower(0) bounds of alpha channel value,
|
85
|
+
respectively. Full transparency corresponds to GD::AlphaTransparent.</p>
|
86
|
+
<dl>
|
87
|
+
<dt><a name="label:14" id="label:14"><code>GD::Arc</code></a><!-- RDLabel: "GD::Arc" -->
|
88
|
+
<dt><a name="label:15" id="label:15"><code>GD::Chord</code></a><!-- RDLabel: "GD::Chord" -->
|
89
|
+
<dt><a name="label:16" id="label:16"><code>GD::Pie</code></a><!-- RDLabel: "GD::Pie" -->
|
90
|
+
<dt><a name="label:17" id="label:17"><code>GD::NoFill</code></a><!-- RDLabel: "GD::NoFill" -->
|
91
|
+
<dt><a name="label:18" id="label:18"><code>GD::Edged</code></a><!-- RDLabel: "GD::Edged" -->
|
92
|
+
</dl>
|
93
|
+
<p>These constants become options that specify how an arc is drawn with
|
94
|
+
using <a href="#label:123">GD::Image#filledArc</a>. See also <a href="#label:123">GD::Image#filledArc</a>.</p>
|
95
|
+
<h1><a name="label:19" id="label:19">Class GD::Image</a></h1><!-- RDLabel: "Class GD::Image" -->
|
96
|
+
<h2><a name="label:20" id="label:20">Class Methods</a></h2><!-- RDLabel: "Class Methods" -->
|
97
|
+
<h5><a name="label:21" id="label:21">Instance Creation</a></h5><!-- RDLabel: "Instance Creation" -->
|
98
|
+
<dl>
|
99
|
+
<dt><a name="label:22" id="label:22"><code>GD::Image.new(<var>width</var>, <var>height</var>)</code></a><!-- RDLabel: "GD::Image.new" -->
|
100
|
+
</dl>
|
101
|
+
<p>creates a new palette image instance with specified <var>width</var> and
|
102
|
+
<var>height</var>.</p>
|
103
|
+
<dl>
|
104
|
+
<dt><a name="label:23" id="label:23"><code>GD::Image.newFromGd(<var>file</var>)</code></a><!-- RDLabel: "GD::Image.newFromGd" -->
|
105
|
+
</dl>
|
106
|
+
<p>creates a new image instance from Gd file. <var>file</var> is a File
|
107
|
+
object.</p>
|
108
|
+
<dl>
|
109
|
+
<dt><a name="label:24" id="label:24"><code>GD::Image.new_from_gd(<var>filename</var>)</code></a><!-- RDLabel: "GD::Image.new_from_gd" -->
|
110
|
+
</dl>
|
111
|
+
<p>creates a new Gd image instance from <var>filename</var>. <var>filename</var>
|
112
|
+
is a String object which specifies the localtion of the image file.</p>
|
113
|
+
<dl>
|
114
|
+
<dt><a name="label:25" id="label:25"><code>GD::Image.newFromGd2(<var>file</var>)</code></a><!-- RDLabel: "GD::Image.newFromGd2" -->
|
115
|
+
</dl>
|
116
|
+
<p>creates a new image instance from Gd2 file. <var>file</var> is a File
|
117
|
+
object.</p>
|
118
|
+
<dl>
|
119
|
+
<dt><a name="label:26" id="label:26"><code>GD::Image.new_from_gd2(<var>filename</var>)</code></a><!-- RDLabel: "GD::Image.new_from_gd2" -->
|
120
|
+
</dl>
|
121
|
+
<p>creates a new Gd2 image instance from <var>filename</var>. <var>filename</var>
|
122
|
+
is a String object which specifies the location of the image file.</p>
|
123
|
+
<dl>
|
124
|
+
<dt><a name="label:27" id="label:27"><code>GD::Image.newFromGd2Part(<var>file</var>, <var>srcX</var>, <var>srcY</var>, <var>width</var>, <var>height</var>)</code></a><!-- RDLabel: "GD::Image.newFromGd2Part" -->
|
125
|
+
</dl>
|
126
|
+
<p>creates a new image instance from part of Gd2 file. <var>file</var> is a
|
127
|
+
File object.</p>
|
128
|
+
<dl>
|
129
|
+
<dt><a name="label:28" id="label:28"><code>GD::Image.new_from_gd2_part(<var>filename</var>)</code></a><!-- RDLabel: "GD::Image.new_from_gd2_part" -->
|
130
|
+
</dl>
|
131
|
+
<p>creates a new Gd2 image instance from <var>filename</var>. <var>filename</var>
|
132
|
+
is a String object which specifies the location of the image file.</p>
|
133
|
+
<dl>
|
134
|
+
<dt><a name="label:29" id="label:29"><code>GD::Image.newFromJpeg(<var>file</var>)</code></a><!-- RDLabel: "GD::Image.newFromJpeg" -->
|
135
|
+
</dl>
|
136
|
+
<p>(gd-1.8 or later)</p>
|
137
|
+
<p>Creates a new image instance from JPEG file. <var>file</var> is a File
|
138
|
+
object.</p>
|
139
|
+
<dl>
|
140
|
+
<dt><a name="label:30" id="label:30"><code>GD::Image.new_from_jpeg(<var>filename</var>)</code></a><!-- RDLabel: "GD::Image.new_from_jpeg" -->
|
141
|
+
</dl>
|
142
|
+
<p>creates a new Jpeg image instance from <var>filename</var>. <var>filename</var>
|
143
|
+
is a String object which specifies the location of the image file.</p>
|
144
|
+
<dl>
|
145
|
+
<dt><a name="label:31" id="label:31"><code>GD::Image.newFromPng(<var>file</var>)</code></a><!-- RDLabel: "GD::Image.newFromPng" -->
|
146
|
+
</dl>
|
147
|
+
<p>creates a new image instance from PNG file. <var>file</var> is a File
|
148
|
+
object.</p>
|
149
|
+
<dl>
|
150
|
+
<dt><a name="label:32" id="label:32"><code>GD::Image.new_from_png(<var>filename</var>)</code></a><!-- RDLabel: "GD::Image.new_from_png" -->
|
151
|
+
</dl>
|
152
|
+
<p>creates a new PNG image instance from <var>filename</var>. <var>filename</var>
|
153
|
+
is a String object which specifies the location of the image file.</p>
|
154
|
+
<dl>
|
155
|
+
<dt><a name="label:33" id="label:33"><code>GD::Image.newFromXbm(<var>file</var>)</code></a><!-- RDLabel: "GD::Image.newFromXbm" -->
|
156
|
+
</dl>
|
157
|
+
<p>creates a new image instance from Xbm file. <var>file</var> is a File
|
158
|
+
object.</p>
|
159
|
+
<dl>
|
160
|
+
<dt><a name="label:34" id="label:34"><code>GD::Image.new_from_xbm(<var>filename</var>)</code></a><!-- RDLabel: "GD::Image.new_from_xbm" -->
|
161
|
+
</dl>
|
162
|
+
<p>creates a new XBitmap image instance from
|
163
|
+
<var>filename</var>. <var>filename</var> is a String object which specifies the
|
164
|
+
location of the image file.</p>
|
165
|
+
<dl>
|
166
|
+
<dt><a name="label:35" id="label:35"><code>GD::Image.newFromXpm(<var>file</var>)</code></a><!-- RDLabel: "GD::Image.newFromXpm" -->
|
167
|
+
</dl>
|
168
|
+
<p>(gd-1.7 or later)</p>
|
169
|
+
<p>creates a new image instance from Xpm file. <var>file</var> is a File
|
170
|
+
object.</p>
|
171
|
+
<dl>
|
172
|
+
<dt><a name="label:36" id="label:36"><code>GD::Image.new_from_xpm(<var>filename</var>)</code></a><!-- RDLabel: "GD::Image.new_from_xpm" -->
|
173
|
+
</dl>
|
174
|
+
<p>creates a new XPixmaps image instance from
|
175
|
+
<var>filename</var>. <var>filename</var> is a String object which specifies the
|
176
|
+
location of the image file.</p>
|
177
|
+
<h5><a name="label:37" id="label:37">Query</a></h5><!-- RDLabel: "Query" -->
|
178
|
+
<dl>
|
179
|
+
<dt><a name="label:38" id="label:38"><code>GD::Image.stringTTF(<var>fg_color</var>, <var>fnt_name</var>, <var>pt</var>, <var>angle</var>, <var>x</var>, <var>y</var>, <var>str</var>)</code></a><!-- RDLabel: "GD::Image.stringTTF" -->
|
180
|
+
</dl>
|
181
|
+
<p>(gd-1.6.1 or later) </p>
|
182
|
+
<p>Tries to find the bounding rectangle of <var>str</var> with size (<var>pt</var>)
|
183
|
+
and the name of the TrueType font(<var>fnt_name</var>), and returns the
|
184
|
+
array consists of the error message string and the array of each
|
185
|
+
vertex of the rectangle(brect[8], see the figure in the section of
|
186
|
+
<a href="#label:85">GD::Image#stringTTF</a>). If successful, the error message is
|
187
|
+
<a name="index:0" id="index:0">nil</a>. See also <a href="#label:85">GD::Image#stringTTF</a>.</p>
|
188
|
+
<dl>
|
189
|
+
<dt><a name="label:39" id="label:39"><code>GD::Image.stringFT(<var>fg_color</var>, <var>fnt_name</var>, <var>pt</var>, <var>angle</var>, <var>x</var>, <var>y</var>, <var>str</var>)</code></a><!-- RDLabel: "GD::Image.stringFT" -->
|
190
|
+
</dl>
|
191
|
+
<p>(gd-1.8.4) </p>
|
192
|
+
<p>This method provides the same functionarity as
|
193
|
+
<a href="#label:38">GD::Image.stringTTF</a> does, but uses FreeType2 library when
|
194
|
+
redering the string. See also <a href="#label:86">GD::Image#stringFT</a></p>
|
195
|
+
<h3><a name="label:11" id="label:11">gd-2.0.0 or higher</a></h3><!-- RDLabel: "gd-2.0.0 or higher" -->
|
196
|
+
<dl>
|
197
|
+
<dt><a name="label:41" id="label:41"><code>GD::Image.newTrueColor(<var>width</var>, <var>height</var>)</code></a><!-- RDLabel: "GD::Image.newTrueColor" -->
|
198
|
+
</dl>
|
199
|
+
<p>Creates a new truecolor image instance with specified <var>width</var> and
|
200
|
+
<var>height</var>.</p>
|
201
|
+
<dl>
|
202
|
+
<dt><a name="label:42" id="label:42"><code>GD::Image.trueColor(<var>r</var>, <var>g</var>, <var>b</var>)</code></a><!-- RDLabel: "GD::Image.trueColor" -->
|
203
|
+
<dt><a name="label:42" id="label:42"><code>GD::Image.trueColor(<var>rgbstr</var>)</code></a><!-- RDLabel: "GD::Image.trueColor" -->
|
204
|
+
</dl>
|
205
|
+
<p>returns the RGBA color value for drawing on a truecolor image, or an
|
206
|
+
image created by <a href="#label:41">GD::Image.newTrueColor</a>. <var>r</var>, <var>g</var>,
|
207
|
+
<var>b</var> values are in the range between 0 and 255. Or, you can
|
208
|
+
specify it by <var>rgbstr</var> which is in the range between "#000000" and
|
209
|
+
"#FFFFFF".</p>
|
210
|
+
<dl>
|
211
|
+
<dt><a name="label:42" id="label:42"><code>GD::Image.trueColor(<var>r</var>, <var>g</var>, <var>b</var>, <var>alpha</var>)</code></a><!-- RDLabel: "GD::Image.trueColor" -->
|
212
|
+
<dt><a name="label:45" id="label:45"><code>GD::Image.trueColorAlpha(<var>rgbstr</var>, <var>alpha</var>)</code></a><!-- RDLabel: "GD::Image.trueColorAlpha" -->
|
213
|
+
</dl>
|
214
|
+
<p>returns the RGBA color value for drawing on a truecolor image, or an
|
215
|
+
image created by <a href="#label:41">GD::Image.newTrueColor</a> with alpha channel
|
216
|
+
transparency. Because gd has 7-bit alpha channel, the <var>alpha</var>
|
217
|
+
value takes between 0(opaque) and 127(transparent).</p>
|
218
|
+
<p>These class methods are used for <em>truecolor</em> images. If you want
|
219
|
+
to specify alpha value for <em>palette</em> images, use
|
220
|
+
<a href="#label:110">GD::Image#colorAllocateAlpha</a>, <a href="#label:112">GD::Image#colorExactAlpha</a>,
|
221
|
+
<a href="#label:114">GD::Image#colorClosestAlpha</a>, or
|
222
|
+
<a href="#label:116">GD::Image#colorResolveAlpha</a> instead.</p>
|
223
|
+
<h2><a name="label:46" id="label:46">Methods</a></h2><!-- RDLabel: "Methods" -->
|
224
|
+
<dl>
|
225
|
+
<dt><a name="label:47" id="label:47"><code>GD::Image#destroy</code></a><!-- RDLabel: "GD::Image#destroy" -->
|
226
|
+
</dl>
|
227
|
+
<p>Free the memory associated with the image instance.</p>
|
228
|
+
<dl>
|
229
|
+
<dt><a name="label:48" id="label:48"><code>GD::Image#interlace=(<var>val</var>)</code></a><!-- RDLabel: "GD::Image#interlace=" -->
|
230
|
+
</dl>
|
231
|
+
<p>If <var>val</var> is <!-- Index, but conflict -->true<!-- Index end -->, the image is interlaced. Otherwise and by
|
232
|
+
default, the image is not interlaced.</p>
|
233
|
+
<h3><a name="label:49" id="label:49">Color Handling</a></h3><!-- RDLabel: "Color Handling" -->
|
234
|
+
<dl>
|
235
|
+
<dt><a name="label:50" id="label:50"><code>GD::Image#colorAllocate(<var>r</var>, <var>g</var>, <var>b</var>)</code></a><!-- RDLabel: "GD::Image#colorAllocate" -->
|
236
|
+
<dt><a name="label:50" id="label:50"><code>GD::Image#colorAllocate(<var>str</var>)</code></a><!-- RDLabel: "GD::Image#colorAllocate" -->
|
237
|
+
</dl>
|
238
|
+
<p>Finds the first available color index in the image instance, and sets
|
239
|
+
its RGB values to <var>r</var>, <var>g</var>, <var>b</var>, respectively and returns
|
240
|
+
the index of the new color table entry. <var>r</var>, <var>g</var>, <var>b</var> take
|
241
|
+
a value between 0 and 255. Also, if you use Ruby-1.6.0 or later, you
|
242
|
+
can specify a color as strings like "#FF00FF".</p>
|
243
|
+
<p>Note that the first time you invoke this method after creating a new
|
244
|
+
image by <a href="#label:22">GD::Image.new</a>, <em>the background color</em> of the image
|
245
|
+
is set.</p>
|
246
|
+
<p>You can allocate upto 256 colors to one image. If there is no space to
|
247
|
+
allocate the requested color, this returns -1.</p>
|
248
|
+
<p>If you use gd-1.6.2 or later, you can use
|
249
|
+
<a href="#label:57">GD::Image#colorResolve</a>, more robust way of color allocation.</p>
|
250
|
+
<dl>
|
251
|
+
<dt><a name="label:52" id="label:52"><code>GD::Image#colorClosest(<var>r</var>, <var>g</var>, <var>b</var>)</code></a><!-- RDLabel: "GD::Image#colorClosest" -->
|
252
|
+
<dt><a name="label:52" id="label:52"><code>GD::Image#colorClosest(<var>str</var>)</code></a><!-- RDLabel: "GD::Image#colorClosest" -->
|
253
|
+
</dl>
|
254
|
+
<p>Searches the colors which have been defined thus far in the image
|
255
|
+
instance and returns the index of the color with RGB values closest to
|
256
|
+
<var>r</var>, <var>g</var>, <var>b</var>, respectively. Also, if you use Ruby-1.6.0
|
257
|
+
or later, you can specify a color as strings like "#FF00FF".If no
|
258
|
+
color have been yet allocated to that image, this returns -1</p>
|
259
|
+
<p>This method is useful when a image instance which you want to allocate
|
260
|
+
a new color is created from the image scanned from a photograph in
|
261
|
+
which many colors will be used.</p>
|
262
|
+
<dl>
|
263
|
+
<dt><a name="label:54" id="label:54"><code>GD::Image#colorDeallocate(<var>color</var>)</code></a><!-- RDLabel: "GD::Image#colorDeallocate" -->
|
264
|
+
</dl>
|
265
|
+
<p>This marks the <var>color</var> at the specified index as being ripe for
|
266
|
+
reallocation. The next time <a href="#label:50">GD::Image#colorAllocate</a> is used,
|
267
|
+
this entry will be replaced. You can call this method several times
|
268
|
+
to deallocate multiple colors.</p>
|
269
|
+
<dl>
|
270
|
+
<dt><a name="label:55" id="label:55"><code>GD::Image#colorExact(<var>r</var>, <var>g</var>, <var>b</var>)</code></a><!-- RDLabel: "GD::Image#colorExact" -->
|
271
|
+
<dt><a name="label:55" id="label:55"><code>GD::Image#colorExact(<var>str</var>)</code></a><!-- RDLabel: "GD::Image#colorExact" -->
|
272
|
+
</dl>
|
273
|
+
<p>Searches the colors which have been defined thus far in the image
|
274
|
+
instance and returns the index of the first color with RGB values
|
275
|
+
which exactly match (<var>r</var>, <var>g</var>, <var>b</var>). If no allocated color
|
276
|
+
matches the request precisely, this returns -1. Also, if you use
|
277
|
+
Ruby-1.6.0 or later, you can specify a color as strings like
|
278
|
+
"#FF00FF".</p>
|
279
|
+
<dl>
|
280
|
+
<dt><a name="label:57" id="label:57"><code>GD::Image#colorResolve(<var>r</var>, <var>g</var>, <var>b</var>)</code></a><!-- RDLabel: "GD::Image#colorResolve" -->
|
281
|
+
<dt><a name="label:57" id="label:57"><code>GD::Image#colorResolve(<var>str</var>)</code></a><!-- RDLabel: "GD::Image#colorResolve" -->
|
282
|
+
</dl>
|
283
|
+
<p>(gd-1.6.2 or later)</p>
|
284
|
+
<p>Searches the colors which have been defined thus far in the image
|
285
|
+
specified and returns the index of the first color with RGB values
|
286
|
+
which exactly match those of the request. Also, if you use Ruby-1.6.0
|
287
|
+
or later, you can specify a color as strings like "#FF00FF".</p>
|
288
|
+
<p>If no allocated color matches the request precisely, then this method
|
289
|
+
tries to allocate the exact color.If there is no space left in the
|
290
|
+
color table then this method returns the closest color (as in
|
291
|
+
<a href="#label:52">GD::Image#colorClosest</a>).</p>
|
292
|
+
<p>Unlike <a href="#label:50">GD::Image#colorAllocate</a>, this method always returns an
|
293
|
+
index of a color.</p>
|
294
|
+
<dl>
|
295
|
+
<dt><a name="label:59" id="label:59"><code>GD::Image#transparent(<var>idx</var>)</code></a><!-- RDLabel: "GD::Image#transparent" -->
|
296
|
+
</dl>
|
297
|
+
<p>Sets the transparent color index for the specified image to the
|
298
|
+
specified color index <var>idx</var>. To indicate that there should be no
|
299
|
+
transparent color, set <var>idx</var> to -1. </p>
|
300
|
+
<p>Note that JPEG images <em>do not support</em> transparency, so this
|
301
|
+
setting has no effect when writing JPEG images.</p>
|
302
|
+
<h5><a name="label:60" id="label:60">Drawing and Filling</a></h5><!-- RDLabel: "Drawing and Filling" -->
|
303
|
+
<dl>
|
304
|
+
<dt><a name="label:61" id="label:61"><code>GD::Image#arc(<var>cx</var>, <var>cy</var>, <var>width</var>, <var>height</var>, <var>start</var>, <var>end</var>, <var>color</var>)</code></a><!-- RDLabel: "GD::Image#arc" -->
|
305
|
+
</dl>
|
306
|
+
<p>Draw a partial ellipse centered at the given point (<var>cx</var>,<var>cy</var>)
|
307
|
+
with specified width <var>width</var> and height <var>height</var> in pixel with
|
308
|
+
specified <var>color</var>. The arc begins at the position in degrees
|
309
|
+
specified by <var>start</var> and ends at the position specified by
|
310
|
+
<var>end</var>.</p>
|
311
|
+
<dl>
|
312
|
+
<dt><a name="label:62" id="label:62"><code>GD::Image#dashedLine(<var>x1</var>, <var>y1</var>, <var>x2</var>, <var>y2</var>, <var>color</var>)</code></a><!-- RDLabel: "GD::Image#dashedLine" -->
|
313
|
+
</dl>
|
314
|
+
<p>This method is provided solely for backwards compatibility of the
|
315
|
+
Boutell's gd library. When drawing a dashed line, new programs should
|
316
|
+
use <a href="#label:67">GD::Image#line</a> with <a href="#label:72">GD::Image#setStyle</a>.</p>
|
317
|
+
<dl>
|
318
|
+
<dt><a name="label:63" id="label:63"><code>GD::Image#fill(<var>x</var>, <var>y</var>, <var>color</var>)</code></a><!-- RDLabel: "GD::Image#fill" -->
|
319
|
+
</dl>
|
320
|
+
<p>Flood a portion of the image with the specified <var>color</var>, beginning
|
321
|
+
at the specified point (<var>x</var>,<var>y</var>) and flooding the surrounding
|
322
|
+
region of the same color as the starting point. See also
|
323
|
+
<a href="#label:66">GD::Image#fillToBorder</a>.</p>
|
324
|
+
<dl>
|
325
|
+
<dt><a name="label:64" id="label:64"><code>GD::Image#filledPolygon(<var>points</var>, <var>color</var>)</code></a><!-- RDLabel: "GD::Image#filledPolygon" -->
|
326
|
+
</dl>
|
327
|
+
<p>Draw a filled polygon with the verticies specified, using the
|
328
|
+
<var>color</var> index specified. see also <a href="#label:68">GD::Image#polygon</a>.</p>
|
329
|
+
<dl>
|
330
|
+
<dt><a name="label:65" id="label:65"><code>GD::Image#filledRectangle(<var>x1</var>, <var>y1</var>, <var>x2</var>, <var>y2</var>, <var>color</var>)</code></a><!-- RDLabel: "GD::Image#filledRectangle" -->
|
331
|
+
</dl>
|
332
|
+
<p>Draw a filled rectangle. See also <a href="#label:69">GD::Image#rectangle</a>.</p>
|
333
|
+
<dl>
|
334
|
+
<dt><a name="label:66" id="label:66"><code>GD::Image#fillToBorder(<var>x</var>, <var>y</var>, <var>border_color</var>, <var>color</var>)</code></a><!-- RDLabel: "GD::Image#fillToBorder" -->
|
335
|
+
</dl>
|
336
|
+
<p>floods a portion of the image with the specified <var>color</var>,
|
337
|
+
beginning at the specified point (<var>x</var>,<var>y</var>) and stopping at the
|
338
|
+
specified <var>border_color</var>.</p>
|
339
|
+
<p>The <var>border_color</var> cannot be a special color such as
|
340
|
+
<a href="#label:7">GD::Tiled</a>. It must be a proper solid color. However the fill
|
341
|
+
<var>color</var> can be a special color.</p>
|
342
|
+
<dl>
|
343
|
+
<dt><a name="label:67" id="label:67"><code>GD::Image#line(<var>x1</var>, <var>y1</var>, <var>x2</var>, <var>y2</var>, <var>color</var>)</code></a><!-- RDLabel: "GD::Image#line" -->
|
344
|
+
</dl>
|
345
|
+
<p>Draw a line between two endpoints (<var>x1</var>,<var>y1</var>) and
|
346
|
+
(<var>x2</var>,<var>y2</var>). <var>color</var> is the color allocated by
|
347
|
+
<a href="#label:50">GD::Image#colorAllocate</a>, or one of <a href="#label:5">GD::Styled</a>,
|
348
|
+
<a href="#label:4">GD::Brushed</a>, <a href="#label:6">GD::StyledBrushed</a>.</p>
|
349
|
+
<dl>
|
350
|
+
<dt><a name="label:68" id="label:68"><code>GD::Image#polygon(<var>points</var>, <var>color</var>)</code></a><!-- RDLabel: "GD::Image#polygon" -->
|
351
|
+
</dl>
|
352
|
+
<p>Draw a polygon with the verticies (at least 3) specified, using the
|
353
|
+
<var>color</var> index. <var>points</var> is <!-- Index, but conflict -->GD::Polygon<!-- Index end --> instance. After
|
354
|
+
you created the <!-- Index, but conflict -->GD::Polygon<!-- Index end --> instances and did some operation on
|
355
|
+
the vertices, the poligon is drawn with this method.</p>
|
356
|
+
<dl>
|
357
|
+
<dt><a name="label:69" id="label:69"><code>GD::Image#rectangle(<var>x1</var>, <var>y1</var>, <var>x2</var>, <var>y2</var>, <var>color</var>)</code></a><!-- RDLabel: "GD::Image#rectangle" -->
|
358
|
+
</dl>
|
359
|
+
<p>Draw a rectangle with two corners(upper left is (<var>x1</var>,<var>y1</var>),
|
360
|
+
lower right (<var>x2</var>, <var>y2</var>)) with the specified <var>color</var>
|
361
|
+
index.</p>
|
362
|
+
<dl>
|
363
|
+
<dt><a name="label:70" id="label:70"><code>GD::Image#setBrush(<var>image</var>)</code></a><!-- RDLabel: "GD::Image#setBrush" -->
|
364
|
+
</dl>
|
365
|
+
<p>Set a "brush"(an image used to draw wide, shaped strokes) to
|
366
|
+
<var>image</var>. <var>image</var> can be any of <!-- Index, but conflict -->GD::Image<!-- Index end --> instance.By
|
367
|
+
setting the transparent color index of the brush image with
|
368
|
+
<a href="#label:59">GD::Image#transparent</a>, a brush of any shape can be created. All
|
369
|
+
line-drawing methods, such as <a href="#label:67">GD::Image#line</a> and
|
370
|
+
<a href="#label:68">GD::Image#polygon</a>, will use the current brush if the special
|
371
|
+
"color" <a href="#label:4">GD::Brushed</a> or <a href="#label:6">GD::StyledBrushed</a> is used when
|
372
|
+
invoking them.</p>
|
373
|
+
<p>As for any image instance, brush image must be destroyed by
|
374
|
+
<a href="#label:47">GD::Image#destroy</a>.</p>
|
375
|
+
<dl>
|
376
|
+
<dt><a name="label:71" id="label:71"><code>GD::Image#setPixel(<var>x</var>, <var>y</var>, <var>color</var>)</code></a><!-- RDLabel: "GD::Image#setPixel" -->
|
377
|
+
</dl>
|
378
|
+
<p>Set the color of a pixel at (<var>x</var>,<var>y</var>) to <var>color</var> index.</p>
|
379
|
+
<dl>
|
380
|
+
<dt><a name="label:72" id="label:72"><code>GD::Image#setStyle(<var>color1</var>, <var>color2</var>, ...)</code></a><!-- RDLabel: "GD::Image#setStyle" -->
|
381
|
+
</dl>
|
382
|
+
<p>Set the series of colors to be drawn repeatedly during the drawing by
|
383
|
+
a method such as <a href="#label:67">GD::Image#line</a>. Each element of <var>color</var> is
|
384
|
+
either the color index allocated by <a href="#label:50">GD::Image#colorAllocate</a>, or
|
385
|
+
<a href="#label:8">GD::Transparent</a> if you want the color of the particular pixel
|
386
|
+
left unchanged.</p>
|
387
|
+
<dl>
|
388
|
+
<dt><a name="label:73" id="label:73"><code>GD::Image#setTile(<var>image</var>)</code></a><!-- RDLabel: "GD::Image#setTile" -->
|
389
|
+
</dl>
|
390
|
+
<p>Set the image to be tiled. <var>image</var> can be any <!-- Index, but conflict -->GD::Image<!-- Index end --> instance.</p>
|
391
|
+
<h5><a name="label:74" id="label:74">Copy and Merge</a></h5><!-- RDLabel: "Copy and Merge" -->
|
392
|
+
<dl>
|
393
|
+
<dt><a name="label:75" id="label:75"><code>GD::Image#copy(<var>dest_img</var>, <var>dest_X</var>, <var>dest_Y</var>, <var>self_X</var>, <var>self_Y</var>, <var>width</var>, <var>height</var>)</code></a><!-- RDLabel: "GD::Image#copy" -->
|
394
|
+
</dl>
|
395
|
+
<p>Copy a portion of the image at (<var>self_X, self_Y</var>) with specified
|
396
|
+
<var>width</var> and <var>height</var> to (<var>dest_X</var>, <var>dest_Y</var>) of
|
397
|
+
<var>dest_img</var>.</p>
|
398
|
+
<dl>
|
399
|
+
<dt><a name="label:76" id="label:76"><code>GD::Image#copyMerge(<var>dest_img</var>, <var>dest_X</var>, <var>dest_Y</var>, <var>self_X</var>, <var>self_Y</var>, <var>width</var>, <var>height</var>, <var>percent</var>)</code></a><!-- RDLabel: "GD::Image#copyMerge" -->
|
400
|
+
</dl>
|
401
|
+
<p>Copy the two images by an amount specified in the last parameter
|
402
|
+
<var>percent</var>. Arguments except for this are identical to those of
|
403
|
+
<a href="#label:75">GD::Image#copy</a>. If <var>percent</var> is equal to 100, then this
|
404
|
+
method will function identically to <a href="#label:75">GD::Image#copy</a> i.e. the
|
405
|
+
source image replaces the pixels in the destination. If the
|
406
|
+
<var>percent</var> = 0, no action is taken.</p>
|
407
|
+
<p>This feature is most useful to 'highlight' sections of an image by
|
408
|
+
merging a solid color with <var>percent</var> = 50.</p>
|
409
|
+
<dl>
|
410
|
+
<dt><a name="label:77" id="label:77"><code>GD::Image#copyMergeGray(<var>dest_img</var>, <var>dest_X</var>, <var>dest_Y</var>, <var>self_X</var>, <var>self_Y</var>, <var>width</var>, <var>height</var>, <var>percent</var>)</code></a><!-- RDLabel: "GD::Image#copyMergeGray" -->
|
411
|
+
</dl>
|
412
|
+
<p>Identical to <a href="#label:76">GD::Image#copyMerge</a>, except that when merging
|
413
|
+
images it preserves the hue of the source by converting the
|
414
|
+
destination pixels to grey scale before the copy operation.</p>
|
415
|
+
<dl>
|
416
|
+
<dt><a name="label:78" id="label:78"><code>GD::Image#copyResized(<var>dest_img</var>, <var>dest_X</var>, <var>dest_Y</var>, <var>self_X</var>, <var>self_Y</var>, <var>self_width</var>, <var>self_height</var>, <var>dest_X</var>, <var>dest_Y</var>)</code></a><!-- RDLabel: "GD::Image#copyResized" -->
|
417
|
+
</dl>
|
418
|
+
<p>Copy a portion of the image at (<var>self_X, self_Y</var>) with specified
|
419
|
+
<var>self_width</var> and <var>self_height</var> to <var>dest_img</var> at
|
420
|
+
(<var>dest_X</var>, <var>dest_Y</var>) with specified <var>dest_width</var> and
|
421
|
+
<var>dest_height</var>.</p>
|
422
|
+
<dl>
|
423
|
+
<dt><a name="label:79" id="label:79"><code>GD::Image#paletteCopy(<var>dest</var>)</code></a><!-- RDLabel: "GD::Image#paletteCopy" -->
|
424
|
+
</dl>
|
425
|
+
<p>Copies a palette to <var>dest</var> image, attempting to match the colors
|
426
|
+
in the target image to the colors in the palette of the self.</p>
|
427
|
+
<h5><a name="label:80" id="label:80">Font and text handling</a></h5><!-- RDLabel: "Font and text handling" -->
|
428
|
+
<dl>
|
429
|
+
<dt><a name="label:81" id="label:81"><code>GD::Image#char(<var>font</var>, <var>x</var>, <var>y</var>, <var>char</var>, <var>color</var>)</code></a><!-- RDLabel: "GD::Image#char" -->
|
430
|
+
</dl>
|
431
|
+
<p>Draws a single character <var>char</var> at (<var>x</var>, <var>y</var>) with
|
432
|
+
specified <var>color</var>. <var>font</var> is specified by one of
|
433
|
+
<a href="#label:161">GD::Font::TinyFont</a>, <a href="#label:160">GD::Font::SmallFont</a>,
|
434
|
+
<a href="#label:159">GD::Font::MediumFont</a>, <a href="#label:158">GD::Font::LargeFont</a>,
|
435
|
+
<a href="#label:157">GD::Font::GiantFont</a>.</p>
|
436
|
+
<dl>
|
437
|
+
<dt><a name="label:82" id="label:82"><code>GD::Image#charUp(<var>font</var>, <var>x</var>, <var>y</var>, <var>char</var>, <var>color</var>)</code></a><!-- RDLabel: "GD::Image#charUp" -->
|
438
|
+
</dl>
|
439
|
+
<p>Draws a single chracter <var>char</var> at (<var>x</var>, <var>y</var>) with
|
440
|
+
specified <var>color</var>. <var>char</var> is drawn in a vertical direction,
|
441
|
+
i.e. drawn with rotated in 90 degree. See also <a href="#label:81">GD::Image#char</a>.</p>
|
442
|
+
<dl>
|
443
|
+
<dt><a name="label:83" id="label:83"><code>GD::Image#string(<var>font</var>, <var>x</var>, <var>y</var>, <var>str</var>, <var>color</var>)</code></a><!-- RDLabel: "GD::Image#string" -->
|
444
|
+
</dl>
|
445
|
+
<p>Draws multiple characters <var>str</var> on the image with the specified
|
446
|
+
<var>color</var>. <var>font</var> is specified by one of
|
447
|
+
<a href="#label:161">GD::Font::TinyFont</a>, <a href="#label:160">GD::Font::SmallFont</a>,
|
448
|
+
<a href="#label:159">GD::Font::MediumFont</a>, <a href="#label:158">GD::Font::LargeFont</a>,
|
449
|
+
<a href="#label:157">GD::Font::GiantFont</a>, or <!-- Index, but conflict -->GD::Font<!-- Index end --> instance created by
|
450
|
+
<a href="#label:150">GD::Font.new</a>.</p>
|
451
|
+
<dl>
|
452
|
+
<dt><a name="label:84" id="label:84"><code>GD::Image#stringUp(<var>font</var>, <var>x</var>, <var>y</var>, <var>str</var>, <var>color</var>)</code></a><!-- RDLabel: "GD::Image#stringUp" -->
|
453
|
+
</dl>
|
454
|
+
<p>Draw multiple characters <var>str</var> on the image with the specified
|
455
|
+
<var>color</var>. <var>str</var> is drawn in a vertical direction, i.e. drawn
|
456
|
+
with rotated in 90 degree. See also <a href="#label:83">GD::Image#string</a>.</p>
|
457
|
+
<dl>
|
458
|
+
<dt><a name="label:85" id="label:85"><code>GD::Image#stringTTF(<var>fg_color</var>, <var>fnt_name</var>, <var>pt</var>, <var>angle</var>, <var>x</var>, <var>y</var>, <var>str</var>)</code></a><!-- RDLabel: "GD::Image#stringTTF" -->
|
459
|
+
</dl>
|
460
|
+
<p>(gd-1.6.1 or later) </p>
|
461
|
+
<p>Draws a string <var>str</var> at (<var>x</var>, <var>y</var>) on the image using
|
462
|
+
user-supplied TrueType fonts with specified <var>fg_color</var>. The
|
463
|
+
location of TrueType font <var>fnt_name</var> is specified by full path.
|
464
|
+
The string may be arbitrarily scaled at <var>pt</var> and rotated
|
465
|
+
(<var>angle</var> in radians).</p>
|
466
|
+
<p>This method returns an array of 2 elements. the first element is the
|
467
|
+
error message string, the 2nd is <em>brect</em> of the bounding rectangle
|
468
|
+
with 8 elements. Each element of <em>brect</em> is illustrated as below:</p>
|
469
|
+
<pre>(brect[6],brect[7]) (brect[4],brect[5])
|
470
|
+
+--------------------+
|
471
|
+
|( S t r i n g )|
|
472
|
+
+--------------------+
|
473
|
+
(brect[0],brect[1]) (brect[2],brect[3])</pre>
|
474
|
+
<p>When the string is successfully drawn, error message is <!-- Index, but conflict -->nil<!-- Index end -->. </p>
|
475
|
+
<p>If you only want to know the brect of the bounding rectangle, you can
|
476
|
+
use <a href="#label:38">GD::Image.stringTTF</a>.</p>
|
477
|
+
<dl>
|
478
|
+
<dt><a name="label:86" id="label:86"><code>GD::Image#stringFT(<var>fg_color</var>, <var>fnt_name</var>, <var>pt</var>, <var>angle</var>, <var>x</var>, <var>y</var>, <var>str</var>)</code></a><!-- RDLabel: "GD::Image#stringFT" -->
|
479
|
+
</dl>
|
480
|
+
<p>(gd-1.8.4) </p>
|
481
|
+
<p>This method provides the same functionarity as
|
482
|
+
<a href="#label:85">GD::Image#stringTTF</a> does, but uses FreeType2 library when
|
483
|
+
redering the string.</p>
|
484
|
+
<h5><a name="label:37" id="label:37">Query</a></h5><!-- RDLabel: "Query" -->
|
485
|
+
<dl>
|
486
|
+
<dt><a name="label:88" id="label:88"><code>GD::Image#bounds</code></a><!-- RDLabel: "GD::Image#bounds" -->
|
487
|
+
</dl>
|
488
|
+
<p>Returns the width and height of the image as Array instance.</p>
|
489
|
+
<dl>
|
490
|
+
<dt><a name="label:89" id="label:89"><code>GD::Image#boundsSafe(<var>x</var>, <var>y</var>)</code></a><!-- RDLabel: "GD::Image#boundsSafe" -->
|
491
|
+
</dl>
|
492
|
+
<p>Returns <!-- Index, but conflict -->true<!-- Index end --> if specified point (<var>x</var>,<var>y</var>) is within the
|
493
|
+
bounds of the image. Otherwise return <!-- Index, but conflict -->false<!-- Index end -->.</p>
|
494
|
+
<dl>
|
495
|
+
<dt><a name="label:90" id="label:90"><code>GD::Image#blue(<var>idx</var>)</code></a><!-- RDLabel: "GD::Image#blue" -->
|
496
|
+
</dl>
|
497
|
+
<p>Returns the blue component of the specified color index <var>idx</var>.</p>
|
498
|
+
<dl>
|
499
|
+
<dt><a name="label:91" id="label:91"><code>GD::Image#colorsTotal</code></a><!-- RDLabel: "GD::Image#colorsTotal" -->
|
500
|
+
</dl>
|
501
|
+
<p>Returns the number of colors currently allocated in the image. </p>
|
502
|
+
<dl>
|
503
|
+
<dt><a name="label:92" id="label:92"><code>GD::Image#getTransparent</code></a><!-- RDLabel: "GD::Image#getTransparent" -->
|
504
|
+
</dl>
|
505
|
+
<p>Returns the current transparent color index of the image. Returns -1
|
506
|
+
if there is no transparent color.</p>
|
507
|
+
<dl>
|
508
|
+
<dt><a name="label:93" id="label:93"><code>GD::Image#getPixel(<var>x</var>, <var>y</var>)</code></a><!-- RDLabel: "GD::Image#getPixel" -->
|
509
|
+
</dl>
|
510
|
+
<p>Returns the color index of a pixel at (<var>x</var>,<var>y</var>)).</p>
|
511
|
+
<dl>
|
512
|
+
<dt><a name="label:94" id="label:94"><code>GD::Image#green(<var>idx</var>)</code></a><!-- RDLabel: "GD::Image#green" -->
|
513
|
+
</dl>
|
514
|
+
<p>Returns the green component of the specified color index <var>idx</var>.</p>
|
515
|
+
<dl>
|
516
|
+
<dt><a name="label:95" id="label:95"><code>GD::Image#height</code></a><!-- RDLabel: "GD::Image#height" -->
|
517
|
+
</dl>
|
518
|
+
<p>Returns the height of the image.</p>
|
519
|
+
<dl>
|
520
|
+
<dt><a name="label:96" id="label:96"><code>GD::Image#interlace</code></a><!-- RDLabel: "GD::Image#interlace" -->
|
521
|
+
</dl>
|
522
|
+
<p>Returns <!-- Index, but conflict -->true<!-- Index end --> if the image is interlaced, and returns <!-- Index, but conflict -->false<!-- Index end --> otherwise.</p>
|
523
|
+
<dl>
|
524
|
+
<dt><a name="label:97" id="label:97"><code>GD::Image#red(<var>idx</var>)</code></a><!-- RDLabel: "GD::Image#red" -->
|
525
|
+
</dl>
|
526
|
+
<p>Returns the red component of the specified color index <var>idx</var>.</p>
|
527
|
+
<dl>
|
528
|
+
<dt><a name="label:98" id="label:98"><code>GD::Image#rgb(<var>idx</var>)</code></a><!-- RDLabel: "GD::Image#rgb" -->
|
529
|
+
</dl>
|
530
|
+
<p>Returns array of the RGB values for the specified index <var>idx</var> of
|
531
|
+
the image.</p>
|
532
|
+
<dl>
|
533
|
+
<dt><a name="label:99" id="label:99"><code>GD::Image#width</code></a><!-- RDLabel: "GD::Image#width" -->
|
534
|
+
</dl>
|
535
|
+
<p>Returns the width of the image.</p>
|
536
|
+
<h5><a name="label:100" id="label:100">Output</a></h5><!-- RDLabel: "Output" -->
|
537
|
+
<dl>
|
538
|
+
<dt><a name="label:101" id="label:101"><code>GD::Image#gd(<var>file</var>)</code></a><!-- RDLabel: "GD::Image#gd" -->
|
539
|
+
</dl>
|
540
|
+
<p>Outputs the image to the specified <var>file</var> in Gd format. </p>
|
541
|
+
<dl>
|
542
|
+
<dt><a name="label:102" id="label:102"><code>GD::Image#gd2(<var>file</var>, <var>chunk_size</var>, <var>fmt</var>)</code></a><!-- RDLabel: "GD::Image#gd2" -->
|
543
|
+
</dl>
|
544
|
+
<p>Outputs the image to the specified <var>file</var> in Gd2 format with
|
545
|
+
specified <var>chunk_size</var> and <var>fmt</var>. A gd2 Image are stored as a
|
546
|
+
series of compressed/uncompressed subimages. You can specify
|
547
|
+
<var>chunk_size</var> which determines the size of the subimages. If
|
548
|
+
<var>chunk_size</var> is set zero, the default size is used. Whether the image
|
549
|
+
is compressed or uncompressed is determined by <var>fmt</var> being
|
550
|
+
<a href="#label:9">GD::GD2_FMT_COMPRESSED</a> or
|
551
|
+
<a href="#label:10">GD::GD2_FMT_RAW</a>, respectively.</p>
|
552
|
+
<dl>
|
553
|
+
<dt><a name="label:103" id="label:103"><code>GD::Image#jpeg(<var>file</var>, <var>quality</var>)</code></a><!-- RDLabel: "GD::Image#jpeg" -->
|
554
|
+
</dl>
|
555
|
+
<p>(gd-1.8 or later)</p>
|
556
|
+
<p>Outputs the image to the specified <var>file</var> with <var>quality</var> in
|
557
|
+
Jpeg format. If <var>quality</var> is set to nagative, the default IJG JPEG
|
558
|
+
quality value (which should yield a good general quality size
|
559
|
+
trade-off for most situations) is used. For practical purposes,
|
560
|
+
quality should be a value in the range 0-95.</p>
|
561
|
+
<dl>
|
562
|
+
<dt><a name="label:104" id="label:104"><code>GD::Image#jpegStr(<var>quality</var>)</code></a><!-- RDLabel: "GD::Image#jpegStr" -->
|
563
|
+
</dl>
|
564
|
+
<p>(gd-1.8 or later)</p>
|
565
|
+
<p>Outputs the Jpeg image as String object with specified <var>quality</var>.
|
566
|
+
This method will be especially useful when you want to transmit an
|
567
|
+
image <em>directly</em> to an user(i.e, without first writing it to a
|
568
|
+
file).</p>
|
569
|
+
<p>This method is provided by Colin Steele(colin@webg2.com). </p>
|
570
|
+
<dl>
|
571
|
+
<dt><a name="label:105" id="label:105"><code>GD::Image#png(<var>file</var>)</code></a><!-- RDLabel: "GD::Image#png" -->
|
572
|
+
</dl>
|
573
|
+
<p>Outputs the image to the specified <var>file</var> in PNG format. </p>
|
574
|
+
<dl>
|
575
|
+
<dt><a name="label:106" id="label:106"><code>GD::Image#pngStr(<var>file</var>)</code></a><!-- RDLabel: "GD::Image#pngStr" -->
|
576
|
+
</dl>
|
577
|
+
<p>Outputs the image in PNG format as String object. This method will be
|
578
|
+
especially useful when you want to transmit an image <em>directly</em> to
|
579
|
+
an user(i.e, without first writing it to a file).</p>
|
580
|
+
<dl>
|
581
|
+
<dt><a name="label:107" id="label:107"><code>GD::Image#wbmp(<var>fg_color</var>, <var>file</var>)</code></a><!-- RDLabel: "GD::Image#wbmp" -->
|
582
|
+
</dl>
|
583
|
+
<p>(gd-1.8 or later)</p>
|
584
|
+
<p>Outputs the specified image to the specified file in WBMP format.</p>
|
585
|
+
<p>WBMP file support is <em>black</em> and <em>white</em> only. The color index
|
586
|
+
specified by the <var>fg_color</var> argument is the "foreground," and only
|
587
|
+
pixels of this color will be set in the WBMP file. All other pixels
|
588
|
+
will be considered "background."</p>
|
589
|
+
<h3><a name="label:11" id="label:11">gd-2.0.0 or higher</a></h3><!-- RDLabel: "gd-2.0.0 or higher" -->
|
590
|
+
<h5><a name="label:109" id="label:109">Color handling</a></h5><!-- RDLabel: "Color handling" -->
|
591
|
+
<dl>
|
592
|
+
<dt><a name="label:110" id="label:110"><code>GD::Image#colorAllocateAlpha(<var>r</var>, <var>g</var>, <var>b</var>, <var>alpha</var>)</code></a><!-- RDLabel: "GD::Image#colorAllocateAlpha" -->
|
593
|
+
<dt><a name="label:110" id="label:110"><code>GD::Image#colorAllocateAlpha(<var>rgbstr</var>, <var>alpha</var>)</code></a><!-- RDLabel: "GD::Image#colorAllocateAlpha" -->
|
594
|
+
</dl>
|
595
|
+
<p>Finds the first available color index in the image specified, sets its
|
596
|
+
RGBA values to those requested and returns the index of the new color
|
597
|
+
table entry, or an RGBA value in the case of a truecolor image; in
|
598
|
+
either case you can then use the returned value as a parameter to
|
599
|
+
drawing functions. The <var>alpha</var> value takes between 0(opaque) and
|
600
|
+
127(transparent).</p>
|
601
|
+
<p>See also <a href="#label:50">GD::Image#colorAllocate</a>.</p>
|
602
|
+
<dl>
|
603
|
+
<dt><a name="label:112" id="label:112"><code>GD::Image#colorExactAlpha(<var>r</var>, <var>g</var>, <var>b</var>, <var>alpha</var>)</code></a><!-- RDLabel: "GD::Image#colorExactAlpha" -->
|
604
|
+
<dt><a name="label:112" id="label:112"><code>GD::Image#colorExactAlpha(<var>rgbstr</var>, <var>alpha</var>)</code></a><!-- RDLabel: "GD::Image#colorExactAlpha" -->
|
605
|
+
</dl>
|
606
|
+
<p>Searches the colors which have been defined thus far in the image
|
607
|
+
specified and returns the index of the first color entry which exactly
|
608
|
+
match those of the request, or an RGBA value in the case of a
|
609
|
+
truecolor image; in either case you can then use the returned value as
|
610
|
+
a parameter to drawing functions.The <var>alpha</var> value takes between
|
611
|
+
0(opaque) and 127(transparent).</p>
|
612
|
+
<p>See also <a href="#label:55">GD::Image#colorExact</a>.</p>
|
613
|
+
<dl>
|
614
|
+
<dt><a name="label:114" id="label:114"><code>GD::Image#colorClosestAlpha(<var>r</var>, <var>g</var>, <var>b</var>, <var>alpha</var>)</code></a><!-- RDLabel: "GD::Image#colorClosestAlpha" -->
|
615
|
+
<dt><a name="label:114" id="label:114"><code>GD::Image#colorClosestAlpha(<var>rgbstr</var>, <var>alpha</var>)</code></a><!-- RDLabel: "GD::Image#colorClosestAlpha" -->
|
616
|
+
</dl>
|
617
|
+
<p>Searches the colors which have been defined thus far in the palette
|
618
|
+
image specified and returns the index of the color with RGBA values
|
619
|
+
closest to those of the request. The <var>alpha</var> value takes between
|
620
|
+
0(opaque) and 127(transparent).</p>
|
621
|
+
<p>Closeness is determined by Euclidian distance, which is used to
|
622
|
+
determine the distance in four-dimensional color/alpha space between
|
623
|
+
colors.</p>
|
624
|
+
<p>When applied to a truecolor image, this method always succeeds in
|
625
|
+
returning the desired color.</p>
|
626
|
+
<p>See also <a href="#label:52">GD::Image#colorClosest</a>.</p>
|
627
|
+
<dl>
|
628
|
+
<dt><a name="label:116" id="label:116"><code>GD::Image#colorResolveAlpha(<var>r</var>, <var>g</var>, <var>b</var>, <var>alpha</var>)</code></a><!-- RDLabel: "GD::Image#colorResolveAlpha" -->
|
629
|
+
<dt><a name="label:116" id="label:116"><code>GD::Image#colorResolveAlpha(<var>rgbstr</var>, <var>alpha</var>)</code></a><!-- RDLabel: "GD::Image#colorResolveAlpha" -->
|
630
|
+
</dl>
|
631
|
+
<p>Searches the colors which have been defined thus far in the palette
|
632
|
+
image specified and returns the index of the first color with RGBA
|
633
|
+
values which exactly match those of the request. The <var>alpha</var> value
|
634
|
+
takes between 0(opaque) and 127(transparent).</p>
|
635
|
+
<p>If no allocated color matches the request precisely, then it tries to
|
636
|
+
allocate the exact color. If there is no space left in the color table
|
637
|
+
then it returns the closest color (as in
|
638
|
+
<!-- Reference, RDLabel "GD::Image#closestAlpha" doesn't exist --><em class="label-not-found">GD::Image#closestAlpha</em><!-- Reference end -->). </p>
|
639
|
+
<p>This method always returns an index of a color. When applied to a
|
640
|
+
truecolor image, this function always succeeds in returning the
|
641
|
+
desired color.</p>
|
642
|
+
<p>See also <a href="#label:57">GD::Image#colorResolve</a>.</p>
|
643
|
+
<dl>
|
644
|
+
<dt><a name="label:118" id="label:118"><code>GD::Image#alphaBlending=(<var>bool</var>)</code></a><!-- RDLabel: "GD::Image#alphaBlending=" -->
|
645
|
+
</dl>
|
646
|
+
<p>Specifies the different modes for drawing on <em>truecolor</em> images.
|
647
|
+
When <var>bool</var> sets <!-- Index, but conflict -->true<!-- Index end -->("blending mode"), how much of the
|
648
|
+
underlying color should be allowed to shine through is determined by
|
649
|
+
the alpha channel value of the color.</p>
|
650
|
+
<p>This blending mode is effective for the following drawing operations,
|
651
|
+
and in this mode, the existing color at the drawing point is blended
|
652
|
+
with drawing color with its alpha value.</p>
|
653
|
+
<p>When <var>bool</var> sets <!-- Index, but conflict -->false<!-- Index end -->("non-blending mode"), the existing
|
654
|
+
color at the drawing point is replaced by the drawing color with its
|
655
|
+
own alpha value.</p>
|
656
|
+
<p>Note that this blending mode is not available when drawing on
|
657
|
+
<em>palette</em> images.</p>
|
658
|
+
<dl>
|
659
|
+
<dt><a name="label:119" id="label:119"><code>GD::Image#alpha(<var>color</var>)</code></a><!-- RDLabel: "GD::Image#alpha" -->
|
660
|
+
</dl>
|
661
|
+
<p>Returns the alpha channel component (between 0 and 127) of the
|
662
|
+
specified color index.</p>
|
663
|
+
<h5><a name="label:120" id="label:120">Image manipulation</a></h5><!-- RDLabel: "Image manipulation" -->
|
664
|
+
<dl>
|
665
|
+
<dt><a name="label:121" id="label:121"><code>GD::Image#copyResampled(<var>dest_img</var>, <var>dest_X</var>, <var>dest_Y</var>, <var>self_X</var>, <var>self_Y</var>, <var>dest_width</var>, <var>dest_height</var>, <var>self_width</var>, <var>self_height</var>)</code></a><!-- RDLabel: "GD::Image#copyResampled" -->
|
666
|
+
</dl>
|
667
|
+
<p>Copies a rectangular portion of one image to another image, smoothly
|
668
|
+
interpolating pixel values so that, in particular, reducing the size
|
669
|
+
of an image still retains a great deal of clarity.</p>
|
670
|
+
<p>Pixel values are interpolated only if the destination image is a
|
671
|
+
truecolor image. Otherwise, for a palette image, the same
|
672
|
+
functionality as <a href="#label:78">GD::Image#copyResized</a> will be invoked.</p>
|
673
|
+
<p>See also <a href="#label:78">GD::Image#copyResized</a>, for a version which does not
|
674
|
+
interpolate pixel values.</p>
|
675
|
+
<dl>
|
676
|
+
<dt><a name="label:122" id="label:122"><code>GD::Image#filledEllipse(<var>cx</var>, <var>cy</var>, <var>width</var>, <var>height</var>, <var>start</var>, <var>end</var>, <var>color</var>)</code></a><!-- RDLabel: "GD::Image#filledEllipse" -->
|
677
|
+
</dl>
|
678
|
+
<p>draws an ellipse centered at the given point (<var>cx</var>, <var>cy</var>),
|
679
|
+
with the specified <var>width</var> and <var>height</var> in pixels.</p>
|
680
|
+
<p>The ellipse is filled in the <var>color</var> and is drawn by beginning
|
681
|
+
from <var>start</var> degrees and ending at <var>end</var> degrees. <var>end</var>
|
682
|
+
must be greater than <var>start</var>. Values greater than 360 are
|
683
|
+
interpreted modulo 360.</p>
|
684
|
+
<dl>
|
685
|
+
<dt><a name="label:123" id="label:123"><code>GD::Image#filledArc(<var>cx</var>, <var>cy</var>, <var>width</var>, <var>height</var>, <var>start</var>, <var>end</var>, <var>color</var>, <var>style</var>)</code></a><!-- RDLabel: "GD::Image#filledArc" -->
|
686
|
+
</dl>
|
687
|
+
<p>draws an partial ellipse(arc) centered at the given point (<var>cx</var>,
|
688
|
+
<var>cy</var>), with the specified <var>width</var> and <var>height</var> in pixels,
|
689
|
+
and filled in the <var>color</var>. The arc begins at <var>start</var> degrees
|
690
|
+
and ends at <var>end</var> degrees.</p>
|
691
|
+
<p>The last argument is bitwise <code>OR</code> of the following possibilities.</p>
|
692
|
+
<ul>
|
693
|
+
<li><code>GD::Arc</code></li>
|
694
|
+
</ul>
|
695
|
+
<p>draws the rounded edge between <var>start</var> and <var>end</var>.</p>
|
696
|
+
<ul>
|
697
|
+
<li><code>GD::Chord</code></li>
|
698
|
+
</ul>
|
699
|
+
<p>draws the line connecting <var>start</var> and <var>end</var>.</p>
|
700
|
+
<ul>
|
701
|
+
<li><code>GD::Pie</code> </li>
|
702
|
+
</ul>
|
703
|
+
<p>synonym for <code>GD::Arc</code></p>
|
704
|
+
<ul>
|
705
|
+
<li><code>GD::NoFill</code></li>
|
706
|
+
</ul>
|
707
|
+
<p>indicates Pie and Chord should be outlined, not filled.</p>
|
708
|
+
<ul>
|
709
|
+
<li><code>GD::Edged</code></li>
|
710
|
+
</ul>
|
711
|
+
<p>used together with <code>GD::NoFill</code>, indicates that the beginning and
|
712
|
+
ending angles should be connected to the center; this is a good way to
|
713
|
+
outline (rather than fill) a 'pie slice'.</p>
|
714
|
+
<dl>
|
715
|
+
<dt><a name="label:124" id="label:124"><code>GD::Image#to_paletteImage(<var>dither_flag</var>, <var>colors</var>)</code></a><!-- RDLabel: "GD::Image#to_paletteImage" -->
|
716
|
+
</dl>
|
717
|
+
<p>transforms the truecolor image to palette image. If <var>dither_flag</var>
|
718
|
+
is <!-- Index, but conflict -->true<!-- Index end -->, the image will be dithered to approximate colors
|
719
|
+
better, at the expense of some obvious "speckling." <var>colors</var> may
|
720
|
+
be anything up to 256, but if the image includes the photographic
|
721
|
+
information, or is a JPEG image, 256 is strongly recommended.</p>
|
722
|
+
<h5><a name="label:125" id="label:125">Query methods</a></h5><!-- RDLabel: "Query methods" -->
|
723
|
+
<dl>
|
724
|
+
<dt><a name="label:126" id="label:126"><code>GD::Image#is_trueColor?</code></a><!-- RDLabel: "GD::Image#is_trueColor?" -->
|
725
|
+
</dl>
|
726
|
+
<p>returns <!-- Index, but conflict -->true<!-- Index end --> if the image is a truecolor image.</p>
|
727
|
+
<dl>
|
728
|
+
<dt><a name="label:127" id="label:127"><code>GD::Image#is_palette?</code></a><!-- RDLabel: "GD::Image#is_palette?" -->
|
729
|
+
</dl>
|
730
|
+
<p>returns <!-- Index, but conflict -->true<!-- Index end --> if the image is a palette image.</p>
|
731
|
+
<dl>
|
732
|
+
<dt><a name="label:128" id="label:128"><code>GD::Image#thickness=(<var>val</var>)</code></a><!-- RDLabel: "GD::Image#thickness=" -->
|
733
|
+
</dl>
|
734
|
+
<p>specifies the line thickness (defaults to 1) that affects methods
|
735
|
+
drawing lines or curves. </p>
|
736
|
+
<h1><a name="label:129" id="label:129">Class GD::Polygon</a></h1><!-- RDLabel: "Class GD::Polygon" -->
|
737
|
+
<h2><a name="label:20" id="label:20">Class Methods</a></h2><!-- RDLabel: "Class Methods" -->
|
738
|
+
<dl>
|
739
|
+
<dt><a name="label:131" id="label:131"><code>GD::Polygon.new</code></a><!-- RDLabel: "GD::Polygon.new" -->
|
740
|
+
</dl>
|
741
|
+
<p>Creates a new polygon instance. After some operations provided below,
|
742
|
+
the polygon is drawn on the image by <a href="#label:68">GD::Image#polygon</a> method.</p>
|
743
|
+
<h2><a name="label:46" id="label:46">Methods</a></h2><!-- RDLabel: "Methods" -->
|
744
|
+
<h5><a name="label:133" id="label:133">Operation</a></h5><!-- RDLabel: "Operation" -->
|
745
|
+
<dl>
|
746
|
+
<dt><a name="label:134" id="label:134"><code>GD::Polygon#addPt(<var>x</var>, <var>y</var>)</code></a><!-- RDLabel: "GD::Polygon#addPt" -->
|
747
|
+
</dl>
|
748
|
+
<p>Adds a new point(vertex) from which the polygon is formed.</p>
|
749
|
+
<dl>
|
750
|
+
<dt><a name="label:135" id="label:135"><code>GD::Polygon#deletePt(<var>idx</var>)</code></a><!-- RDLabel: "GD::Polygon#deletePt" -->
|
751
|
+
</dl>
|
752
|
+
<p>Deletes the the specified <var>idx</var>-th elements of the vertices.</p>
|
753
|
+
<dl>
|
754
|
+
<dt><a name="label:136" id="label:136"><code>GD::Polygon#getPt(<var>idx</var>)</code></a><!-- RDLabel: "GD::Polygon#getPt" -->
|
755
|
+
</dl>
|
756
|
+
<p>Returns the value of the specified <var>idx</var>-th elements of the
|
757
|
+
vertices.</p>
|
758
|
+
<dl>
|
759
|
+
<dt><a name="label:137" id="label:137"><code>GD::Polygon#map(<var>dest_L</var>, <var>dest_T</var>, <var>dest_R</var>, <var>dest_B</var>)</code></a><!-- RDLabel: "GD::Polygon#map" -->
|
760
|
+
<dt><a name="label:137" id="label:137"><code>GD::Polygon#map([<var>src_L</var>, <var>src_T</var>, <var>src_R</var>, <var>src_B</var>,] <var>dest_L</var>, <var>dest_T</var>, <var>dest_R</var>, <var>dest_B</var>)</code></a><!-- RDLabel: "GD::Polygon#map" -->
|
761
|
+
</dl>
|
762
|
+
<p>Maps the polygon from a source rectangle to an equivalent position in
|
763
|
+
a destination rectangle, moving it and resizing it as necessary. Both
|
764
|
+
the source and destination rectangles are given in
|
765
|
+
(left,top,right,bottom) coordinates. See figure below.</p>
|
766
|
+
<p>This method takes 4 or 8 arguments. Note that if 4 arguments are
|
767
|
+
given, source rectangle are automatically computed as the bounding box
|
768
|
+
of the poligon, and maps it to the destination rectangle specified in
|
769
|
+
the arguments.</p>
|
770
|
+
<pre><source rectangle> <destination rectangle></pre>
|
771
|
+
<pre>(src_L, src_T) (dest_L, dest_T)
|
772
|
+
+--------------+ +----------+
|
773
|
+
| | | |
|
774
|
+
| | => | |
|
775
|
+
| | | |
|
776
|
+
+--------------+ | |
|
777
|
+
(src_R, src_B) +----------+
|
778
|
+
(dest_R, dest_B)</pre>
|
779
|
+
<dl>
|
780
|
+
<dt><a name="label:139" id="label:139"><code>GD::Polygon#offset(<var>dx</var>, <var>dy</var>)</code></a><!-- RDLabel: "GD::Polygon#offset" -->
|
781
|
+
</dl>
|
782
|
+
<p>Offsets all the vertices of the polygon by <var>dx</var> pixels
|
783
|
+
horizontally and <var>dy</var> pixels vertically.</p>
|
784
|
+
<dl>
|
785
|
+
<dt><a name="label:140" id="label:140"><code>GD::Polygon#setPt(<var>idx</var>, <var>new_x</var>, <var>new_y</var>)</code></a><!-- RDLabel: "GD::Polygon#setPt" -->
|
786
|
+
</dl>
|
787
|
+
<p>Changes the value of the specified <var>idx</var>-th elements of the
|
788
|
+
vertices to (<var>new_x</var>, <var>new_y</var>).</p>
|
789
|
+
<dl>
|
790
|
+
<dt><a name="label:141" id="label:141"><code>GD::Polygon#toPt(<var>dx</var>, <var>dy</var>)</code></a><!-- RDLabel: "GD::Polygon#toPt" -->
|
791
|
+
</dl>
|
792
|
+
<p>Draw from current vertex to a new vertex, using relative (<var>dx</var>,
|
793
|
+
<var>dy</var>) coordinates. If this is the first point, act like
|
794
|
+
<!-- Reference, RDLabel "GD::Image#addPt" doesn't exist --><em class="label-not-found">GD::Image#addPt</em><!-- Reference end -->.</p>
|
795
|
+
<dl>
|
796
|
+
<dt><a name="label:142" id="label:142"><code>GD::Polygon#scale(<var>sx</var>, <var>sy</var>)</code></a><!-- RDLabel: "GD::Polygon#scale" -->
|
797
|
+
</dl>
|
798
|
+
<p>Scales each vertex of the polygon by the X and Y factors indicated by
|
799
|
+
<var>sx</var> and <var>sy</var>. For best results, move the center of the
|
800
|
+
polygon to position (0,0) before you scale, then move it back to its
|
801
|
+
previous position.</p>
|
802
|
+
<dl>
|
803
|
+
<dt><a name="label:143" id="label:143"><code>GD::Polygon#transform(<var>sx</var>,<var>rx</var>,<var>sy</var>,<var>ry</var>,<var>tx</var>,<var>ty</var>)</code></a><!-- RDLabel: "GD::Polygon#transform" -->
|
804
|
+
</dl>
|
805
|
+
<p>Runs each vertex of the polygon through a transformation matrix, where
|
806
|
+
<var>sx</var> and <var>sy</var> are the X and Y scaling factors, <var>rx</var> and
|
807
|
+
<var>ry</var> are the X and Y rotation factors, and <var>tx</var> and <var>ty</var>
|
808
|
+
are X and Y offsets.</p>
|
809
|
+
<h5><a name="label:37" id="label:37">Query</a></h5><!-- RDLabel: "Query" -->
|
810
|
+
<dl>
|
811
|
+
<dt><a name="label:145" id="label:145"><code>GD::Polygon#bounds</code></a><!-- RDLabel: "GD::Polygon#bounds" -->
|
812
|
+
</dl>
|
813
|
+
<p>Returns the smallest rectangle that completely encloses the polygon.
|
814
|
+
The return value is an array containing the [left,top,right,bottom] of
|
815
|
+
the rectangle.</p>
|
816
|
+
<dl>
|
817
|
+
<dt><a name="label:146" id="label:146"><code>GD::Polygon#length</code></a><!-- RDLabel: "GD::Polygon#length" -->
|
818
|
+
</dl>
|
819
|
+
<p>Returns the number of the vertices.</p>
|
820
|
+
<dl>
|
821
|
+
<dt><a name="label:147" id="label:147"><code>GD::Polygon#vertices</code></a><!-- RDLabel: "GD::Polygon#vertices" -->
|
822
|
+
</dl>
|
823
|
+
<p>Returns all of the coodinates of the vertices as Array instance.</p>
|
824
|
+
<h1><a name="label:148" id="label:148">Class GD::Font</a></h1><!-- RDLabel: "Class GD::Font" -->
|
825
|
+
<h2><a name="label:20" id="label:20">Class Methods</a></h2><!-- RDLabel: "Class Methods" -->
|
826
|
+
<dl>
|
827
|
+
<dt><a name="label:150" id="label:150"><code>GD::Font.new(<var>name</var>)</code></a><!-- RDLabel: "GD::Font.new" -->
|
828
|
+
</dl>
|
829
|
+
<p>Creates a new font instance. The font is specified by its
|
830
|
+
<var>name</var>, which is one of "<em>Tiny</em>", "<em>Small</em>",
|
831
|
+
"<em>Medium</em>", "<em>Large</em>", "<em>Giant</em>". These strings correspond
|
832
|
+
to <a href="#label:161">GD::Font::TinyFont</a>, <a href="#label:160">GD::Font::SmallFont</a>,
|
833
|
+
<a href="#label:159">GD::Font::MediumFont</a>, <a href="#label:158">GD::Font::LargeFont</a>,
|
834
|
+
<a href="#label:157">GD::Font::GiantFont</a>, respectively.</p>
|
835
|
+
<p>The instance becomes the arguments in the charcter/string drawing
|
836
|
+
method such as <a href="#label:81">GD::Image#char</a>, <a href="#label:83">GD::Image#string</a>.</p>
|
837
|
+
<h2><a name="label:46" id="label:46">Methods</a></h2><!-- RDLabel: "Methods" -->
|
838
|
+
<dl>
|
839
|
+
<dt><a name="label:152" id="label:152"><code>GD::Font#height</code></a><!-- RDLabel: "GD::Font#height" -->
|
840
|
+
</dl>
|
841
|
+
<p>Returns the height of each character of the font.</p>
|
842
|
+
<dl>
|
843
|
+
<dt><a name="label:153" id="label:153"><code>GD::Font#nchars</code></a><!-- RDLabel: "GD::Font#nchars" -->
|
844
|
+
</dl>
|
845
|
+
<p>Returns the number of characeters in the font.</p>
|
846
|
+
<dl>
|
847
|
+
<dt><a name="label:154" id="label:154"><code>GD::Font#offset</code></a><!-- RDLabel: "GD::Font#offset" -->
|
848
|
+
</dl>
|
849
|
+
<p>Returns the offset of the first character in the font.</p>
|
850
|
+
<dl>
|
851
|
+
<dt><a name="label:155" id="label:155"><code>GD::Font#width</code></a><!-- RDLabel: "GD::Font#width" -->
|
852
|
+
</dl>
|
853
|
+
<p>Returns the width of each character of the font.</p>
|
854
|
+
<h2><a name="label:3" id="label:3">Constants</a></h2><!-- RDLabel: "Constants" -->
|
855
|
+
<p>These constants also becomes the arguments in the charcter/string
|
856
|
+
drawing method such as <a href="#label:81">GD::Image#char</a>, <a href="#label:83">GD::Image#string</a>.</p>
|
857
|
+
<dl>
|
858
|
+
<dt><a name="label:157" id="label:157"><code>GD::Font::GiantFont</code></a><!-- RDLabel: "GD::Font::GiantFont" -->
|
859
|
+
</dl>
|
860
|
+
<p>This stands for 9x15 bold font:</p>
|
861
|
+
<pre>-Misc-Fixed-Bold-R-Normal-Sans-15-140-75-75-C-90-ISO8859-2</pre>
|
862
|
+
<dl>
|
863
|
+
<dt><a name="label:158" id="label:158"><code>GD::Font::LargeFont</code></a><!-- RDLabel: "GD::Font::LargeFont" -->
|
864
|
+
</dl>
|
865
|
+
<p>This stands for the public domain 8x16 font:</p>
|
866
|
+
<pre>-misc-fixed-medium-r-normal--16-140-75-75-c-80-iso8859-2</pre>
|
867
|
+
<dl>
|
868
|
+
<dt><a name="label:159" id="label:159"><code>GD::Font::MediumFont</code></a><!-- RDLabel: "GD::Font::MediumFont" -->
|
869
|
+
</dl>
|
870
|
+
<p>This stands for the a public domain 7x13 font:</p>
|
871
|
+
<pre>-misc-fixed-bold-r-normal-sans-13-94-100-100-c-70-iso8859-2</pre>
|
872
|
+
<dl>
|
873
|
+
<dt><a name="label:160" id="label:160"><code>GD::Font::SmallFont</code></a><!-- RDLabel: "GD::Font::SmallFont" -->
|
874
|
+
</dl>
|
875
|
+
<p>This stands for a well known public domain 6x12 font:</p>
|
876
|
+
<pre>-misc-fixed-medium-r-semicondensed-sans-12-116-75-75-c-60-iso8859-2</pre>
|
877
|
+
<dl>
|
878
|
+
<dt><a name="label:161" id="label:161"><code>GD::Font::TinyFont</code></a><!-- RDLabel: "GD::Font::TinyFont" -->
|
879
|
+
</dl>
|
880
|
+
<p>This stands for almost unreadable font, 5x8 pixels wide:</p>
|
881
|
+
<pre>-Misc-Fixed-Medium-R-Normal--8-80-75-75-C-50-ISO8859-2</pre>
|
882
|
+
<h1><a name="label:162" id="label:162">Reference</a></h1><!-- RDLabel: "Reference" -->
|
883
|
+
<ul>
|
884
|
+
<li>index.html distributed with gd-1.8.4</li>
|
885
|
+
<li>index.html distributed with gd-2.0.1</li>
|
886
|
+
<li>gd.h distributed with gd-2.0.1</li>
|
887
|
+
<li>documents embedded in GD.pm version 1.30</li>
|
888
|
+
</ul>
|
889
|
+
|
890
|
+
</body>
|
891
|
+
</html>
|