HSWAW fork of JSPaint https://pixel.label.hackerspace.pl
 
 
 
 
Go to file
Isaiah Odhner b0c60954e4 Ditch Netlify for GitHub Pages 2020-02-27 17:37:48 -05:00
.vscode Configure VS Code 2019-12-02 19:57:31 -05:00
cypress Accept visual test changes 2019-12-21 00:38:47 -05:00
help Optionally convert to monochrome (with a threshold) 2020-01-05 11:59:25 -05:00
images Add news indicator in status bar 2019-12-21 23:45:05 -05:00
lib Update gif.js 2019-12-21 00:38:49 -05:00
src Disable Image > Clear Image when there's a selection 2020-01-05 17:14:28 -05:00
styles DRY 2019-12-23 12:14:21 -05:00
.eslintrc.js Spaces to tabs 2019-12-21 00:38:43 -05:00
.gitignore Use cypress for visual testing 2019-11-04 20:51:39 -05:00
.travis.yml Ugh apparently spaces are mandatory 2019-11-04 22:08:11 -05:00
CNAME Ditch Netlify for GitHub Pages 2020-02-27 17:37:48 -05:00
CONTRIBUTING.md Update CONTRIBUTING.md 2018-01-23 18:56:55 -05:00
README.md Update README 2019-12-21 00:39:07 -05:00
TODO.md Support patterns for Fill With Color 2019-12-23 13:50:24 -05:00
browserconfig.xml Fix MS tile icon paths 2019-10-08 12:29:27 -04:00
cypress.json Set up cypress service 2019-11-04 23:38:25 -05:00
favicon.ico Make JS Paint installable 2019-09-27 19:22:10 -04:00
index.html Avoid awkward language 2020-01-05 11:59:28 -05:00
jsconfig.json Configure VS Code 2019-12-02 19:57:31 -05:00
manifest.webmanifest Clean up icon names 2019-10-07 00:12:20 -04:00
package-lock.json Concat source files for linting 2019-12-21 00:38:39 -05:00
package.json Disable --record for cypress 2019-12-21 00:38:47 -05:00
test-news-newer.html Redesign layout of About Paint 2019-10-10 12:19:20 -04:00

README.md

JS Paint

A nice web-based MS Paint remake and more... Try it out!

The goal is to remake MS Paint (including its little-known features), improve on it, and to extend the types of images it can edit. So far, it does this pretty well.

Screenshot

Ah yes, good old paint. Not the one with the ribbons or the new skeuomorphic one with the interface that can take up nearly half the screen. (And not the even newer Paint 3D.)

Windows 95, 98, and XP were the golden years of paint. You had a tool box and a color box, a foreground color and a background color, and that was all you needed.

Things were simple.

But we want to undo more than three actions. We want to edit transparent images. We can't just keep using the old paint.

So that's why I'm making JS Paint. I want to bring good old paint into the modern era.

