about summary refs log tree commit diff
path: root/libnetpbm_draw.html
blob: cb7f16cc7662f1e4879ed47c68059d14df1a364f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE>Libnetpbm PPM Drawing Function Manual</TITLE>
<META NAME="manual_section" CONTENT="3">
</HEAD>
<BODY>
<H1>Libnetpbm PPM Drawing Function Manual</H1>
Updated: September 2005
<br>
<p><A HREF="#toc">Table Of Contents</A>
<?makeman .SH NAME ?>
<?makeman libnetpbm_draw \- Libnetpbm PPM Drawing Function Manual ?>
<?makeman .SH DESCRIPTION ?>

<p>This reference manual covers functions in the <b>libnetpbm</b>
library for drawing images, using the PPM image format and the
<b>libnetpbm</b> in-memory image formats.

<p>We actually have very little information here; this is mainly a
framework for adding documentation later if someone becomes interested
in this facility.


<h2 id="functions">The Functions</h2>

<p>The functions are all declared in the <b>ppmdraw.h</b> header file.

<h3><b>ppmd_point_drawproc</b></h3>

<h3><b>ppmd_setlinetype</b></h3>

<h3><b>ppmd_setlineclip</b></h3>

<h3><b>ppmd_line</b></h3>

<h3><b>ppmd_spline3</b></h3>

<h3><b>ppmd_polyspline</b></h3>

<h3><b>ppmd_circle</b></h3>

<h3><b>ppmd_filledrectangle</b></h3>

<h3><b>ppmd_fill_drawproc</b></h3>

<h3><b>ppmd_fill</b></h3>

<h3><b>ppmd_text</b></h3>

<h3><b>ppmd_text_box</b></h3>


<h2 id="fonts">Fonts</h2>

<p>
The <b>ppmd_text</b> and <b>ppmd_text_box</b> functions use fonts.
You control the fonts using functions described in this section.
There is one font that comes with Netpbm, called &quot;standard&quot;.
It is built into the function library and is the default font.  You
can create additional fonts and use them instead.

<p>In a program that uses Netpbm drawing facilities, there is a
&quot;current font.&quot; all drawing of text uses the current font.
When the program starts, the current font is &quot;standard&quot;; you
can change it after that by calling the <b>ppmd_set_font</b> function.

<p>Other than a built-in font, a font lives in file in a format
special to Netpbm called Ppmdfont.  The file typically has a name that
ends in &quot;.ppmdfont&quot;.

<p>Use the <b>ppmddumpfont</b> program to dump the contents of a
Ppmdfont file in human readable format.

<p>Use the <b>ppmdmkfont</b> program to generate the &quot;standard&quot;
font as a Ppmdfont file.  You don't normally need to do this, because
&quot;standard&quot; is built into <b>libnetpbm</b>.

<p>Use the <b>ppmdcfont</b> program to turn a Ppmdfont file into a C
source file that you can compile into a program as a built-in font.
Though we don't give full instructions here on how to do that,
<b>libnetpbm</b>'s built-in &quot;standard&quot; font is a good
example.  In Netpbm source code, you will find the C source file
<b>standardppmdfont.c</b>, which was generated from the file
<b>standard.ppmdfont</b> by <b>ppmdcfont</b>.  You simply use a
pointer to the structure that the C file defines as a font handle,
just like one you would get from <b>ppmd_read_font</b>.


<h2>Font File Format</h2>

<p>The font file starts with the characters &quot;ppmdfont&quot; (without
the quotation marks) in ASCII.

<p>The rest of the format is not yet documented, but it generally
describes, for each code point, a sequence of straight line plotting
commands to form the glyph for the indicated character.  I.e. it is a
vector, not raster, font.


<h2 id="fontcontrol">Font Control Functions</h2>

<p>These functions are declared in the header file <b>ppmdfont.h</b>.

<h3><b>ppmd_read_font</b></h3>

<p>This function associates a Ppmdfont file, which you identify by
naming the Ppmdfont file, with a handle that you can use to identify
the font to other functions.  Technically, this function reads the
font into memory.

<h3><b>ppmd_free_font</b></h3>

<p>This function releases the handle that you get from
<b>ppmd_read_font</b>.  It frees resources associated with it; you
can't use the handle after this.

<h3><b>ppmd_get_font</b></h3>

<p>This function returns the handle of the currently selected font.

<h3><b>ppmd_set_font</b></h3>

<p>This function sets the currently selected font.  You identify the
font to which to set it with a handle such as you get from
<b>ppmd_read_font</b> or <b>ppmd_get_font</b>.

<HR>
<A NAME="toc">&nbsp;</A>
<H2>Table Of Contents</H2>

<ul>
  <li><a href="#functions">The Functions</a>
  <li><a href="#fonts">Fonts</a>
  </ul>



</BODY>
</HTML>