C++ Bitmap Library  release
bitmap_test.cpp
Go to the documentation of this file.
1 /*
2  *****************************************************************************
3  * *
4  * Platform Independent *
5  * Bitmap Image Reader Writer Library *
6  * *
7  * Author: Arash Partow - 2002 *
8  * URL: http://partow.net/programming/bitmap/index.html *
9  * *
10  * Note: This library only supports 24-bits per pixel bitmap format files. *
11  * *
12  * Copyright notice: *
13  * Free use of the Platform Independent Bitmap Image Reader Writer Library *
14  * is permitted under the guidelines and in accordance with the most current *
15  * version of the MIT License. *
16  * http://www.opensource.org/licenses/MIT *
17  * *
18  *****************************************************************************
19 */
20 
21 
22 #include <cmath>
23 #include <cstdio>
24 #include <cstdlib>
25 #include <iostream>
26 #include <string>
27 
28 #include "bitmap_image.hpp"
29 
30 
31 void test01()
32 {
33  std::string file_name("image.bmp");
34 
35  bitmap_image image(file_name);
36 
37  if (!image)
38  {
39  printf("test01() - Error - Failed to open '%s'\n",file_name.c_str());
40  return;
41  }
42 
43  image.save_image("test01_saved.bmp");
44 }
45 
46 void test02()
47 {
48  std::string file_name("image.bmp");
49 
50  bitmap_image image(file_name);
51 
52  if (!image)
53  {
54  printf("test02() - Error - Failed to open '%s'\n",file_name.c_str());
55  return;
56  }
57 
58  image.save_image("test02_saved.bmp");
59 
60  image.vertical_flip();
61  image.save_image("test02_saved_vert_flip.bmp");
62  image.vertical_flip();
63 
64  image.horizontal_flip();
65  image.save_image("test02_saved_horiz_flip.bmp");
66 }
67 
68 void test03()
69 {
70  std::string file_name("image.bmp");
71 
72  bitmap_image image(file_name);
73 
74  if (!image)
75  {
76  printf("test03() - Error - Failed to open '%s'\n",file_name.c_str());
77  return;
78  }
79 
80  bitmap_image subsampled_image1;
81  bitmap_image subsampled_image2;
82  bitmap_image subsampled_image3;
83 
84  image.subsample(subsampled_image1);
85  subsampled_image1.save_image("test03_1xsubsampled_image.bmp");
86 
87  subsampled_image1.subsample(subsampled_image2);
88  subsampled_image2.save_image("test03_2xsubsampled_image.bmp");
89 
90  subsampled_image2.subsample(subsampled_image3);
91  subsampled_image3.save_image("test03_3xsubsampled_image.bmp");
92 }
93 
94 void test04()
95 {
96  std::string file_name("image.bmp");
97 
98  bitmap_image image(file_name);
99 
100  if (!image)
101  {
102  printf("test04() - Error - Failed to open '%s'\n",file_name.c_str());
103  return;
104  }
105 
106  bitmap_image upsampled_image1;
107  bitmap_image upsampled_image2;
108  bitmap_image upsampled_image3;
109 
110  image.upsample(upsampled_image1);
111  upsampled_image1.save_image("test04_1xupsampled_image.bmp");
112 
113  upsampled_image1.upsample(upsampled_image2);
114  upsampled_image2.save_image("test04_2xupsampled_image.bmp");
115 
116  upsampled_image2.upsample(upsampled_image3);
117  upsampled_image3.save_image("test04_3xupsampled_image.bmp");
118 }
119 
120 void test05()
121 {
122  std::string file_name("image.bmp");
123 
124  bitmap_image image(file_name);
125 
126  if (!image)
127  {
128  printf("test05() - Error - Failed to open '%s'\n",file_name.c_str());
129  return;
130  }
131 
132  image.set_all_ith_bits_low(0);
133  image.save_image("test05_lsb0_removed_saved.bmp");
134  image.set_all_ith_bits_low(1);
135  image.save_image("test05_lsb01_removed_saved.bmp");
136  image.set_all_ith_bits_low(2);
137  image.save_image("test05_lsb012_removed_saved.bmp");
138  image.set_all_ith_bits_low(3);
139  image.save_image("test05_lsb0123_removed_saved.bmp");
140  image.set_all_ith_bits_low(4);
141  image.save_image("test05_lsb01234_removed_saved.bmp");
142  image.set_all_ith_bits_low(5);
143  image.save_image("test05_lsb012345_removed_saved.bmp");
144  image.set_all_ith_bits_low(6);
145  image.save_image("test05_lsb0123456_removed_saved.bmp");
146 }
147 
148 void test06()
149 {
150  std::string file_name("image.bmp");
151 
152  bitmap_image image(file_name);
153 
154  if (!image)
155  {
156  printf("test06() - Error - Failed to open '%s'\n",file_name.c_str());
157  return;
158  }
159 
160  bitmap_image red_channel_image;
161  image.export_color_plane(bitmap_image::red_plane,red_channel_image);
162  red_channel_image.save_image("test06_red_channel_image.bmp");
163 
164  bitmap_image green_channel_image;
165  image.export_color_plane(bitmap_image::green_plane,green_channel_image);
166  green_channel_image.save_image("test06_green_channel_image.bmp");
167 
168  bitmap_image blue_channel_image;
169  image.export_color_plane(bitmap_image::blue_plane,blue_channel_image);
170  blue_channel_image.save_image("test06_blue_channel_image.bmp");
171 }
172 
173 void test07()
174 {
175  std::string file_name("image.bmp");
176 
177  bitmap_image image(file_name);
178 
179  if (!image)
180  {
181  printf("test07() - Error - Failed to open '%s'\n",file_name.c_str());
182  return;
183  }
184 
185  image.convert_to_grayscale();
186  image.save_image("test07_grayscale_image.bmp");
187 }
188 
189 void test08()
190 {
191  std::string file_name("image.bmp");
192 
193  bitmap_image image(file_name);
194 
195  if (!image)
196  {
197  printf("test08() - Error - Failed to open '%s'\n",file_name.c_str());
198  return;
199  }
200 
201  bitmap_image image1;
202  bitmap_image image2;
203  bitmap_image image3;
204  bitmap_image image4;
205 
206  unsigned int w = image.width();
207  unsigned int h = image.height();
208 
209  if (!image.region(0,0, w / 2, h / 2,image1))
210  {
211  std::cout << "ERROR: upper_left_image" << std::endl;
212  }
213 
214  if (!image.region((w - 1) / 2, 0, w / 2, h / 2,image2))
215  {
216  std::cout << "ERROR: upper_right_image" << std::endl;
217  }
218 
219  if (!image.region(0,(h - 1) / 2, w / 2, h / 2,image3))
220  {
221  std::cout << "ERROR: lower_left_image" << std::endl;
222  }
223 
224  if (!image.region((w - 1) / 2, (h - 1) / 2, w / 2, h / 2,image4))
225  {
226  std::cout << "ERROR: lower_right_image" << std::endl;
227  }
228 
229  image1.save_image("test08_upper_left_image.bmp");
230  image2.save_image("test08_upper_right_image.bmp");
231  image3.save_image("test08_lower_left_image.bmp");
232  image4.save_image("test08_lower_right_image.bmp");
233 }
234 
235 void test09()
236 {
237  const unsigned int dim = 1000;
238 
239  bitmap_image image(dim,dim);
240 
241  for (unsigned int x = 0; x < dim; ++x)
242  {
243  for (unsigned int y = 0; y < dim; ++y)
244  {
245  rgb_t col = jet_colormap[(x + y) % dim];
246  image.set_pixel(x,y,col.red,col.green,col.blue);
247  }
248  }
249 
250  image.save_image("test09_color_map_image.bmp");
251 }
252 
253 void test10()
254 {
255  std::string file_name("image.bmp");
256 
257  bitmap_image image(file_name);
258 
259  if (!image)
260  {
261  printf("test10() - Error - Failed to open '%s'\n",file_name.c_str());
262  return;
263  }
264 
265  image.invert_color_planes();
266  image.save_image("test10_inverted_color_image.bmp");
267 }
268 
269 void test11()
270 {
271  std::string file_name("image.bmp");
272 
273  bitmap_image image(file_name);
274 
275  if (!image)
276  {
277  printf("test11() - Error - Failed to open '%s'\n",file_name.c_str());
278  return;
279  }
280 
281  for (unsigned int i = 0; i < 10; ++i)
282  {
284  image.save_image(std::string("test11_") + static_cast<char>(48 + i) + std::string("_red_inc_image.bmp"));
285  }
286 }
287 
288 void test12()
289 {
290  std::string file_name("image.bmp");
291 
292  bitmap_image image(file_name);
293 
294  if (!image)
295  {
296  printf("test12() - Error - Failed to open '%s'\n",file_name.c_str());
297  return;
298  }
299 
300  double* y = new double [image.pixel_count()];
301  double* cb = new double [image.pixel_count()];
302  double* cr = new double [image.pixel_count()];
303 
304  image.export_ycbcr(y,cb,cr);
305 
306  for (unsigned int i = 0; i < image.pixel_count(); ++i)
307  {
308  cb[i] = cr[i] = 0.0;
309  }
310 
311  image.import_ycbcr(y,cb,cr);
312  image.save_image("test12_only_y_image.bmp");
313 
314  delete[] y;
315  delete[] cb;
316  delete[] cr;
317 }
318 
319 void test13()
320 {
321  std::string file_name("image.bmp");
322 
323  bitmap_image image(file_name);
324 
325  if (!image)
326  {
327  printf("test13() - Error - Failed to open '%s'\n",file_name.c_str());
328  return;
329  }
330 
331  double* y = new double [image.pixel_count()];
332  double* cb = new double [image.pixel_count()];
333  double* cr = new double [image.pixel_count()];
334 
335  image.export_ycbcr(y,cb,cr);
336 
337  for (unsigned int j = 0; j < 10; ++j)
338  {
339  for (unsigned int i = 0; i < image.pixel_count(); ++i)
340  {
341  y[i] += 15.0;
342  }
343 
344  image.import_ycbcr(y,cb,cr);
345  image.save_image(std::string("test13_") + static_cast<char>(48 + j) + std::string("_y_image.bmp"));
346  }
347 
348  delete[] y;
349  delete[] cb;
350  delete[] cr;
351 }
352 
353 void test14()
354 {
355  bitmap_image image(512,512);
356 
357  image.clear();
359  image.save_image("test14_checkered_01.bmp");
360 
361  image.clear();
362  checkered_pattern(32,64,100,200,50,image);
363  image.save_image("test14_checkered_02.bmp");
364 }
365 
366 void test15()
367 {
368  bitmap_image image(1024,1024);
369 
370  image.clear();
371 
372  double c1 = 0.9;
373  double c2 = 0.5;
374  double c3 = 0.3;
375  double c4 = 0.7;
376 
377  ::srand(0xA5AA5AA5);
378  plasma(image,0,0,image.width(),image.height(),c1,c2,c3,c4,3.0,jet_colormap);
379  image.save_image("test15_plasma.bmp");
380 }
381 
382 void test16()
383 {
384  std::string file_name("image.bmp");
385 
386  bitmap_image image(file_name);
387 
388  if (!image)
389  {
390  printf("test16() - Error - Failed to open '%s'\n",file_name.c_str());
391  return;
392  }
393 
394  double c1 = 0.9;
395  double c2 = 0.5;
396  double c3 = 0.3;
397  double c4 = 0.7;
398 
399  bitmap_image plasma_image(image.width(),image.height());
400  plasma(plasma_image,0,0,plasma_image.width(),plasma_image.height(),c1,c2,c3,c4,3.0,jet_colormap);
401 
402  bitmap_image temp_image(image);
403 
404  temp_image.alpha_blend(0.1, plasma_image);
405  temp_image.save_image("test16_alpha_0.1.bmp");
406  temp_image = image;
407 
408  temp_image.alpha_blend(0.2, plasma_image);
409  temp_image.save_image("test16_alpha_0.2.bmp");
410  temp_image = image;
411 
412  temp_image.alpha_blend(0.3, plasma_image);
413  temp_image.save_image("test16_alpha_0.3.bmp");
414  temp_image = image;
415 
416  temp_image.alpha_blend(0.4, plasma_image);
417  temp_image.save_image("test16_alpha_0.4.bmp");
418  temp_image = image;
419 
420  temp_image.alpha_blend(0.5, plasma_image);
421  temp_image.save_image("test16_alpha_0.5.bmp");
422  temp_image = image;
423 
424  temp_image.alpha_blend(0.6, plasma_image);
425  temp_image.save_image("test16_alpha_0.6.bmp");
426  temp_image = image;
427 
428  temp_image.alpha_blend(0.7, plasma_image);
429  temp_image.save_image("test16_alpha_0.7.bmp");
430  temp_image = image;
431 
432  temp_image.alpha_blend(0.8, plasma_image);
433  temp_image.save_image("test16_alpha_0.8.bmp");
434  temp_image = image;
435 
436  temp_image.alpha_blend(0.9, plasma_image);
437  temp_image.save_image("test16_alpha_0.9.bmp");
438 }
439 
440 void test17()
441 {
442  bitmap_image image(1024,1024);
443 
444  double c1 = 0.9;
445  double c2 = 0.5;
446  double c3 = 0.3;
447  double c4 = 0.7;
448 
449  plasma(image,0,0,image.width(),image.height(),c1,c2,c3,c4,3.0,jet_colormap);
450 
451  image_drawer draw(image);
452 
453  draw.pen_width(3);
454  draw.pen_color(255,0,0);
455  draw.circle(image.width() / 2 + 100, image.height() / 2, 100);
456 
457  draw.pen_width(2);
458  draw.pen_color(0,255,255);
459  draw.ellipse(image.width() / 2, image.height() / 2, 200,350);
460 
461  draw.pen_width(1);
462  draw.pen_color(255,255,0);
463  draw.rectangle(50,50,250,400);
464 
465  draw.pen_color(0,255,0);
466  draw.rectangle(450,250,850,880);
467 
468  image.save_image("test17_image_drawer.bmp");
469 }
470 
471 void test18()
472 {
473  {
474  bitmap_image image(1000,180);
475  image_drawer draw(image);
476  const rgb_t* colormap[9] = {
480  hot_colormap,
481  hsv_colormap,
482  jet_colormap,
484  vga_colormap,
486  };
487 
488  for (unsigned int i = 0; i < image.width(); ++i)
489  {
490  for (unsigned int j = 0; j < 9; ++j)
491  {
492  draw.pen_color(colormap[j][i].red,colormap[j][i].green,colormap[j][i].blue);
493  draw.vertical_line_segment(j * 20, (j + 1) * 20, i);
494  }
495  }
496 
497  image.save_image("test18_color_maps.bmp");
498  }
499 
500  {
501  bitmap_image image(1000,500);
502  image_drawer draw(image);
503 
504  std::size_t palette_colormap_size = sizeof(palette_colormap) / sizeof(rgb_t);
505  std::size_t bar_width = image.width() / palette_colormap_size;
506 
507  for (std::size_t i = 0; i < palette_colormap_size; ++i)
508  {
509  for (std::size_t j = 0; j < bar_width; ++j)
510  {
511  draw.pen_color(palette_colormap[i].red,palette_colormap[i].green,palette_colormap[i].blue);
512  draw.vertical_line_segment(0, image.height(), static_cast<int>(i * bar_width + j));
513  }
514  }
515 
516  image.save_image("test18_palette_colormap.bmp");
517  }
518 }
519 
520 void test19()
521 {
522  {
523  cartesian_canvas canvas(1000, 1000);
524 
525  if (!canvas)
526  {
527  printf("test19() - Error - Failed to instantiate cartesian canvas(1000x1000) [1]\n");
528  return;
529  }
530 
531  canvas.rectangle(canvas.min_x(), canvas.min_y(), canvas.max_x(), canvas.max_y());
532 
533  canvas.horiztonal_line_segment(canvas.min_x(), canvas.max_x(), -400.0);
534 
535  canvas.line_segment(-500.0, 600.0, 600.0, -500.0);
536 
537  canvas.pen_width(3);
538 
539  for (std::size_t i = 0; i < 160; i++)
540  {
541  std::size_t c_idx = i % (sizeof(palette_colormap) / sizeof(rgb_t));
542 
543  canvas.pen_color(palette_colormap[c_idx].red, palette_colormap[c_idx].green, palette_colormap[c_idx].blue);
544 
545  canvas.circle(0.0, 0.0, 3.0 * i);
546  }
547 
548  canvas.image().save_image("test19_cartesian_canvas01.bmp");
549  }
550 
551  {
552  static const double pi = 3.14159265358979323846264338327950288419716939937510;
553 
554  cartesian_canvas canvas(1000, 1000);
555 
556  if (!canvas)
557  {
558  printf("test19() - Error - Failed to instantiate cartesian canvas(1000x1000) [2]\n");
559  return;
560  }
561 
562  canvas.image().set_all_channels(0xFF);
563 
564  canvas.pen_width(2);
565 
566  unsigned int i = 0;
567 
568  for (double x = -500; x < 500; x += 3, ++i)
569  {
570  std::size_t c_idx = i % (sizeof(palette_colormap) / sizeof(rgb_t));
571 
572  canvas.pen_color(palette_colormap[c_idx].red, palette_colormap[c_idx].green, palette_colormap[c_idx].blue);
573 
574  double radius = std::max(10.0,std::abs(80.0 * std::sin((1.0 / 80.0) * pi * x)));
575 
576  double y = 400.0 * std::sin((1.0 / 200.0) * pi * x);
577 
578  canvas.circle(x, y, radius);
579  }
580 
581  canvas.image().save_image("test19_cartesian_canvas02.bmp");
582  }
583 }
584 
585 void test20()
586 {
587  const rgb_t* colormap[4] = {
588  hsv_colormap,
589  jet_colormap,
592  };
593 
594  const unsigned int fractal_width = 1200;
595  const unsigned int fractal_height = 800;
596 
597  {
598  bitmap_image fractal_hsv (fractal_width,fractal_height);
599  bitmap_image fractal_jet (fractal_width,fractal_height);
600  bitmap_image fractal_prism(fractal_width,fractal_height);
601  bitmap_image fractal_vga (fractal_width,fractal_height);
602 
603  fractal_hsv .clear();
604  fractal_jet .clear();
605  fractal_prism.clear();
606  fractal_vga .clear();
607 
608  double cr, ci;
609  double nextr, nexti;
610  double prevr, previ;
611 
612  const unsigned int max_iterations = 1000;
613 
614  for (unsigned int y = 0; y < fractal_height; ++y)
615  {
616  for (unsigned int x = 0; x < fractal_width; ++x)
617  {
618  cr = 1.5 * (2.0 * x / fractal_width - 1.0) - 0.5;
619  ci = (2.0 * y / fractal_height - 1.0);
620 
621  nextr = nexti = 0;
622  prevr = previ = 0;
623 
624  for (unsigned int i = 0; i < max_iterations; i++)
625  {
626  prevr = nextr;
627  previ = nexti;
628 
629  nextr = prevr * prevr - previ * previ + cr;
630  nexti = 2 * prevr * previ + ci;
631 
632  if (((nextr * nextr) + (nexti * nexti)) > 4)
633  {
634  if (max_iterations != i)
635  {
636  double z = sqrt(nextr * nextr + nexti * nexti);
637 
638  #define log2(x) (std::log(1.0 * x) / std::log(2.0))
639 
640  unsigned int index = static_cast<unsigned int>
641  (1000.0 * log2(1.75 + i - log2(log2(z))) / log2(max_iterations));
642  #undef log2
643 
644  rgb_t c0 = colormap[0][index];
645  rgb_t c1 = colormap[1][index];
646  rgb_t c2 = colormap[2][index];
647  rgb_t c3 = colormap[3][index];
648 
649  fractal_hsv .set_pixel(x, y, c0.red, c0.green, c0.blue);
650  fractal_jet .set_pixel(x, y, c1.red, c1.green, c1.blue);
651  fractal_prism.set_pixel(x, y, c2.red, c2.green, c2.blue);
652  fractal_vga .set_pixel(x, y, c3.red, c3.green, c3.blue);
653  }
654 
655  break;
656  }
657  }
658  }
659  }
660 
661  fractal_hsv .save_image("test20_mandelbrot_set_hsv.bmp" );
662  fractal_jet .save_image("test20_mandelbrot_set_jet.bmp" );
663  fractal_prism.save_image("test20_mandelbrot_set_prism.bmp");
664  fractal_vga .save_image("test20_mandelbrot_set_vga.bmp" );
665  }
666 
667  {
668  bitmap_image fractal_hsv (fractal_width,fractal_height);
669  bitmap_image fractal_jet (fractal_width,fractal_height);
670  bitmap_image fractal_prism(fractal_width,fractal_height);
671  bitmap_image fractal_vga (fractal_width,fractal_height);
672 
673  fractal_hsv .clear();
674  fractal_jet .clear();
675  fractal_prism.clear();
676  fractal_vga .clear();
677 
678  const unsigned int max_iterations = 300;
679 
680  const double cr = -0.70000;
681  const double ci = 0.27015;
682 
683  double prevr, previ;
684 
685  for (unsigned int y = 0; y < fractal_height; ++y)
686  {
687  for (unsigned int x = 0; x < fractal_width; ++x)
688  {
689  double nextr = 1.5 * (2.0 * x / fractal_width - 1.0);
690  double nexti = (2.0 * y / fractal_height - 1.0);
691 
692  for (unsigned int i = 0; i < max_iterations; i++)
693  {
694  prevr = nextr;
695  previ = nexti;
696 
697  nextr = prevr * prevr - previ * previ + cr;
698  nexti = 2 * prevr * previ + ci;
699 
700  if (((nextr * nextr) + (nexti * nexti)) > 4)
701  {
702  if (max_iterations != i)
703  {
704  unsigned int index = static_cast<int>((1000.0 * i) / max_iterations);
705 
706  rgb_t c0 = colormap[0][index];
707  rgb_t c1 = colormap[1][index];
708  rgb_t c2 = colormap[2][index];
709  rgb_t c3 = colormap[3][index];
710 
711  fractal_hsv .set_pixel(x, y, c0.red, c0.green, c0.blue);
712  fractal_jet .set_pixel(x, y, c1.red, c1.green, c1.blue);
713  fractal_prism.set_pixel(x, y, c2.red, c2.green, c2.blue);
714  fractal_vga .set_pixel(x, y, c3.red, c3.green, c3.blue);
715  }
716 
717  break;
718  }
719  }
720  }
721  }
722 
723  fractal_hsv .save_image("test20_julia_set_hsv.bmp" );
724  fractal_jet .save_image("test20_julia_set_jet.bmp" );
725  fractal_prism.save_image("test20_julia_set_prism.bmp");
726  fractal_vga .save_image("test20_julia_set_vga.bmp" );
727  }
728 }
729 
730 int main()
731 {
732  test01();
733  test02();
734  test03();
735  test04();
736  test05();
737  test06();
738  test07();
739  test08();
740  test09();
741  test10();
742  test11();
743  test12();
744  test13();
745  test14();
746  test15();
747  test16();
748  test17();
749  test18();
750  test19();
751  test20();
752  return 0;
753 }
754 
755 
756 /*
757  Note: In some of the tests a bitmap image by the name of 'image.bmp'
758  is required. If not present the test will fail.
759 */
void test12()
void test05()
void test08()
void export_color_plane(const color_plane color, unsigned char *image)
const rgb_t hot_colormap[1000]
void pen_color(const unsigned char &red, const unsigned char &green, const unsigned char &blue)
bool region(const unsigned int &x, const unsigned int &y, const unsigned int &width, const unsigned int &height, bitmap_image &dest_image)
const rgb_t gray_colormap[1000]
void set_pixel(const unsigned int x, const unsigned int y, const unsigned char red, const unsigned char green, const unsigned char blue)
unsigned int height() const
unsigned char red
void test07()
void test06()
unsigned char green
void alpha_blend(const double &alpha, const bitmap_image &image)
void vertical_flip()
void import_ycbcr(double *y, double *cb, double *cr)
unsigned int width() const
void test03()
Definition: bitmap_test.cpp:68
void test09()
void set_all_ith_bits_low(const unsigned int bitr_index)
void plasma(bitmap_image &image, const double &x, const double &y, const double &width, const double &height, const double &c1, const double &c2, const double &c3, const double &c4, const double &roughness=3.0, const rgb_t colormap[]=0)
const rgb_t jet_colormap[1000]
const rgb_t vga_colormap[1000]
void test17()
double min_x() const
unsigned char blue
void test18()
int main()
void horizontal_flip()
const rgb_t palette_colormap[]
#define log2(x)
void pen_width(const unsigned int &width)
void invert_color_planes()
const rgb_t autumn_colormap[1000]
void subsample(bitmap_image &dest)
const rgb_t prism_colormap[1000]
void vertical_line_segment(int y1, int y2, int x)
void checkered_pattern(const unsigned int x_width, const unsigned int y_width, const unsigned char value, const bitmap_image::color_plane color, bitmap_image &image)
void test10()
void test13()
void test11()
void save_image(const std::string &file_name) const
void rectangle(double x1, double y1, double x2, double y2)
double min_y() const
void test01()
Definition: bitmap_test.cpp:31
double max_x() const
const rgb_t copper_colormap[1000]
void test16()
void line_segment(double x1, double y1, double x2, double y2)
void export_ycbcr(double *y, double *cb, double *cr)
const rgb_t yarg_colormap[1000]
unsigned int pixel_count() const
void test20()
void add_to_color_plane(const color_plane color, const unsigned char &value)
double max_y() const
void test04()
Definition: bitmap_test.cpp:94
void horiztonal_line_segment(double x1, double x2, double y)
const bitmap_image & image() const
void convert_to_grayscale()
void upsample(bitmap_image &dest)
const rgb_t hsv_colormap[1000]
void test02()
Definition: bitmap_test.cpp:46
void test14()
void circle(double centerx, double centery, double radius)
void test19()
void test15()
void pen_color(const unsigned char &red, const unsigned char &green, const unsigned char &blue)
void clear(const unsigned char v=0x00)
void set_all_channels(const unsigned char &value)