he shoots and misses try again

This commit is contained in:
Gentoo
2026-03-04 22:52:18 -05:00
parent cd3bf2ddb9
commit ce216b1879
+21 -10
View File
@@ -206,21 +206,33 @@ chromatic_circular_shift(unsigned int clr, int n)
}
unsigned int*
horizontal_flip(unsigned int* buf, int size, int w, int h) {
unsigned int* flip = malloc((w *h) * sizeof(unsigned int));
horizontal_flip(unsigned int* buf, int size, int w, int h)
{
unsigned int* flip = malloc((w * h) * sizeof(unsigned int));
int idx = 0;
for (int i = 0; i < w; i++)
{
for (int k = h - 1; k >= 0; k--)
{
flip[idx] = buf[i * w + k];
idx++;
}
}
free(buf);
return flip;
}
unsigned int*
vertical_flip(unsigned int* buf, int size, int w, int h) {
vertical_flip(unsigned int* buf, int size, int w, int h)
{
unsigned int* flip = malloc((w * h) * sizeof(unsigned int));
int idx = 0;
for(int i = h - 1; i >= 0; i--) {
for(int k = 0; k < w; k++) {
for (int i = h - 1; i >= 0; i--)
{
for (int k = 0; k < w; k++)
{
flip[idx] = buf[i * w + k];
idx++;
}
@@ -230,7 +242,6 @@ vertical_flip(unsigned int* buf, int size, int w, int h) {
return flip;
}
void
print_bits_int(unsigned int n)
{
@@ -273,10 +284,10 @@ main()
int max_val;
unsigned int* buf =
ppm_encode("../test.ppm", &width, &height, &max_val,
magic_number);
ppm_encode("../test.ppm", &width, &height, &max_val, magic_number);
// ppm_apply_brightness(buf, (width * height), .5);
buf = vertical_flip(buf, (width * height), width, height);
// buf = vertical_flip(buf, (width * height), width, height);
buf = horizontal_flip(buf, (width * height), width, height);
ppm_decode(buf, (width * height), "../new.ppm", &width, &height);
free(buf);
return 0;