MRaster examples 21.0.0.0
Image Processing Library
Loading...
Searching...
No Matches
test_images.cpp
Go to the documentation of this file.
1// -*- Mode:C++; Coding:us-ascii-unix; fill-column:158 -*-
2/*******************************************************************************************************************************************************.H.S.**/
3/**
4 @file test_images.cpp
5 @author Mitch Richling <https://www.mitchr.me>
6 @brief Generate some test images.@EOL
7 @copyright
8 @parblock
9 Copyright (c) 1988-2015, Mitchell Jay Richling <https://www.mitchr.me> All rights reserved.
10
11 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
12
13 1. Redistributions of source code must retain the above copyright notice, this list of conditions, and the following disclaimer.
14
15 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions, and the following disclaimer in the documentation
16 and/or other materials provided with the distribution.
17
18 3. Neither the name of the copyright holder nor the names of its contributors may be used to edorse or promote products derived from this software
19 without specific prior written permission.
20
21 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
26 DAMAGE.
27 @endparblock
28*/
29/*******************************************************************************************************************************************************.H.E.**/
30/** @cond exj */
31
32//--------------------------------------------------------------------------------------------------------------------------------------------------------------
33#include "ramCanvas.hpp"
34
35//--------------------------------------------------------------------------------------------------------------------------------------------------------------
36int main() {
37 const int wide = 4096/1;
38 const int tall = 2048/1;
39 const int gap = 32;
40 mjr::ramCanvas3c8b cRamCanvas(wide, tall);
41 mjr::ramCanvas1c8b mRamCanvas(wide, tall);
42
43 char const numc = 7;
44 char const *colors[numc] = { "white", "red", "green", "blue", "magenta", "cyan", "yellow" };
45
46 cRamCanvas.clrCanvasToBlack();
47 for(int i=1; i<wide/gap; i++)
48 cRamCanvas.drawLine(i*gap, 0, i*gap, (tall-1), colors[i%numc]);
49 for(int i=1; i<tall/gap; i++)
50 cRamCanvas.drawLine(0, i*gap, (wide-1), i*gap, colors[i%numc]);
51 cRamCanvas.writeTIFFfile("test_images_ccgrid.tiff");
52
53 for(int j=1; j<tall/gap/2+1; j++) {
54 for(int i=(j-1)*4+1; i<wide/gap; i++) {
55 cRamCanvas.drawFillTriangle(i*gap, j*gap,
56 (i+1)*gap, (j+1)*gap,
57 (i+1)*gap, j*gap,
58 colors[i%numc]);
59 }
60 }
61 cRamCanvas.writeTIFFfile("test_images_ccgridt.tiff");
62
63 mRamCanvas.clrCanvasToBlack();
64 cRamCanvas.clrCanvasToBlack();
65 for(int i=1; i<wide/gap; i++) {
66 cRamCanvas.drawLine(i*gap, 0, i*gap, (tall-1), "white");
67 mRamCanvas.drawLine(i*gap, 0, i*gap, (tall-1), "white");
68 }
69 for(int i=1; i<tall/gap; i++) {
70 cRamCanvas.drawLine(0, i*gap, (wide-1), i*gap, "white");
71 mRamCanvas.drawLine(0, i*gap, (wide-1), i*gap, "white");
72 }
73 cRamCanvas.writeTIFFfile("test_images_mcgrid.tiff");
74 mRamCanvas.writeTIFFfile("test_images_mmgrid.tiff");
75
76 for(int j=1; j<tall/gap/2+1; j++) {
77 for(int i=(j-1)*4+1; i<wide/gap; i++) {
78 cRamCanvas.drawFillTriangle(i*gap, j*gap,
79 (i+1)*gap, (j+1)*gap,
80 (i+1)*gap, j*gap,
81 "white");
82 mRamCanvas.drawFillTriangle(i*gap, j*gap,
83 (i+1)*gap, (j+1)*gap,
84 (i+1)*gap, j*gap,
85 "white");
86 }
87 }
88 cRamCanvas.writeTIFFfile("test_images_mcgridt.tiff");
89 mRamCanvas.writeTIFFfile("test_images_mmgridt.tiff");
90
91 return 0;
92}
93/** @endcond */
int main(int argc, char *argv[])