Print attributes for ppm
This commit is contained in:
@@ -233,3 +233,11 @@ inherit_from_ppm(const PPM* in)
|
||||
};
|
||||
return image;
|
||||
}
|
||||
|
||||
/** The Second image gets merged into the first.
|
||||
* The First image obtains attributes from the second image that were not found.
|
||||
*/
|
||||
PPM
|
||||
merge_ppm(const PPM* in_1, const PPM* in_2) {
|
||||
if(in)
|
||||
}
|
||||
|
||||
+17
-10
@@ -1,20 +1,27 @@
|
||||
#include <stdlib.h>
|
||||
#include "image/utils.h"
|
||||
#include "image/filters.h"
|
||||
// #include "transformations.h"
|
||||
// #include "image/filters.h"
|
||||
// #include "image/transformations.h"
|
||||
#include "image/imgio.h"
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
PPM out = {
|
||||
.name = "../test.ppm",
|
||||
};
|
||||
JPEG out_1 = {
|
||||
.name = "../MF8jno.jpg",
|
||||
|
||||
unsigned int* src_buf = ppm_load("../assets/8ktest.ppm", &out);
|
||||
unsigned int* blurred = box_blur(src_buf, &out, 10);
|
||||
ppm_save(blurred, out);
|
||||
free(src_buf);
|
||||
free(blurred);
|
||||
};
|
||||
|
||||
// PPM out_2 = inherit_from_jpeg(&out_1, '6');
|
||||
//
|
||||
//
|
||||
PPM out = inherit_from_jpeg(&out_1, '6');
|
||||
// print_attr(&out);
|
||||
// unsigned int* src_buf = ppm_load("../assets/8ktest.ppm", &out_2);
|
||||
// unsigned int* blurred = box_blur(src_buf, &out_2, 10);
|
||||
// unsigned int* flip = u32_rotate(src_buf_jpeg, );
|
||||
// ppm_save(blurred, out_2);
|
||||
// free(src_buf);
|
||||
// free(blurred);
|
||||
return 0;
|
||||
}
|
||||
|
||||
+10
@@ -1,4 +1,5 @@
|
||||
#include "image/utils.h"
|
||||
#include <stdio.h>
|
||||
|
||||
unsigned long
|
||||
u32to_u64(const unsigned int clr)
|
||||
@@ -21,3 +22,12 @@ u64to_u32(const unsigned long clr, const unsigned long u64_div)
|
||||
return ENCODE_ARGB((a / u64_div), (r / u64_div), (g / u64_div),
|
||||
(b / u64_div));
|
||||
}
|
||||
|
||||
// Utilizing new knowledge below
|
||||
|
||||
void
|
||||
__attribute__((overloadable))
|
||||
print_attr(const PPM *src) {
|
||||
printf("Name: %s\nFMT: %c\nWidth: %i, Height: %i\nLength: %i",
|
||||
src->name, src->fmt, src->width, src->height, src->len);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user