Grafx2 Panning
I've been spending the last year working (off-and-on) on some changes to Grafx2!
Grafx2, for anyone not aware of it, is an old piece of pixel art software from the 90s, for doing 256 color art. It closely mimics Deluxe Paint, for those familiar with it.
There are a few weird aspects of the UI (attributable to the fact that it's from the 90s), but the biggest issue I have with it is the limited ability to pan around the image. As of this writing, Grafx2 doesn't let you move the visible area in a way that would let you center the upper-left corner of the image. You can't pan further to the left than the point where the left edge touches the left side of the screen (or window). Similarly for the top edge and vertical panning.
Thankfully, Grafx2 is also open-source! So I figured "oh! Why don't I just go in and fix that?"
The result was a lot more work than I bargained for. But it's finally starting to show results. You can now pan the image around a lot more freely in Grafx2!
I have a branch that, while the code is SUPER MESSY and spills out a ton of warnings, it's still functional. Almost everything works (except one of the many pixel scaling modes, as of this writing).
My current "panning" branch is available right here. Feel free to give it a whirl! Please, please, please let me know if you find any bugs specific to the panning branch!
The messy details
This change touches a LOT of code.
- Many tools had their own (redundant) clipping implementation, so a lot of that has been shifted out into some common clipping functions.
- A lot of the existing global variables that describe the usable/visible area have been swapped out with more descriptive names, with dedicated clip area structures.
- Many variables throughout the application needed to be converted into signed types.
- Every single pixel scaling mode has separate redundant code that needed an update. The redundancy here would be difficult to factor out, because a lot of these functions - being low-level blitters and such - need to avoid any extra function call overhead.
Remaining work
The code is extremely messy at the moment, and needs a ton of cleanup, but everything is currently working. At least, on PC.
It still needs testing on all the other platforms Grafx2 runs on. This is largely due to switching around some integer data types that might end up with different sizes or signedness on other platforms with different data models.