[Tuxpaint-devel] Magic size option
An award-winning drawing program for children of all ages
Brought to you by:
wkendrick
From: Bill K. <nb...@so...> - 2023-04-13 17:19:11
|
I've extended Tux Paint's Magic "API", and added a UI element to the Magic tool, to allow magic tools to support sizes. For example, for 20 years now, tools like "Darken" have been locked at a particular size -- e.g., a 16px diameter circle -- making it difficult to make finer adjustments. Now, it will be possible for such tools to tell Tux Paint, for example, "I accept 4 different sizes, and my default is '2'". The Magic tool will then show a little 4-step sizing selector (similar to the options for stamp sizes, brush spacing, and slideshow playback speed). Almost none of the Magic tools support the updated API yet (I need to go in and edit every single pluin source!), so if you `git pull` right now, don't be surprised when you see almost all of the Magic tools missing. ;-) I've so far worked on three plugins: * Kaleidoscope, Symmetry, Tile, Pattern -- offer different thickness levels for the lines you paint. * Blur -- offer different radiuses for the blur effect. Since the Blur tool offers both 'paint'/freehand mode, and 'fullscreen'/affect-the-whole-canvas-at-once mode, I had to make sure the sizing option was not just tool-specific, but also mode-specific. * Googly Eyes -- offer four different sizes of googly eyes. But wait! Tux Paint already has two different googly eye tools -- large & small! Well, it won't any more. That is, unless Tux Paint is invoked with "--nomagicsizes", which disables this new feature altogether, thus simplifying the UI for younger kids. It isn't a requirement that size option needs to affect the radius of an applied effect (like darken, blur, etc.), or the thickness of a painted effect (like toothpaste or fur); it's entirely up to the Magic tool to decide how to interpret the user's choice. (Of course, we need to avoid too many 'surprises'.) For example, the new Kaleido-X tools could be collapsed into a single tool (when this new sizing UI hasn't been disabled), and offer the different variations (-4, -6, and -8 -- and perhaps more!) via the 'sizing' interface. Some tools may end up using the setting more as an 'intensity' option. (I've actually thought of providing TWO sliders, but... I need to not go overboard, here, I think!) Why did I do this? It's by popular demand. Obviously, folks I hear from on Twitter are not the youngest users of Tux Paint, and are skewed more in the teen-to-twenties age range, but of course that's why I always try to make it possible to turn off new "advanced" features for the younger users. (The option to disable this is already in tuxpaint-config git master. :) ) Long story short, basically there are a lot of places where we (mostly me) picked an arbitrary hard-coded value that gets used by Magic tools, but now it's possible to let the user pick from a variety of sizes :) - for (yy = -8; yy < 8; yy++) - { - for (xx = -8; xx < 8; xx++) + for (yy = -kalidescope_sz; yy < kalidescope_sz; yy++) + { + for (xx = -kalidescope_sz; xx < kalidescope_sz; xx++) -- -bill! Sent from my computer |