Split magic tools into menus
An award-winning drawing program for children of all ages
Brought to you by:
wkendrick
Currently we have dozens of magic tools and it begins to be hard to find a tool between all of them.
Attached is a proposal made by GCI student David Vishal on how can the magic tools be splitted, we can take it as a start, right now I think that Fill should go as a regular tool.
A proposal on how magic tool can be splitted into menus.
I don't disagree that they could be split into sections. However, I do disagree with the idea of a drop-down menu. I think left/right paging buttons, like used in Stamps, would be sufficient.
I have moved Fill tool from magic to regular . How to sumit code for review .
Hi, Sorry for not replying before.
I think the best way would be to upload your code to the fork you have at SF then post
a mail to the -devel mail list explaining where one can check your changes, what you have done so far, what should be tested/reviewed and what do you plan to do next.
I have upadetd my forked repo https://sourceforge.net/u/lokeshsharma97/tuxpaint-SDL2/ci/master/tree/
changes made :
moved magic_fill_tool funcs in tuxpaint.c to ( fill_click , fill_do_flood )
added fill_tool in tools.h
moved fill_tools icon to regular tools
deleted fiil.c
next I would be organizing magic tools . I cannot find that proposal made by GCI student .
Some thoughts
The place of the fill icon should be were currently is the empty box, next to Magic and the empty box removed, so the rest of icons doesn't change their place.
The panel on the right needs work, currently it shows the panel of the last used tool so it is useless for the fill tool. Must think what can be there to make that panel usefull.
The proposal seems gone :(
basically was some categories like
drawing tools, like calligrafy, toothpaste...
object tools, tornado, flower...
tools for very young children, simetry, kalidescope...
effect tools, sharpen, light...
fullscreen tools mirror, flip, move, perspective...
other
The goal would be to have about 10 to 20 magic tools in each category and I supose that tools for very young children should be the default ones.
After thinking a bit . this could be possible solution
The right panel could contain patterns . Position of these patterns would be same as the other tools has
their option ( different shapes in shapes tool , different stamps in stamp tool ) .
when user will click on any of the patten whole enclosed area would be filled by patten( instead
of just color )
the first pattern would be the current color and would be selected by default .
others patterns could be patterns that we already have .
Tv
xor colors
metal paint
three mosiac patterns
mosiac pattern
noise
bricks
example :
if user draw a circle then selected fll tool and then selected bricks pattern then whole
circle would be filled by bricks
Makes sense :)
I was thinking of how to implement pattern fill .
the only magic tool which is able to fill selction properly on drag is mosiac shaped tools.
other tools like bricks draws complete brick without considering boundaries (screenshot attached).
any thoughts how mosiac is able to do this . would be helpful in making pattern fill .
I think scan_fill function and sharpen_pixel are responsible . If I comment the last part where
sharpen_pixel is called inside two for loops in mosaic_shaped_switchin func this behaviour vanishes .
Unable to logic behind those funcs .
Inside mosaic_shaped_fill there are two scan_fill() calls, they do:
first) scan the values of the pixels inside the edges in order to get the average color of the area
second) fill those pixels with the average color.
mosaic_shaped stops at the edges of the tiles(drawed into the canvas_shaped surface), in plus, hexagonal draws additional edges on that surface, based on the edges found in the draw, IIRC, is the mosaic_shaped_sharpen_pixel() function who does that. This is why the effect follows the draw.
Other tools like Bricks are not designed to follow arbitrary edges.
An idea to do that could be to draw the bricks on an auxiliary surface, then copy the needed pixels to the canvas, like the second run of scanfill does but copying from the auxiliary surface instead of filling with the average color.
here is my approach :
I am applying fullscreen magic to a temporary surface ( which is copy of canvas )
then calling a modified version of do_flood_fill which puts the corresponding pixel on screen from temp
surface instead of current color .
The problem is when fullscreen magic is applied on temp surface coresponding sound is played
along with fill_tool sound . Is there anything i can do disable fullscreen sound .
Any code we can see?
by storing handle_idx for coressponding magic tool and then calling
coreponding magic func
click with mode = fullscreen .
On Tue, Nov 15, 2016 at 4:23 AM, Pere Pujal i Carabantes perepujal@users.sf.net wrote:
Related
Feature Requests:
#169by storing handle_idx for coressponding magic tool and then calling coreponding magic func
click with mode = fullscreen .
static void fill_pattern(magic_api * api, int which, int mode,
SDL_Surface * canvas, SDL_Surface * last,
int x, int y, SDL_Rect * update_rect)
{
SDL_Surface* aux_surface = SDL_CreateRGBSurface(screen->flags,
WINDOW_WIDTH - (96 * 2),
(48 * 7) + 40 + HEIGHTOFFSET,
screen->format->BitsPerPixel,
screen->format->Rmask,
screen->format->Gmask,
screen->format->Bmask, 0);
magic_funcs[fill_patterns[cur_fill_pattern].handle_idx].click(magic_api_struct,
which,
mode,
aux_surface, last,
x, y,
&update_rect);
do_flood_fill_pattern(api, canvas, x, y, aux_surface
api->getpixel(canvas, x, y));
}
I'd say to let the magic func play it's sound.
There are workarounds to don't play the magic sound like
disable/re-enable sound when calling the function or modify the magic api but I think it is good to have different sounds for different fill effects
I have updated my forked repo https://sourceforge.net/u/lokeshsharma97/tuxpaint-SDL2/ci/master/tree/
I have made metalpaint fullscreen . It was required to incorporate it as a pattern in fill tool.
Added few magics not all fullscreen magics as patterns .
there are few problematic areas like .
first pattern which is current color does not update
on screen if another color is selected . I will fix it soon .
there are only few magics which qualify as patterns . therefore not many patterns to fill.
brick magic tool is not fullscreen .
How can we incorporate more patterns in fill tool ?
One solution could be to load seamless patterns from file then Tiling them up and
performing same search fill algorithm .
Any suggestions .
regarding the first problem .
current color updates when we again click on fill tool or any other patterns in pattern toolbar of
fill tool . I am unable to understand why this happens .
how does tuxpaint updates colors toolbar when we click on it . This might help to fix the problem
since current color(pattern) should update along with colors toolbar.
Replaced with #201