Like This Site? 
 
RSS Feed Follow Us 

on Twitter! Be Our Fan!

Creating a Paint Bucket Tool in HTML5 and JavaScript

Share this post!
 Vote this!

This tutorial will show how to create a simple paint bucket tool on an HTML5 Canvas using JavaScript. We will be implementing a flood fill algorithm using the HTML5 imageData object for pixel manipulation.
First we will learn how to determine the colors of the pixel on an HTML5 canvas. Then we will go step by step through an implementation of a flood fill algorithm in JavaScript. Let's get started.

The HTML5 Canvas Pixel

Before we start filling anything, we need to know the colors of our image. We can utilize HTML5 imageData object to describe our image as an array of pixel data or more specifically a CanvasPixelArray object. Each pixel is in the form: [R, G, B, A] where R is the red component, G is green component, B is the blue component, and A is the alpha. more...

0 comments:

Post a Comment