Open p0nce opened 10 years ago
Yeh I really like the template approach, my own abstraction was not well thought out. Let's do it. My headaches when writing this initially were about pixel formats and how to deal with different types of pixel/color interleaving. It's not clear to me how this is efficiently handled in CyberShadow's approach, but I didn't dig too deep yet.
When I started my own library, I also had one Image abstraction, and used it to port stb_image to D. All was good and I thought I had something foundational for image processing in D (Yet the JPEG and PNG decoders of stb_image are hard to modify/understand, and I'd like to get rid of them).
Then CyberShadow published its own Image abstraction: http://blog.thecybershadow.net/2014/03/21/functional-image-processing-in-d/ and it was way better than mine, so I scrapped my own, ported this part of
ae
to DUB (package "ae-graphics") and used it until now.Now I found imaged which I'd like to contribute too but it has its own Image abstraction. I think it's an impediment for code reuse and prevent the "STL" style that is embodied in Phobos.
My vision for imaged (and I'm not sure if you would agree) is the following : I'd like imaged to scrap its own Image abstraction and use ae-graphics's one. Here the concepts https://github.com/p0nce/ae-graphics/blob/master/ae/utils/graphics/view.d#L22 (not my library just a fork for DUB). What is fascinating about it is that this resembles ranges, there is probably something fundamental about it with regards to algorithms separated from data.
Now let's get gory, what would be the mapping between ae-graphics and imaged concepts?
Img(Px F)
would be an instantiation of https://github.com/p0nce/ae-graphics/blob/master/ae/utils/graphics/image.d#L72 . With goal of separation of algorithm and data in mind, image resizing and bilinear interpolation would have to be separated from Img(Px F).interface Image
in imaged), you would manipulate an Algebraic http://dlang.org/phobos/std_variant.html#.Algebraicinterface Image
would then disappear in a puff of smoke.What do you think?