1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <stdio.h>
#include <stdlib.h>
// TIP from office hours -- may help with HW13, dealing with corners and edges.
// illustration .. not tested code

int _clamp(int n, int n_min, int n_max) {
    if(n < n_min) {
        return n_min;
    }
    else if(n > n_max) {
        return n_max;
    }
    else {
        return n;
    }
}

int main(int argc, char* argv[]) {
    int x_src = 0;
    int y_src = 1;
    int r = 2;   // radius

    int x_min = _clamp(x_src, 0, img -> header.width_px - 1);
    int x_max = _clamp(x_src, 0, img -> header.width_px - 1);
    for(int x = x_min; x < x_max; x++) {

        int y_min = _clamp(y_src, 0, img -> header.width_px - 1);
        int y_max = _clamp(y_src, 0, img -> header.width_px - 1);
        for(int y = y_min; y < y_max; y++) {

        }
    }

    
    return EXIT_SUCCESS;
}
/* vim: set tabstop=4 shiftwidth=4 fileencoding=utf-8 noexpandtab: */

© Copyright 2019 Alexander J. Quinn         This content is protected and may not be shared, uploaded, or distributed.