You're asking for a graphical image adjustment tool while simultaneously asserting that you can't use the extant ones because you want to make your own tool.
There are other interactive tools for doing image adjustment. MIMT has immodify(), and IPT has imcontrast(), but that's really irrelevant. If your goal is to reinvent the wheel, then reinvent the wheel.