When writing graphics operations [blits, combines, etc] for various formats I often find that I often have to write/rewrite/cut'n'paste a boring chunk of boiler plate code that does clipping, calculates a few pointers and so on before getting down to the real work: the pixel shunting. This real work is usually incredibly simple, being either simple assignment under a mask or component lerps, but it's unfortunately obscured by the boiler plate code. I could try an oo type solution, passing a virtual base pixel_op class, but that would be slow and not that much nicer to read/write.
I don't really understand typeclasses so of course I suspect that they could be a solution. Would they allow me to do something like: boiler_plate(src, dst)[copy_op, RGBA8_Type]; boiler_plate(src, dst)[blend_op, RGB8_Type]; boiler_plate2(src, dst, mask)[copy_under_mask_op, RGB8_Type]; boiler_plate(src, dst)[xor_op, RGB16_Type]; boiler_plate(src, dst)[graf_verb, RGBfloat_Type]; or cooler boiler_plate(src, dst)[lerp_op, N_component, fast_int] ? Excuse the very-pseudo code, I basically want to define a swathe of functions as good or better than handwritten version with the least number of keystrokes. Possibile? RF ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Felix-language mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/felix-language
