15 #define EPSILON 0.00000001
17 static void font5_generate(
char input,
int output[5][5]) {
18 int output0[5][5] = {{0, 1, 1, 1, 0},
23 output1[5][5] = {{0, 0, 1, 0, 0},
28 output2[5][5] = {{0, 1, 1, 1, 0},
33 output3[5][5] = {{0, 1, 1, 1, 0},
38 output4[5][5] = {{0, 1, 0, 1, 0},
43 output5[5][5] = {{0, 1, 1, 1, 0},
48 output6[5][5] = {{0, 1, 1, 1, 0},
53 output7[5][5] = {{0, 1, 1, 1, 0},
58 output8[5][5] = {{0, 1, 1, 1, 0},
63 output9[5][5] = {{0, 1, 1, 1, 0},
68 outpute[5][5] = {{0, 1, 1, 1, 0},
73 outputd[5][5] = {{0, 0, 0, 0, 0},
78 outputa[5][5] = {{0, 0, 0, 0, 0},
83 outputs[5][5] = {{0, 0, 0, 0, 0},
88 outputt[5][5] = {{1, 1, 1, 1, 1},
93 outputq[5][5] = {{0, 0, 0, 0, 0},
98 outputf[5][5] = {{0, 1, 1, 1, 0},
107 for (i = 0; i < 5; i++)
108 for (j = 0; j < 5; j++) output[i][j] = output0[i][j];
111 for (i = 0; i < 5; i++)
112 for (j = 0; j < 5; j++) output[i][j] = output1[i][j];
115 for (i = 0; i < 5; i++)
116 for (j = 0; j < 5; j++) output[i][j] = output2[i][j];
119 for (i = 0; i < 5; i++)
120 for (j = 0; j < 5; j++) output[i][j] = output3[i][j];
123 for (i = 0; i < 5; i++)
124 for (j = 0; j < 5; j++) output[i][j] = output4[i][j];
127 for (i = 0; i < 5; i++)
128 for (j = 0; j < 5; j++) output[i][j] = output5[i][j];
131 for (i = 0; i < 5; i++)
132 for (j = 0; j < 5; j++) output[i][j] = output6[i][j];
135 for (i = 0; i < 5; i++)
136 for (j = 0; j < 5; j++) output[i][j] = output7[i][j];
139 for (i = 0; i < 5; i++)
140 for (j = 0; j < 5; j++) output[i][j] = output8[i][j];
143 for (i = 0; i < 5; i++)
144 for (j = 0; j < 5; j++) output[i][j] = output9[i][j];
147 for (i = 0; i < 5; i++)
148 for (j = 0; j < 5; j++) output[i][j] = outpute[i][j];
151 for (i = 0; i < 5; i++)
152 for (j = 0; j < 5; j++) output[i][j] = outputd[i][j];
155 for (i = 0; i < 5; i++)
156 for (j = 0; j < 5; j++) output[i][j] = outputa[i][j];
159 for (i = 0; i < 5; i++)
160 for (j = 0; j < 5; j++) output[i][j] = outputs[i][j];
163 for (i = 0; i < 5; i++)
164 for (j = 0; j < 5; j++) output[i][j] = outputt[i][j];
167 for (i = 0; i < 5; i++)
168 for (j = 0; j < 5; j++) output[i][j] = outputq[i][j];
171 for (i = 0; i < 5; i++)
172 for (j = 0; j < 5; j++) output[i][j] = outputf[i][j];
175 for (i = 0; i < 5; i++)
176 for (j = 0; j < 5; j++) output[i][j] = 0;
183 int output0[7][7] = {{0, 0, 1, 1, 1, 0, 0}, {0, 1, 0, 0, 0, 1, 0},
184 {0, 1, 0, 0, 0, 1, 0}, {0, 1, 0, 0, 0, 1, 0},
185 {0, 1, 0, 0, 0, 1, 0}, {0, 1, 0, 0, 0, 1, 0},
186 {0, 0, 1, 1, 1, 0, 0}},
187 output1[7][7] = {{0, 0, 0, 1, 0, 0, 0}, {0, 0, 0, 1, 0, 0, 0},
188 {0, 0, 0, 1, 0, 0, 0}, {0, 0, 0, 1, 0, 0, 0},
189 {0, 0, 0, 1, 0, 0, 0}, {0, 0, 0, 1, 0, 0, 0},
190 {0, 0, 0, 1, 0, 0, 0}},
191 output2[7][7] = {{0, 1, 1, 1, 1, 1, 0}, {0, 0, 0, 0, 0, 1, 0},
192 {0, 0, 0, 0, 0, 1, 0}, {0, 1, 1, 1, 1, 1, 0},
193 {0, 1, 0, 0, 0, 0, 0}, {0, 1, 0, 0, 0, 0, 0},
194 {0, 1, 1, 1, 1, 1, 0}},
195 output3[7][7] = {{0, 1, 1, 1, 1, 1, 0}, {0, 0, 0, 0, 0, 1, 0},
196 {0, 0, 0, 0, 0, 1, 0}, {0, 1, 1, 1, 1, 1, 0},
197 {0, 0, 0, 0, 0, 1, 0}, {0, 0, 0, 0, 0, 1, 0},
198 {0, 1, 1, 1, 1, 1, 0}},
199 output4[7][7] = {{0, 1, 0, 0, 0, 1, 0}, {0, 1, 0, 0, 0, 1, 0},
200 {0, 1, 0, 0, 0, 1, 0}, {0, 1, 1, 1, 1, 1, 0},
201 {0, 0, 0, 0, 0, 1, 0}, {0, 0, 0, 0, 0, 1, 0},
202 {0, 0, 0, 0, 0, 1, 0}},
203 output5[7][7] = {{0, 1, 1, 1, 1, 1, 0}, {0, 1, 0, 0, 0, 0, 0},
204 {0, 1, 0, 0, 0, 0, 0}, {0, 1, 1, 1, 1, 1, 0},
205 {0, 0, 0, 0, 0, 1, 0}, {0, 0, 0, 0, 0, 1, 0},
206 {0, 1, 1, 1, 1, 1, 0}},
207 output6[7][7] = {{0, 1, 1, 1, 1, 1, 0}, {0, 1, 0, 0, 0, 0, 0},
208 {0, 1, 0, 0, 0, 0, 0}, {0, 1, 1, 1, 1, 1, 0},
209 {0, 1, 0, 0, 0, 1, 0}, {0, 1, 0, 0, 0, 1, 0},
210 {0, 1, 1, 1, 1, 1, 0}},
211 output7[7][7] = {{0, 1, 1, 1, 1, 1, 0}, {0, 0, 0, 0, 0, 1, 0},
212 {0, 0, 0, 0, 0, 1, 0}, {0, 0, 0, 0, 0, 1, 0},
213 {0, 0, 0, 0, 0, 1, 0}, {0, 0, 0, 0, 0, 1, 0},
214 {0, 0, 0, 0, 0, 1, 0}},
215 output8[7][7] = {{0, 1, 1, 1, 1, 1, 0}, {0, 1, 0, 0, 0, 1, 0},
216 {0, 1, 0, 0, 0, 1, 0}, {0, 1, 1, 1, 1, 1, 0},
217 {0, 1, 0, 0, 0, 1, 0}, {0, 1, 0, 0, 0, 1, 0},
218 {0, 1, 1, 1, 1, 1, 0}},
219 output9[7][7] = {{0, 1, 1, 1, 1, 1, 0}, {0, 1, 0, 0, 0, 1, 0},
220 {0, 1, 0, 0, 0, 1, 0}, {0, 1, 1, 1, 1, 1, 0},
221 {0, 0, 0, 0, 0, 1, 0}, {0, 0, 0, 0, 0, 1, 0},
222 {0, 1, 1, 1, 1, 1, 0}},
223 outpute[7][7] = {{0, 1, 1, 1, 1, 1, 0}, {0, 1, 0, 0, 0, 0, 0},
224 {0, 1, 0, 0, 0, 0, 0}, {0, 1, 1, 1, 1, 1, 0},
225 {0, 1, 0, 0, 0, 0, 0}, {0, 1, 0, 0, 0, 0, 0},
226 {0, 1, 1, 1, 1, 1, 0}},
227 outputd[7][7] = {{0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0},
228 {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0},
229 {0, 0, 1, 1, 0, 0, 0}, {0, 0, 1, 1, 0, 0, 0},
230 {0, 0, 0, 0, 0, 0, 0}},
231 outputa[7][7] = {{0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 1, 0, 0, 0},
232 {0, 0, 0, 1, 0, 0, 0}, {0, 1, 1, 1, 1, 1, 0},
233 {0, 0, 0, 1, 0, 0, 0}, {0, 0, 0, 1, 0, 0, 0},
234 {0, 0, 0, 0, 0, 0, 0}},
235 outputs[7][7] = {{0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0},
236 {0, 0, 0, 0, 0, 0, 0}, {0, 1, 1, 1, 1, 1, 0},
237 {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0},
238 {0, 0, 0, 0, 0, 0, 0}},
239 outputt[7][7] = {{1, 1, 1, 1, 1, 1, 1}, {0, 0, 0, 1, 0, 0, 0},
240 {0, 0, 0, 1, 0, 0, 0}, {0, 0, 0, 1, 0, 0, 0},
241 {0, 0, 0, 1, 0, 0, 0}, {0, 0, 0, 1, 0, 0, 0},
242 {0, 0, 0, 1, 0, 0, 0}},
243 outputq[7][7] = {{0, 0, 0, 0, 0, 0, 0}, {0, 1, 1, 1, 1, 1, 0},
244 {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0},
245 {0, 0, 0, 0, 0, 0, 0}, {0, 1, 1, 1, 1, 1, 0},
246 {0, 0, 0, 0, 0, 0, 0}},
247 outputf[7][7] = {{0, 0, 1, 1, 1, 0, 0}, {0, 1, 0, 0, 0, 1, 0},
248 {0, 0, 1, 0, 0, 0, 0}, {0, 0, 0, 1, 0, 0, 0},
249 {0, 0, 0, 0, 1, 0, 0}, {0, 1, 0, 0, 0, 1, 0},
250 {0, 0, 1, 1, 1, 0, 0}};
255 for (i = 0; i < 7; i++)
256 for (j = 0; j < 7; j++) output[i][j] = output0[i][j];
259 for (i = 0; i < 7; i++)
260 for (j = 0; j < 7; j++) output[i][j] = output1[i][j];
263 for (i = 0; i < 7; i++)
264 for (j = 0; j < 7; j++) output[i][j] = output2[i][j];
267 for (i = 0; i < 7; i++)
268 for (j = 0; j < 7; j++) output[i][j] = output3[i][j];
271 for (i = 0; i < 7; i++)
272 for (j = 0; j < 7; j++) output[i][j] = output4[i][j];
275 for (i = 0; i < 7; i++)
276 for (j = 0; j < 7; j++) output[i][j] = output5[i][j];
279 for (i = 0; i < 7; i++)
280 for (j = 0; j < 7; j++) output[i][j] = output6[i][j];
283 for (i = 0; i < 7; i++)
284 for (j = 0; j < 7; j++) output[i][j] = output7[i][j];
287 for (i = 0; i < 7; i++)
288 for (j = 0; j < 7; j++) output[i][j] = output8[i][j];
291 for (i = 0; i < 7; i++)
292 for (j = 0; j < 7; j++) output[i][j] = output9[i][j];
295 for (i = 0; i < 7; i++)
296 for (j = 0; j < 7; j++) output[i][j] = outpute[i][j];
299 for (i = 0; i < 7; i++)
300 for (j = 0; j < 7; j++) output[i][j] = outputd[i][j];
303 for (i = 0; i < 7; i++)
304 for (j = 0; j < 7; j++) output[i][j] = outputa[i][j];
307 for (i = 0; i < 7; i++)
308 for (j = 0; j < 7; j++) output[i][j] = outputs[i][j];
311 for (i = 0; i < 7; i++)
312 for (j = 0; j < 7; j++) output[i][j] = outputt[i][j];
315 for (i = 0; i < 7; i++)
316 for (j = 0; j < 7; j++) output[i][j] = outputq[i][j];
319 for (i = 0; i < 7; i++)
320 for (j = 0; j < 7; j++) output[i][j] = outputf[i][j];
323 for (i = 0; i < 7; i++)
324 for (j = 0; j < 7; j++) output[i][j] = 0;
331 double background_color[3],
double start_time,
332 double time_interval,
int timestep,
int max_len_step,
335 int start_ys, start_xs, scale, len_step;
337 char buf[128], buf1[128], buf2[128], buf3[128];
338 int output7[7][7], tmp1, tmp2;
341 scale = (int)font_size;
344 vv = start_time + (double)timestep * time_interval;
346 tmp2 = (int)((vv - (
double)tmp1) * 100.0);
347 sprintf(buf1,
"%d", tmp1);
348 len_step = strlen(buf1);
350 if (len_step < max_len_step) {
351 for (i = 0; i < max_len_step - len_step; i++) buf2[i] =
' ';
353 for (i = max_len_step - len_step; i < max_len_step; i++)
354 buf2[i] = buf1[i - (max_len_step - len_step)];
356 buf2[max_len_step] =
'\0';
358 sprintf(buf2,
"%s", buf1);
361 sprintf(buf3,
"%d", tmp2);
363 if (strlen(buf3) < 2) {
369 sprintf(buf,
"%s%s.%s%s",
"T=", buf2, buf3,
"s");
371 for (m = 0; m < max_len_step + 6; m++) {
373 for (j = 0; j < 7 * scale; j++)
374 for (i = 0; i < 7 * scale; i++) {
375 if (output7[6 - (
int)(j / scale)][(
int)(i / scale)] == 1) {
376 image[((start_ys + j) * xr + start_xs - i) * 3] = font_color[0];
377 image[((start_ys + j) * xr + start_xs - i) * 3 + 1] = font_color[1];
378 image[((start_ys + j) * xr + start_xs - i) * 3 + 2] = font_color[2];
380 image[((start_ys + j) * xr + start_xs - i) * 3] = background_color[0];
381 image[((start_ys + j) * xr + start_xs - i) * 3 + 1] =
383 image[((start_ys + j) * xr + start_xs - i) * 3 + 2] =
387 start_xs += 7 * scale;
395 if (color_system_type == 1) {
396 if (value < 0.0) value = 0.0;
397 if (value > 1.0) value = 1.0;
403 }
else if ((value > 0.25) && (value <= 0.5)) {
406 b = (0.5 - value) * 4.0;
407 }
else if ((value > 0.5) && (value <= 0.75)) {
408 r = (value - 0.5) * 4.0;
411 }
else if (value > 0.75) {
413 g = (1.0 - value) * 4.0;
417 }
else if (color_system_type == 2) {
418 if (value < 0.0) value = 0.0;
419 if (value > 1.0) value = 1.0;
422 r = (0.2 - value) * 5.0;
425 }
else if ((value > 0.2) && (value <= 0.4)) {
427 g = (value - 0.2) * 5.0;
429 }
else if ((value > 0.4) && (value <= 0.6)) {
432 b = 1.0 - (value - 0.4) * 5.0;
433 }
else if ((value > 0.6) && (value <= 0.8)) {
434 r = (value - 0.6) * 5.0;
437 }
else if (value > 0.0) {
439 g = 1.0 - (value - 0.8) * 5.0;
442 }
else if (color_system_type == 3) {
453 static double rgb_to_value(
double value_rgb,
double mincolor,
double maxcolor,
454 int color_mapping_style,
double *interval_point,
455 int interval_mapping_num) {
459 if (color_mapping_style == 1) {
460 if (fabs(maxcolor - mincolor) >
EPSILON)
461 value = value_rgb * (maxcolor - mincolor) + mincolor;
462 }
else if (color_mapping_style == 2) {
463 mincolor = interval_point[0];
464 maxcolor = interval_point[1];
466 if (fabs(maxcolor - mincolor) >
EPSILON)
467 value = value_rgb * (maxcolor - mincolor) + mincolor;
468 }
else if ((color_mapping_style == 3) || (color_mapping_style == 4)) {
469 if (value_rgb <= interval_point[1]) {
471 }
else if (value_rgb >= interval_point[interval_mapping_num * 2 + 1]) {
474 for (i = 1; i < interval_mapping_num + 1; i++) {
475 if ((value_rgb <= interval_point[i * 2 + 1]) &&
476 (value_rgb > interval_point[(i - 1) * 2 + 1])) {
477 value = (value_rgb - interval_point[(i - 1) * 2 + 1]) /
478 (interval_point[i * 2 + 1] -
479 interval_point[(i - 1) * 2 + 1]) *
480 (interval_point[i * 2] - interval_point[(i - 1) * 2]) +
481 interval_point[(i - 1) * 2];
491 int color_bar_style,
int mark_0_on,
492 int color_mapping_bar_on,
int xr,
int yr,
493 double font_color[3],
int color_system_type,
494 int color_mapping_style,
double *interval_point,
495 int interval_mapping_num,
int num_of_scale,
496 double tmincolor,
double tmaxcolor,
double org_mincolor,
497 double org_maxcolor,
double *
image) {
499 int start_x, start_y, end_x, end_y, start_ys, start_xs, scale;
500 double value, color[3], delta_y;
503 int output5[5][5], output7[7][7], type;
505 if (scale_marking_on == 1) {
506 if ((font_size - (
int)font_size) < 0.5 -
EPSILON)
512 if (color_bar_style == 1) {
513 if (scale_marking_on == 0) {
515 }
else if (scale_marking_on == 1) {
518 if (mark_0_on == 1) start_x = 40;
520 if (font_size >= 2.0) {
521 start_x = 25 + (int)(font_size - 1) * 20;
522 if (mark_0_on == 1) start_x = 40 + (int)(font_size - 1) * 20;
524 }
else if (type == 2) {
526 if (mark_0_on == 1) start_x = 55;
528 if (font_size >= 2.0) {
529 start_x = 35 + (int)(font_size - 1) * 30;
530 if (mark_0_on == 1) start_x = 55 + (int)(font_size - 1) * 30;
534 start_y = (yr - 20) / 10 + 10;
535 end_y = (yr - 20) / 10 * 5 + start_y;
537 delta_y = 1.0 / (double)(end_y - start_y);
539 if (color_mapping_bar_on == 1) {
540 for (j = start_y; j < end_y; j++) {
541 value = delta_y * (double)(j - start_y) * (tmaxcolor - tmincolor) +
543 value_to_rgb(value, color, tmincolor, tmaxcolor, color_mapping_style,
544 interval_point, interval_mapping_num, color_system_type);
546 for (i = start_x; i < end_x; i++)
547 for (k = 0; k < 3; k++)
image[(j * xr + i) * 3 + k] = color[k];
551 if (scale_marking_on == 1) {
553 scale = (int)font_size;
554 for (k = 0; k < 2; k++) {
558 start_ys = start_y - 4 - (int)font_size * 5;
560 start_ys = start_y - 4 - (int)font_size * 7;
563 start_ys = end_y + 4;
567 sprintf(buf,
"%10.2E", vv);
569 for (m = 0; m < 10; m++) {
571 font5_generate(buf[9 - m], output5);
572 for (j = 0; j < 5 * scale; j++)
573 for (i = 0; i < 5 * scale; i++) {
574 image[((start_ys + j) * xr + start_xs - i) * 3] =
575 (double)output5[4 - (
int)(j / scale)][(
int)(i / scale)] *
577 image[((start_ys + j) * xr + start_xs - i) * 3 + 1] =
578 (double)output5[4 - (
int)(j / scale)][(
int)(i / scale)] *
580 image[((start_ys + j) * xr + start_xs - i) * 3 + 2] =
581 (double)output5[4 - (
int)(j / scale)][(
int)(i / scale)] *
584 start_xs += 5 * scale;
585 }
else if (type == 2) {
587 for (j = 0; j < 7 * scale; j++)
588 for (i = 0; i < 7 * scale; i++) {
589 image[((start_ys + j) * xr + start_xs - i) * 3] =
590 (double)output7[6 - (
int)(j / scale)][(
int)(i / scale)] *
592 image[((start_ys + j) * xr + start_xs - i) * 3 + 1] =
593 (double)output7[6 - (
int)(j / scale)][(
int)(i / scale)] *
595 image[((start_ys + j) * xr + start_xs - i) * 3 + 2] =
596 (double)output7[6 - (
int)(j / scale)][(
int)(i / scale)] *
599 start_xs += 7 * scale;
604 if (mark_0_on == 1) {
605 if ((tmincolor < 0) && (tmaxcolor > 0)) {
606 start_ys = (int)((0 - tmincolor) / (tmaxcolor - tmincolor) *
614 for (m = 0; m < 3; m++) {
616 font5_generate(buf[2 - m], output5);
617 for (j = 0; j < 5 * scale; j++)
618 for (i = 0; i < 5 * scale; i++) {
619 image[((start_ys + j) * xr + start_xs - i) * 3] =
620 (double)output5[4 - (
int)(j / scale)][(
int)(i / scale)] *
622 image[((start_ys + j) * xr + start_xs - i) * 3 + 1] =
623 (double)output5[4 - (
int)(j / scale)][(
int)(i / scale)] *
625 image[((start_ys + j) * xr + start_xs - i) * 3 + 2] =
626 (double)output5[4 - (
int)(j / scale)][(
int)(i / scale)] *
629 start_xs += 5 * scale;
630 }
else if (type == 2) {
632 for (j = 0; j < 7 * scale; j++)
633 for (i = 0; i < 7 * scale; i++) {
634 image[((start_ys + j) * xr + start_xs - i) * 3] =
635 (double)output7[6 - (
int)(j / scale)][(
int)(i / scale)] *
637 image[((start_ys + j) * xr + start_xs - i) * 3 + 1] =
638 (double)output7[6 - (
int)(j / scale)][(
int)(i / scale)] *
640 image[((start_ys + j) * xr + start_xs - i) * 3 + 2] =
641 (double)output7[6 - (
int)(j / scale)][(
int)(i / scale)] *
644 start_xs += 7 * scale;
648 for (i = start_xs; i < start_x; i++)
649 for (j = 0; j < 3; j++)
650 image[(start_ys * xr + i) * 3 + j] = font_color[j];
654 }
else if (color_bar_style == 2) {
655 if (scale_marking_on == 0) {
657 }
else if (scale_marking_on == 1) {
658 scale = (int)font_size;
660 start_x = 45 * scale + 15;
662 start_x = 63 * scale + 15;
665 start_y = (yr - 20) / 10 + 10;
666 end_y = (yr - 20) / 10 * 5 + start_y;
668 delta_y = 1.0 / (double)(end_y - start_y);
670 if (color_mapping_bar_on == 1) {
671 for (j = start_y; j < end_y; j++) {
672 value = ((double)(j - start_y)) / (
double)(end_y - start_y);
675 for (i = start_x; i < end_x; i++)
676 for (k = 0; k < 3; k++)
image[(j * xr + i) * 3 + k] = color[k];
680 if (scale_marking_on == 1) {
682 scale = (int)font_size;
683 for (k = 0; k < num_of_scale; k++) {
684 if ((k != 0) && (k != num_of_scale - 1))
685 vv = rgb_to_value(1.0 / (num_of_scale - 1) * k, tmincolor, tmaxcolor,
686 color_mapping_style, interval_point,
687 interval_mapping_num);
690 else if (k == num_of_scale - 1)
695 (int)((
double)(end_y - start_y) / (num_of_scale - 1) * k) -
699 (int)((
double)(end_y - start_y) / (num_of_scale - 1) * k) -
703 sprintf(buf,
"%10.2E", vv);
704 for (m = 0; m < 10; m++) {
706 font5_generate(buf[9 - m], output5);
707 for (j = 0; j < 5 * scale; j++)
708 for (i = 0; i < 5 * scale; i++) {
709 image[((start_ys + j) * xr + start_xs - i) * 3] =
710 (double)output5[4 - (
int)(j / scale)][(
int)(i / scale)] *
712 image[((start_ys + j) * xr + start_xs - i) * 3 + 1] =
713 (double)output5[4 - (
int)(j / scale)][(
int)(i / scale)] *
715 image[((start_ys + j) * xr + start_xs - i) * 3 + 2] =
716 (double)output5[4 - (
int)(j / scale)][(
int)(i / scale)] *
719 start_xs += 5 * scale;
720 if ((vv >= 0) && (m == 9)) start_xs -= 5 * scale;
721 }
else if (type == 2) {
723 for (j = 0; j < 7 * scale; j++)
724 for (i = 0; i < 7 * scale; i++) {
725 image[((start_ys + j) * xr + start_xs - i) * 3] =
726 (double)output7[6 - (
int)(j / scale)][(
int)(i / scale)] *
728 image[((start_ys + j) * xr + start_xs - i) * 3 + 1] =
729 (double)output7[6 - (
int)(j / scale)][(
int)(i / scale)] *
731 image[((start_ys + j) * xr + start_xs - i) * 3 + 2] =
732 (double)output7[6 - (
int)(j / scale)][(
int)(i / scale)] *
735 start_xs += 7 * scale;
736 if ((vv >= 0) && (m == 9)) start_xs -= 7 * scale;
740 if ((k != 0) && (k != num_of_scale - 1)) {
742 start_ys += (int)5 * scale / 2;
744 start_ys += (int)7 * scale / 2;
746 for (i = start_x; i < end_x; i++)
747 for (j = 0; j < 3; j++)
748 image[(start_ys * xr + i) * 3 + j] = font_color[j];
752 if (mark_0_on == 1) {
753 if ((tmincolor < 0) && (tmaxcolor > 0)) {
754 start_ys = (int)((0 - tmincolor) / (tmaxcolor - tmincolor) *
758 sprintf(buf,
"%10.2E", 0.0);
760 for (m = 0; m < 10; m++) {
762 font5_generate(buf[9 - m], output5);
763 for (j = 0; j < 5 * scale; j++)
764 for (i = 0; i < 5 * scale; i++) {
765 image[((start_ys + j) * xr + start_xs - i) * 3] =
766 (double)output5[4 - (
int)(j / scale)][(
int)(i / scale)] *
768 image[((start_ys + j) * xr + start_xs - i) * 3 + 1] =
769 (double)output5[4 - (
int)(j / scale)][(
int)(i / scale)] *
771 image[((start_ys + j) * xr + start_xs - i) * 3 + 2] =
772 (double)output5[4 - (
int)(j / scale)][(
int)(i / scale)] *
775 start_xs += 5 * scale;
776 }
else if (type == 2) {
778 for (j = 0; j < 7 * scale; j++)
779 for (i = 0; i < 7 * scale; i++) {
780 image[((start_ys + j) * xr + start_xs - i) * 3] =
781 (double)output7[6 - (
int)(j / scale)][(
int)(i / scale)] *
783 image[((start_ys + j) * xr + start_xs - i) * 3 + 1] =
784 (double)output7[6 - (
int)(j / scale)][(
int)(i / scale)] *
786 image[((start_ys + j) * xr + start_xs - i) * 3 + 2] =
787 (double)output7[6 - (
int)(j / scale)][(
int)(i / scale)] *
790 start_xs += 7 * scale;
794 for (i = start_xs + 1; i < start_xs + 5; i++)
795 for (j = 0; j < 3; j++)
796 image[(start_ys * xr + i) * 3 + j] = font_color[j];
805 static unsigned short int transform_hex(
char a) {
806 unsigned short int aa;
862 char c_buf[10], newc_buf[10], changed_buf[10];
863 unsigned short int i, m, digit;
865 sprintf(c_buf,
"%x", n);
868 while (c_buf[m] !=
'\0') m++;
873 for (i = 0; i < 4 - m; i++) newc_buf[i] =
'0';
875 for (i = 0; i < m; i++) newc_buf[4 - m + i] = c_buf[i];
878 changed_buf[0] = newc_buf[2];
879 changed_buf[1] = newc_buf[3];
880 changed_buf[2] = newc_buf[0];
881 changed_buf[3] = newc_buf[1];
882 changed_buf[4] =
'\0';
885 for (i = 0; i < 4; i++) {
887 digit += transform_hex(changed_buf[i]);
893 char c_buf[10], newc_buf[10], changed_buf[10], changed2_buf[10];
894 unsigned int i, m, digit;
896 sprintf(c_buf,
"%x", n);
899 for (i = 0; i < 8; i++) {
900 if (c_buf[i] ==
'\0')
909 for (i = 0; i < 8 - m; i++) newc_buf[i] =
'0';
911 for (i = 0; i < m; i++) newc_buf[8 - m + i] = c_buf[i];
915 for (i = 0; i < 4; i++) changed_buf[i] = newc_buf[i + 4];
917 for (i = 0; i < 4; i++) changed_buf[i + 4] = newc_buf[i];
919 changed2_buf[0] = changed_buf[2];
920 changed2_buf[1] = changed_buf[3];
921 changed2_buf[2] = changed_buf[0];
922 changed2_buf[3] = changed_buf[1];
923 changed2_buf[4] = changed_buf[6];
924 changed2_buf[5] = changed_buf[7];
925 changed2_buf[6] = changed_buf[4];
926 changed2_buf[7] = changed_buf[5];
927 changed2_buf[8] =
'\0';
930 for (i = 0; i < 8; i++) {
932 digit += transform_hex(changed2_buf[i]);
939 char c_buf[10], newc_buf[10], changed_buf[10], changed2_buf[10];
942 sprintf(c_buf,
"%x", n);
945 for (i = 0; i < 8; i++) {
946 if (c_buf[i] ==
'\0')
955 for (i = 0; i < 8 - m; i++) newc_buf[i] =
'0';
957 for (i = 0; i < m; i++) newc_buf[8 - m + i] = c_buf[i];
961 for (i = 0; i < 4; i++) changed_buf[i] = newc_buf[i + 4];
963 for (i = 0; i < 4; i++) changed_buf[i + 4] = newc_buf[i];
965 changed2_buf[0] = changed_buf[2];
966 changed2_buf[1] = changed_buf[3];
967 changed2_buf[2] = changed_buf[0];
968 changed2_buf[3] = changed_buf[1];
969 changed2_buf[4] = changed_buf[6];
970 changed2_buf[5] = changed_buf[7];
971 changed2_buf[6] = changed_buf[4];
972 changed2_buf[7] = changed_buf[5];
973 changed2_buf[8] =
'\0';
976 for (i = 0; i < 8; i++) {
978 digit += transform_hex(changed2_buf[i]);