MRaster examples 21.0.0.0
Image Processing Library
Loading...
Searching...
No Matches
utest_ramCanvasTpl.cpp
Go to the documentation of this file.
1// -*- Mode:C++; Coding:us-ascii-unix; fill-column:158 -*-
2/*******************************************************************************************************************************************************.H.S.**/
3/**
4 @file utest_ramCanvasTpl.cpp
5 @author Mitch Richling http://www.mitchr.me/
6 @date 2022-08-24
7 @brief unit tests for ramCanvasTpl on 64-bit little endian hardware -- like ia64/x86_64.@EOL
8 @std C++20
9 @copyright
10 @parblock
11 Copyright (c) 2022, Mitchell Jay Richling <http://www.mitchr.me/> All rights reserved.
12
13 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
14
15 1. Redistributions of source code must retain the above copyright notice, this list of conditions, and the following disclaimer.
16
17 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions, and the following disclaimer in the documentation
18 and/or other materials provided with the distribution.
19
20 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software
21 without specific prior written permission.
22
23 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
25 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 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
28 DAMAGE.
29 @endparblock
30*/
31/*******************************************************************************************************************************************************.H.E.**/
32/** @cond exj */
33
34#define BOOST_TEST_DYN_LINK
35#define BOOST_TEST_MODULE Main
36#include <boost/test/unit_test.hpp>
37
38#define BOOST_TEST_DYN_LINK
39#ifdef STAND_ALONE
40# define BOOST_TEST_MODULE Main
41#endif
42#include <boost/test/unit_test.hpp>
43
44#include "ramCanvas.hpp"
45
46#if 1
47
48////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
49BOOST_AUTO_TEST_CASE(draw_primatives_int) {
50
51 // We instantiate every drawing function in ramCanvas so that we can check for compile time errors and do some basic functionality testing.
52
53 const int BSIZE = 60;
54
55 mjr::ramCanvasRGB8b aRamCanvas(BSIZE, BSIZE, 0, BSIZE-1, 0, BSIZE-1); mjr::ramCanvasRGB8b RaRamCanvas(BSIZE, BSIZE, 0, BSIZE-1, 0, BSIZE-1);
56 mjr::colorRGB8b aColor(mjr::colorRGB8b::cornerColorEnum::RED);
57 mjr::colorRGB8b bColor(mjr::colorRGB8b::cornerColorEnum::GREEN);
58
59 //------------------------------------------------------------------------------------------------------------------------------------------------------------
60 aRamCanvas.drawPoint(1, 1, aColor); // drawPoint(iCrd x, iCrd y, clr color);
61 aRamCanvas.setDfltColor(bColor);
62 aRamCanvas.moveTo(2, 1);
63 aRamCanvas.drawPoint(); // drawPoint();
64 aRamCanvas.moveTo(3, 1);
65 aRamCanvas.drawPoint(aColor); // drawPoint(clr color);
66 aRamCanvas.setDfltColor(bColor);
67 aRamCanvas.drawPoint(4, 1); // drawPoint(iCrd x, iCrd y);
68 aRamCanvas.setDfltColor(aColor);
69 aRamCanvas.drawPoint(5.0, 2.0); // drawPoint(fCrd x, fCrd y);
70 aRamCanvas.drawPoint(6.0, 2.0, bColor); // drawPoint(fCrd x, fCrd y, clr color);
71 aRamCanvas.drawPoint(mjr::ramCanvasRGB8b::pointIntType({7, 1}), aColor); // drawPoint(iPnt thePoint, clr color);
72 aRamCanvas.setDfltColor(bColor);
73 aRamCanvas.drawPoint(mjr::ramCanvasRGB8b::pointIntType({8, 1})); // drawPoint(iPnt thePoint);
74 aRamCanvas.setDfltColor(aColor);
75 aRamCanvas.drawPoint(mjr::ramCanvasRGB8b::pointFltType({9.0, 2.0})); // drawPoint(fPnt thePoint);
76 aRamCanvas.drawPoint(mjr::ramCanvasRGB8b::pointFltType({10.0, 2.0}), bColor); // drawPoint(fPnt thePoint, clr color);
77 //------------------------------------------------------------------------------------------------------------------------------------------------------------
78 aRamCanvas.drawLine(1, 4, 1, 6, aColor); // drawLine(iCrd x1, iCrd y1, iCrd x2, iCrd y2, clr color);
79 aRamCanvas.setDfltColor(bColor);
80 aRamCanvas.moveTo(2, 4);
81 aRamCanvas.drawLine(2, 6); // drawLine(iCrd x, iCrd y);
82 aRamCanvas.setDfltColor(aColor);
83 aRamCanvas.moveTo(3.0, 5.0);
84 aRamCanvas.drawLine(3.0, 7.0); // drawLine(fCrd x, fCrd y);
85 aRamCanvas.moveTo(4, 4);
86 aRamCanvas.drawLine(4, 6, bColor); // drawLine(iCrd x, iCrd y, clr color);
87 aRamCanvas.moveTo(5.0, 5.0);
88 aRamCanvas.drawLine(5.0, 7.0, aColor); // drawLine(fCrd x, fCrd y, clr color);
89 aRamCanvas.setDfltColor(bColor);
90 aRamCanvas.drawLine(6, 4, 6, 6); // drawLine(iCrd x1, iCrd y1, iCrd x2, iCrd y2);
91 aRamCanvas.setDfltColor(aColor);
92 aRamCanvas.drawLine(7.0, 5.0, 7.0, 7.0); // drawLine(fCrd x1, fCrd y1, fCrd x2, fCrd y2);
93 aRamCanvas.drawLine(8.0, 5.0, 8.0, 7.0, bColor); // drawLine(fCrd x1, fCrd y1, fCrd x2, fCrd y2, clr color);
94 aRamCanvas.setDfltColor(aColor);
95 aRamCanvas.moveTo(mjr::ramCanvasRGB8b::pointFltType({9.0, 5.0}));
96 aRamCanvas.drawLine(mjr::ramCanvasRGB8b::pointFltType({9.0, 7.0})); // drawLine(fPnt point1);
97 aRamCanvas.moveTo(10.0, 5.0);
98 aRamCanvas.drawLine(mjr::ramCanvasRGB8b::pointFltType({10.0, 7.0}), bColor); // drawLine(fPnt point1, clr color);
99 aRamCanvas.setDfltColor(aColor);
100 aRamCanvas.moveTo(11, 4);
101 aRamCanvas.drawLine(mjr::ramCanvasRGB8b::pointIntType({11, 6})); // drawLine(iPnt point1);
102 aRamCanvas.setDfltColor(bColor);
103 aRamCanvas.moveTo(mjr::ramCanvasRGB8b::pointIntType({12, 4}));
104 aRamCanvas.drawLine(mjr::ramCanvasRGB8b::pointIntType({12, 6}), aColor); // drawLine(iPnt point1, clr color);
105 aRamCanvas.setDfltColor(bColor);
106 aRamCanvas.drawLine(mjr::ramCanvasRGB8b::pointFltType({13, 5.0}),
107 mjr::ramCanvasRGB8b::pointFltType({13, 7.0})); // drawLine(fPnt point1, fPnt point2);
108 aRamCanvas.drawLine(mjr::ramCanvasRGB8b::pointFltType({14, 5.0}),
109 mjr::ramCanvasRGB8b::pointFltType({14, 7.0}), aColor); // drawLine(fPnt point1, fPnt point2, clr color);
110 aRamCanvas.setDfltColor(bColor);
111 aRamCanvas.drawLine(mjr::ramCanvasRGB8b::pointIntType({15, 4}),
112 mjr::ramCanvasRGB8b::pointIntType({15, 6})); // drawLine(iPnt point1, iPnt point2);
113 aRamCanvas.drawLine(mjr::ramCanvasRGB8b::pointIntType({16, 5}),
114 mjr::ramCanvasRGB8b::pointIntType({16, 6}), aColor); // drawLine(iPnt point1, iPnt point2, clr color);
115 //------------------------------------------------------------------------------------------------------------------------------------------------------------
116 aRamCanvas.drawTriangle(1, 9, 4, 9, 4, 12, aColor); // drawTriangle(iCrd x1, iCrd y1, iCrd x2, iCrd y2, iCrd x3, iCrd y3,
117 // clr color);
118 aRamCanvas.setDfltColor(bColor);
119 aRamCanvas.drawTriangle(6, 9, 9, 9, 9, 12); // drawTriangle(iCrd x1, iCrd y1, iCrd x2, iCrd y2, iCrd x3, iCrd y3);
120 aRamCanvas.drawTriangle(11.0, 10.0, 14.0, 10.0, 14.0, 13.0, aColor); // drawTriangle(fCrd x1, fCrd y1, fCrd x2, fCrd y2, fCrd x3, fCrd y3,
121 // clr color);
122 aRamCanvas.setDfltColor(bColor);
123 aRamCanvas.drawTriangle(16.0, 10.0, 19.0, 10.0, 19.0, 13.0); // drawTriangle(fCrd x1, fCrd y1, fCrd x2, fCrd y2, fCrd x3, fCrd y3);
124 aRamCanvas.drawTriangle(mjr::ramCanvasRGB8b::pointIntType({1, 14}),
125 mjr::ramCanvasRGB8b::pointIntType({4, 14}),
126 mjr::ramCanvasRGB8b::pointIntType({4, 17}), aColor); // drawTriangle(iPnt point1, iPnt point2, iPnt point3, clr color);
127 aRamCanvas.setDfltColor(bColor);
128 aRamCanvas.drawTriangle(mjr::ramCanvasRGB8b::pointIntType({6, 14}),
129 mjr::ramCanvasRGB8b::pointIntType({9, 14}),
130 mjr::ramCanvasRGB8b::pointIntType({9, 17})); // drawTriangle(iPnt point1, iPnt point2, iPnt point3);
131 aRamCanvas.drawTriangle(mjr::ramCanvasRGB8b::pointFltType({11.0, 15.0}),
132 mjr::ramCanvasRGB8b::pointFltType({14.0, 15.0}),
133 mjr::ramCanvasRGB8b::pointFltType({14.0, 18.0}), aColor); // drawTriangle(fPnt point1, fPnt point2, fPnt point3, clr color);
134 aRamCanvas.setDfltColor(bColor);
135 aRamCanvas.drawTriangle(mjr::ramCanvasRGB8b::pointFltType({16.0, 15.0}),
136 mjr::ramCanvasRGB8b::pointFltType({19.0, 15.0}),
137 mjr::ramCanvasRGB8b::pointFltType({19.0, 18.0})); // drawTriangle(fPnt point1, fPnt point2, fPnt point3);
138 mjr::ramCanvasRGB8b::pointIntType ptl1[3] = { {1, 19}, {4, 19}, {4, 22} };
139 aRamCanvas.drawTriangle(ptl1, aColor); // drawTriangle(iPnt *thePoints, clr color);
140 mjr::ramCanvasRGB8b::pointIntType ptl2[3] = { {6, 19}, {9, 19}, {9, 22} };
141 aRamCanvas.setDfltColor(bColor);
142 aRamCanvas.drawTriangle(ptl2); // drawTriangle(iPnt *thePoints);
143 mjr::ramCanvasRGB8b::pointFltType ptl3[3] = { {11.0, 20.0},
144 {14.0, 20.0},
145 {14.0, 23.0} };
146 aRamCanvas.drawTriangle(ptl3, aColor); // drawTriangle(fPnt *thePoints, clr color);
147 mjr::ramCanvasRGB8b::pointFltType ptl4[3] = { {16.0, 20.0},
148 {19.0, 20.0},
149 {19.0, 23.0} };
150 aRamCanvas.setDfltColor(bColor);
151 aRamCanvas.drawTriangle(ptl4); // drawTriangle(fPnt *thePoints);
152 //------------------------------------------------------------------------------------------------------------------------------------------------------------
153 aRamCanvas.drawFillTriangle(21, 9, 24, 9, 24, 12, aColor); // drawFillTriangle(iCrd x1, iCrd y1, iCrd x2, iCrd y2, iCrd x3, iCrd y3,
154 // clr color);
155 aRamCanvas.setDfltColor(bColor);
156 aRamCanvas.drawFillTriangle(26, 9, 29, 9, 29, 12); // drawFillTriangle(iCrd x1, iCrd y1, iCrd x2, iCrd y2, iCrd x3, iCrd y3);
157 aRamCanvas.drawFillTriangle(31.0, 10.0, 34.0, 10.0, 34.0, 13.0, aColor); // drawFillTriangle(fCrd x1, fCrd y1, fCrd x2, fCrd y2, fCrd x3, fCrd y3
158 // clr color);
159 aRamCanvas.setDfltColor(bColor);
160 aRamCanvas.drawFillTriangle(36.0, 10.0, 39.0, 10.0, 39.0, 13.0); // drawFillTriangle(fCrd x1, fCrd y1, fCrd x2, fCrd y2, fCrd x3, fCrd y3);
161 aRamCanvas.drawFillTriangle(mjr::ramCanvasRGB8b::pointIntType({21, 14}),
162 mjr::ramCanvasRGB8b::pointIntType({24, 14}),
163 mjr::ramCanvasRGB8b::pointIntType({24, 17}), aColor); // drawFillTriangle(iPnt point1, iPnt point2, iPnt point3, clr color);
164 aRamCanvas.setDfltColor(bColor);
165 aRamCanvas.drawFillTriangle(mjr::ramCanvasRGB8b::pointIntType({26, 14}),
166 mjr::ramCanvasRGB8b::pointIntType({29, 14}),
167 mjr::ramCanvasRGB8b::pointIntType({29, 17})); // drawFillTriangle(iPnt point1, iPnt point2, iPnt point3);
168 aRamCanvas.drawFillTriangle(mjr::ramCanvasRGB8b::pointFltType({31.0, 15.0}),
169 mjr::ramCanvasRGB8b::pointFltType({34.0, 15.0}),
170 mjr::ramCanvasRGB8b::pointFltType({34.0, 18.0}), aColor); // drawFillTriangle(fPnt point1, fPnt point2, fPnt point3, clr color);
171 aRamCanvas.setDfltColor(bColor);
172 aRamCanvas.drawFillTriangle(mjr::ramCanvasRGB8b::pointFltType({36.0, 15.0}),
173 mjr::ramCanvasRGB8b::pointFltType({39.0, 15.0}),
174 mjr::ramCanvasRGB8b::pointFltType({39.0, 18.0})); // drawFillTriangle(fPnt point1, fPnt point2, fPnt point3);
175 mjr::ramCanvasRGB8b::pointIntType ptl5[3] = { {21, 19}, {24, 19}, {24, 22} };
176 aRamCanvas.drawFillTriangle(ptl5, aColor); // drawFillTriangle(iPnt *thePoints, clr color);
177 mjr::ramCanvasRGB8b::pointIntType ptl6[3] = { {26, 19}, {29, 19}, {29, 22} };
178 aRamCanvas.setDfltColor(bColor);
179 aRamCanvas.drawFillTriangle(ptl6); // drawFillTriangle(iPnt *thePoints);
180 mjr::ramCanvasRGB8b::pointFltType ptl7[3] = { {31.0, 20.0},
181 {34.0, 20.0},
182 {34.0, 23.0} };
183 aRamCanvas.drawFillTriangle(ptl7, aColor); // drawFillTriangle(fPnt *thePoints, clr color);
184 mjr::ramCanvasRGB8b::pointFltType ptl8[3] = { {36.0, 20.0},
185 {39.0, 20.0},
186 {39.0, 23.0} };
187 aRamCanvas.setDfltColor(bColor);
188 aRamCanvas.drawFillTriangle(ptl8); // drawFillTriangle(fPnt *thePoints);
189 //------------------------------------------------------------------------------------------------------------------------------------------------------------
190 aRamCanvas.drawCircle(3, 27, 2, aColor); // drawCircle(iCrd centerX, iCrd centerY, iCrd radiusX, clr color);
191 aRamCanvas.setDfltColor(bColor);
192 aRamCanvas.drawCircle(9, 27, 2); // drawCircle(iCrd centerX, iCrd centerY, iCrd radius);
193 aRamCanvas.moveTo(15, 27);
194 aRamCanvas.setDfltColor(aColor);
195 aRamCanvas.drawCircle(2); // drawCircle(iCrd radius);
196 aRamCanvas.drawCircle(21.0, 28.0, 2.0, bColor); // drawCircle(fCrd centerX, fCrd centerY, fCrd radiusX, clr color);
197 aRamCanvas.setDfltColor(aColor);
198 aRamCanvas.drawCircle(27.0, 28.0, 2.0); // drawCircle(fCrd centerX, fCrd centerY, fCrd radiusX);
199 aRamCanvas.moveTo(33.0, 28.0);
200 aRamCanvas.setDfltColor(bColor);
201 aRamCanvas.drawCircle(2.0); // drawCircle(fCrd radiusX);
202 aRamCanvas.drawCircle(mjr::ramCanvasRGB8b::pointIntType({39, 27}), 2, aColor); // drawCircle(iPnt centerPoint, iCrd radiusX, clr color);
203 aRamCanvas.setDfltColor(bColor);
204 aRamCanvas.drawCircle(mjr::ramCanvasRGB8b::pointIntType({45, 27}), 2); // drawCircle(iPnt centerPoint, iCrd radiusX);
205 aRamCanvas.drawCircle(mjr::ramCanvasRGB8b::pointFltType({51.0, 28.0}), 2.0, aColor); // drawCircle(fPnt centerPoint, fCrd radiusX, clr color);
206 aRamCanvas.setDfltColor(bColor);
207 aRamCanvas.drawCircle(mjr::ramCanvasRGB8b::pointFltType({57.0, 28.0}), 2.0); // drawCircle(fPnt centerPoint, fCrd radiusX);
208 //------------------------------------------------------------------------------------------------------------------------------------------------------------
209 aRamCanvas.drawFillCircle(3, 33, 2, aColor); // drawFillCircle(iCrd centerX, iCrd centerY, iCrd radiusX, clr color);
210 aRamCanvas.setDfltColor(bColor);
211 aRamCanvas.drawFillCircle(9, 33, 2); // drawFillCircle(iCrd centerX, iCrd centerY, iCrd radiusX);
212 aRamCanvas.moveTo(15, 33);
213 aRamCanvas.setDfltColor(aColor);
214 aRamCanvas.drawFillCircle(2); // drawFillCircle(iCrd radiusX);
215 aRamCanvas.drawFillCircle(21.0, 34.0, 2.0, bColor); // drawFillCircle(fCrd centerX, fCrd centerY, fCrd radiusX, clr color);
216 aRamCanvas.setDfltColor(aColor);
217 aRamCanvas.drawFillCircle(27.0, 34.0, 2.0); // drawFillCircle(fCrd centerX, fCrd centerY, fCrd radiusX);
218 aRamCanvas.moveTo(33.0, 34.0);
219 aRamCanvas.setDfltColor(bColor);
220 aRamCanvas.drawFillCircle(2.0); // drawFillCircle(fCrd radiusX);
221 aRamCanvas.drawFillCircle(mjr::ramCanvasRGB8b::pointIntType({39, 33}), 2, aColor); // drawFillCircle(iPnt centerPoint, iCrd radiusX, clr color);
222 aRamCanvas.setDfltColor(bColor);
223 aRamCanvas.drawFillCircle(mjr::ramCanvasRGB8b::pointIntType({45, 33}), 2); // drawFillCircle(iPnt centerPoint, iCrd radiusX);
224 aRamCanvas.drawFillCircle(mjr::ramCanvasRGB8b::pointFltType({51.0, 34.0}), 2.0, aColor); // drawFillCircle(fPnt centerPoint, fCrd radiusX, clr color);
225 aRamCanvas.setDfltColor(bColor);
226 aRamCanvas.drawFillCircle(mjr::ramCanvasRGB8b::pointFltType({57.0, 34.0}), 2.0); // drawFillCircle(fPnt centerPoint, fCrd radiusX);
227 //------------------------------------------------------------------------------------------------------------------------------------------------------------
228 aRamCanvas.drawRectangle(2, 38, 4, 40, aColor); // drawRectangle(iCrd x1, iCrd y1, iCrd x2, iCrd y2, clr color);
229 aRamCanvas.setDfltColor(bColor);
230 aRamCanvas.drawRectangle(6, 38, 8, 40); // drawRectangle(iCrd x1, iCrd y1, iCrd x2, iCrd y2);
231 aRamCanvas.drawRectangle(10.0, 39.0, 12.0, 41.0, aColor); // drawRectangle(fCrd x1, fCrd y1, fCrd x2, fCrd y2, clr color);
232 aRamCanvas.setDfltColor(bColor);
233 aRamCanvas.drawRectangle(14.0, 39.0, 16.0, 41.0); // drawRectangle(fCrd x1, fCrd y1, fCrd x2, fCrd y2);
234 aRamCanvas.drawRectangle(mjr::ramCanvasRGB8b::pointIntType({18, 38}),
235 mjr::ramCanvasRGB8b::pointIntType({20, 40}), aColor); // drawRectangle(iPnt point1, iPnt point2, clr color);
236 aRamCanvas.setDfltColor(bColor);
237 aRamCanvas.drawRectangle(mjr::ramCanvasRGB8b::pointIntType({22, 38}),
238 mjr::ramCanvasRGB8b::pointIntType({24, 40})); // drawRectangle(iPnt point1, iPnt point2);
239 aRamCanvas.drawRectangle(mjr::ramCanvasRGB8b::pointFltType({26.0, 39.0}),
240 mjr::ramCanvasRGB8b::pointFltType({28.0, 41.0}), aColor); // drawRectangle(fPnt point1, fPnt point2, clr color);
241 aRamCanvas.setDfltColor(bColor);
242 aRamCanvas.drawRectangle(mjr::ramCanvasRGB8b::pointFltType({30.0, 39.0}),
243 mjr::ramCanvasRGB8b::pointFltType({32.0, 41.0})); // drawRectangle(fPnt point1, fPnt point2);
244 mjr::ramCanvasRGB8b::pointIntType ptl9[2] = { {34, 38}, {36, 40} };
245 aRamCanvas.drawRectangle(ptl9, aColor); // drawRectangle(iPnt *thePoints, clr color);
246 mjr::ramCanvasRGB8b::pointIntType ptl10[2] = { {38, 38}, {40, 40} };
247 aRamCanvas.setDfltColor(bColor);
248 aRamCanvas.drawRectangle(ptl10); // drawRectangle(iPnt *thePoints);
249 mjr::ramCanvasRGB8b::pointFltType ptl11[2] = { {42.0, 39.0}, {44.0, 41.0} };
250 aRamCanvas.drawRectangle(ptl11, aColor); // drawRectangle(fPnt *thePoints, clr color);
251 mjr::ramCanvasRGB8b::pointFltType ptl12[2] = { {46.0, 39.0}, {48.0, 41.0} };
252 aRamCanvas.setDfltColor(bColor);
253 aRamCanvas.drawRectangle(ptl12); // drawRectangle(fPnt *thePoints);
254 //------------------------------------------------------------------------------------------------------------------------------------------------------------
255 aRamCanvas.drawFillRectangle(2, 42, 4, 44, aColor); // drawFillRectangle(iCrd x1, iCrd y1, iCrd x2, iCrd y2, clr color);
256 aRamCanvas.setDfltColor(bColor);
257 aRamCanvas.drawFillRectangle(6, 42, 8, 44); // drawFillRectangle(fCrd x1, fCrd y1, fCrd x2, fCrd y2);
258 aRamCanvas.drawFillRectangle(10.0, 43.0, 12.0, 45.0, aColor); // drawFillRectangle(fCrd x1, fCrd y1, fCrd x2, fCrd y2, clr color);
259 aRamCanvas.setDfltColor(bColor);
260 aRamCanvas.drawFillRectangle(14.0, 43.0, 16.0, 45.0); // drawFillRectangle(iCrd x1, iCrd y1, iCrd x2, iCrd y2);
261 aRamCanvas.drawFillRectangle(mjr::ramCanvasRGB8b::pointIntType({18, 42}),
262 mjr::ramCanvasRGB8b::pointIntType({20, 44}), aColor); // drawFillRectangle(iPnt point1, iPnt point2, clr color);
263 aRamCanvas.setDfltColor(bColor);
264 aRamCanvas.drawFillRectangle(mjr::ramCanvasRGB8b::pointIntType({22, 42}),
265 mjr::ramCanvasRGB8b::pointIntType({24, 44})); // drawFillRectangle(iPnt point1, iPnt point2);
266 aRamCanvas.drawFillRectangle(mjr::ramCanvasRGB8b::pointFltType({26.0, 43.0}),
267 mjr::ramCanvasRGB8b::pointFltType({28.0, 45.0}), aColor); // drawFillRectangle(fPnt point1, fPnt point2, clr color);
268 aRamCanvas.setDfltColor(bColor);
269 aRamCanvas.drawFillRectangle(mjr::ramCanvasRGB8b::pointFltType({30.0, 43.0}),
270 mjr::ramCanvasRGB8b::pointFltType({32.0, 45.0})); // drawFillRectangle(fPnt point1, fPnt point2);
271 mjr::ramCanvasRGB8b::pointIntType ptl13[2] = { {34, 42}, {36, 44} };
272 aRamCanvas.drawFillRectangle(ptl13, aColor); // drawFillRectangle(iPnt *thePoints, clr color);
273 mjr::ramCanvasRGB8b::pointIntType ptl14[2] = { {38, 42}, {40, 44} };
274 aRamCanvas.setDfltColor(bColor);
275 aRamCanvas.drawFillRectangle(ptl14); // drawFillRectangle(iPnt *thePoints);
276 mjr::ramCanvasRGB8b::pointFltType ptl15[2] = { {42.0, 43.0}, {44.0, 45.0} };
277 aRamCanvas.drawFillRectangle(ptl15, aColor); // drawFillRectangle(fPnt *thePoints, clr color);
278 mjr::ramCanvasRGB8b::pointFltType ptl16[2] = { {46.0, 43.0}, {48.0, 45.0} };
279 aRamCanvas.setDfltColor(bColor);
280 aRamCanvas.drawFillRectangle(ptl16); // drawFillRectangle(fPnt *thePoints);
281 //------------------------------------------------------------------------------------------------------------------------------------------------------------
282 mjr::ramCanvasRGB8b::coordIntType icx1[3] = { 2, 4, 4 };
283 mjr::ramCanvasRGB8b::coordIntType icy1[3] = { 46, 46, 48 };
284 aRamCanvas.drawPLCurve(3, icx1, icy1, aColor); // drawPLCurve(int numPoints, iCrd *x, iCrd *y, clr color);
285 mjr::ramCanvasRGB8b::coordIntType icx2[3] = { 6, 8, 8 };
286 mjr::ramCanvasRGB8b::coordIntType icy2[3] = { 46, 46, 48 };
287 aRamCanvas.setDfltColor(bColor);
288 aRamCanvas.drawPLCurve(3, icx2, icy2); // drawPLCurve(int numPoints, iCrd *x, iCrd *y);
289 mjr::ramCanvasRGB8b::coordFltType fcx1[3] = { 10.0, 12.0, 12.0 };
290 mjr::ramCanvasRGB8b::coordFltType fcy1[3] = { 47.0, 47.0, 49.0 };
291 aRamCanvas.drawPLCurve(3, fcx1, fcy1, aColor); // drawPLCurve(int numPoints, fCrd *x, fCrd *y, clr color);
292 mjr::ramCanvasRGB8b::coordFltType fcx2[3] = { 14.0, 16.0, 16.0 };
293 mjr::ramCanvasRGB8b::coordFltType fcy2[3] = { 47.0, 47.0, 49.0 };
294 aRamCanvas.setDfltColor(bColor);
295 aRamCanvas.drawPLCurve(3, fcx2, fcy2); // drawPLCurve(int numPoints, fCrd *x, fCrd *y);
296 mjr::ramCanvasRGB8b::pointIntType ptl17[3] = { {18, 46},
297 {20, 46},
298 {20, 48} };
299 aRamCanvas.drawPLCurve(3, ptl17, aColor); // drawPLCurve(int numPoints, iPnt *thePoints, clr color);
300 mjr::ramCanvasRGB8b::pointIntType ptl18[3] = { {22, 46},
301 {24, 46},
302 {24, 48} };
303 aRamCanvas.setDfltColor(bColor);
304 aRamCanvas.drawPLCurve(3, ptl18); // drawPLCurve(int numPoints, iPnt *thePoints);
305 mjr::ramCanvasRGB8b::pointFltType ptl19[3] = { {26.0, 47.0},
306 {28.0, 47.0},
307 {28.0, 49.0} };
308 aRamCanvas.drawPLCurve(3, ptl19, aColor); // drawPLCurve(int numPoints, fPnt *thePoints, clr color);
309 mjr::ramCanvasRGB8b::pointFltType ptl20[3] = { {30.0, 47.0},
310 {32.0, 47.0},
311 {32.0, 49.0} };
312 aRamCanvas.setDfltColor(bColor);
313 aRamCanvas.drawPLCurve(3, ptl20); // drawPLCurve(int numPoints, fPnt *thePoints);
314
315 //------------------------------------------------------------------------------------------------------------------------------------------------------------
316 aRamCanvas.writeRAWfile("ut-draw_primatives_int.mrw");
317 BOOST_TEST_CHECK(RaRamCanvas.readRAWfile("../data/utest/ut-draw_primatives_int.mrw") == 0);
318 BOOST_TEST_CHECK(RaRamCanvas.isEqual(aRamCanvas) == true);
319
320 //------------------------------------------------------------------------------------------------------------------------------------------------------------
321 aRamCanvas.scaleUpProximal(5);
322 aRamCanvas.writeTIFFfile("ut-draw_primatives_int.tiff");
323}
324
325////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
326BOOST_AUTO_TEST_CASE(draw_primatives_flt) {
327
328 // We instantiate every drawing function in ramCanvas so that we can check for compile time errors and do some basic functionality testing.
329
330 const int BSIZE = 60;
331
332 mjr::ramCanvasRGB32F aRamCanvas(BSIZE, BSIZE, 0, BSIZE-1, 0, BSIZE-1); mjr::ramCanvasRGB32F RaRamCanvas(BSIZE, BSIZE, 0, BSIZE-1, 0, BSIZE-1);
333 mjr::colorRGB32F aColor(mjr::colorRGB32F::cornerColorEnum::RED);
334 mjr::colorRGB32F bColor(mjr::colorRGB32F::cornerColorEnum::GREEN);
335
336 //------------------------------------------------------------------------------------------------------------------------------------------------------------
337 aRamCanvas.drawPoint(1, 1, aColor); // drawPoint(iCrd x, iCrd y, clr color);
338 aRamCanvas.setDfltColor(bColor);
339 aRamCanvas.moveTo(2, 1);
340 aRamCanvas.drawPoint(); // drawPoint();
341 aRamCanvas.moveTo(3, 1);
342 aRamCanvas.drawPoint(aColor); // drawPoint(clr color);
343 aRamCanvas.setDfltColor(bColor);
344 aRamCanvas.drawPoint(4, 1); // drawPoint(iCrd x, iCrd y);
345 aRamCanvas.setDfltColor(aColor);
346 aRamCanvas.drawPoint(5.0, 2.0); // drawPoint(fCrd x, fCrd y);
347 aRamCanvas.drawPoint(6.0, 2.0, bColor); // drawPoint(fCrd x, fCrd y, clr color);
348 aRamCanvas.drawPoint(mjr::ramCanvasRGB32F::pointIntType({7, 1}), aColor); // drawPoint(iPnt thePoint, clr color);
349 aRamCanvas.setDfltColor(bColor);
350 aRamCanvas.drawPoint(mjr::ramCanvasRGB32F::pointIntType({8, 1})); // drawPoint(iPnt thePoint);
351 aRamCanvas.setDfltColor(aColor);
352 aRamCanvas.drawPoint(mjr::ramCanvasRGB32F::pointFltType({9.0, 2.0})); // drawPoint(fPnt thePoint);
353 aRamCanvas.drawPoint(mjr::ramCanvasRGB32F::pointFltType({10.0, 2.0}), bColor); // drawPoint(fPnt thePoint, clr color);
354 //------------------------------------------------------------------------------------------------------------------------------------------------------------
355 aRamCanvas.drawLine(1, 4, 1, 6, aColor); // drawLine(iCrd x1, iCrd y1, iCrd x2, iCrd y2, clr color);
356 aRamCanvas.setDfltColor(bColor);
357 aRamCanvas.moveTo(2, 4);
358 aRamCanvas.drawLine(2, 6); // drawLine(iCrd x, iCrd y);
359 aRamCanvas.setDfltColor(aColor);
360 aRamCanvas.moveTo(3.0, 5.0);
361 aRamCanvas.drawLine(3.0, 7.0); // drawLine(fCrd x, fCrd y);
362 aRamCanvas.moveTo(4, 4);
363 aRamCanvas.drawLine(4, 6, bColor); // drawLine(iCrd x, iCrd y, clr color);
364 aRamCanvas.moveTo(5.0, 5.0);
365 aRamCanvas.drawLine(5.0, 7.0, aColor); // drawLine(fCrd x, fCrd y, clr color);
366 aRamCanvas.setDfltColor(bColor);
367 aRamCanvas.drawLine(6, 4, 6, 6); // drawLine(iCrd x1, iCrd y1, iCrd x2, iCrd y2);
368 aRamCanvas.setDfltColor(aColor);
369 aRamCanvas.drawLine(7.0, 5.0, 7.0, 7.0); // drawLine(fCrd x1, fCrd y1, fCrd x2, fCrd y2);
370 aRamCanvas.drawLine(8.0, 5.0, 8.0, 7.0, bColor); // drawLine(fCrd x1, fCrd y1, fCrd x2, fCrd y2, clr color);
371 aRamCanvas.setDfltColor(aColor);
372 aRamCanvas.moveTo(mjr::ramCanvasRGB32F::pointFltType({9.0, 5.0}));
373 aRamCanvas.drawLine(mjr::ramCanvasRGB32F::pointFltType({9.0, 7.0})); // drawLine(fPnt point1);
374 aRamCanvas.moveTo(10.0, 5.0);
375 aRamCanvas.drawLine(mjr::ramCanvasRGB32F::pointFltType({10.0, 7.0}), bColor); // drawLine(fPnt point1, clr color);
376 aRamCanvas.setDfltColor(aColor);
377 aRamCanvas.moveTo(11, 4);
378 aRamCanvas.drawLine(mjr::ramCanvasRGB32F::pointIntType({11, 6})); // drawLine(iPnt point1);
379 aRamCanvas.setDfltColor(bColor);
380 aRamCanvas.moveTo(mjr::ramCanvasRGB32F::pointIntType({12, 4}));
381 aRamCanvas.drawLine(mjr::ramCanvasRGB32F::pointIntType({12, 6}), aColor); // drawLine(iPnt point1, clr color);
382 aRamCanvas.setDfltColor(bColor);
383 aRamCanvas.drawLine(mjr::ramCanvasRGB32F::pointFltType({13, 5.0}),
384 mjr::ramCanvasRGB32F::pointFltType({13, 7.0})); // drawLine(fPnt point1, fPnt point2);
385 aRamCanvas.drawLine(mjr::ramCanvasRGB32F::pointFltType({14, 5.0}),
386 mjr::ramCanvasRGB32F::pointFltType({14, 7.0}), aColor); // drawLine(fPnt point1, fPnt point2, clr color);
387 aRamCanvas.setDfltColor(bColor);
388 aRamCanvas.drawLine(mjr::ramCanvasRGB32F::pointIntType({15, 4}),
389 mjr::ramCanvasRGB32F::pointIntType({15, 6})); // drawLine(iPnt point1, iPnt point2);
390 aRamCanvas.drawLine(mjr::ramCanvasRGB32F::pointIntType({16, 5}),
391 mjr::ramCanvasRGB32F::pointIntType({16, 6}), aColor); // drawLine(iPnt point1, iPnt point2, clr color);
392 //------------------------------------------------------------------------------------------------------------------------------------------------------------
393 aRamCanvas.drawTriangle(1, 9, 4, 9, 4, 12, aColor); // drawTriangle(iCrd x1, iCrd y1, iCrd x2, iCrd y2, iCrd x3, iCrd y3,
394 // clr color);
395 aRamCanvas.setDfltColor(bColor);
396 aRamCanvas.drawTriangle(6, 9, 9, 9, 9, 12); // drawTriangle(iCrd x1, iCrd y1, iCrd x2, iCrd y2, iCrd x3, iCrd y3);
397 aRamCanvas.drawTriangle(11.0, 10.0, 14.0, 10.0, 14.0, 13.0, aColor); // drawTriangle(fCrd x1, fCrd y1, fCrd x2, fCrd y2, fCrd x3, fCrd y3,
398 // clr color);
399 aRamCanvas.setDfltColor(bColor);
400 aRamCanvas.drawTriangle(16.0, 10.0, 19.0, 10.0, 19.0, 13.0); // drawTriangle(fCrd x1, fCrd y1, fCrd x2, fCrd y2, fCrd x3, fCrd y3);
401 aRamCanvas.drawTriangle(mjr::ramCanvasRGB32F::pointIntType({1, 14}),
402 mjr::ramCanvasRGB32F::pointIntType({4, 14}),
403 mjr::ramCanvasRGB32F::pointIntType({4, 17}), aColor); // drawTriangle(iPnt point1, iPnt point2, iPnt point3, clr color);
404 aRamCanvas.setDfltColor(bColor);
405 aRamCanvas.drawTriangle(mjr::ramCanvasRGB32F::pointIntType({6, 14}),
406 mjr::ramCanvasRGB32F::pointIntType({9, 14}),
407 mjr::ramCanvasRGB32F::pointIntType({9, 17})); // drawTriangle(iPnt point1, iPnt point2, iPnt point3);
408 aRamCanvas.drawTriangle(mjr::ramCanvasRGB32F::pointFltType({11.0, 15.0}),
409 mjr::ramCanvasRGB32F::pointFltType({14.0, 15.0}),
410 mjr::ramCanvasRGB32F::pointFltType({14.0, 18.0}), aColor); // drawTriangle(fPnt point1, fPnt point2, fPnt point3, clr color);
411 aRamCanvas.setDfltColor(bColor);
412 aRamCanvas.drawTriangle(mjr::ramCanvasRGB32F::pointFltType({16.0, 15.0}),
413 mjr::ramCanvasRGB32F::pointFltType({19.0, 15.0}),
414 mjr::ramCanvasRGB32F::pointFltType({19.0, 18.0})); // drawTriangle(fPnt point1, fPnt point2, fPnt point3);
415 mjr::ramCanvasRGB32F::pointIntType ptl1[3] = { {1, 19}, {4, 19}, {4, 22} };
416 aRamCanvas.drawTriangle(ptl1, aColor); // drawTriangle(iPnt *thePoints, clr color);
417 mjr::ramCanvasRGB32F::pointIntType ptl2[3] = { {6, 19}, {9, 19}, {9, 22} };
418 aRamCanvas.setDfltColor(bColor);
419 aRamCanvas.drawTriangle(ptl2); // drawTriangle(iPnt *thePoints);
420 mjr::ramCanvasRGB32F::pointFltType ptl3[3] = { {11.0, 20.0},
421 {14.0, 20.0},
422 {14.0, 23.0} };
423 aRamCanvas.drawTriangle(ptl3, aColor); // drawTriangle(fPnt *thePoints, clr color);
424 mjr::ramCanvasRGB32F::pointFltType ptl4[3] = { {16.0, 20.0},
425 {19.0, 20.0},
426 {19.0, 23.0} };
427 aRamCanvas.setDfltColor(bColor);
428 aRamCanvas.drawTriangle(ptl4); // drawTriangle(fPnt *thePoints);
429 //------------------------------------------------------------------------------------------------------------------------------------------------------------
430 aRamCanvas.drawFillTriangle(21, 9, 24, 9, 24, 12, aColor); // drawFillTriangle(iCrd x1, iCrd y1, iCrd x2, iCrd y2, iCrd x3, iCrd y3,
431 // clr color);
432 aRamCanvas.setDfltColor(bColor);
433 aRamCanvas.drawFillTriangle(26, 9, 29, 9, 29, 12); // drawFillTriangle(iCrd x1, iCrd y1, iCrd x2, iCrd y2, iCrd x3, iCrd y3);
434 aRamCanvas.drawFillTriangle(31.0, 10.0, 34.0, 10.0, 34.0, 13.0, aColor); // drawFillTriangle(fCrd x1, fCrd y1, fCrd x2, fCrd y2, fCrd x3, fCrd y3
435 // clr color);
436 aRamCanvas.setDfltColor(bColor);
437 aRamCanvas.drawFillTriangle(36.0, 10.0, 39.0, 10.0, 39.0, 13.0); // drawFillTriangle(fCrd x1, fCrd y1, fCrd x2, fCrd y2, fCrd x3, fCrd y3);
438 aRamCanvas.drawFillTriangle(mjr::ramCanvasRGB32F::pointIntType({21, 14}),
439 mjr::ramCanvasRGB32F::pointIntType({24, 14}),
440 mjr::ramCanvasRGB32F::pointIntType({24, 17}), aColor); // drawFillTriangle(iPnt point1, iPnt point2, iPnt point3, clr color);
441 aRamCanvas.setDfltColor(bColor);
442 aRamCanvas.drawFillTriangle(mjr::ramCanvasRGB32F::pointIntType({26, 14}),
443 mjr::ramCanvasRGB32F::pointIntType({29, 14}),
444 mjr::ramCanvasRGB32F::pointIntType({29, 17})); // drawFillTriangle(iPnt point1, iPnt point2, iPnt point3);
445 aRamCanvas.drawFillTriangle(mjr::ramCanvasRGB32F::pointFltType({31.0, 15.0}),
446 mjr::ramCanvasRGB32F::pointFltType({34.0, 15.0}),
447 mjr::ramCanvasRGB32F::pointFltType({34.0, 18.0}), aColor); // drawFillTriangle(fPnt point1, fPnt point2, fPnt point3, clr color);
448 aRamCanvas.setDfltColor(bColor);
449 aRamCanvas.drawFillTriangle(mjr::ramCanvasRGB32F::pointFltType({36.0, 15.0}),
450 mjr::ramCanvasRGB32F::pointFltType({39.0, 15.0}),
451 mjr::ramCanvasRGB32F::pointFltType({39.0, 18.0})); // drawFillTriangle(fPnt point1, fPnt point2, fPnt point3);
452 mjr::ramCanvasRGB32F::pointIntType ptl5[3] = { {21, 19}, {24, 19}, {24, 22} };
453 aRamCanvas.drawFillTriangle(ptl5, aColor); // drawFillTriangle(iPnt *thePoints, clr color);
454 mjr::ramCanvasRGB32F::pointIntType ptl6[3] = { {26, 19}, {29, 19}, {29, 22} };
455 aRamCanvas.setDfltColor(bColor);
456 aRamCanvas.drawFillTriangle(ptl6); // drawFillTriangle(iPnt *thePoints);
457 mjr::ramCanvasRGB32F::pointFltType ptl7[3] = { {31.0, 20.0},
458 {34.0, 20.0},
459 {34.0, 23.0} };
460 aRamCanvas.drawFillTriangle(ptl7, aColor); // drawFillTriangle(fPnt *thePoints, clr color);
461 mjr::ramCanvasRGB32F::pointFltType ptl8[3] = { {36.0, 20.0},
462 {39.0, 20.0},
463 {39.0, 23.0} };
464 aRamCanvas.setDfltColor(bColor);
465 aRamCanvas.drawFillTriangle(ptl8); // drawFillTriangle(fPnt *thePoints);
466 //------------------------------------------------------------------------------------------------------------------------------------------------------------
467 aRamCanvas.drawCircle(3, 27, 2, aColor); // drawCircle(iCrd centerX, iCrd centerY, iCrd radiusX, clr color);
468 aRamCanvas.setDfltColor(bColor);
469 aRamCanvas.drawCircle(9, 27, 2); // drawCircle(iCrd centerX, iCrd centerY, iCrd radius);
470 aRamCanvas.moveTo(15, 27);
471 aRamCanvas.setDfltColor(aColor);
472 aRamCanvas.drawCircle(2); // drawCircle(iCrd radius);
473 aRamCanvas.drawCircle(21.0, 28.0, 2.0, bColor); // drawCircle(fCrd centerX, fCrd centerY, fCrd radiusX, clr color);
474 aRamCanvas.setDfltColor(aColor);
475 aRamCanvas.drawCircle(27.0, 28.0, 2.0); // drawCircle(fCrd centerX, fCrd centerY, fCrd radiusX);
476 aRamCanvas.moveTo(33.0, 28.0);
477 aRamCanvas.setDfltColor(bColor);
478 aRamCanvas.drawCircle(2.0); // drawCircle(fCrd radiusX);
479 aRamCanvas.drawCircle(mjr::ramCanvasRGB32F::pointIntType({39, 27}), 2, aColor); // drawCircle(iPnt centerPoint, iCrd radiusX, clr color);
480 aRamCanvas.setDfltColor(bColor);
481 aRamCanvas.drawCircle(mjr::ramCanvasRGB32F::pointIntType({45, 27}), 2); // drawCircle(iPnt centerPoint, iCrd radiusX);
482 aRamCanvas.drawCircle(mjr::ramCanvasRGB32F::pointFltType({51.0, 28.0}), 2.0, aColor); // drawCircle(fPnt centerPoint, fCrd radiusX, clr color);
483 aRamCanvas.setDfltColor(bColor);
484 aRamCanvas.drawCircle(mjr::ramCanvasRGB32F::pointFltType({57.0, 28.0}), 2.0); // drawCircle(fPnt centerPoint, fCrd radiusX);
485 //------------------------------------------------------------------------------------------------------------------------------------------------------------
486 aRamCanvas.drawFillCircle(3, 33, 2, aColor); // drawFillCircle(iCrd centerX, iCrd centerY, iCrd radiusX, clr color);
487 aRamCanvas.setDfltColor(bColor);
488 aRamCanvas.drawFillCircle(9, 33, 2); // drawFillCircle(iCrd centerX, iCrd centerY, iCrd radiusX);
489 aRamCanvas.moveTo(15, 33);
490 aRamCanvas.setDfltColor(aColor);
491 aRamCanvas.drawFillCircle(2); // drawFillCircle(iCrd radiusX);
492 aRamCanvas.drawFillCircle(21.0, 34.0, 2.0, bColor); // drawFillCircle(fCrd centerX, fCrd centerY, fCrd radiusX, clr color);
493 aRamCanvas.setDfltColor(aColor);
494 aRamCanvas.drawFillCircle(27.0, 34.0, 2.0); // drawFillCircle(fCrd centerX, fCrd centerY, fCrd radiusX);
495 aRamCanvas.moveTo(33.0, 34.0);
496 aRamCanvas.setDfltColor(bColor);
497 aRamCanvas.drawFillCircle(2.0); // drawFillCircle(fCrd radiusX);
498 aRamCanvas.drawFillCircle(mjr::ramCanvasRGB32F::pointIntType({39, 33}), 2, aColor); // drawFillCircle(iPnt centerPoint, iCrd radiusX, clr color);
499 aRamCanvas.setDfltColor(bColor);
500 aRamCanvas.drawFillCircle(mjr::ramCanvasRGB32F::pointIntType({45, 33}), 2); // drawFillCircle(iPnt centerPoint, iCrd radiusX);
501 aRamCanvas.drawFillCircle(mjr::ramCanvasRGB32F::pointFltType({51.0, 34.0}), 2.0, aColor); // drawFillCircle(fPnt centerPoint, fCrd radiusX, clr color);
502 aRamCanvas.setDfltColor(bColor);
503 aRamCanvas.drawFillCircle(mjr::ramCanvasRGB32F::pointFltType({57.0, 34.0}), 2.0); // drawFillCircle(fPnt centerPoint, fCrd radiusX);
504 //------------------------------------------------------------------------------------------------------------------------------------------------------------
505 aRamCanvas.drawRectangle(2, 38, 4, 40, aColor); // drawRectangle(iCrd x1, iCrd y1, iCrd x2, iCrd y2, clr color);
506 aRamCanvas.setDfltColor(bColor);
507 aRamCanvas.drawRectangle(6, 38, 8, 40); // drawRectangle(iCrd x1, iCrd y1, iCrd x2, iCrd y2);
508 aRamCanvas.drawRectangle(10.0, 39.0, 12.0, 41.0, aColor); // drawRectangle(fCrd x1, fCrd y1, fCrd x2, fCrd y2, clr color);
509 aRamCanvas.setDfltColor(bColor);
510 aRamCanvas.drawRectangle(14.0, 39.0, 16.0, 41.0); // drawRectangle(fCrd x1, fCrd y1, fCrd x2, fCrd y2);
511 aRamCanvas.drawRectangle(mjr::ramCanvasRGB32F::pointIntType({18, 38}),
512 mjr::ramCanvasRGB32F::pointIntType({20, 40}), aColor); // drawRectangle(iPnt point1, iPnt point2, clr color);
513 aRamCanvas.setDfltColor(bColor);
514 aRamCanvas.drawRectangle(mjr::ramCanvasRGB32F::pointIntType({22, 38}),
515 mjr::ramCanvasRGB32F::pointIntType({24, 40})); // drawRectangle(iPnt point1, iPnt point2);
516 aRamCanvas.drawRectangle(mjr::ramCanvasRGB32F::pointFltType({26.0, 39.0}),
517 mjr::ramCanvasRGB32F::pointFltType({28.0, 41.0}), aColor); // drawRectangle(fPnt point1, fPnt point2, clr color);
518 aRamCanvas.setDfltColor(bColor);
519 aRamCanvas.drawRectangle(mjr::ramCanvasRGB32F::pointFltType({30.0, 39.0}),
520 mjr::ramCanvasRGB32F::pointFltType({32.0, 41.0})); // drawRectangle(fPnt point1, fPnt point2);
521 mjr::ramCanvasRGB32F::pointIntType ptl9[2] = { {34, 38}, {36, 40} };
522 aRamCanvas.drawRectangle(ptl9, aColor); // drawRectangle(iPnt *thePoints, clr color);
523 mjr::ramCanvasRGB32F::pointIntType ptl10[2] = { {38, 38}, {40, 40} };
524 aRamCanvas.setDfltColor(bColor);
525 aRamCanvas.drawRectangle(ptl10); // drawRectangle(iPnt *thePoints);
526 mjr::ramCanvasRGB32F::pointFltType ptl11[2] = { {42.0, 39.0}, {44.0, 41.0} };
527 aRamCanvas.drawRectangle(ptl11, aColor); // drawRectangle(fPnt *thePoints, clr color);
528 mjr::ramCanvasRGB32F::pointFltType ptl12[2] = { {46.0, 39.0}, {48.0, 41.0} };
529 aRamCanvas.setDfltColor(bColor);
530 aRamCanvas.drawRectangle(ptl12); // drawRectangle(fPnt *thePoints);
531 //------------------------------------------------------------------------------------------------------------------------------------------------------------
532 aRamCanvas.drawFillRectangle(2, 42, 4, 44, aColor); // drawFillRectangle(iCrd x1, iCrd y1, iCrd x2, iCrd y2, clr color);
533 aRamCanvas.setDfltColor(bColor);
534 aRamCanvas.drawFillRectangle(6, 42, 8, 44); // drawFillRectangle(fCrd x1, fCrd y1, fCrd x2, fCrd y2);
535 aRamCanvas.drawFillRectangle(10.0, 43.0, 12.0, 45.0, aColor); // drawFillRectangle(fCrd x1, fCrd y1, fCrd x2, fCrd y2, clr color);
536 aRamCanvas.setDfltColor(bColor);
537 aRamCanvas.drawFillRectangle(14.0, 43.0, 16.0, 45.0); // drawFillRectangle(iCrd x1, iCrd y1, iCrd x2, iCrd y2);
538 aRamCanvas.drawFillRectangle(mjr::ramCanvasRGB32F::pointIntType({18, 42}),
539 mjr::ramCanvasRGB32F::pointIntType({20, 44}), aColor); // drawFillRectangle(iPnt point1, iPnt point2, clr color);
540 aRamCanvas.setDfltColor(bColor);
541 aRamCanvas.drawFillRectangle(mjr::ramCanvasRGB32F::pointIntType({22, 42}),
542 mjr::ramCanvasRGB32F::pointIntType({24, 44})); // drawFillRectangle(iPnt point1, iPnt point2);
543 aRamCanvas.drawFillRectangle(mjr::ramCanvasRGB32F::pointFltType({26.0, 43.0}),
544 mjr::ramCanvasRGB32F::pointFltType({28.0, 45.0}), aColor); // drawFillRectangle(fPnt point1, fPnt point2, clr color);
545 aRamCanvas.setDfltColor(bColor);
546 aRamCanvas.drawFillRectangle(mjr::ramCanvasRGB32F::pointFltType({30.0, 43.0}),
547 mjr::ramCanvasRGB32F::pointFltType({32.0, 45.0})); // drawFillRectangle(fPnt point1, fPnt point2);
548 mjr::ramCanvasRGB32F::pointIntType ptl13[2] = { {34, 42}, {36, 44} };
549 aRamCanvas.drawFillRectangle(ptl13, aColor); // drawFillRectangle(iPnt *thePoints, clr color);
550 mjr::ramCanvasRGB32F::pointIntType ptl14[2] = { {38, 42}, {40, 44} };
551 aRamCanvas.setDfltColor(bColor);
552 aRamCanvas.drawFillRectangle(ptl14); // drawFillRectangle(iPnt *thePoints);
553 mjr::ramCanvasRGB32F::pointFltType ptl15[2] = { {42.0, 43.0}, {44.0, 45.0} };
554 aRamCanvas.drawFillRectangle(ptl15, aColor); // drawFillRectangle(fPnt *thePoints, clr color);
555 mjr::ramCanvasRGB32F::pointFltType ptl16[2] = { {46.0, 43.0}, {48.0, 45.0} };
556 aRamCanvas.setDfltColor(bColor);
557 aRamCanvas.drawFillRectangle(ptl16); // drawFillRectangle(fPnt *thePoints);
558 //------------------------------------------------------------------------------------------------------------------------------------------------------------
559 mjr::ramCanvasRGB32F::coordIntType icx1[3] = { 2, 4, 4 };
560 mjr::ramCanvasRGB32F::coordIntType icy1[3] = { 46, 46, 48 };
561 aRamCanvas.drawPLCurve(3, icx1, icy1, aColor); // drawPLCurve(int numPoints, iCrd *x, iCrd *y, clr color);
562 mjr::ramCanvasRGB32F::coordIntType icx2[3] = { 6, 8, 8 };
563 mjr::ramCanvasRGB32F::coordIntType icy2[3] = { 46, 46, 48 };
564 aRamCanvas.setDfltColor(bColor);
565 aRamCanvas.drawPLCurve(3, icx2, icy2); // drawPLCurve(int numPoints, iCrd *x, iCrd *y);
566 mjr::ramCanvasRGB32F::coordFltType fcx1[3] = { 10.0, 12.0, 12.0 };
567 mjr::ramCanvasRGB32F::coordFltType fcy1[3] = { 47.0, 47.0, 49.0 };
568 aRamCanvas.drawPLCurve(3, fcx1, fcy1, aColor); // drawPLCurve(int numPoints, fCrd *x, fCrd *y, clr color);
569 mjr::ramCanvasRGB32F::coordFltType fcx2[3] = { 14.0, 16.0, 16.0 };
570 mjr::ramCanvasRGB32F::coordFltType fcy2[3] = { 47.0, 47.0, 49.0 };
571 aRamCanvas.setDfltColor(bColor);
572 aRamCanvas.drawPLCurve(3, fcx2, fcy2); // drawPLCurve(int numPoints, fCrd *x, fCrd *y);
573 mjr::ramCanvasRGB32F::pointIntType ptl17[3] = { {18, 46},
574 {20, 46},
575 {20, 48} };
576 aRamCanvas.drawPLCurve(3, ptl17, aColor); // drawPLCurve(int numPoints, iPnt *thePoints, clr color);
577 mjr::ramCanvasRGB32F::pointIntType ptl18[3] = { {22, 46},
578 {24, 46},
579 {24, 48} };
580 aRamCanvas.setDfltColor(bColor);
581 aRamCanvas.drawPLCurve(3, ptl18); // drawPLCurve(int numPoints, iPnt *thePoints);
582 mjr::ramCanvasRGB32F::pointFltType ptl19[3] = { {26.0, 47.0},
583 {28.0, 47.0},
584 {28.0, 49.0} };
585 aRamCanvas.drawPLCurve(3, ptl19, aColor); // drawPLCurve(int numPoints, fPnt *thePoints, clr color);
586 mjr::ramCanvasRGB32F::pointFltType ptl20[3] = { {30.0, 47.0},
587 {32.0, 47.0},
588 {32.0, 49.0} };
589 aRamCanvas.setDfltColor(bColor);
590 aRamCanvas.drawPLCurve(3, ptl20); // drawPLCurve(int numPoints, fPnt *thePoints);
591
592 //------------------------------------------------------------------------------------------------------------------------------------------------------------
593 aRamCanvas.writeRAWfile("ut-draw_primatives_flt.mrw");
594 BOOST_TEST_CHECK(RaRamCanvas.readRAWfile("../data/utest/ut-draw_primatives_flt.mrw") == 0);
595 BOOST_TEST_CHECK(RaRamCanvas.isEqual(aRamCanvas) == true);
596
597 //------------------------------------------------------------------------------------------------------------------------------------------------------------
598 aRamCanvas.scaleUpProximal(5);
599 aRamCanvas.writeTIFFfile("ut-draw_primatives_flt.tiff");
600}
601
602////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
603BOOST_AUTO_TEST_CASE(save_file) {
604
605 const int WIDE = 16;
606 const int TALL = 8;
607
608 mjr::ramCanvasRGB8b aRamCanvas(WIDE, TALL); mjr::ramCanvasRGB8b::colorType aColor; typedef mjr::ramCanvasRGB8b::colorChanType aCt; mjr::ramCanvasRGB8b RaRamCanvas(WIDE, TALL);
609 mjr::ramCanvasRGB16b bRamCanvas(WIDE, TALL); mjr::ramCanvasRGB16b::colorType bColor; typedef mjr::ramCanvasRGB16b::colorChanType bCt; mjr::ramCanvasRGB16b RbRamCanvas(WIDE, TALL);
610 mjr::ramCanvasRGB32b cRamCanvas(WIDE, TALL); mjr::ramCanvasRGB32b::colorType cColor; typedef mjr::ramCanvasRGB32b::colorChanType cCt; mjr::ramCanvasRGB32b RcRamCanvas(WIDE, TALL);
611 mjr::ramCanvasRGB64b dRamCanvas(WIDE, TALL); mjr::ramCanvasRGB64b::colorType dColor; typedef mjr::ramCanvasRGB64b::colorChanType dCt; mjr::ramCanvasRGB64b RdRamCanvas(WIDE, TALL);
612 mjr::ramCanvasRGB32F eRamCanvas(WIDE, TALL); mjr::ramCanvasRGB32F::colorType eColor; typedef mjr::ramCanvasRGB32F::colorChanType eCt; mjr::ramCanvasRGB32F ReRamCanvas(WIDE, TALL);
613 mjr::ramCanvasRGB64F fRamCanvas(WIDE, TALL); mjr::ramCanvasRGB64F::colorType fColor; typedef mjr::ramCanvasRGB64F::colorChanType fCt; mjr::ramCanvasRGB64F RfRamCanvas(WIDE, TALL);
614 mjr::ramCanvas1c8b gRamCanvas(WIDE, TALL); mjr::ramCanvas1c8b::colorType gColor; typedef mjr::ramCanvas1c8b::colorChanType gCt; mjr::ramCanvas1c8b RgRamCanvas(WIDE, TALL);
615 mjr::ramCanvas1c16b hRamCanvas(WIDE, TALL); mjr::ramCanvas1c16b::colorType hColor; typedef mjr::ramCanvas1c16b::colorChanType hCt; mjr::ramCanvas1c16b RhRamCanvas(WIDE, TALL);
616 mjr::ramCanvas1c32b iRamCanvas(WIDE, TALL); mjr::ramCanvas1c32b::colorType iColor; typedef mjr::ramCanvas1c32b::colorChanType iCt; mjr::ramCanvas1c32b RiRamCanvas(WIDE, TALL);
617 mjr::ramCanvas1c64b jRamCanvas(WIDE, TALL); mjr::ramCanvas1c64b::colorType jColor; typedef mjr::ramCanvas1c64b::colorChanType jCt; mjr::ramCanvas1c64b RjRamCanvas(WIDE, TALL);
618 mjr::ramCanvas1c32F kRamCanvas(WIDE, TALL); mjr::ramCanvas1c32F::colorType kColor; typedef mjr::ramCanvas1c32F::colorChanType kCt; mjr::ramCanvas1c32F RkRamCanvas(WIDE, TALL);
619 mjr::ramCanvas1c64F lRamCanvas(WIDE, TALL); mjr::ramCanvas1c64F::colorType lColor; typedef mjr::ramCanvas1c64F::colorChanType lCt; mjr::ramCanvas1c64F RlRamCanvas(WIDE, TALL);
620
621 for(int x=0;x<aRamCanvas.getNumPixX();x++)
622 for(int y=0;y<aRamCanvas.getNumPixY();y++) {
623 aRamCanvas.drawPoint(x, y, aColor.setChansRGB((aCt)x, (aCt)y, (aCt)(x+y)));
624 bRamCanvas.drawPoint(x, y, bColor.setChansRGB((bCt)x, (bCt)y, (bCt)(x+y)));
625 cRamCanvas.drawPoint(x, y, cColor.setChansRGB((cCt)x, (cCt)y, (cCt)(x+y)));
626 dRamCanvas.drawPoint(x, y, dColor.setChansRGB((dCt)x, (dCt)y, (dCt)(x+y)));
627 eRamCanvas.drawPoint(x, y, eColor.setChansRGB((eCt)x, (eCt)y, (eCt)(x+y)));
628 fRamCanvas.drawPoint(x, y, fColor.setChansRGB((fCt)x, (fCt)y, (fCt)(x+y)));
629 gRamCanvas.drawPoint(x, y, gColor.setChans((gCt)(x+y)));
630 hRamCanvas.drawPoint(x, y, hColor.setChans((hCt)(x+y)));
631 iRamCanvas.drawPoint(x, y, iColor.setChans((iCt)(x+y)));
632 jRamCanvas.drawPoint(x, y, jColor.setChans((jCt)(x+y)));
633 kRamCanvas.drawPoint(x, y, kColor.setChans((kCt)(x+y)));
634 lRamCanvas.drawPoint(x, y, lColor.setChans((lCt)(x+y)));
635 }
636
637 //------------------------------------------------------------------------------------------------------------------------------------------------------------
638 // Write TIFF files
639 aRamCanvas.writeTIFFfile("ut-save_file-a.tiff");
640 bRamCanvas.writeTIFFfile("ut-save_file-b.tiff");
641 cRamCanvas.writeTIFFfile("ut-save_file-c.tiff");
642 dRamCanvas.writeTIFFfile("ut-save_file-d.tiff");
643 eRamCanvas.writeTIFFfile("ut-save_file-e.tiff");
644 fRamCanvas.writeTIFFfile("ut-save_file-f.tiff");
645 gRamCanvas.writeTIFFfile("ut-save_file-g.tiff");
646 hRamCanvas.writeTIFFfile("ut-save_file-h.tiff");
647 iRamCanvas.writeTIFFfile("ut-save_file-i.tiff");
648 jRamCanvas.writeTIFFfile("ut-save_file-j.tiff");
649 kRamCanvas.writeTIFFfile("ut-save_file-k.tiff");
650 lRamCanvas.writeTIFFfile("ut-save_file-l.tiff");
651
652 //------------------------------------------------------------------------------------------------------------------------------------------------------------
653 // Write TIFF files
654
655 aRamCanvas.writeRAWfile("ut-save_file-a.mrw");
656 bRamCanvas.writeRAWfile("ut-save_file-b.mrw");
657 cRamCanvas.writeRAWfile("ut-save_file-c.mrw");
658 dRamCanvas.writeRAWfile("ut-save_file-d.mrw");
659 eRamCanvas.writeRAWfile("ut-save_file-e.mrw");
660 fRamCanvas.writeRAWfile("ut-save_file-f.mrw");
661 gRamCanvas.writeRAWfile("ut-save_file-g.mrw");
662 hRamCanvas.writeRAWfile("ut-save_file-h.mrw");
663 iRamCanvas.writeRAWfile("ut-save_file-i.mrw");
664 jRamCanvas.writeRAWfile("ut-save_file-j.mrw");
665 kRamCanvas.writeRAWfile("ut-save_file-k.mrw");
666 lRamCanvas.writeRAWfile("ut-save_file-l.mrw");
667
668
669 //------------------------------------------------------------------------------------------------------------------------------------------------------------
670 // Compare reference images with images just created
671
672 // I checked this file by hand on 2022-08-28. sha256: 94c07f28db463165acc539a88c8a31c13646890204c7548d72ec3b3bda851c9c
673 // hexDump.rb -t 0 -c -w 16 -b 3 -p 100 ut-save_file-a.mrw | less -SR
674 BOOST_TEST_CHECK(RaRamCanvas.readRAWfile("../data/utest/ut-save_file-a.mrw") == 0);
675 BOOST_TEST_CHECK(RaRamCanvas.isEqual(aRamCanvas) == true);
676
677 // I checked this file by hand on 2022-08-28. sha256: daeac55ba6fdf084ece356ce86fba5f0b501ba375b0765d3b1e0aed91bde78b5
678 // hexDump.rb -t 0 -c -w 16 -b 6 -p 100 ut-save_file-b.mrw | less -RS
679 BOOST_TEST_CHECK(RbRamCanvas.readRAWfile("../data/utest/ut-save_file-b.mrw") == 0);
680 BOOST_TEST_CHECK(RbRamCanvas.isEqual(bRamCanvas) == true);
681
682 // I checked this file qby hand on 2022-08-28. sha256: d29aa9add19842ba1f2cd98e48a5987b645e8357180984b9b88186733ee4b99f
683 // hexDump.rb -t 0 -c -w 16 -b 12 -p 100 ut-save_file-c.mrw | less -RS
684 BOOST_TEST_CHECK(RcRamCanvas.readRAWfile("../data/utest/ut-save_file-c.mrw") == 0);
685 BOOST_TEST_CHECK(RcRamCanvas.isEqual(cRamCanvas) == true);
686
687 // I checked this file qby hand on 2022-08-28. sha256: bf987ec465ba232f3339b87bb9a90b52ec282d31f91378821965c06d72cc1720
688 // hexDump.rb -t -1 -c -w 16 -b 24 -p 100 ut-save_file-d.mrw | less -RS
689 BOOST_TEST_CHECK(RdRamCanvas.readRAWfile("../data/utest/ut-save_file-d.mrw") == 0);
690 BOOST_TEST_CHECK(RdRamCanvas.isEqual(dRamCanvas) == true);
691
692 // I checked this file qby hand on 2022-08-28. sha256: eb74e602fc69f5755a276c0bcc3c7acc473def2fb7288e324b6463f45d7f8816
693 // hexDump.rb -t 0 -c -w 16 -b 12 -p 100 ut-save_file-e.mrw | less -RS
694 BOOST_TEST_CHECK(ReRamCanvas.readRAWfile("../data/utest/ut-save_file-e.mrw") == 0);
695 BOOST_TEST_CHECK(ReRamCanvas.isEqual(eRamCanvas) == true);
696
697 // I checked this file qby hand on 2022-08-28. sha256: 060b545e73ce68ea60f9413ba8611cea1ddf30c986c6ad9384d137939927465d
698 // I did the conversion by hand, so I should double check it...
699 // hexDump.rb -t -1 -c -w 16 -b 24 -p 100 ut-save_file-f.mrw | less -RS
700 BOOST_TEST_CHECK(RfRamCanvas.readRAWfile("../data/utest/ut-save_file-f.mrw") == 0);
701 BOOST_TEST_CHECK(RfRamCanvas.isEqual(fRamCanvas) == true);
702
703 // I checked this file qby hand on 2022-08-28. sha256: 24c15670cd4776abbad82f9ad3fa6c83c90dca367c6931bb9dce6b7565108a97
704 // hexDump.rb -t 0 -c -w 16 -b 1 -p 100 ut-save_file-g.mrw | less -RS
705 BOOST_TEST_CHECK(RgRamCanvas.readRAWfile("../data/utest/ut-save_file-g.mrw") == 0);
706 BOOST_TEST_CHECK(RgRamCanvas.isEqual(gRamCanvas) == true);
707
708 // I checked this file qby hand on 2022-08-28. sha256: a2daf01cd91b48e850b4db7424dc06d689fe557bc777b20f7dda6954c9bd0618
709 // hexDump.rb -t 0 -c -w 16 -b 2 -p 100 ut-save_file-h.mrw | less -RS
710 BOOST_TEST_CHECK(RhRamCanvas.readRAWfile("../data/utest/ut-save_file-h.mrw") == 0);
711 BOOST_TEST_CHECK(RhRamCanvas.isEqual(hRamCanvas) == true);
712
713 // I checked this file qby hand on 2022-08-28. sha256: e54e75ae84fe412648121cf55ba39a0c05405474a0a1cd19ac6dfc92ac839be0 *ut-save_file-i.mrw
714 // hexDump.rb -t 0 -c -w 16 -b 4 -p 100 ut-save_file-i.mrw | less -RS
715 BOOST_TEST_CHECK(RiRamCanvas.readRAWfile("../data/utest/ut-save_file-i.mrw") == 0);
716 BOOST_TEST_CHECK(RiRamCanvas.isEqual(iRamCanvas) == true);
717
718 // I checked this file qby hand on 2022-08-28. sha256: 3144a77040b5a25c9c089d7cf32d6ee0f832a23b71de1f2d1b3fafab4b82408c
719 // hexDump.rb -t 0 -c -w 16 -b 8 -p 100 ut-save_file-j.mrw | less -RS
720 BOOST_TEST_CHECK(RjRamCanvas.readRAWfile("../data/utest/ut-save_file-j.mrw") == 0);
721 BOOST_TEST_CHECK(RjRamCanvas.isEqual(jRamCanvas) == true);
722
723 // I checked this file qby hand on 2022-08-28. sha256: 25ce4b85baca2aa4ea8f4635e82abb4e1aa92e55ec6a9caf9b5558a1d0574a66
724 // hexDump.rb -t 0 -c -w 16 -b 4 -p 100 ut-save_file-k.mrw | less -RS
725 BOOST_TEST_CHECK(RkRamCanvas.readRAWfile("../data/utest/ut-save_file-k.mrw") == 0);
726 BOOST_TEST_CHECK(RkRamCanvas.isEqual(kRamCanvas) == true);
727
728 // I checked this file qby hand on 2022-08-28. sha256: 007879b182639b37a54358067f742c86bccb1ec0cb85a67a9f648ebf56c44294
729 // I did the conversion by hand, so I should double check it...
730 // hexDump.rb -t -1 -c -w 16 -b 8 -p 100 ut-save_file-l.mrw | less -RS
731 BOOST_TEST_CHECK(RlRamCanvas.readRAWfile("../data/utest/ut-save_file-l.mrw") == 0);
732 BOOST_TEST_CHECK(RlRamCanvas.isEqual(lRamCanvas) == true);
733}
734
735////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
736BOOST_AUTO_TEST_CASE(lines_no_clip) {
737
738// The line draw algorithm has many cases. We try to hit them all.
739
740 const int WIDE = 16+16+16+1;
741 const int TALL = 18;
742
743 mjr::ramCanvas1c8b aRamCanvas(WIDE, TALL); mjr::ramCanvas1c8b RaRamCanvas(WIDE, TALL);
744 mjr::ramCanvas1c8b::colorType aColor;
745
746 std::vector<std::vector<int>> lns {{ 1, 1, 1, 11},
747 { 1, 1, 11, 16},
748 { 1, 1, 11, 11},
749 { 1, 1, 11, 6},
750 { 1, 1, 11, 1},
751 {13, 16, 23, 11},
752 {13, 16, 23, 6},
753 {13, 16, 23, 1}};
754
755 aColor.setToWhite();
756 for(auto pts : lns) {
757 aRamCanvas.drawLine( pts[2], pts[3], pts[0], pts[1], aColor);
758 aRamCanvas.drawLine(24+pts[0], pts[1], 24+pts[2], pts[3], aColor);
759 }
760
761 //------------------------------------------------------------------------------------------------------------------------------------------------------------
762 // Compare reference with test
763 BOOST_TEST_CHECK(RaRamCanvas.readRAWfile("../data/utest/ut-lines_no_clip.mrw") == 0);
764 BOOST_TEST_CHECK(RaRamCanvas.isEqual(aRamCanvas) == true);
765
766 //------------------------------------------------------------------------------------------------------------------------------------------------------------
767 // Save diagnostic images
768 aRamCanvas.writeRAWfile("ut-lines_no_clip.mrw");
769 aRamCanvas.scaleUpProximal(10);
770 aRamCanvas.writeTIFFfile("ut-lines_no_clip.tiff");
771}
772
773////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
774BOOST_AUTO_TEST_CASE(lines_clip) {
775
776 // The line draw algorithm has many cases. We try to hit them all.
777
778 std::vector<std::vector<int>> lns {{ -8, -16, 8, 16},
779 {-16, -16, 16, 16},
780 {-16, -8, 16, 8},
781 {-16, 0, 16, 0},
782 {-16, 8, 16, -8},
783 {-16, 16, 16, -16},
784 { -8, 16, 8, -16},
785 { 0, -16, 0, 16}};
786
787 mjr::ramCanvas1c8b::colorType aColor;
788 aColor.setToWhite();
789
790 //------------------------------------------------------------------------------------------------------------------------------------------------------------
791 // no-clip
792 mjr::ramCanvas1c8b bRamCanvas(40, 40); mjr::ramCanvas1c8b RbRamCanvas(40, 40);
793 mjr::ramCanvas1c8b cRamCanvas(40, 40);
794
795 for(auto pts : lns) {
796 bRamCanvas.drawLine(19+pts[0], 19+pts[1], 19+pts[2], 19+pts[3], aColor);
797 cRamCanvas.drawLine(19+pts[2], 19+pts[3], 19+pts[0], 19+pts[1], aColor);
798 }
799
800 BOOST_CHECK_EQUAL_COLLECTIONS(bRamCanvas.begin(), bRamCanvas.end(), cRamCanvas.begin(), cRamCanvas.end());
801
802 // Compare reference with test
803 BOOST_TEST_CHECK(RbRamCanvas.readRAWfile("../data/utest/ut-lines_clip-b.mrw") == 0);
804 BOOST_TEST_CHECK(RbRamCanvas.isEqual(bRamCanvas) == true);
805
806 // Save diagnostic images
807 bRamCanvas.writeRAWfile("ut-lines_clip-b.mrw");
808 bRamCanvas.scaleUpProximal(10);
809 bRamCanvas.writeTIFFfile("ut-lines_clip-b.tiff");
810
811 cRamCanvas.writeRAWfile("ut-lines_clip-c.mrw");
812 cRamCanvas.scaleUpProximal(10);
813 cRamCanvas.writeTIFFfile("ut-lines_clip-c.tiff");
814
815 //------------------------------------------------------------------------------------------------------------------------------------------------------------
816 // bot/left-clip
817 mjr::ramCanvas1c8b dRamCanvas(25, 25); mjr::ramCanvas1c8b RdRamCanvas(25, 25);
818 mjr::ramCanvas1c8b eRamCanvas(25, 25);
819
820 for(auto pts : lns) {
821 dRamCanvas.drawLine(7+pts[0], 7+pts[1], 7+pts[2], 7+pts[3], aColor);
822 eRamCanvas.drawLine(7+pts[2], 7+pts[3], 7+pts[0], 7+pts[1], aColor);
823 }
824
825 BOOST_CHECK_EQUAL_COLLECTIONS(dRamCanvas.begin(), dRamCanvas.end(), eRamCanvas.begin(), eRamCanvas.end());
826
827 // Compare reference with test
828 BOOST_TEST_CHECK(RdRamCanvas.readRAWfile("../data/utest/ut-lines_clip-d.mrw") == 0);
829 BOOST_TEST_CHECK(RdRamCanvas.isEqual(dRamCanvas) == true);
830
831 // Save diagnostic images
832 dRamCanvas.writeRAWfile("ut-lines_clip-d.mrw");
833 dRamCanvas.scaleUpProximal(10);
834 dRamCanvas.writeTIFFfile("ut-lines_clip-d.tiff");
835
836 eRamCanvas.writeRAWfile("ut-lines_clip-e.mrw");
837 eRamCanvas.scaleUpProximal(10);
838 eRamCanvas.writeTIFFfile("ut-lines_clip-e.tiff");
839
840 //------------------------------------------------------------------------------------------------------------------------------------------------------------
841 // top/right-clip
842 mjr::ramCanvas1c8b fRamCanvas(25, 25); mjr::ramCanvas1c8b RfRamCanvas(25, 25);
843 mjr::ramCanvas1c8b gRamCanvas(25, 25);
844
845 for(auto pts : lns) {
846 fRamCanvas.drawLine(17+pts[0], 17+pts[1], 17+pts[2], 17+pts[3], aColor);
847 gRamCanvas.drawLine(17+pts[2], 17+pts[3], 17+pts[0], 17+pts[1], aColor);
848 }
849
850 BOOST_CHECK_EQUAL_COLLECTIONS(fRamCanvas.begin(), fRamCanvas.end(), gRamCanvas.begin(), gRamCanvas.end());
851
852 // Compare reference with test
853 BOOST_TEST_CHECK(RfRamCanvas.readRAWfile("../data/utest/ut-lines_clip-f.mrw") == 0);
854 BOOST_TEST_CHECK(RfRamCanvas.isEqual(fRamCanvas) == true);
855
856 // Save diagnostic images
857 fRamCanvas.writeRAWfile("ut-lines_clip-f.mrw");
858 fRamCanvas.scaleUpProximal(10);
859 fRamCanvas.writeTIFFfile("ut-lines_clip-f.tiff");
860
861 gRamCanvas.writeRAWfile("ut-lines_clip-g.mrw");
862 gRamCanvas.scaleUpProximal(10);
863 gRamCanvas.writeTIFFfile("ut-lines_clip-g.tiff");
864
865 //------------------------------------------------------------------------------------------------------------------------------------------------------------
866 // all-clip
867 mjr::ramCanvas1c8b hRamCanvas(15, 15); mjr::ramCanvas1c8b RhRamCanvas(15, 15);
868 mjr::ramCanvas1c8b iRamCanvas(15, 15);
869
870 for(auto pts : lns) {
871 hRamCanvas.drawLine(7+pts[0], 7+pts[1], 7+pts[2], 7+pts[3], aColor);
872 iRamCanvas.drawLine(7+pts[2], 7+pts[3], 7+pts[0], 7+pts[1], aColor);
873 }
874
875 BOOST_CHECK_EQUAL_COLLECTIONS(hRamCanvas.begin(), hRamCanvas.end(), iRamCanvas.begin(), iRamCanvas.end());
876
877 // Compare reference with test
878 BOOST_TEST_CHECK(RhRamCanvas.readRAWfile("../data/utest/ut-lines_clip-h.mrw") == 0);
879 BOOST_TEST_CHECK(RhRamCanvas.isEqual(hRamCanvas) == true);
880
881 // Save diagnostic images
882 hRamCanvas.writeRAWfile("ut-lines_clip-h.mrw");
883 hRamCanvas.scaleUpProximal(10);
884 hRamCanvas.writeTIFFfile("ut-lines_clip-h.tiff");
885
886 iRamCanvas.writeRAWfile("ut-lines_clip-i.mrw");
887 iRamCanvas.scaleUpProximal(10);
888 iRamCanvas.writeTIFFfile("ut-lines_clip-i.tiff");
889}
890
891////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
892BOOST_AUTO_TEST_CASE(triangles) {
893
894 // Try to hit many of the special cases for triangle rendering. For filled triangles, that includes the cases cA-cS in ramCanvasTpl::drawFillTriangleUtl.
895 // It also means trying to get some good coverage of the special cases in ramCanvasTpl::triangleEdger as well. One critical care about is that the edges of
896 // triangles (open, solid, and shaded) are *identical*. Another is that the results should be invariant under permutations of the points in the function
897 // call.
898
899 std::vector<std::vector<int>> tri {{ 0, 0, 16, 0, 8, 8}, // flat bot, ctr, 45
900 { 0, 0, 16, 0, 8, 16}, // flat bot, ctr, <45
901 { 0, 0, 16, 0, 8, 4}, // flat bot, ctr, >45
902 { 0, 0, 8, 0, 0, 8}, // flat bot, lft, 45
903 { 0, 0, 8, 0, 0, 16}, // flat bot, lft, <45
904 { 0, 0, 8, 0, 0, 4}, // flat bot, lft, >45
905 { 0, 0, 8, 0, 8, 8}, // flat bot, rgt, 45
906 { 0, 0, 8, 0, 8, 16}, // flat bot, rgt, <45
907 { 0, 0, 8, 0, 8, 4}, // flat bot, rgt, >45
908 { 0, 16, 16, 16, 8, 8}, // flat top, ctr, 45
909 { 0, 16, 16, 16, 8, 0}, // flat top, ctr, <45
910 { 0, 16, 16, 16, 8, 12}, // flat top, ctr, >45
911 { 0, 16, 8, 16, 0, 8}, // flat top, lft, 45
912 { 0, 16, 8, 16, 0, 0}, // flat top, lft, <45
913 { 0, 16, 8, 16, 0, 12}, // flat top, lft, >45
914 { 0, 16, 8, 16, 8, 8}, // flat top, rgt, 45
915 { 0, 16, 8, 16, 8, 0}, // flat top, rgt, <45
916 { 0, 16, 8, 16, 8, 12}, // flat top, rgt, >45
917 { 0, 0, 0, 16, 8, 8}, // flat lft, ctr, 45
918 { 0, 0, 0, 16, 16, 8}, // flat lft, ctr, <45
919 { 0, 0, 0, 16, 4, 8}, // flat lft, ctr, >45
920 { 0, 0, 0, 8, 8, 0}, // flat lft, bot, 45
921 { 0, 0, 0, 8, 16, 0}, // flat lft, bot, <45
922 { 0, 0, 0, 8, 4, 0}, // flat lft, bot, >45
923 { 0, 0, 0, 8, 8, 8}, // flat lft, top, 45
924 { 0, 0, 0, 8, 16, 8}, // flat lft, top, <45
925 { 0, 0, 0, 8, 4, 8}, // flat lft, top, >45
926 {16, 0, 16, 16, 8, 8}, // flat rgt, ctr, 45
927 {16, 0, 16, 16, 0, 8}, // flat rgt, ctr, <45
928 {16, 0, 16, 16, 12, 8}, // flat rgt, ctr, >45
929 {16, 0, 16, 8, 8, 0}, // flat rgt, bot, 45
930 {16, 0, 16, 8, 0, 0}, // flat rgt, bot, <45
931 {16, 0, 16, 8, 12, 0}, // flat rgt, bot, >45
932 {16, 0, 16, 8, 8, 8}, // flat rgt, lft, 45
933 {16, 0, 16, 8, 0, 8}, // flat rgt, lft, <45
934 {16, 0, 16, 8, 12, 8}, // flat rgt, lft, >45
935 { 0, 0, 16, 0, 8, 0}, // flat hoz, ctr
936 { 0, 0, 16, 0, 0, 0}, // flat hoz, lft
937 { 0, 0, 16, 0, 16, 0}, // flat hoz, rgt
938 { 0, 0, 0, 16, 0, 8}, // flat vrt, ctr
939 { 0, 0, 0, 16, 0, 0}, // flat vrt, bot
940 { 0, 0, 0, 16, 0, 16}, // flat vrt, top
941 { 8, 8, 8, 8, 8, 8}, // one point
942 { 0, 0, 0, 0, 16, 16}, // line 45
943 { 0, 16, 0, 16, 16, 0}, // line -45
944 { 0, 0, 0, 0, 16, 4}, // line small slope
945 { 0, 0, 0, 0, 16, 8}, // line small slope
946 { 0, 16, 0, 16, 16, 8}, // line small -slope
947 { 0, 16, 0, 16, 16, 12}, // line small -slope
948 { 0, 0, 0, 0, 4, 16}, // line big slope
949 { 0, 0, 0, 0, 8, 16}, // line big slope
950 { 0, 16, 0, 16, 12, 0}, // line big -slope
951 { 0, 16, 0, 16, 8, 0}, // line big -slope
952 { 0, 0, 8, 8, 16, 16}, // 45 1-3 pt in ctr
953 { 0, 0, 4, 8, 16, 16}, // 45 1-3 pt above
954 { 0, 0, 12, 8, 16, 16}, // 45 1-3 pt below
955 //{ 4, 0, 8, 8, 12, 16}, // >45 1-3 pt in ctr
956 { 4, 0, 6, 8, 12, 16}, // >45 1-3 pt off -2
957 { 4, 0, 4, 8, 12, 16}, // >45 1-3 pt off -4
958 { 4, 0, 0, 8, 12, 16}, // >45 1-3 pt off -8
959 { 4, 0, 10, 8, 12, 16}, // >45 1-3 pt off +2
960 { 4, 0, 12, 8, 12, 16}, // >45 1-3 pt off +4
961 { 4, 0, 16, 8, 12, 16}, // >45 1-3 pt off +8
962 //{ 4, 16, 8, 8, 12, 0}, // >-45 1-3 pt in ctr
963 { 4, 16, 6, 8, 12, 0}, // >-45 1-3 pt off -2
964 { 4, 16, 4, 8, 12, 0}, // >-45 1-3 pt off -4
965 { 4, 16, 0, 8, 12, 0}, // >-45 1-3 pt off -8
966 { 4, 16, 10, 8, 12, 0}, // >-45 1-3 pt off +2
967 { 4, 16, 12, 8, 12, 0}, // >-45 1-3 pt off +4
968 { 4, 16, 16, 8, 12, 0}, // >-45 1-3 pt off +8
969 //{ 0, 4, 8, 8, 16, 12}, // <45 1-3 pt in ctr
970 { 0, 4, 8, 6, 16, 12}, // <45 1-3 pt off -2
971 { 0, 4, 8, 4, 16, 12}, // <45 1-3 pt off -4
972 { 0, 4, 8, 0, 16, 12}, // <45 1-3 pt off -8
973 { 0, 4, 8, 10, 16, 12}, // <45 1-3 pt off +2
974 { 0, 4, 8, 12, 16, 12}, // <45 1-3 pt off +4
975 { 0, 4, 8, 16, 16, 12}, // <45 1-3 pt off +8
976 {16, 4, 8, 6, 0, 12}, // >-45 1-3 pt off -2
977 {16, 4, 8, 4, 0, 12}, // >-45 1-3 pt off -4
978 {16, 4, 8, 0, 0, 12}, // >-45 1-3 pt off -8
979 {16, 4, 8, 10, 0, 12}, // >-45 1-3 pt off +2
980 {16, 4, 8, 12, 0, 12}, // >-45 1-3 pt off +4
981 {16, 4, 8, 16, 0, 12}, // >-45 1-3 pt off +8
982 {16, 4, 8, 8, 0, 12} // >-45 1-3 pt in ctr
983 };
984
985 mjr::ramCanvas1c8b::colorType aColor(mjr::ramCanvas1c8b::colorType::cornerColorEnum::WHITE);
986 mjr::ramCanvas3c8b::colorType bColor(mjr::ramCanvas3c8b::colorType::cornerColorEnum::BLUE);
987 mjr::ramCanvas3c8b::colorType cColor(mjr::ramCanvas3c8b::colorType::cornerColorEnum::GREEN);
988 mjr::ramCanvas3c8b::colorType dColor(mjr::ramCanvas3c8b::colorType::cornerColorEnum::RED);
989
990 mjr::ramCanvas1c8b aRamCanvas(163, 163); mjr::ramCanvas1c8b RaRamCanvas(163, 163);
991 mjr::ramCanvas1c8b bRamCanvas(163, 163);
992 mjr::ramCanvas1c8b cRamCanvas(163, 163);
993 mjr::ramCanvas1c8b dRamCanvas(163, 163);
994 mjr::ramCanvas1c8b eRamCanvas(163, 163);
995 mjr::ramCanvas1c8b fRamCanvas(163, 163);
996
997 mjr::ramCanvas1c8b gRamCanvas(163, 163); mjr::ramCanvas1c8b RgRamCanvas(163, 163);
998 mjr::ramCanvas1c8b hRamCanvas(163, 163);
999 mjr::ramCanvas1c8b iRamCanvas(163, 163);
1000 mjr::ramCanvas1c8b jRamCanvas(163, 163);
1001 mjr::ramCanvas1c8b kRamCanvas(163, 163);
1002 mjr::ramCanvas1c8b lRamCanvas(163, 163);
1003
1004 mjr::ramCanvas3c8b mRamCanvas(163, 163); mjr::ramCanvas3c8b RmRamCanvas(163, 163);
1005 mjr::ramCanvas3c8b nRamCanvas(163, 163);
1006 mjr::ramCanvas3c8b oRamCanvas(163, 163);
1007 mjr::ramCanvas3c8b pRamCanvas(163, 163);
1008 mjr::ramCanvas3c8b qRamCanvas(163, 163);
1009 mjr::ramCanvas3c8b rRamCanvas(163, 163);
1010
1011 for(int i=0; i<9; i++) {
1012 for(int j=0; j<9; j++) {
1013 unsigned k = i + j * 9;
1014 if (k < tri.size()) {
1015 auto pts = tri[k];;
1016 int xo = 1+18*i;
1017 int yo = 1+18*j;
1018 aRamCanvas.drawTriangle(xo+pts[0], yo+pts[1], xo+pts[2], yo+pts[3], xo+pts[4], yo+pts[5], aColor);
1019 bRamCanvas.drawTriangle(xo+pts[2], yo+pts[3], xo+pts[4], yo+pts[5], xo+pts[0], yo+pts[1], aColor);
1020 cRamCanvas.drawTriangle(xo+pts[4], yo+pts[5], xo+pts[0], yo+pts[1], xo+pts[2], yo+pts[3], aColor);
1021 dRamCanvas.drawTriangle(xo+pts[4], yo+pts[5], xo+pts[2], yo+pts[3], xo+pts[0], yo+pts[1], aColor);
1022 eRamCanvas.drawTriangle(xo+pts[2], yo+pts[3], xo+pts[0], yo+pts[1], xo+pts[4], yo+pts[5], aColor);
1023 fRamCanvas.drawTriangle(xo+pts[0], yo+pts[1], xo+pts[4], yo+pts[5], xo+pts[2], yo+pts[3], aColor);
1024
1025 gRamCanvas.drawFillTriangle(xo+pts[0], yo+pts[1], xo+pts[2], yo+pts[3], xo+pts[4], yo+pts[5], aColor);
1026 hRamCanvas.drawFillTriangle(xo+pts[2], yo+pts[3], xo+pts[4], yo+pts[5], xo+pts[0], yo+pts[1], aColor);
1027 iRamCanvas.drawFillTriangle(xo+pts[4], yo+pts[5], xo+pts[0], yo+pts[1], xo+pts[2], yo+pts[3], aColor);
1028 jRamCanvas.drawFillTriangle(xo+pts[4], yo+pts[5], xo+pts[2], yo+pts[3], xo+pts[0], yo+pts[1], aColor);
1029 kRamCanvas.drawFillTriangle(xo+pts[2], yo+pts[3], xo+pts[0], yo+pts[1], xo+pts[4], yo+pts[5], aColor);
1030 lRamCanvas.drawFillTriangle(xo+pts[0], yo+pts[1], xo+pts[4], yo+pts[5], xo+pts[2], yo+pts[3], aColor);
1031
1032
1033 mRamCanvas.drawFillTriangle(xo+pts[0], yo+pts[1], xo+pts[2], yo+pts[3], xo+pts[4], yo+pts[5], bColor, cColor, dColor);
1034 nRamCanvas.drawFillTriangle(xo+pts[2], yo+pts[3], xo+pts[4], yo+pts[5], xo+pts[0], yo+pts[1], cColor, dColor, bColor);
1035 oRamCanvas.drawFillTriangle(xo+pts[4], yo+pts[5], xo+pts[0], yo+pts[1], xo+pts[2], yo+pts[3], dColor, bColor, cColor);
1036 pRamCanvas.drawFillTriangle(xo+pts[4], yo+pts[5], xo+pts[2], yo+pts[3], xo+pts[0], yo+pts[1], dColor, cColor, bColor);
1037 qRamCanvas.drawFillTriangle(xo+pts[2], yo+pts[3], xo+pts[0], yo+pts[1], xo+pts[4], yo+pts[5], cColor, bColor, dColor);
1038 rRamCanvas.drawFillTriangle(xo+pts[0], yo+pts[1], xo+pts[4], yo+pts[5], xo+pts[2], yo+pts[3], bColor, dColor, cColor);
1039 }
1040 }
1041 }
1042
1043 BOOST_CHECK_EQUAL_COLLECTIONS(aRamCanvas.begin(), aRamCanvas.end(), bRamCanvas.begin(), bRamCanvas.end());
1044 BOOST_CHECK_EQUAL_COLLECTIONS(aRamCanvas.begin(), aRamCanvas.end(), cRamCanvas.begin(), cRamCanvas.end());
1045 BOOST_CHECK_EQUAL_COLLECTIONS(aRamCanvas.begin(), aRamCanvas.end(), dRamCanvas.begin(), dRamCanvas.end());
1046 BOOST_CHECK_EQUAL_COLLECTIONS(aRamCanvas.begin(), aRamCanvas.end(), eRamCanvas.begin(), eRamCanvas.end());
1047 BOOST_CHECK_EQUAL_COLLECTIONS(aRamCanvas.begin(), aRamCanvas.end(), fRamCanvas.begin(), fRamCanvas.end());
1048
1049 BOOST_TEST_CHECK(RaRamCanvas.readRAWfile("../data/utest/ut-triangles-a.mrw") == 0);
1050 BOOST_TEST_CHECK(RaRamCanvas.isEqual(aRamCanvas) == true);
1051
1052 BOOST_CHECK_EQUAL_COLLECTIONS(gRamCanvas.begin(), gRamCanvas.end(), hRamCanvas.begin(), hRamCanvas.end());
1053 BOOST_CHECK_EQUAL_COLLECTIONS(gRamCanvas.begin(), gRamCanvas.end(), iRamCanvas.begin(), iRamCanvas.end());
1054 BOOST_CHECK_EQUAL_COLLECTIONS(gRamCanvas.begin(), gRamCanvas.end(), jRamCanvas.begin(), jRamCanvas.end());
1055 BOOST_CHECK_EQUAL_COLLECTIONS(gRamCanvas.begin(), gRamCanvas.end(), kRamCanvas.begin(), kRamCanvas.end());
1056 BOOST_CHECK_EQUAL_COLLECTIONS(gRamCanvas.begin(), gRamCanvas.end(), lRamCanvas.begin(), lRamCanvas.end());
1057
1058 BOOST_TEST_CHECK(RgRamCanvas.readRAWfile("../data/utest/ut-triangles-g.mrw") == 0);
1059 BOOST_TEST_CHECK(RgRamCanvas.isEqual(gRamCanvas) == true);
1060
1061 BOOST_CHECK_EQUAL_COLLECTIONS(mRamCanvas.begin(), mRamCanvas.end(), nRamCanvas.begin(), nRamCanvas.end());
1062 BOOST_CHECK_EQUAL_COLLECTIONS(mRamCanvas.begin(), mRamCanvas.end(), oRamCanvas.begin(), oRamCanvas.end());
1063 BOOST_CHECK_EQUAL_COLLECTIONS(mRamCanvas.begin(), mRamCanvas.end(), pRamCanvas.begin(), pRamCanvas.end());
1064 BOOST_CHECK_EQUAL_COLLECTIONS(mRamCanvas.begin(), mRamCanvas.end(), qRamCanvas.begin(), qRamCanvas.end());
1065 BOOST_CHECK_EQUAL_COLLECTIONS(mRamCanvas.begin(), mRamCanvas.end(), rRamCanvas.begin(), rRamCanvas.end());
1066
1067 BOOST_TEST_CHECK(RmRamCanvas.readRAWfile("../data/utest/ut-triangles-m.mrw") == 0);
1068 BOOST_TEST_CHECK(RmRamCanvas.isEqual(mRamCanvas) == true);
1069
1070 aRamCanvas.writeRAWfile("ut-triangles-a.mrw");
1071 bRamCanvas.writeRAWfile("ut-triangles-b.mrw");
1072 cRamCanvas.writeRAWfile("ut-triangles-c.mrw");
1073 dRamCanvas.writeRAWfile("ut-triangles-d.mrw");
1074 eRamCanvas.writeRAWfile("ut-triangles-e.mrw");
1075 fRamCanvas.writeRAWfile("ut-triangles-f.mrw");
1076
1077 aRamCanvas.scaleUpProximal(8);
1078 bRamCanvas.scaleUpProximal(8);
1079 cRamCanvas.scaleUpProximal(8);
1080 dRamCanvas.scaleUpProximal(8);
1081 eRamCanvas.scaleUpProximal(8);
1082 fRamCanvas.scaleUpProximal(8);
1083
1084 aRamCanvas.writeTIFFfile("ut-triangles-a.tiff");
1085 bRamCanvas.writeTIFFfile("ut-triangles-b.tiff");
1086 cRamCanvas.writeTIFFfile("ut-triangles-c.tiff");
1087 dRamCanvas.writeTIFFfile("ut-triangles-d.tiff");
1088 eRamCanvas.writeTIFFfile("ut-triangles-e.tiff");
1089 fRamCanvas.writeTIFFfile("ut-triangles-f.tiff");
1090
1091 gRamCanvas.writeRAWfile("ut-triangles-g.mrw");
1092 hRamCanvas.writeRAWfile("ut-triangles-h.mrw");
1093 iRamCanvas.writeRAWfile("ut-triangles-i.mrw");
1094 jRamCanvas.writeRAWfile("ut-triangles-j.mrw");
1095 kRamCanvas.writeRAWfile("ut-triangles-k.mrw");
1096 lRamCanvas.writeRAWfile("ut-triangles-l.mrw");
1097
1098 gRamCanvas.scaleUpProximal(8);
1099 hRamCanvas.scaleUpProximal(8);
1100 iRamCanvas.scaleUpProximal(8);
1101 jRamCanvas.scaleUpProximal(8);
1102 kRamCanvas.scaleUpProximal(8);
1103 lRamCanvas.scaleUpProximal(8);
1104
1105 gRamCanvas.writeTIFFfile("ut-triangles-g.tiff");
1106 hRamCanvas.writeTIFFfile("ut-triangles-h.tiff");
1107 iRamCanvas.writeTIFFfile("ut-triangles-i.tiff");
1108 jRamCanvas.writeTIFFfile("ut-triangles-j.tiff");
1109 kRamCanvas.writeTIFFfile("ut-triangles-k.tiff");
1110 lRamCanvas.writeTIFFfile("ut-triangles-l.tiff");
1111
1112 mRamCanvas.writeRAWfile("ut-triangles-m.mrw");
1113 nRamCanvas.writeRAWfile("ut-triangles-n.mrw");
1114 oRamCanvas.writeRAWfile("ut-triangles-o.mrw");
1115 pRamCanvas.writeRAWfile("ut-triangles-p.mrw");
1116 qRamCanvas.writeRAWfile("ut-triangles-q.mrw");
1117 rRamCanvas.writeRAWfile("ut-triangles-r.mrw");
1118
1119 mRamCanvas.scaleUpProximal(8);
1120 nRamCanvas.scaleUpProximal(8);
1121 oRamCanvas.scaleUpProximal(8);
1122 pRamCanvas.scaleUpProximal(8);
1123 qRamCanvas.scaleUpProximal(8);
1124 rRamCanvas.scaleUpProximal(8);
1125
1126 mRamCanvas.writeTIFFfile("ut-triangles-m.tiff");
1127 nRamCanvas.writeTIFFfile("ut-triangles-n.tiff");
1128 oRamCanvas.writeTIFFfile("ut-triangles-o.tiff");
1129 pRamCanvas.writeTIFFfile("ut-triangles-p.tiff");
1130 qRamCanvas.writeTIFFfile("ut-triangles-q.tiff");
1131 rRamCanvas.writeTIFFfile("ut-triangles-r.tiff");
1132}
1133
1134////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
1135BOOST_AUTO_TEST_CASE(circles) {
1136
1137 mjr::color1c8b aColor(mjr::color1c8b::cornerColorEnum::WHITE);
1138 mjr::color1c8b bColor(mjr::color1c8b::cornerColorEnum::BLACK);
1139
1140 mjr::ramCanvas1c8b aRamCanvas(63, 63); mjr::ramCanvas1c8b RaRamCanvas(63, 63);
1141 for(int i=2; i<32; i+=2)
1142 aRamCanvas.drawCircle(31, 31, i, aColor);
1143 BOOST_TEST_CHECK(RaRamCanvas.readRAWfile("../data/utest/ut-circles-a.mrw") == 0);
1144 BOOST_TEST_CHECK(RaRamCanvas.isEqual(aRamCanvas) == true);
1145
1146 mjr::ramCanvas1c8b bRamCanvas(63, 63); mjr::ramCanvas1c8b RbRamCanvas(63, 63);
1147 bRamCanvas.drawFillCircle(31, 31, 30, aColor);
1148 BOOST_TEST_CHECK(RbRamCanvas.readRAWfile("../data/utest/ut-circles-b.mrw") == 0);
1149 BOOST_TEST_CHECK(RbRamCanvas.isEqual(bRamCanvas) == true);
1150
1151 mjr::ramCanvas1c8b cRamCanvas(32, 32); mjr::ramCanvas1c8b RcRamCanvas(32, 32);
1152 cRamCanvas.drawCircle(31, 31, 16, aColor);
1153 cRamCanvas.drawCircle(16, -5, 15, aColor);
1154 cRamCanvas.drawCircle(5, 20, 8, aColor);
1155 BOOST_TEST_CHECK(RcRamCanvas.readRAWfile("../data/utest/ut-circles-c.mrw") == 0);
1156 BOOST_TEST_CHECK(RcRamCanvas.isEqual(cRamCanvas) == true);
1157
1158 mjr::ramCanvas1c8b dRamCanvas(32, 32); mjr::ramCanvas1c8b RdRamCanvas(32, 32);
1159 dRamCanvas.drawFillCircle(31, 31, 16, aColor);
1160 dRamCanvas.drawFillCircle(16, -5, 15, aColor);
1161 dRamCanvas.drawFillCircle(5, 20, 8, aColor);
1162 BOOST_TEST_CHECK(RdRamCanvas.readRAWfile("../data/utest/ut-circles-d.mrw") == 0);
1163 BOOST_TEST_CHECK(RdRamCanvas.isEqual(dRamCanvas) == true);
1164
1165 mjr::ramCanvas1c8b eRamCanvas(32, 32); mjr::ramCanvas1c8b ReRamCanvas(32, 32);
1166 eRamCanvas.drawFillCircle(16, 16, 17, aColor);
1167 BOOST_TEST_CHECK(ReRamCanvas.readRAWfile("../data/utest/ut-circles-e.mrw") == 0);
1168 BOOST_TEST_CHECK(ReRamCanvas.isEqual(eRamCanvas) == true);
1169
1170 mjr::ramCanvas1c8b fRamCanvas(32, 32); mjr::ramCanvas1c8b RfRamCanvas(32, 32);
1171 fRamCanvas.drawFillCircle(16, 16, 50, aColor);
1172 BOOST_TEST_CHECK(RfRamCanvas.readRAWfile("../data/utest/ut-circles-f.mrw") == 0);
1173 BOOST_TEST_CHECK(RfRamCanvas.isEqual(fRamCanvas) == true);
1174
1175 aRamCanvas.writeRAWfile("ut-circles-a.mrw");
1176 aRamCanvas.scaleUpProximal(8);
1177 aRamCanvas.writeTIFFfile("ut-circles-a.tiff");
1178
1179 bRamCanvas.writeRAWfile("ut-circles-b.mrw");
1180 bRamCanvas.scaleUpProximal(8);
1181 bRamCanvas.writeTIFFfile("ut-circles-b.tiff");
1182
1183 cRamCanvas.writeRAWfile("ut-circles-c.mrw");
1184 cRamCanvas.scaleUpProximal(20);
1185 cRamCanvas.writeTIFFfile("ut-circles-c.tiff");
1186
1187 dRamCanvas.writeRAWfile("ut-circles-d.mrw");
1188 dRamCanvas.scaleUpProximal(20);
1189 dRamCanvas.writeTIFFfile("ut-circles-d.tiff");
1190
1191 eRamCanvas.writeRAWfile("ut-circles-e.mrw");
1192 eRamCanvas.scaleUpProximal(20);
1193 eRamCanvas.writeTIFFfile("ut-circles-e.tiff");
1194
1195 fRamCanvas.writeRAWfile("ut-circles-f.mrw");
1196 fRamCanvas.scaleUpProximal(20);
1197 fRamCanvas.writeTIFFfile("ut-circles-f.tiff");
1198}
1199
1200////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
1201BOOST_AUTO_TEST_CASE(rectanglesO) {
1202
1203 // The drawRectangle method is pretty simple, but has several edge cases around clipping. It is also weird about how it uses it's arguments.
1204
1205 mjr::ramCanvas1c8b::colorType aColor(mjr::ramCanvas1c8b::colorType::cornerColorEnum::WHITE);
1206
1207 // open: The args are used not points (x1, y1) & (x2, y2), but rather as x and y ranges.
1208 mjr::ramCanvas1c8b aRamCanvas(9, 9); mjr::ramCanvas1c8b RaRamCanvas(9, 9);
1209 aRamCanvas.drawRectangle(1, 1, 7, 7, aColor);
1210 BOOST_TEST_CHECK(RaRamCanvas.readRAWfile("../data/utest/ut-rectanglesO-a.mrw") == 0);
1211 BOOST_TEST_CHECK(RaRamCanvas.isEqual(aRamCanvas) == true);
1212
1213 mjr::ramCanvas1c8b bRamCanvas(9, 9);
1214 bRamCanvas.clrCanvasToBlack();
1215 bRamCanvas.drawRectangle(1, 1, 7, 7, aColor);
1216 BOOST_TEST_CHECK(aRamCanvas.isEqual(bRamCanvas) == true);
1217
1218 bRamCanvas.clrCanvasToBlack();
1219 bRamCanvas.drawRectangle(7, 1, 1, 7, aColor);
1220 BOOST_TEST_CHECK(aRamCanvas.isEqual(bRamCanvas) == true);
1221
1222 bRamCanvas.clrCanvasToBlack();
1223 bRamCanvas.drawRectangle(1, 7, 7, 1, aColor);
1224 BOOST_TEST_CHECK(aRamCanvas.isEqual(bRamCanvas) == true);
1225
1226 bRamCanvas.clrCanvasToBlack();
1227 bRamCanvas.drawRectangle(7, 7, 1, 1, aColor);
1228 BOOST_TEST_CHECK(aRamCanvas.isEqual(bRamCanvas) == true);
1229
1230 // open: clip ALL corner (canvas inside rectangle)
1231 mjr::ramCanvas1c8b cRamCanvas(9, 9); mjr::ramCanvas1c8b RcRamCanvas(9, 9);
1232 cRamCanvas.drawRectangle(-4, -2, 25, 12, aColor);
1233 BOOST_TEST_CHECK(RcRamCanvas.readRAWfile("../data/utest/ut-rectanglesO-c.mrw") == 0);
1234 BOOST_TEST_CHECK(RcRamCanvas.isEqual(cRamCanvas) == true);
1235
1236 // open: clip ALL corner (canvas inside rectangle)
1237 mjr::ramCanvas1c8b dRamCanvas(9, 9); mjr::ramCanvas1c8b RdRamCanvas(9, 9);
1238 dRamCanvas.drawRectangle(-9, 2, -4, 7, aColor); // to left
1239 dRamCanvas.drawRectangle(16, 2, 24, 7, aColor); // to right
1240 dRamCanvas.drawRectangle( 2, 12, 7, 17, aColor); // to top
1241 dRamCanvas.drawRectangle( 2, -17, 7, -10, aColor); // to bot
1242 dRamCanvas.drawRectangle(-9, -15, -4, -7, aColor); // to left below
1243 dRamCanvas.drawRectangle(10, 15, 14, 17, aColor); // to right up
1244 BOOST_TEST_CHECK(RdRamCanvas.readRAWfile("../data/utest/ut-rectanglesO-d.mrw") == 0);
1245 BOOST_TEST_CHECK(RdRamCanvas.isEqual(dRamCanvas) == true);
1246
1247 // open: clip one corner
1248 mjr::ramCanvas1c8b eRamCanvas(9, 9); mjr::ramCanvas1c8b ReRamCanvas(9, 9);
1249 eRamCanvas.drawRectangle( 6, 6, 12, 12, aColor);
1250 eRamCanvas.drawRectangle( 6, 2, 12, -12, aColor);
1251 eRamCanvas.drawRectangle(-6, 6, 2, 16, aColor);
1252 eRamCanvas.drawRectangle(-6, -6, 2, 2, aColor);
1253 BOOST_TEST_CHECK(ReRamCanvas.readRAWfile("../data/utest/ut-rectanglesO-e.mrw") == 0);
1254 BOOST_TEST_CHECK(ReRamCanvas.isEqual(eRamCanvas) == true);
1255
1256 // open: clip one side
1257 mjr::ramCanvas1c8b fRamCanvas(9, 9); mjr::ramCanvas1c8b RfRamCanvas(9, 9);
1258 fRamCanvas.drawRectangle( 2, 7, 6, 12, aColor); // top
1259 fRamCanvas.drawRectangle( 7, 2, 20, 6, aColor); // right
1260 fRamCanvas.drawRectangle(-6, 2, 1, 6, aColor); // left
1261 fRamCanvas.drawRectangle( 2, -27, 6, 1, aColor); // bot
1262 BOOST_TEST_CHECK(RfRamCanvas.readRAWfile("../data/utest/ut-rectanglesO-f.mrw") == 0);
1263 BOOST_TEST_CHECK(RfRamCanvas.isEqual(fRamCanvas) == true);
1264
1265 // open: clip one side (T/B)
1266 mjr::ramCanvas1c8b gRamCanvas(9, 9); mjr::ramCanvas1c8b RgRamCanvas(9, 9);
1267 gRamCanvas.drawRectangle(-3, 7, 26, 12, aColor); // top
1268 gRamCanvas.drawRectangle(-4, -27, 30, 1, aColor); // bot
1269 BOOST_TEST_CHECK(RgRamCanvas.readRAWfile("../data/utest/ut-rectanglesO-g.mrw") == 0);
1270 BOOST_TEST_CHECK(RgRamCanvas.isEqual(gRamCanvas) == true);
1271
1272 // open: clip one side (L/R)
1273 mjr::ramCanvas1c8b hRamCanvas(9, 9); mjr::ramCanvas1c8b RhRamCanvas(9, 9);
1274 hRamCanvas.drawRectangle( 7, -2, 20, 36, aColor); // right
1275 hRamCanvas.drawRectangle(-6, -5, 1, 16, aColor); // left
1276 BOOST_TEST_CHECK(RhRamCanvas.readRAWfile("../data/utest/ut-rectanglesO-h.mrw") == 0);
1277 BOOST_TEST_CHECK(RhRamCanvas.isEqual(hRamCanvas) == true);
1278
1279 aRamCanvas.writeRAWfile("ut-rectanglesO-a.mrw");
1280 aRamCanvas.scaleUpProximal(20);
1281 aRamCanvas.writeTIFFfile("ut-rectanglesO-a.tiff");
1282
1283 cRamCanvas.writeRAWfile("ut-rectanglesO-c.mrw");
1284 cRamCanvas.scaleUpProximal(20);
1285 cRamCanvas.writeTIFFfile("ut-rectanglesO-c.tiff");
1286
1287 dRamCanvas.writeRAWfile("ut-rectanglesO-d.mrw");
1288 dRamCanvas.scaleUpProximal(20);
1289 dRamCanvas.writeTIFFfile("ut-rectanglesO-d.tiff");
1290
1291 eRamCanvas.writeRAWfile("ut-rectanglesO-e.mrw");
1292 eRamCanvas.scaleUpProximal(20);
1293 eRamCanvas.writeTIFFfile("ut-rectanglesO-e.tiff");
1294
1295 fRamCanvas.writeRAWfile("ut-rectanglesO-f.mrw");
1296 fRamCanvas.scaleUpProximal(20);
1297 fRamCanvas.writeTIFFfile("ut-rectanglesO-f.tiff");
1298
1299 gRamCanvas.writeRAWfile("ut-rectanglesO-g.mrw");
1300 gRamCanvas.scaleUpProximal(20);
1301 gRamCanvas.writeTIFFfile("ut-rectanglesO-g.tiff");
1302
1303 hRamCanvas.writeRAWfile("ut-rectanglesO-h.mrw");
1304 hRamCanvas.scaleUpProximal(20);
1305 hRamCanvas.writeTIFFfile("ut-rectanglesO-h.tiff");
1306
1307}
1308
1309////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
1310BOOST_AUTO_TEST_CASE(rectanglesF) {
1311
1312 // The drawFillRectangle method is pretty simple, but has several edge cases around clipping. It is also weird about how it uses it's arguments.
1313
1314 mjr::ramCanvas1c8b::colorType aColor(mjr::ramCanvas1c8b::colorType::cornerColorEnum::WHITE);
1315
1316 // open: The args are used not points (x1, y1) & (x2, y2), but rather as x and y ranges.
1317 mjr::ramCanvas1c8b aRamCanvas(9, 9); mjr::ramCanvas1c8b RaRamCanvas(9, 9);
1318 aRamCanvas.drawFillRectangle(1, 1, 7, 7, aColor);
1319 BOOST_TEST_CHECK(RaRamCanvas.readRAWfile("../data/utest/ut-rectanglesF-a.mrw") == 0);
1320 BOOST_TEST_CHECK(RaRamCanvas.isEqual(aRamCanvas) == true);
1321
1322 mjr::ramCanvas1c8b bRamCanvas(9, 9);
1323 bRamCanvas.clrCanvasToBlack();
1324 bRamCanvas.drawFillRectangle(1, 1, 7, 7, aColor);
1325 BOOST_TEST_CHECK(aRamCanvas.isEqual(bRamCanvas) == true);
1326
1327 bRamCanvas.clrCanvasToBlack();
1328 bRamCanvas.drawFillRectangle(7, 1, 1, 7, aColor);
1329 BOOST_TEST_CHECK(aRamCanvas.isEqual(bRamCanvas) == true);
1330
1331 bRamCanvas.clrCanvasToBlack();
1332 bRamCanvas.drawFillRectangle(1, 7, 7, 1, aColor);
1333 BOOST_TEST_CHECK(aRamCanvas.isEqual(bRamCanvas) == true);
1334
1335 bRamCanvas.clrCanvasToBlack();
1336 bRamCanvas.drawFillRectangle(7, 7, 1, 1, aColor);
1337 BOOST_TEST_CHECK(aRamCanvas.isEqual(bRamCanvas) == true);
1338
1339 // open: clip ALL corner (canvas inside rectangle)
1340 mjr::ramCanvas1c8b cRamCanvas(9, 9); mjr::ramCanvas1c8b RcRamCanvas(9, 9);
1341 cRamCanvas.drawFillRectangle(-4, -2, 25, 12, aColor);
1342 BOOST_TEST_CHECK(RcRamCanvas.readRAWfile("../data/utest/ut-rectanglesF-c.mrw") == 0);
1343 BOOST_TEST_CHECK(RcRamCanvas.isEqual(cRamCanvas) == true);
1344
1345 // open: clip ALL corner (canvas inside rectangle)
1346 mjr::ramCanvas1c8b dRamCanvas(9, 9); mjr::ramCanvas1c8b RdRamCanvas(9, 9);
1347 dRamCanvas.drawFillRectangle(-9, 2, -4, 7, aColor); // to left
1348 dRamCanvas.drawFillRectangle(16, 2, 24, 7, aColor); // to right
1349 dRamCanvas.drawFillRectangle( 2, 12, 7, 17, aColor); // to top
1350 dRamCanvas.drawFillRectangle( 2, -17, 7, -10, aColor); // to bot
1351 dRamCanvas.drawFillRectangle(-9, -15, -4, -7, aColor); // to left below
1352 dRamCanvas.drawFillRectangle(10, 15, 14, 17, aColor); // to right up
1353 BOOST_TEST_CHECK(RdRamCanvas.readRAWfile("../data/utest/ut-rectanglesF-d.mrw") == 0);
1354 BOOST_TEST_CHECK(RdRamCanvas.isEqual(dRamCanvas) == true);
1355
1356 // open: clip one corner
1357 mjr::ramCanvas1c8b eRamCanvas(9, 9); mjr::ramCanvas1c8b ReRamCanvas(9, 9);
1358 eRamCanvas.drawFillRectangle( 6, 6, 12, 12, aColor);
1359 eRamCanvas.drawFillRectangle( 6, 2, 12, -12, aColor);
1360 eRamCanvas.drawFillRectangle(-6, 6, 2, 16, aColor);
1361 eRamCanvas.drawFillRectangle(-6, -6, 2, 2, aColor);
1362 BOOST_TEST_CHECK(ReRamCanvas.readRAWfile("../data/utest/ut-rectanglesF-e.mrw") == 0);
1363 BOOST_TEST_CHECK(ReRamCanvas.isEqual(eRamCanvas) == true);
1364
1365 // open: clip one side
1366 mjr::ramCanvas1c8b fRamCanvas(9, 9); mjr::ramCanvas1c8b RfRamCanvas(9, 9);
1367 fRamCanvas.drawFillRectangle( 2, 7, 6, 12, aColor); // top
1368 fRamCanvas.drawFillRectangle( 7, 2, 20, 6, aColor); // right
1369 fRamCanvas.drawFillRectangle(-6, 2, 1, 6, aColor); // left
1370 fRamCanvas.drawFillRectangle( 2, -27, 6, 1, aColor); // bot
1371 BOOST_TEST_CHECK(RfRamCanvas.readRAWfile("../data/utest/ut-rectanglesF-f.mrw") == 0);
1372 BOOST_TEST_CHECK(RfRamCanvas.isEqual(fRamCanvas) == true);
1373
1374 // open: clip one side (T/B)
1375 mjr::ramCanvas1c8b gRamCanvas(9, 9); mjr::ramCanvas1c8b RgRamCanvas(9, 9);
1376 gRamCanvas.drawFillRectangle(-3, 7, 26, 12, aColor); // top
1377 gRamCanvas.drawFillRectangle(-4, -27, 30, 1, aColor); // bot
1378 BOOST_TEST_CHECK(RgRamCanvas.readRAWfile("../data/utest/ut-rectanglesF-g.mrw") == 0);
1379 BOOST_TEST_CHECK(RgRamCanvas.isEqual(gRamCanvas) == true);
1380
1381 // open: clip one side (L/R)
1382 mjr::ramCanvas1c8b hRamCanvas(9, 9); mjr::ramCanvas1c8b RhRamCanvas(9, 9);
1383 hRamCanvas.drawFillRectangle( 7, -2, 20, 36, aColor); // right
1384 hRamCanvas.drawFillRectangle(-6, -5, 1, 16, aColor); // left
1385 BOOST_TEST_CHECK(RhRamCanvas.readRAWfile("../data/utest/ut-rectanglesF-h.mrw") == 0);
1386 BOOST_TEST_CHECK(RhRamCanvas.isEqual(hRamCanvas) == true);
1387
1388 aRamCanvas.writeRAWfile("ut-rectanglesF-a.mrw");
1389 aRamCanvas.scaleUpProximal(20);
1390 aRamCanvas.writeTIFFfile("ut-rectanglesF-a.tiff");
1391
1392 cRamCanvas.writeRAWfile("ut-rectanglesF-c.mrw");
1393 cRamCanvas.scaleUpProximal(20);
1394 cRamCanvas.writeTIFFfile("ut-rectanglesF-c.tiff");
1395
1396 dRamCanvas.writeRAWfile("ut-rectanglesF-d.mrw");
1397 dRamCanvas.scaleUpProximal(20);
1398 dRamCanvas.writeTIFFfile("ut-rectanglesF-d.tiff");
1399
1400 eRamCanvas.writeRAWfile("ut-rectanglesF-e.mrw");
1401 eRamCanvas.scaleUpProximal(20);
1402 eRamCanvas.writeTIFFfile("ut-rectanglesF-e.tiff");
1403
1404 fRamCanvas.writeRAWfile("ut-rectanglesF-f.mrw");
1405 fRamCanvas.scaleUpProximal(20);
1406 fRamCanvas.writeTIFFfile("ut-rectanglesF-f.tiff");
1407
1408 gRamCanvas.writeRAWfile("ut-rectanglesF-g.mrw");
1409 gRamCanvas.scaleUpProximal(20);
1410 gRamCanvas.writeTIFFfile("ut-rectanglesF-g.tiff");
1411
1412 hRamCanvas.writeRAWfile("ut-rectanglesF-h.mrw");
1413 hRamCanvas.scaleUpProximal(20);
1414 hRamCanvas.writeTIFFfile("ut-rectanglesF-h.tiff");
1415}
1416
1417////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
1418BOOST_AUTO_TEST_CASE(draw_point) {
1419
1420 mjr::ramCanvasRGB8b aRamCanvas(20, 20, 0.0, 19.0, 0.0, 19.0); mjr::ramCanvasRGB8b RaRamCanvas(20, 20, 0.0, 19.0, 0.0, 19.0);
1421 aRamCanvas.setRealAxOrientationY(mjr::ramCanvasRGB8b::realAxisOrientation::INVERTED);
1422 mjr::colorRGB8b aColor(mjr::colorRGB8b::cornerColorEnum::RED);
1423 mjr::colorRGB8b bColor(mjr::colorRGB8b::cornerColorEnum::BLUE);
1424 mjr::colorRGB8b cColor(mjr::colorRGB8b::cornerColorEnum::MAGENTA);
1425 mjr::colorRGB8b dColor(mjr::colorRGB8b::cornerColorEnum::CYAN);
1426
1427 //------------------------------------------------------------------------------------------------------------------------------------------------------------
1428 aRamCanvas.drawPoint(mjr::ramCanvasRGB8b::pointIntType({2, 2}), aColor); // Initializeer list
1429 aRamCanvas.drawPoint(mjr::ramCanvasRGB8b::pointIntType(4, 2), bColor); // two arg
1430 aRamCanvas.drawPoint(mjr::ramCanvasRGB8b::pointIntType(std::tuple<int,int>(6, 2)), aColor); // tuple<int,int>
1431 aRamCanvas.drawPoint(mjr::ramCanvasRGB8b::pointIntType(std::tuple<int,short>(8, 2)), bColor); // tuple<int,short>
1432 aRamCanvas.drawPoint(mjr::ramCanvasRGB8b::pointIntType(std::complex<int>(10, 2)), aColor); // complex<int>
1433 aRamCanvas.drawPoint(mjr::ramCanvasRGB8b::pointIntType(std::vector<int>({14, 2})), aColor); // vector<int)
1434 int aArI[2] = {16, 2};
1435 aRamCanvas.drawPoint(mjr::ramCanvasRGB8b::pointIntType(aArI), bColor); // array of int
1436 int aArS[2] = {18, 2};
1437 aRamCanvas.drawPoint(mjr::ramCanvasRGB8b::pointIntType(aArS), aColor); // array of short
1438
1439 //------------------------------------------------------------------------------------------------------------------------------------------------------------
1440 aRamCanvas.drawPoint(std::complex<int>(2, 4), bColor); // complex<int> -- complex<short> no work
1441 aRamCanvas.drawPoint(std::tuple<int,int>(4, 4), aColor); // tuple<int,int> -- tuple<int,short> no work
1442 aRamCanvas.drawPoint(std::vector<int>({6, 4}), bColor); // vector<int>
1443
1444 //------------------------------------------------------------------------------------------------------------------------------------------------------------
1445 aRamCanvas.drawPoint(mjr::ramCanvasRGB8b::pointFltType({2, 2}), cColor); // Initializeer list
1446 aRamCanvas.drawPoint(mjr::ramCanvasRGB8b::pointFltType(4, 2), dColor); // two arg
1447 aRamCanvas.drawPoint(mjr::ramCanvasRGB8b::pointFltType(std::tuple<int,int>(6, 2)), cColor); // tuple<int,int>
1448 aRamCanvas.drawPoint(mjr::ramCanvasRGB8b::pointFltType(std::tuple<int,short>(8, 2)), dColor); // tuple<int,short>
1449 aRamCanvas.drawPoint(mjr::ramCanvasRGB8b::pointFltType(std::complex<double>(10, 2)), cColor); // complex<double>
1450 aRamCanvas.drawPoint(mjr::ramCanvasRGB8b::pointFltType(std::complex<double>(12, 2)), dColor); // complex<double>
1451 aRamCanvas.drawPoint(mjr::ramCanvasRGB8b::pointFltType(std::vector<double>({14, 2})), cColor); // vector<double>
1452 double aArD[2] = {16, 2};
1453 aRamCanvas.drawPoint(mjr::ramCanvasRGB8b::pointFltType(aArD), dColor); // array of double
1454
1455 //------------------------------------------------------------------------------------------------------------------------------------------------------------
1456 aRamCanvas.drawPoint(std::complex<double>(2, 4), dColor); // complex<double> -- complex<double> no work
1457 aRamCanvas.drawPoint(std::tuple<double,double>(4, 4), cColor); // tuple<double,double> -- tuple<double,double> no work
1458 aRamCanvas.drawPoint(std::vector<double>({6, 4}), dColor); // vector<double>
1459
1460 //------------------------------------------------------------------------------------------------------------------------------------------------------------
1461 BOOST_TEST_CHECK(RaRamCanvas.readRAWfile("../data/utest/ut-points-a.mrw") == 0);
1462 BOOST_TEST_CHECK(RaRamCanvas.isEqual(aRamCanvas) == true);
1463
1464 //------------------------------------------------------------------------------------------------------------------------------------------------------------
1465 aRamCanvas.writeRAWfile("ut-points-a.mrw");
1466 aRamCanvas.scaleUpProximal(20);
1467 aRamCanvas.writeTIFFfile("ut-points-a.tiff");
1468}
1469
1470////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
1471BOOST_AUTO_TEST_CASE(lines_ep_swap) {
1472
1473// Make sure we get the same result regardless of point order in drawLine call
1474
1475 mjr::ramCanvas1c8b aRamCanvas(16, 16);
1476 mjr::ramCanvas1c8b bRamCanvas(16, 16);
1477 mjr::ramCanvas1c8b::colorType aColor(mjr::ramCanvas1c8b::colorType::cornerColorEnum::WHITE);
1478
1479 int x1, y1, x2, y2;
1480 for(int i=0; i<16; i++) {
1481 y1 = i;
1482 x1 = 0;
1483 y2 = 15-y1;
1484 x2 = 15;
1485 aRamCanvas.clrCanvasToBlack();
1486 aRamCanvas.drawLine(x1, y1, x2, y2, aColor);
1487 bRamCanvas.clrCanvasToBlack();
1488 bRamCanvas.drawLine(x2, y2, x1, y1, aColor);
1489 BOOST_TEST_CHECK(aRamCanvas.isEqual(bRamCanvas) == true);
1490 y1 = 0;
1491 x1 = i;
1492 y2 = 15;
1493 x2 = 15-x1;
1494 aRamCanvas.clrCanvasToBlack();
1495 aRamCanvas.drawLine(x1, y1, x2, y2, aColor);
1496 bRamCanvas.clrCanvasToBlack();
1497 bRamCanvas.drawLine(x2, y2, x1, y1, aColor);
1498 BOOST_TEST_CHECK(aRamCanvas.isEqual(bRamCanvas) == true);
1499 // Clip on right
1500 y1 = i;
1501 x1 = 0;
1502 y2 = 15-y1;
1503 x2 = 25;
1504 aRamCanvas.clrCanvasToBlack();
1505 aRamCanvas.drawLine(x1, y1, x2, y2, aColor);
1506 bRamCanvas.clrCanvasToBlack();
1507 bRamCanvas.drawLine(x2, y2, x1, y1, aColor);
1508 BOOST_TEST_CHECK(aRamCanvas.isEqual(bRamCanvas) == true);
1509 // Clip on top
1510 y1 = 0;
1511 x1 = i;
1512 y2 = 25;
1513 x2 = 15-x1;
1514 aRamCanvas.clrCanvasToBlack();
1515 aRamCanvas.drawLine(x1, y1, x2, y2, aColor);
1516 bRamCanvas.clrCanvasToBlack();
1517 bRamCanvas.drawLine(x2, y2, x1, y1, aColor);
1518 BOOST_TEST_CHECK(aRamCanvas.isEqual(bRamCanvas) == true);
1519 // Clip on left
1520 y1 = i;
1521 x1 = -5;
1522 y2 = 15-y1;
1523 x2 = 15;
1524 aRamCanvas.clrCanvasToBlack();
1525 aRamCanvas.drawLine(x1, y1, x2, y2, aColor);
1526 bRamCanvas.clrCanvasToBlack();
1527 bRamCanvas.drawLine(x2, y2, x1, y1, aColor);
1528 BOOST_TEST_CHECK(aRamCanvas.isEqual(bRamCanvas) == true);
1529 // Clip on bot
1530 y1 = -10;
1531 x1 = i;
1532 y2 = 15;
1533 x2 = 15-x1;
1534 aRamCanvas.clrCanvasToBlack();
1535 aRamCanvas.drawLine(x1, y1, x2, y2, aColor);
1536 bRamCanvas.clrCanvasToBlack();
1537 bRamCanvas.drawLine(x2, y2, x1, y1, aColor);
1538 BOOST_TEST_CHECK(aRamCanvas.isEqual(bRamCanvas) == true);
1539 }
1540}
1541
1542////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
1543BOOST_AUTO_TEST_CASE(btriangle) {
1544
1545 mjr::ramCanvas3c8b aRamCanvas(153, 83); mjr::ramCanvas3c8b RaRamCanvas(153, 83);
1546
1547 aRamCanvas.drawFillTriangle(81, 31, 1, 9, 51, 81, "green", "red", "blue");
1548 aRamCanvas.drawTriangle (81, 31, 1, 9, 51, 81, "white");
1549
1550 aRamCanvas.drawFillTriangle(71, 1, 151, 31, 121, 81, "red", "green", "blue");
1551 aRamCanvas.drawTriangle (71, 1, 151, 31, 121, 81, "white");
1552
1553 BOOST_TEST_CHECK(RaRamCanvas.readRAWfile("../data/utest/ut-btriangle-a.mrw") == 0);
1554 BOOST_TEST_CHECK(RaRamCanvas.isEqual(aRamCanvas) == true);
1555
1556 aRamCanvas.writeRAWfile("ut-btriangle-a.mrw");
1557 aRamCanvas.scaleUpProximal(20);
1558 aRamCanvas.writeTIFFfile("ut-btriangle-a.tiff");
1559}
1560
1561////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
1562BOOST_AUTO_TEST_CASE(glyph_axis) {
1563
1564 // Make sure glyphs render right side up and forward. The images in RAM will differ, but the *FILES* should be identical.
1565
1566 mjr::ramCanvas3c8b aRamCanvas(127, 127);
1567 aRamCanvas.drawLine(0, 63, 127, 63, "blue");
1568 aRamCanvas.drawLine(63, 0, 63, 127, "blue");
1569 aRamCanvas.setIntAxOrientationX(mjr::ramCanvas3c8b::intAxisOrientation::NATURAL);
1570 aRamCanvas.setIntAxOrientationY(mjr::ramCanvas3c8b::intAxisOrientation::NATURAL);
1571 aRamCanvas.drawHersheyGlyph(505, 63, 63, 1, 1, "red");
1572 aRamCanvas.drawHersheyGlyph(505, 63, 63, 2, 2, "red");
1573 aRamCanvas.drawHersheyGlyph(505, 63, 63, 4, 4, "red");
1574
1575 aRamCanvas.writeRAWfile("ut-glyph_axis-a.mrw");
1576 aRamCanvas.scaleUpProximal(4);
1577 aRamCanvas.writeTIFFfile("ut-glyph_axis-a.tiff");
1578
1579 mjr::ramCanvas3c8b bRamCanvas(127, 127);
1580 bRamCanvas.drawLine(0, 63, 127, 63, "blue");
1581 bRamCanvas.drawLine(63, 0, 63, 127, "blue");
1582 bRamCanvas.setIntAxOrientationX(mjr::ramCanvas3c8b::intAxisOrientation::NATURAL);
1583 bRamCanvas.setIntAxOrientationY(mjr::ramCanvas3c8b::intAxisOrientation::INVERTED);
1584 bRamCanvas.drawHersheyGlyph(505, 63, 63, 1, 1, "red");
1585 bRamCanvas.drawHersheyGlyph(505, 63, 63, 2, 2, "red");
1586 bRamCanvas.drawHersheyGlyph(505, 63, 63, 4, 4, "red");
1587
1588 bRamCanvas.writeRAWfile("ut-glyph_axis-b.mrw");
1589 bRamCanvas.scaleUpProximal(4);
1590 bRamCanvas.writeTIFFfile("ut-glyph_axis-b.tiff");
1591
1592 mjr::ramCanvas3c8b cRamCanvas(127, 127);
1593 cRamCanvas.drawLine(0, 63, 127, 63, "blue");
1594 cRamCanvas.drawLine(63, 0, 63, 127, "blue");
1595 cRamCanvas.setIntAxOrientationX(mjr::ramCanvas3c8b::intAxisOrientation::INVERTED);
1596 cRamCanvas.setIntAxOrientationY(mjr::ramCanvas3c8b::intAxisOrientation::NATURAL);
1597 cRamCanvas.drawHersheyGlyph(505, 63, 63, 1, 1, "red");
1598 cRamCanvas.drawHersheyGlyph(505, 63, 63, 2, 2, "red");
1599 cRamCanvas.drawHersheyGlyph(505, 63, 63, 4, 4, "red");
1600
1601 cRamCanvas.writeRAWfile("ut-glyph_axis-c.mrw");
1602 cRamCanvas.scaleUpProximal(4);
1603 cRamCanvas.writeTIFFfile("ut-glyph_axis-c.tiff");
1604
1605 mjr::ramCanvas3c8b dRamCanvas(127, 127);
1606 dRamCanvas.drawLine(0, 63, 127, 63, "blue");
1607 dRamCanvas.drawLine(63, 0, 63, 127, "blue");
1608 dRamCanvas.setIntAxOrientationX(mjr::ramCanvas3c8b::intAxisOrientation::INVERTED);
1609 dRamCanvas.setIntAxOrientationY(mjr::ramCanvas3c8b::intAxisOrientation::INVERTED);
1610 dRamCanvas.drawHersheyGlyph(505, 63, 63, 1, 1, "red");
1611 dRamCanvas.drawHersheyGlyph(505, 63, 63, 2, 2, "red");
1612 dRamCanvas.drawHersheyGlyph(505, 63, 63, 4, 4, "red");
1613
1614 dRamCanvas.writeRAWfile("ut-glyph_axis-d.mrw");
1615 dRamCanvas.scaleUpProximal(4);
1616 dRamCanvas.writeTIFFfile("ut-glyph_axis-d.tiff");
1617
1618 std::ifstream ifsag("ut-glyph_axis-a.mrw");
1619 std::ifstream ifsaar("../data/utest/ut-glyph_axis-a.mrw");
1620 std::istream_iterator<char> bag(ifsag), eag;
1621 std::istream_iterator<char> baar(ifsaar), eaar;
1622 BOOST_CHECK_EQUAL_COLLECTIONS(bag, eag, baar, eaar);
1623
1624 std::ifstream ifsbg("ut-glyph_axis-b.mrw");
1625 std::ifstream ifsabr("../data/utest/ut-glyph_axis-a.mrw");
1626 std::istream_iterator<char> bbg(ifsbg), ebg;
1627 std::istream_iterator<char> babr(ifsabr), eabr;
1628 BOOST_CHECK_EQUAL_COLLECTIONS(bbg, ebg, babr, eabr);
1629
1630 std::ifstream ifscg("ut-glyph_axis-c.mrw");
1631 std::ifstream ifsacr("../data/utest/ut-glyph_axis-a.mrw");
1632 std::istream_iterator<char> bcg(ifscg), ecg;
1633 std::istream_iterator<char> bacr(ifsacr), eacr;
1634 BOOST_CHECK_EQUAL_COLLECTIONS(bcg, ecg, bacr, eacr);
1635
1636 std::ifstream ifsdg("ut-glyph_axis-d.mrw");
1637 std::ifstream ifsadr("../data/utest/ut-glyph_axis-a.mrw");
1638 std::istream_iterator<char> bdg(ifsdg), edg;
1639 std::istream_iterator<char> badr(ifsadr), eadr;
1640 BOOST_CHECK_EQUAL_COLLECTIONS(bdg, edg, badr, eadr);
1641}
1642
1643////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
1644BOOST_AUTO_TEST_CASE(strings) {
1645
1646 mjr::ramCanvas3c8b aRamCanvas(450, 100); mjr::ramCanvas3c8b RaRamCanvas(450, 100);
1647 int y;
1648 aRamCanvas.setIntAxOrientationY(mjr::ramCanvas3c8b::intAxisOrientation::INVERTED);
1649 RaRamCanvas.setIntAxOrientationY(mjr::ramCanvas3c8b::intAxisOrientation::INVERTED);
1650 aRamCanvas.drawLine(50, 0, 50, 512, "blue");
1651 y = 18;
1652 aRamCanvas.drawLine(0, y, 1024, y, "blue");
1653 aRamCanvas.drawString("Hello, World!", mjr::hershey::font::ROMAN_SL_SANSERIF, 50, y, "red", 1, 16);
1654 y+=50;
1655 aRamCanvas.drawLine(0, y, 1024, y, "blue");
1656 aRamCanvas.drawString("Hello, World!", mjr::hershey::font::ROMAN_SL_SANSERIF, 50, y, "red", 2, 15);
1657
1658 BOOST_TEST_CHECK(RaRamCanvas.readRAWfile("../data/utest/ut-strings-a.mrw") == 0);
1659 BOOST_TEST_CHECK(RaRamCanvas.isEqual(aRamCanvas) == true);
1660
1661 mjr::ramCanvas3c8b bRamCanvas(450, 100); mjr::ramCanvas3c8b RbRamCanvas(450, 100);
1662 bRamCanvas.setIntAxOrientationY(mjr::ramCanvas3c8b::intAxisOrientation::INVERTED);
1663 RbRamCanvas.setIntAxOrientationY(mjr::ramCanvas3c8b::intAxisOrientation::INVERTED);
1664 y =18;
1665 bRamCanvas.drawStringBox("Hello, World!", mjr::hershey::font::ROMAN_SL_SANSERIF, 50, y, "red", "green", 1, 16);
1666 bRamCanvas.drawLine(0, y, 1024, y, "blue");
1667 y+=50;
1668 bRamCanvas.drawStringBox("Hello, World!", mjr::hershey::font::ROMAN_SL_SANSERIF, 50, y, "red", "green", 2, 15);
1669 bRamCanvas.drawLine(0, y, 1024, y, "blue");
1670 bRamCanvas.drawLine(50, 0, 50, 512, "blue");
1671
1672 BOOST_TEST_CHECK(RbRamCanvas.readRAWfile("../data/utest/ut-strings-b.mrw") == 0);
1673 BOOST_TEST_CHECK(RbRamCanvas.isEqual(bRamCanvas) == true);
1674
1675 aRamCanvas.writeRAWfile("ut-strings-a.mrw");
1676 aRamCanvas.scaleUpProximal(4);
1677 aRamCanvas.writeTIFFfile("ut-strings-a.tiff");
1678
1679 bRamCanvas.writeRAWfile("ut-strings-b.mrw");
1680 bRamCanvas.scaleUpProximal(4);
1681 bRamCanvas.writeTIFFfile("ut-strings-b.tiff");
1682}
1683
1684////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
1685BOOST_AUTO_TEST_CASE(geom_tfrm) {
1686
1687 mjr::ramCanvas1c8b aRamCanvas(8, 8); mjr::ramCanvas1c8b RaRamCanvas(8, 8);
1688
1689 //------------------------------------------------------------------------------------------------------------------------------------------------------------
1690 aRamCanvas.drawLine(0, 0, 3, 0, "white");
1691 aRamCanvas.drawLine(3, 7, 7, 7, "white");
1692 BOOST_TEST_CHECK(RaRamCanvas.readRAWfile("../data/utest/ut-geom_tfrm-a.mrw") == 0);
1693 BOOST_TEST_CHECK(RaRamCanvas.isEqual(aRamCanvas) == true);
1694
1695 //------------------------------------------------------------------------------------------------------------------------------------------------------------
1696 mjr::ramCanvas1c8b bRamCanvas(aRamCanvas); mjr::ramCanvas1c8b RbRamCanvas(8, 8);
1697 bRamCanvas.flipHorz();
1698 BOOST_TEST_CHECK(RbRamCanvas.readRAWfile("../data/utest/ut-geom_tfrm-b.mrw") == 0);
1699 BOOST_TEST_CHECK(RbRamCanvas.isEqual(bRamCanvas) == true);
1700 RbRamCanvas.flipHorz();
1701 BOOST_TEST_CHECK(RbRamCanvas.isEqual(aRamCanvas) == true);
1702
1703 //------------------------------------------------------------------------------------------------------------------------------------------------------------
1704 mjr::ramCanvas1c8b cRamCanvas(aRamCanvas); mjr::ramCanvas1c8b RcRamCanvas(8, 8);
1705 cRamCanvas.flipVert();
1706 BOOST_TEST_CHECK(RcRamCanvas.readRAWfile("../data/utest/ut-geom_tfrm-c.mrw") == 0);
1707 BOOST_TEST_CHECK(RcRamCanvas.isEqual(cRamCanvas) == true);
1708 RcRamCanvas.flipVert();
1709 BOOST_TEST_CHECK(RcRamCanvas.isEqual(aRamCanvas) == true);
1710
1711 //------------------------------------------------------------------------------------------------------------------------------------------------------------
1712 mjr::ramCanvas1c8b dRamCanvas(aRamCanvas); mjr::ramCanvas1c8b RdRamCanvas(8, 8);
1713 dRamCanvas.flipTranspose();
1714 BOOST_TEST_CHECK(RdRamCanvas.readRAWfile("../data/utest/ut-geom_tfrm-d.mrw") == 0);
1715 BOOST_TEST_CHECK(RdRamCanvas.isEqual(dRamCanvas) == true);
1716 RdRamCanvas.flipTranspose();
1717 BOOST_TEST_CHECK(RdRamCanvas.isEqual(aRamCanvas) == true);
1718
1719 //------------------------------------------------------------------------------------------------------------------------------------------------------------
1720 mjr::ramCanvas1c8b eRamCanvas(aRamCanvas); mjr::ramCanvas1c8b ReRamCanvas(8, 8);
1721 eRamCanvas.rotate90CW();
1722 BOOST_TEST_CHECK(ReRamCanvas.readRAWfile("../data/utest/ut-geom_tfrm-e.mrw") == 0);
1723 BOOST_TEST_CHECK(ReRamCanvas.isEqual(eRamCanvas) == true);
1724 eRamCanvas.rotate90CCW();
1725 BOOST_TEST_CHECK(eRamCanvas.isEqual(aRamCanvas) == true);
1726 eRamCanvas.rotate90CW();
1727 eRamCanvas.rotate90CW();
1728 eRamCanvas.rotate90CW();
1729 eRamCanvas.rotate90CW();
1730 BOOST_TEST_CHECK(eRamCanvas.isEqual(aRamCanvas) == true);
1731
1732 //------------------------------------------------------------------------------------------------------------------------------------------------------------
1733 mjr::ramCanvas1c8b fRamCanvas(aRamCanvas); mjr::ramCanvas1c8b RfRamCanvas(8, 8);
1734 fRamCanvas.rotate90CCW();
1735 BOOST_TEST_CHECK(RfRamCanvas.readRAWfile("../data/utest/ut-geom_tfrm-f.mrw") == 0);
1736 BOOST_TEST_CHECK(RfRamCanvas.isEqual(fRamCanvas) == true);
1737 fRamCanvas.rotate90CW();
1738 BOOST_TEST_CHECK(fRamCanvas.isEqual(aRamCanvas) == true);
1739 fRamCanvas.rotate90CCW();
1740 fRamCanvas.rotate90CCW();
1741 fRamCanvas.rotate90CCW();
1742 fRamCanvas.rotate90CCW();
1743 BOOST_TEST_CHECK(fRamCanvas.isEqual(aRamCanvas) == true);
1744
1745 //------------------------------------------------------------------------------------------------------------------------------------------------------------
1746 mjr::ramCanvas1c8b gRamCanvas(aRamCanvas); mjr::ramCanvas1c8b RgRamCanvas(8, 8);
1747 gRamCanvas.rotate180();
1748 BOOST_TEST_CHECK(RgRamCanvas.readRAWfile("../data/utest/ut-geom_tfrm-g.mrw") == 0);
1749 BOOST_TEST_CHECK(RgRamCanvas.isEqual(gRamCanvas) == true);
1750 gRamCanvas.rotate180();
1751 BOOST_TEST_CHECK(gRamCanvas.isEqual(aRamCanvas) == true);
1752
1753 //------------------------------------------------------------------------------------------------------------------------------------------------------------
1754 aRamCanvas.writeRAWfile("ut-geom_tfrm-a.mrw");
1755 aRamCanvas.scaleUpProximal(16);
1756 aRamCanvas.writeTIFFfile("ut-geom_tfrm-a.tiff");
1757
1758 bRamCanvas.writeRAWfile("ut-geom_tfrm-b.mrw");
1759 bRamCanvas.scaleUpProximal(16);
1760 bRamCanvas.writeTIFFfile("ut-geom_tfrm-b.tiff");
1761
1762 cRamCanvas.writeRAWfile("ut-geom_tfrm-c.mrw");
1763 cRamCanvas.scaleUpProximal(16);
1764 cRamCanvas.writeTIFFfile("ut-geom_tfrm-c.tiff");
1765
1766 dRamCanvas.writeRAWfile("ut-geom_tfrm-d.mrw");
1767 dRamCanvas.scaleUpProximal(16);
1768 dRamCanvas.writeTIFFfile("ut-geom_tfrm-d.tiff");
1769
1770 eRamCanvas.writeRAWfile("ut-geom_tfrm-e.mrw");
1771 eRamCanvas.scaleUpProximal(16);
1772 eRamCanvas.writeTIFFfile("ut-geom_tfrm-e.tiff");
1773
1774 fRamCanvas.writeRAWfile("ut-geom_tfrm-f.mrw");
1775 fRamCanvas.scaleUpProximal(16);
1776 fRamCanvas.writeTIFFfile("ut-geom_tfrm-f.tiff");
1777
1778 gRamCanvas.writeRAWfile("ut-geom_tfrm-g.mrw");
1779 gRamCanvas.scaleUpProximal(16);
1780 gRamCanvas.writeTIFFfile("ut-geom_tfrm-g.tiff");
1781}
1782
1783////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
1784BOOST_AUTO_TEST_CASE(p_scale) {
1785
1786 mjr::ramCanvas1c8b aRamCanvas(4, 4); mjr::ramCanvas1c8b RaRamCanvas(8, 8);
1787
1788 //------------------------------------------------------------------------------------------------------------------------------------------------------------
1789 aRamCanvas.drawLine(0, 0, 4, 0, "white");
1790 aRamCanvas.drawLine(0, 1, 4, 1, "black");
1791
1792 aRamCanvas.drawLine(2, 0, 2, 4, "black");
1793 aRamCanvas.drawLine(3, 4, 3, 4, "white");
1794
1795 aRamCanvas.drawLine(0, 2, 4, 2, "black");
1796 aRamCanvas.drawLine(0, 3, 4, 4, "white");
1797
1798 BOOST_TEST_CHECK(RaRamCanvas.readRAWfile("../data/utest/ut-p_scale-a.mrw") == 0);
1799 BOOST_TEST_CHECK(RaRamCanvas.isEqual(aRamCanvas) == true);
1800
1801 //------------------------------------------------------------------------------------------------------------------------------------------------------------
1802 mjr::ramCanvas1c8b bRamCanvas(aRamCanvas); mjr::ramCanvas1c8b RbRamCanvas(8, 8);
1803 bRamCanvas.scaleDown1pt(2);
1804 BOOST_TEST_CHECK(RbRamCanvas.readRAWfile("../data/utest/ut-p_scale-b.mrw") == 0);
1805 BOOST_TEST_CHECK(RbRamCanvas.isEqual(bRamCanvas) == true);
1806
1807 //------------------------------------------------------------------------------------------------------------------------------------------------------------
1808 mjr::ramCanvas1c8b cRamCanvas(aRamCanvas); mjr::ramCanvas1c8b RcRamCanvas(8, 8);
1809 cRamCanvas.scaleDownMax(2);
1810 BOOST_TEST_CHECK(RcRamCanvas.readRAWfile("../data/utest/ut-p_scale-c.mrw") == 0);
1811 BOOST_TEST_CHECK(RcRamCanvas.isEqual(cRamCanvas) == true);
1812
1813 //------------------------------------------------------------------------------------------------------------------------------------------------------------
1814 mjr::ramCanvas1c8b dRamCanvas(aRamCanvas); mjr::ramCanvas1c8b RdRamCanvas(8, 8);
1815 dRamCanvas.scaleDownMean(2);
1816 BOOST_TEST_CHECK(RdRamCanvas.readRAWfile("../data/utest/ut-p_scale-d.mrw") == 0);
1817 BOOST_TEST_CHECK(RdRamCanvas.isEqual(dRamCanvas) == true);
1818
1819 //------------------------------------------------------------------------------------------------------------------------------------------------------------
1820 mjr::ramCanvas1c8b eRamCanvas(dRamCanvas); mjr::ramCanvas1c8b ReRamCanvas(8, 8);
1821 eRamCanvas.scaleUpProximal(2);
1822 BOOST_TEST_CHECK(ReRamCanvas.readRAWfile("../data/utest/ut-p_scale-e.mrw") == 0);
1823 BOOST_TEST_CHECK(ReRamCanvas.isEqual(eRamCanvas) == true);
1824
1825 //------------------------------------------------------------------------------------------------------------------------------------------------------------
1826 aRamCanvas.writeRAWfile("ut-p_scale-a.mrw");
1827 aRamCanvas.scaleUpProximal(32);
1828 aRamCanvas.writeTIFFfile("ut-p_scale-a.tiff");
1829
1830 bRamCanvas.writeRAWfile("ut-p_scale-b.mrw");
1831 bRamCanvas.scaleUpProximal(64);
1832 bRamCanvas.writeTIFFfile("ut-p_scale-b.tiff");
1833
1834 cRamCanvas.writeRAWfile("ut-p_scale-c.mrw");
1835 cRamCanvas.scaleUpProximal(64);
1836 cRamCanvas.writeTIFFfile("ut-p_scale-c.tiff");
1837
1838 dRamCanvas.writeRAWfile("ut-p_scale-d.mrw");
1839 dRamCanvas.scaleUpProximal(64);
1840 dRamCanvas.writeTIFFfile("ut-p_scale-d.tiff");
1841
1842 eRamCanvas.writeRAWfile("ut-p_scale-e.mrw");
1843 eRamCanvas.scaleUpProximal(32);
1844 eRamCanvas.writeTIFFfile("ut-p_scale-e.tiff");
1845}
1846
1847////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
1848BOOST_AUTO_TEST_CASE(adjoin) {
1849
1850 mjr::ramCanvas1c8b aRamCanvas(8, 8);
1851 aRamCanvas.drawRectangle(0, 0, 7, 7, "white");
1852 aRamCanvas.drawLine(0, 7, 7, 0, "white");
1853
1854 mjr::ramCanvas1c8b bRamCanvas(8, 8);
1855 bRamCanvas.drawRectangle(0, 0, 7, 7, "white");
1856 bRamCanvas.drawLine(0, 0, 7, 7, "white");
1857
1858 mjr::ramCanvas1c8b cRamCanvas(aRamCanvas); mjr::ramCanvas1c8b RcRamCanvas(8, 8);
1859 cRamCanvas.adjoinCanvasRight(bRamCanvas);
1860 BOOST_TEST_CHECK(RcRamCanvas.readRAWfile("../data/utest/ut-adjoin-c.mrw") == 0);
1861 BOOST_TEST_CHECK(RcRamCanvas.isEqual(cRamCanvas) == true);
1862
1863 mjr::ramCanvas1c8b dRamCanvas(aRamCanvas); mjr::ramCanvas1c8b RdRamCanvas(8, 8);
1864 dRamCanvas.adjoinCanvasLeft(bRamCanvas);
1865 BOOST_TEST_CHECK(RdRamCanvas.readRAWfile("../data/utest/ut-adjoin-d.mrw") == 0);
1866 BOOST_TEST_CHECK(RdRamCanvas.isEqual(dRamCanvas) == true);
1867
1868 mjr::ramCanvas1c8b eRamCanvas(aRamCanvas); mjr::ramCanvas1c8b ReRamCanvas(8, 8);
1869 eRamCanvas.adjoinCanvasBottom(bRamCanvas);
1870 BOOST_TEST_CHECK(ReRamCanvas.readRAWfile("../data/utest/ut-adjoin-e.mrw") == 0);
1871 BOOST_TEST_CHECK(ReRamCanvas.isEqual(eRamCanvas) == true);
1872
1873 mjr::ramCanvas1c8b fRamCanvas(aRamCanvas); mjr::ramCanvas1c8b RfRamCanvas(8, 8);
1874 fRamCanvas.adjoinCanvasTop(bRamCanvas);
1875 BOOST_TEST_CHECK(RfRamCanvas.readRAWfile("../data/utest/ut-adjoin-f.mrw") == 0);
1876 BOOST_TEST_CHECK(RfRamCanvas.isEqual(fRamCanvas) == true);
1877
1878 //------------------------------------------------------------------------------------------------------------------------------------------------------------
1879 aRamCanvas.writeRAWfile("ut-adjoin-a.mrw");
1880 aRamCanvas.scaleUpProximal(32);
1881 aRamCanvas.writeTIFFfile("ut-adjoin-a.tiff");
1882
1883 //------------------------------------------------------------------------------------------------------------------------------------------------------------
1884 bRamCanvas.writeRAWfile("ut-adjoin-b.mrw");
1885 bRamCanvas.scaleUpProximal(32);
1886 bRamCanvas.writeTIFFfile("ut-adjoin-b.tiff");
1887
1888 //------------------------------------------------------------------------------------------------------------------------------------------------------------
1889 cRamCanvas.writeRAWfile("ut-adjoin-c.mrw");
1890 cRamCanvas.scaleUpProximal(32);
1891 cRamCanvas.writeTIFFfile("ut-adjoin-c.tiff");
1892
1893 //------------------------------------------------------------------------------------------------------------------------------------------------------------
1894 dRamCanvas.writeRAWfile("ut-adjoin-d.mrw");
1895 dRamCanvas.scaleUpProximal(32);
1896 dRamCanvas.writeTIFFfile("ut-adjoin-d.tiff");
1897
1898 //------------------------------------------------------------------------------------------------------------------------------------------------------------
1899 eRamCanvas.writeRAWfile("ut-adjoin-e.mrw");
1900 eRamCanvas.scaleUpProximal(32);
1901 eRamCanvas.writeTIFFfile("ut-adjoin-e.tiff");
1902
1903 //------------------------------------------------------------------------------------------------------------------------------------------------------------
1904 fRamCanvas.writeRAWfile("ut-adjoin-f.mrw");
1905 fRamCanvas.scaleUpProximal(32);
1906 fRamCanvas.writeTIFFfile("ut-adjoin-f.tiff");
1907}
1908
1909#endif
1910
1911
1912
1913 // XRamCanvas.writeRAWfile("ut-strings-X.mrw");
1914 // XRamCanvas.scaleUpProximal(20);
1915 // XRamCanvas.writeTIFFfile("ut-strings-X.tiff");
1916 //
1917 // std::ifstream ifsXg("ut-strings-X.mrw");
1918 // std::ifstream ifsXr("../data/utest/ut-strings-X.mrw");
1919 // std::istream_iterator<char> bXg(ifsXg), eXg;
1920 // std::istream_iterator<char> bXr(ifsXr), eXr;
1921 // BOOST_CHECK_EQUAL_COLLECTIONS(bXg, eXg, bXr, eXr);
1922
1923/** @endcond */