Flying Swissman
Flying Swissman

Reputation: 803

simple way of generating shapes

I want to generate shapes like the one following (image file e.g. PNG):

example

I'm looking for a c / c++ library which will allow me to realize the following algorithm:

The basic algorithm would be:

  1. Make circle
  2. Partition Circle randomly
  3. Fill in one segement
  4. Twirl whole shape (see link)
  5. Save Image as PNG

Link: Twirl filter in Photoshop

I will accept the first answer which lists and links one library or more which is will enable me to implement the above algorithm with ease. The library should be light weight if possible.

Upvotes: 0

Views: 646

Answers (1)

Brett Hale
Brett Hale

Reputation: 22358

The 'easiest' solution I can think of is to use the GraphicsMagick library - specifically, the Magick++ API. With a Magick::Image, you can use Drawable objects, flood-fills, and even a Image::swirl method. Saving as a PNG can be as simple as a call to Image::write("filename.png")

Upvotes: 1

Related Questions