lego

package module
v0.0.0-...-f9f36cb Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2015 License: Apache-2.0 Imports: 5 Imported by: 0

README

lego

Simple library to create Lego panels from images.

Documentation

Overview

Copyright 2014 Leonardo "Bubble" Mesquita

Index

Constants

This section is empty.

Variables

View Source
var (
	// Names and values retrieved from:
	//   http://www.peeron.com/cgi-bin/invcgis/colorguide.cgi
	// Selected colors from http://shop.lego.com that are available for
	// 1x1 bricks, so any images are doable.
	WHITE                  = Color{"White (#1)", color.NRGBA{242, 243, 242, 255}}
	BRIGHT_RED             = Color{"Bright red (#21)", color.NRGBA{196, 40, 27, 255}}
	BRIGHT_BLUE            = Color{"Bright blue (#23)", color.NRGBA{13, 105, 171, 255}}
	BLACK                  = Color{"Black (#26)", color.NRGBA{27, 42, 52, 255}}
	DARK_GREEN             = Color{"Dark green (#28)", color.NRGBA{40, 127, 70, 255}}
	BRIGHT_YELLOW          = Color{"Bright yellow (#24)", color.NRGBA{245, 205, 47, 255}}
	BRICK_YELLOW           = Color{"Brick yellow (#5)", color.NRGBA{215, 197, 153, 255}}
	BRIGHT_ORANGE          = Color{"Bright orange (#106)", color.NRGBA{218, 133, 64, 255}}
	MEDIUM_BLUE            = Color{"Medium blue (#102)", color.NRGBA{110, 153, 201, 255}}
	DARK_STONE_GREY        = Color{"Dark stone grey (#199)", color.NRGBA{99, 95, 97, 255}}
	REDDISH_BROWN          = Color{"Reddish brown (#192)", color.NRGBA{105, 64, 39, 255}}
	MEDIUM_STONE_GREY      = Color{"Medium stone grey (#194)", color.NRGBA{163, 162, 164, 255}}
	BRIGHT_YELLOWISH_GREEN = Color{"Bright yellowish green (#119)", color.NRGBA{164, 189, 70, 255}}
	LIGHT_PURPLE           = Color{"Light purple (#222)", color.NRGBA{228, 173, 200, 255}}
	BRIGHT_REDDISH_VIOLET  = Color{"Bright reddish violet (#124)", color.NRGBA{146, 57, 120, 255}}
)
View Source
var (
	BASIC_BRICKS = generateBricks(basicShapes, WHITE, BRIGHT_RED, BRIGHT_BLUE,
		BLACK, DARK_GREEN, BRIGHT_YELLOW, BRICK_YELLOW, BRIGHT_ORANGE,
	)
	ADVANCED_BRICKS = append(
		generateBricks(basicShapes, DARK_STONE_GREY, REDDISH_BROWN,
			MEDIUM_STONE_GREY, BRIGHT_YELLOWISH_GREEN, LIGHT_PURPLE),
		append(generateBricks([]image.Point{{1, 1}, {1, 2}, {1, 4}}, MEDIUM_BLUE),
			generateBricks([]image.Point{{1, 1}, {1, 2}}, BRIGHT_REDDISH_VIOLET)...,
		)...,
	)
	ALL_BRICKS = append(BASIC_BRICKS, ADVANCED_BRICKS...)
)

Functions

This section is empty.

Types

type Brick

type Brick struct {
	Size  image.Point
	Color Color
}

func (Brick) String

func (b Brick) String() string

type Color

type Color struct {
	// contains filtered or unexported fields
}

func (*Color) Color

func (c *Color) Color() color.Color

func (*Color) Name

func (c *Color) Name() string

type Options

type Options struct {
	Width  uint
	Bricks []*Brick
	Dither bool
}

type Panel

type Panel struct {
	// contains filtered or unexported fields
}

func NewPanel

func NewPanel(img image.Image, opt *Options) *Panel

func (*Panel) CountBricks

func (p *Panel) CountBricks() map[Brick]int

func (*Panel) Draw

func (p *Panel) Draw(scale int, outline bool) image.Image

func (*Panel) Size

func (p *Panel) Size() image.Point

Jump to

Keyboard shortcuts

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