Commit Graph

129 Commits (977c8c3b65c9bd2b95e8933b9df82f7b3f39058c)

Author SHA1 Message Date
Isaiah Odhner 977c8c3b65 Spellcheck 2021-06-19 20:40:30 -04:00
Isaiah Odhner 25f47bff0b Add bounds safety to fill algorithms
I swear did this before, maybe I lost it when my hard drive crashed...
2021-05-18 00:20:34 -04:00
Isaiah Odhner 59415978c7 Add thresholds everywhere canvas ImageData is compared
- Fixes brushes sometimes including extra random pixels they're not supposed to, for example a two-pixel pencil.
- Fixes document sometimes being considered transparent
- Fixes brush/pencil/airbrush sometimes showing rainbowy (my hack representation of translucency) even though the color is solid
2021-03-26 00:54:49 -04:00
Isaiah Odhner 7b26faecd8 Fix monochromeWithTransparency 2021-03-26 00:54:49 -04:00
Isaiah Odhner d78ff15a35 Localize "(Selection)" in history view 2021-02-18 08:36:45 -05:00
Isaiah Odhner b24620f155 Handle potential errors during WebGL initialization
Might help in Tor browser, for instance (untested).
2021-02-15 14:46:24 -05:00
Isaiah Odhner c61f904b6d Enable several eslint rules 2021-02-12 10:13:53 -05:00
Isaiah Odhner 60e6dfc69f Rename selected colors global 2021-02-12 10:13:53 -05:00
Isaiah Odhner e4d2a24eb6 Rename main canvas globals
"canvas"/"ctx" are WAY too typo-prone, way too prone to accidental use.
2021-02-10 22:27:35 -05:00
Isaiah Odhner 7a8f314be1 Refactor 2021-02-10 22:23:07 -05:00
Isaiah Odhner 81bda0f34b Simplify and optimize 2021-02-10 14:02:36 -05:00
Isaiah Odhner fa77303cd8 Handle monochrome invert for Free-Form Select 2021-02-10 14:02:36 -05:00
Isaiah Odhner fe3cd5eaa1 Invert monochrome image by swapping the two colors 2021-02-08 01:03:13 -05:00
Isaiah Odhner ea2ca59ce2 Remove ineffectual code
x/y += was ineffectual and misleading since x/y wasn't used.

