// Sesión 2: escriban invert, threshold, flip_horizontal y box_blur.
// brighten ya está hecha y sirve de modelo. Lo que pide cada filtro está en filters.h.
#include "filters.h"

struct image brighten(struct image img, int amount) {
    for (int y = 0; y < img.height; y++) {
        for (int x = 0; x < img.width; x++) {
            int value = img.pixels[y][x] + amount;
            if (value < 0) {
                value = 0;
            }
            if (value > img.max_value) {
                value = img.max_value;
            }
            img.pixels[y][x] = value;
        }
    }
    return img;
}

struct image invert(struct image img) {
    // Escriban aquí su código.
    return img;
}

struct image threshold(struct image img, int level) {
    (void) level;  // borren esta línea cuando usen level
    // Escriban aquí su código.
    return img;
}

struct image flip_horizontal(struct image img) {
    // Escriban aquí su código.
    return img;
}

struct image box_blur(struct image img, int radius) {
    (void) radius;  // borren esta línea cuando usen radius
    // Escriban aquí su código.
    return img;
}
