chopper

package
v0.0.0-...-556f726 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2016 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Load

func Load(file multipart.File) (*image.Image, string, error)

func SaveAll

func SaveAll(tiles []*Tile)

Types

type CreateResponse

type CreateResponse struct {
	User         string       `json:"user"`
	ChopId       string       `json:"chopid"`
	Href         string       `json:"href"`
	PuzzleHref   string       `json:"puzzle_href"`
	SolutionHref string       `json:"solution_href"`
	Tiles        []*TileEntry `json:"tiles"`
}

type DeleteResponse

type DeleteResponse struct {
	User  string       `json:"user"`
	Id    string       `json:"id"`
	Tiles []*TileEntry `json:"tiles"`
}

type ReadAllResponse

type ReadAllResponse struct {
	User      string           `json:"user"`
	Slapchops []*SlapchopEntry `json:"slapchops"`
}

type ReadResponse

type ReadResponse struct {
	User  string       `json:"user"`
	Id    string       `json:"id"`
	Tiles []*TileEntry `json:"tiles"`
}

type SlapchopEntry

type SlapchopEntry struct {
	Id   string `json:"id"`
	User string `json:"user"`
	Href string `json:"href"`
}

func NewSlapchop

func NewSlapchop(host_str, username, id string) *SlapchopEntry

func (*SlapchopEntry) Grid

func (s *SlapchopEntry) Grid(tiles []*TileEntry) [][40]string

func (*SlapchopEntry) LoadFiles

func (s *SlapchopEntry) LoadFiles(UploadDir string) ([]os.FileInfo, error)

func (*SlapchopEntry) LoadTiles

func (s *SlapchopEntry) LoadTiles(host string, files []os.FileInfo) []*TileEntry

func (*SlapchopEntry) ShuffleGrid

func (s *SlapchopEntry) ShuffleGrid(grid [][40]string) [][40]string

func (*SlapchopEntry) UploadPoint

func (s *SlapchopEntry) UploadPoint(UploadDir string) string

type Tile

type Tile struct {
	PosX int
	PosY int
	AbsX int
	AbsY int
	// contains filtered or unexported fields
}

func Slice

func Slice(original image.Image, tileSize int, format string, path string) []*Tile

func (*Tile) Save

func (t *Tile) Save()

func (*Tile) ToResp

func (t *Tile) ToResp(basepath string) *TileEntry

type TileEntry

type TileEntry struct {
	Filename string `json:"-"`
	Href     string `json:"href"`

	PosX int `json:"pos_x"`
	PosY int `json:"pos_y"`
	AbsX int `json:"abs_x"`
	AbsY int `json:"abs_y"`
}

Jump to

Keyboard shortcuts

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