Technically all the anti-aliased tool code is unused, but it may be later on.
2021-02-07 22:48:05 -05:00
Isaiah Odhner ee85eb5f38 Use more localized strings 2021-01-31 01:02:20 -05:00
Isaiah Odhner f3952515b4 Handle failure to get WebGL context 2020-12-04 10:47:00 -05:00
Isaiah Odhner 0cfc7332fa Introduce slight threshold to fill operations
Fixes https://github.com/1j01/jspaint/issues/184
2020-12-04 10:47:00 -05:00
Isaiah Odhner 882fa50381 Use theme colors for tool options
- Fix the contrast of (most) tool options in the new dark theme
- (There isn't very good contrast for the shape style options in this dark theme.)
- Simplify events for re-rendering tool options
- Re-render tool options when dropping in a .theme/.themepack file
2020-05-29 23:56:14 -04:00
Isaiah Odhner 31edf30064 Unify TODO comments 2020-04-27 20:45:47 -04:00
Isaiah Odhner 6a0d597ab3 Remove unused 2020-04-18 19:05:30 -04:00
Isaiah Odhner e4a3018c5c Rename flood-filling sub-functions 2020-01-05 17:14:28 -05:00
Isaiah Odhner 2c0aeb60c0 Improve action names
"Invert Selection" was ambiguous, could mean selecting the opposite set of pixels.
"Rotate 90 degrees Selection" was ungrammatical.
I could template the names so that it was "Invert Selection Colors", "Rotate Selection 90 degrees", but for now, putting parentheses around "Selection" works fine.
2020-01-05 11:59:27 -05:00
Isaiah Odhner a9fe8e3553 Optionally convert to monochrome (with a threshold) 2020-01-05 11:59:25 -05:00
Isaiah Odhner 29765b797b Support patterns for global color replacement 2019-12-23 15:03:24 -05:00
Isaiah Odhner 14cf228157 Support patterns for Fill With Color 2019-12-23 13:50:24 -05:00
Isaiah Odhner 42de87ff38 Invalidate brush caches when restoring WebGL context 2019-12-21 00:38:42 -05:00
Isaiah Odhner f70277f0bd Clean up unused parameters 2019-12-21 00:38:38 -05:00
Isaiah Odhner 9e8b56d41b Fix accidental global "pixel_pos" 2019-12-21 00:38:35 -05:00
Isaiah Odhner 226dc4348c Perf: use brush cache for Brush tool options 2019-12-21 00:38:32 -05:00
Isaiah Odhner 1515016bf7 Simplify tool options chooser event handling 2019-12-21 00:38:31 -05:00
Isaiah Odhner 51fe6913ee Fix parenting of image transform undoables
`cancel()` inside `undoable()` action callback caused it to navigate history,
and it would navigate all the way to the start of the last pointer gesture because
`history_node_to_cancel_to` was only set on pointerdown, not taking into account non-pointer-gesture operations.
The point was to allow undoing Fill With Color when canceling, but with the old definition of `history_node_to_cancel_to` it would have needed to be set in scattered places.
Now I'm defining it where it can be null, and if it's null, canceling should just go back to the history node at the start of `cancel()` (after making history nodes if applicable by telling tools to finish).
2019-12-21 00:38:16 -05:00
Isaiah Odhner 6f819c7555 Fix app-breaking Stretch/Skew to zero width/height 2019-12-21 00:38:14 -05:00
Isaiah Odhner 9948d8f9bb DRY 2019-12-21 00:38:13 -05:00
Isaiah Odhner 433b01f1f3 Add icons for stretching and skewing 2019-12-21 00:38:12 -05:00
Isaiah Odhner 96d6d4c064 Add icons for flipping and rotating actions 2019-12-21 00:38:12 -05:00
Isaiah Odhner be216e5aad Add action icon for Invert 2019-12-21 00:38:11 -05:00
Isaiah Odhner f9069fd8ab DRY image inversion code 2019-12-21 00:38:10 -05:00
Isaiah Odhner 3e2146adaa Mark selection transformations as soft 2019-12-21 00:38:05 -05:00
Isaiah Odhner d19d2a80d5 Clean up and guard console logs 2019-12-21 00:38:00 -05:00
Isaiah Odhner 1d9f56d0d4 Restructure arguments to undoable() 2019-12-21 00:37:50 -05:00
Isaiah Odhner bc3a450c47 Include selection and selection operations in history 2019-12-21 00:37:46 -05:00
Isaiah Odhner 6d7220f60e Re-enable line drawing >1px width 2019-12-21 00:37:29 -05:00
Isaiah Odhner 9a72ee964f Stamp to make brush/pencil whole again 2019-12-21 00:37:26 -05:00
Isaiah Odhner b1335343d6 WIP: optimize brush, pencil, & eraser performance
The plan is to try drawing a set of lines with WebGL based on the border of the shape of the brush.
2019-12-21 00:37:20 -05:00
Isaiah Odhner 703fcd6105 Get rid of canvas-change.js
- Remove the whole ugly hacky module. Most things only modify the canvas when creating undoables now. Only a few things modify undoables after creating them.
- Formally disable pointer operations playback, instead of just leaving it accidentally disabled.
2019-12-21 00:37:15 -05:00
Isaiah Odhner dae22f837f Improve WebGL context loss handling 2019-12-08 23:00:35 -05:00
Isaiah Odhner 987d6e8d4c More detail! 2019-12-08 13:07:27 -05:00
Isaiah Odhner 85e8922c08 Name undoables with details 2019-12-08 13:07:27 -05:00
Isaiah Odhner a862d5b7b8 Name undoables 2019-12-08 11:52:12 -05:00
Isaiah Odhner f4fb65ee88 Remove redo data deletion dialog 2019-12-08 10:52:06 -05:00