gomondrian

package module
v0.0.0-...-5121a6b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 30, 2017 License: MIT Imports: 5 Imported by: 0

README

Build Status

GoMondrian

A simple Piet Mondrian-like generator written in golang.

Getting Started

Prerequisites

You need a working Go installation. (1.7 or greater)

Installing
$ go get github.com/8lall0/GoMondrian
Usage

See the example.

How it works

It starts with an integer matrix filled with zeroes. Then it randomly select a cell (pixel) and checks about:

  • Borders (they must be not reachable from pixel plus surrounding padding)
  • Paddings (they must not reach other preesistent borders)

Then it goes straight on rows or columns (settings cells to 1): if both are possible, it randomly selects one road.

If you reach another border, it randomly selects if go across and "divide" another square.

After that, it randomly fills some squares with a number from 2 to 4 to select different colors.

Contributing

Feel free to send pull requests, fork or send me suggestions.

Authors

  • Savino Pio Liguori

License

This project is licensed under the MIT License - see the LICENSE file for details

Acknowledgments

  • Strongly inspired by the work of FogleMan

Documentation

Overview

Package gomondrian provides a simple random generator for Piet Mondrian-like images. (https://en.wikipedia.org/wiki/Piet_Mondrian)

It returns an *image.RGBA that you can handle with the standard tools of the image standard package in Go.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Generate

func Generate(w, h, padding, nDiv, nColor int) (img *image.RGBA, err error)

Generates the *image.RGBA that you can use with the standard image package.

Types

This section is empty.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL