Comments (2)
Hi timo002,
The example code for the bucket tool has two layers: a color layer (where the colors are drawn) and an outline layer (the black and transparent image i.e. the watermelon duck which is not changed). The two layers are stacked on top of each other so that we can draw to the color layer and keep the outline smooth and anti-aliased. The color layer will fill in any contiguous pixels once tapped, but since it starts off empty you would need to draw to the color layer initially. Just create a new variable for the initial color image and assign it an "src" property with the image path and an "onload" property with a function that draws to the context (like the outlineImage in the init function). Note: You will also need to change the outlineImage.onload function since it clears the canvas if it loads after the new onload function.
Let me know if this is what you are looking for and it works for you.
from html5-paint-bucket-tool.
Hello William,
I can work with this! Thanks!
from html5-paint-bucket-tool.
Related Issues (8)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from html5-paint-bucket-tool.