~ubuntu-branches/ubuntu/intrepid/plplot/intrepid

« back to all changes in this revision

Viewing changes to examples/c++/x24.cc

  • Committer: Bazaar Package Importer
  • Author(s): Rafael Laboissiere
  • Date: 2006-11-04 10:19:34 UTC
  • mfrom: (2.1.8 edgy)
  • Revision ID: james.westby@ubuntu.com-20061104101934-mlirvdg4gpwi6i5q
Tags: 5.6.1-10
* Orphaning the package
* debian/control: Changed the maintainer to the Debian QA Group

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//
 
2
//  Unicode Pace Flag
 
3
//
 
4
//  Copyright (C) 2005 Rafael Laboissiere
 
5
//
 
6
//
 
7
//  This file is part of PLplot.
 
8
//
 
9
//  PLplot is free software; you can redistribute it and/or modify
 
10
//  it under the terms of the GNU General Library Public License as published
 
11
//  by the Free Software Foundation; either version 2 of the License, or
 
12
//  (at your option) any later version.
 
13
//
 
14
//  PLplot is distributed in the hope that it will be useful,
 
15
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
16
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
17
//  GNU Library General Public License for more details.
 
18
//
 
19
//  You should have received a copy of the GNU Library General Public License
 
20
//  along with PLplot; if not, write to the Free Software
 
21
//  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
22
//
 
23
//
 
24
// In Debian, run like this:
 
25
//
 
26
// PLPLOT_FREETYPE_SANS_FONT=/usr/share/fonts/truetype/arphic/bkai00mp.ttf \
 
27
// PLPLOT_FREETYPE_SERIF_FONT=/usr/share/fonts/truetype/freefont/FreeSerif.ttf \
 
28
// PLPLOT_FREETYPE_MONO_FONT=/usr/share/fonts/truetype/ttf-devanagari-fonts/lohit_hi.ttf \
 
29
// PLPLOT_FREETYPE_SCRIPT_FONT=/usr/share/fonts/truetype/unfonts/UnBatang.ttf \
 
30
// PLPLOT_FREETYPE_SYMBOL_FONT=/usr/share/fonts/truetype/ttf-bangla-fonts/JamrulNormal.ttf \
 
31
// ./x24 -dev png -drvopt smooth=0 -o x24cxx.png
 
32
//
 
33
// Packages needed:
 
34
//
 
35
// ttf-arphic-bkai00mp
 
36
// ttf-freefont
 
37
// ttf-indic-fonts
 
38
// ttf-unfonts
 
39
// ttf-bangla-fonts
 
40
//
 
41
//
 
42
 
 
43
 
 
44
#include "plc++demos.h"
 
45
 
 
46
class x24 {
 
47
 
 
48
public:
 
49
  x24(int, char **);
 
50
 
 
51
private:
 
52
  plstream *pls;
 
53
 
 
54
  static PLINT red[], green[], blue[];
 
55
 
 
56
  static PLFLT px[], py[], sx[], sy[];
 
57
 
 
58
  static char *peace[];
 
59
};
 
60
 
 
61
PLINT x24::red[]   = {240, 204, 204, 204,   0,  39, 125};
 
62
PLINT x24::green[] = {240,   0, 125, 204, 204,  80,   0};
 
63
PLINT x24::blue[]  = {240,   0,   0,   0,   0, 204, 125};
 
64
 
 
65
PLFLT x24::px[] = {0.0, 0.0, 1.0, 1.0};
 
66
PLFLT x24::py[] = {0.0, 0.16667, 0.16667, 0.0};
 
67
 
 
68
PLFLT x24::sx[] = {
 
69
  0.16374,
 
70
  0.15844,
 
71
  0.15255,
 
72
  0.17332,
 
73
  0.50436,
 
74
  0.51721,
 
75
  0.49520,
 
76
  0.48713,
 
77
  0.83976,
 
78
  0.81688,
 
79
  0.82231,
 
80
  0.82647
 
81
};
 
82
 
 
83
PLFLT x24::sy[] = {
 
84
  0.11341,
 
85
  0.35481,
 
86
  0.61621,
 
87
  0.86525,
 
88
  0.13249,
 
89
  0.37995,
 
90
  0.61584,
 
91
  0.86303,
 
92
  0.13901,
 
93
  0.30533,
 
94
  0.63165,
 
95
  0.87598
 
96
};
 
97
 
 
98
 
 
99
/* Taken from http://www.columbia.edu/~fdc/pace/ */
 
100
 
 
101
char* x24::peace[] = {
 
102
  /* Mandarin */
 
103
  "#<0x00>和平",
 
104
  /* Hindi */
 
105
  "#<0x20>शांति",
 
106
  /* English */
 
107
  "#<0x10>Peace",
 
108
  /* Hebrew */
 
109
  "#<0x10>שלום",
 
110
  /* Russian */
 
111
  "#<0x10>Мир",
 
112
  /* German */
 
113
  "#<0x10>Friede",
 
114
  /* Korean */
 
115
  "#<0x30>평화",
 
116
  /* French */
 
117
  "#<0x10>Paix",
 
118
  /* Spanish */
 
119
  "#<0x10>Paz",
 
120
  /* Arabic */
 
121
  "#<0x10>ﺳﻼم",
 
122
  /* Turkish*/
 
123
  "#<0x10>Barış",
 
124
  /* Kurdish */
 
125
  "#<0x10>Hasîtî",
 
126
};
 
127
 
 
128
x24::x24(int argc, char *argv[])
 
129
{
 
130
  int i, j;
 
131
 
 
132
  pls = new plstream();
 
133
 
 
134
  pls->parseopts (&argc, argv, PL_PARSE_FULL);
 
135
 
 
136
  pls->init ();
 
137
 
 
138
  pls->adv (0);
 
139
  pls->vpor (0.0, 1.0, 0.0, 1.0);
 
140
  pls->wind (0.0, 1.0, 0.0, 1.0);
 
141
  pls->col0 (0);
 
142
  pls->box("", 1.0, 0, "", 1.0, 0);
 
143
 
 
144
  pls->scmap0n (7);
 
145
  pls->scmap0 (red, green, blue, 7);
 
146
 
 
147
  pls->schr (0, 4.0);
 
148
  pls->font (1);
 
149
 
 
150
  for (i = 0; i < 6; i++) {
 
151
 
 
152
    pls->col0 (i + 1);
 
153
    pls->fill (4, px, py);
 
154
 
 
155
    for (j = 0; j < 4; j++)
 
156
      py [j] += 1.0 / 6.0;
 
157
 
 
158
  }
 
159
 
 
160
  pls->col0 (0);
 
161
  for (i = 0; i < 12; i++)
 
162
    pls->ptex (sx [i], sy [i], 1.0, 0.0, 0.5, peace [i]);
 
163
 
 
164
  delete pls;
 
165
 
 
166
}
 
167
 
 
168
int main( int argc, char **argv )
 
169
{
 
170
  x24 *x = new x24( argc, argv );
 
171
 
 
172
  delete x;
 
173
}