MCPcopy Create free account
hub / github.com/devilsen/CZXing / stepToEdge

Method stepToEdge

czxing/src/main/cpp/zxing/src/BitMatrixCursor.h:114–131  ·  view source on GitHub ↗

* @brief stepToEdge advances cursor to one step behind the next (or n-th) edge. * @param nth number of edges to pass * @param range max number of steps to take * @param backup whether or not to backup one step so we land in front of the edge * @return number of steps taken or 0 if moved outside of range/image */

Source from the content-addressed store, hash-verified

112 * @return number of steps taken or 0 if moved outside of range/image
113 */
114 int stepToEdge(int nth = 1, int range = 0, bool backup = false)
115 {
116 int steps = 0;
117 auto lv = testAt(p);
118
119 while (nth && (!range || steps < range) && lv.isValid()) {
120 ++steps;
121 auto v = testAt(p + steps * d);
122 if (lv != v) {
123 lv = v;
124 --nth;
125 }
126 }
127 if (backup)
128 --steps;
129 p += steps * d;
130 return steps * (nth == 0);
131 }
132
133 bool stepAlongEdge(Direction dir, bool skipCorner = false)
134 {

Callers 6

AverageEdgePixelsFunction · 0.80
CenterOfRingFunction · 0.80
CollectRingPointsFunction · 0.80
ReadSymmetricPatternFunction · 0.80
TraceLineFunction · 0.80
ReadCodeWordsFunction · 0.80

Calls 1

isValidMethod · 0.45

Tested by

no test coverage detected