// Parte 2: reescriban invert, threshold y flip_horizontal, y escriban image_stats.
// brighten ya está reescrita y sirve de modelo. Lo que pide cada función está en filters.h.
#include "filters.h"

void 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;
        }
    }
}

void invert(struct image *img) {
    (void) img;  // borren esta línea cuando usen img
    // Escriban aquí su código.
}

void threshold(struct image *img, int level) {
    (void) img;    // borren estas dos líneas cuando usen img y level
    (void) level;
    // Escriban aquí su código.
}

void flip_horizontal(struct image *img) {
    (void) img;  // borren esta línea cuando usen img
    // Escriban aquí su código.
}

void image_stats(const struct image *img, int *min, int *max, double *mean) {
    (void) img;  // borren estas cuatro líneas cuando usen los parámetros
    (void) min;
    (void) max;
    (void) mean;
    // Escriban aquí su código.
}