Current improvements include:

  • Cross-platform
  • Unlimited undos/redos (as opposed to a measly 3 in Windows XP, or a measly 50 in Windows 7)
  • Undo history is nonlinear, which means if you undo and do something other than redo, the redos aren't destroyed. Instead, a new branch in the history tree is created. Jump to any point in history with Ctrl+Shift+Y
  • Automatically keeps a backup of your image. Only one backup per image tho, which doesn't give you a lot of safety. Remember to save with File > Save or Ctrl+S! Manage backups with File > Manage Storage.
  • Edit transparent images! To create a transparent image, go to Image > Attributes... and select Transparent, then Okay, and then Image > Clear Image or use the Eraser tool. Images with any translucent pixels will open in Transparent mode.
  • Switch themes from the Extras menu
  • Create an animated GIF from the current document history. Accessible from the Extras menu or with Ctrl+Shift+G. It's pretty nifty, you should try it out! You might want to limit the size of the image though.
  • You can shoot at it Asteroids style
  • When you do Edit > Paste From... you can select transparent images. You can even paste a transparent animated GIF and then hold Shift while dragging the selection to smear it across the canvas while it animates! Update: This was due to not-to-spec behavior in Chrome. I may reimplement this in the future as I really liked this feature.
  • You can open SVG files, though only as a bitmap. (And you can't choose a size for the bitmap when opening an SVG. It may open super large, or tiny.)
  • You can crop the image by making a selection while holding Ctrl
  • Keyboard shortcuts for rotation: Ctrl+. and Ctrl+, (< and >)
  • Rotate by any arbitrary angle in Image > Flip/Rotate
  • In Image > Stretch/Skew, you can stretch more than 500% at once
  • Zoom to an arbitrary scale in View > Zoom > Custom...
  • Non-contiguous fill: Replace a color in the entire image by holding Shift when using the fill tool
  • You can use the Text tool at any zoom level, and it previews the exact pixels that will end up on the canvas.
  • Spellcheck is available in the textbox if your browser supports it.
  • Rudimentary multi-user support. Start up a session at jspaint.app/#session:multi-user-test and send the link to your friends! It isn't seamless; actions by other users interrupt what you're doing, and visa versa. Sessions are not private, and you may lose your work at any time. If you want better collaboration support, follow the development of Mopaint.
  • Load many different palette formats with Colors > Get Colors. (I made a library for this.)
  • Mobile support (altho fairly lacking in some areas). Use two fingers to pan the view.
  • Click/tap the selected colors area to swap the foreground and background colors

JS Paint drawing of JS Paint on a phone

Limitations:

A few things with the tools aren't done yet. See TODO.md

Full clipboard support in the web app requires a browser supporting the Async Clipboard API w/ Images, namely Chrome 76+ at the time of writing.

In other browsers you can still can copy with Ctrl+C, cut with Ctrl+X, and paste with Ctrl+V, but data copied from JS Paint can only be pasted into other instances of JS Paint. External images can be pasted in.

(There's also a partially-built desktop app version you can install that has full clipboard support, and also lets you set the wallpaper.)

Did you know?

  • There's a black and white mode with patterns instead of colors in the palette, which you can get to from Image > Attributes...

  • You can drag the color box and tool box around if you grab them by the right place. You can even drag them out into little windows. You can dock the windows back to the side by double-clicking on their title bars.

  • In addition to the left-click foreground color and the right-click background color, there's a third color you can access by holding Ctrl while you draw. It starts out with no color so you'll need to hold Ctrl and select a color first. The fancy thing about this color slot is you can press and release Ctrl to switch colors while drawing.

  • You can apply image transformations like Flip/Rotate, Stretch/Skew or Invert (in the Image menu) either to the whole image or to a selection. Try scribbling with the Free-Form Select tool and then doing Image > Invert

  • These Tips and Tricks from a tutorial for MS Paint also work in JS Paint:

    • Brush Scaling (+ & - on the Numpad to adjust brush size)
    • "Custom Brushes" (hold Shift and drag the selection to smear it)
    • The 'Stamp' "Tool" (hold Shift and click the selection to stamp it)
    • Image Scaling (+ & - on the Numpad to scale the selection by factors of 2)
    • Color Replacement (right mouse button with Eraser to selectively replace the foreground color with the background color)
    • The Grid (Ctrl+G & Zoom to 4x+)
    • Quick Undo (Pressing a second mouse button cancels the action you were performing. I also made it redoable, in case you do it by accident!)
    • Scroll Wheel Bug (Hmm, let's maybe not recreate this?)

Desktop App

I've started work on a desktop app, built with Electron and Electron Forge.

There are no releases yet, but much of the groundwork has been laid, and several features implemented.

Why did I do this. I hate electron apps. They're so slow and bulky...

If you're interested, comment on this issue.

Development Setup

Clone the repo.

Install Node.js if you don't have it, then open up a command prompt / terminal in the project directory.

Testing

Run npm run lint to check for code problems.

Run npm test to run browser-based tests with Cypress. (It's slow to start up and run tests, unfortunately.)

Run npm run accept to accept any visual changes. This unfortunately re-runs all the tests, rather than accepting results of the previous test, so you could end up with different results than the previous test. If you use GitHub Desktop, you can view diffs of images, in four different modes.

To open the Cypress UI, first run npm run test:start-server, then concurrently npm run cy:open

Tests are also run in continuous integration with Travis CI.

Web App (https://jspaint.app)

You just need an HTTP server, but Live Server is recommended. It auto reloads when you save changes.

It's included in package.json so if you've installed dependencies (npm i) you can use npm run dev to run it. (It's configured to ignore some files/directories for reloading.)

Desktop App (Electron)

  • Install dependencies with npm i
  • Start the electron app with npm start

electron-debug and devtron are included, so you can use Ctrl+R to reload and F12/Ctrl+Shift+I to open the devtools, and there's a Devtron tab with tools specific to Electron.

You can build for production with npm run make