Get Updates By E-mail 

Article Written By:
Johann Dowa

Example Source Code: Easy Cocos2D Sprite Floodfill Class

  •  
  •  
  •  
  •  
  •  

Creativity apps have been growing in popularity and the Cocos2D framework has already been used in a number drawing apps and coloring games.  Some time ago I mentioned an excellent color picker implementation created with Cocos2D designed specifically for  touch screens.

Something that nearly any drawing app or coloring game will need is the ability to floodfill an image with a specified color.

Today I came across a class that makes this very easy you simply initialize the provided CCSpriteFloodFill class with an image, and provide the fillFromPoint method a screen location and color, and the image will automatically be flood filled from that point.

The example is from Ignacio Inglese and can be found on Github here.  You can read the original thread with more details on the example and algorithm in the Cocos2D forum here.

Very useful if you want to put together any kind of drawing or coloring app.

Added to the Cocos2D tutorial and example page.


  •  
  •  
  •  
  •  
  •  

Submit A Resource

Have you created a useful tutorial, library or tool for iOS development that you would like to get in front of our 300,000+ monthly page views from iOS developers?

You can submit the url here.

The resources we feel will appeal to our readers the most will be posted on the front page.

Comments