36 QString hash = hashForCoordinates (
p.x(),
40 bool inBounds = (0 <=
p.x() &&
42 p.x() < image.width () &&
43 p.y() < image.height ());
56 for (
int dx = -1;
dx <= 1;
dx++) {
57 for (
int dy = -1;
dy <= 1;
dy++) {
58 if (
dx != 0 ||
dy != 0) {
111 int height = image.height();
112 int width = image.width();
160 int height = image.height();
161 int width = image.width();
195int Pixels::fillPass (
QImage &image,
203 int height = image.height();
204 int width = image.width ();
231 image.setPixel (
col,
row, Qt::black);
239 for (
int dx = -1;
dx <= 1;
dx++) {
243 for (
int dy = -1;
dy <= 1;
dy++) {
247 if (
dx != 0 ||
dy != 0) {
269QString Pixels::hashForCoordinates (
int x,
279int Pixels::indexCollapse (
int row,
const int INNER_RADIUS_MIN
QMap< QString, bool > HashLookup
Quick lookup table for pixel coordinate hashes processed so far.
PixelFillState
Each pixel transitions from unprocessed, to in-process, to processed.
@ PIXEL_FILL_STATE_UNPROCESSED
@ PIXEL_FILL_STATE_IN_PROCESS
@ PIXEL_FILL_STATE_PROCESSED
QQueue< QPoint > QueuedPoints
void fillIsolatedWhitePixels(QImage &image)
Fill in white pixels surrounded by more black pixels than white pixels.
static bool pixelIsBlack(const QImage &image, int x, int y)
Return true if pixel is black in black and white image.
int countBlackPixelsAroundPoint(const QImage &image, int x, int y, int stopCountAt)
Fill triangle between these three points.
void fillHoles(QImage &image, int thresholdCount)
Fill in white holes, surrounded by black pixels, smaller than some threshold number of pixels.
void fillHole(QImage &image, int row, int col, int thresholdCount) const
Fill white hole encompassing (row,col) if number of pixels in that hole is below the threshold.
Pixels()
Single constructor.