asset

package module
v0.0.0-...-8e4e8e6 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2016 License: Apache-2.0 Imports: 14 Imported by: 0

README

asset

Utilities to create iOS asset catalogs

This is not yet ready for public usage. It works, but is missing documentation. You will need to read the code to try it out. The API is not final and will be changed in the future. Any code you write will need to be updated after the API change.

License

The is released under the Apache 2.0 License. Please see the LICENSE file for details.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoInkScape = errors.New("inkscape not installed. inkscape (https://www.inkscape.org/) is needed to convert SVG files.")
View Source
var Log = func(args ...interface{}) {}

Functions

This section is empty.

Types

type Catalog

type Catalog struct {
	*Container `json:"-"`
	AppIcon    *ImageSet   `json:"-"`
	Info       CatalogInfo `json:"info"`
}

func NewCatalog

func NewCatalog(dir string) (*Catalog, error)

func (*Catalog) Write

func (c *Catalog) Write() error

type CatalogInfo

type CatalogInfo struct {
	Author  string `json:"author"`
	Version int    `json:"version"`
}

type Container

type Container struct {
	Dir    string
	Groups map[string]*Group
	Images map[string]*ImageSet
}

func NewContainer

func NewContainer(dir string) *Container

func (*Container) AddGroup

func (c *Container) AddGroup(name string) (*Group, error)

type Group

type Group struct {
	*Container `json:"-"`
	Info       CatalogInfo     `json:"info"`
	Properties GroupProperties `json:"properties"`
}

func (*Group) Write

func (g *Group) Write() error

type GroupProperties

type GroupProperties struct {
	ResourceTags
	ProvidesNamespace bool `json:"provides-namespace"`
}

type Image

type Image struct {
	FileName           string                 `json:"filename"`
	Size               string                 `json:"size,omitempty"`
	GraphicsFeatureSet string                 `json:"graphics-feature-set,omitempty"`
	Idiom              string                 `json:"idiom,omitempty"`
	Memory             string                 `json:"memory,omitempty"`
	Scale              string                 `json:"scale,omitempty"`
	Subtype            string                 `json:"subtype,omitempty"`
	ScreenWidth        string                 `json:"screen-width,omitempty"`
	WidthClass         string                 `json:"width-class,omitempty"`
	HeightClass        string                 `json:"height-class,omitempty"`
	Unassigned         bool                   `json:"unassigned,omitempty"`
	AlignmentInsets    map[string]interface{} `json:"alignment-insets,omitempty"`
	// contains filtered or unexported fields
}

type ImageSet

type ImageSet struct {
	Dir        string      `json:"-"`
	Info       CatalogInfo `json:"info"`
	Properties ResourceTags
	Images     []Image `json:"images"`
}

func NewImageSet

func NewImageSet(path string) (*ImageSet, error)

func (*ImageSet) Write

func (i *ImageSet) Write() error

type InkScapeConverter

type InkScapeConverter struct{}

func (InkScapeConverter) Convert

func (InkScapeConverter) Convert(scale int, height, width float32, svgFile, pngFile string) error

type PhantomJSConverter

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

func StartPhantomJSConverter

func StartPhantomJSConverter() (*PhantomJSConverter, error)

func (*PhantomJSConverter) Convert

func (p *PhantomJSConverter) Convert(scale int, height, width float32, svgFile, pngFile string) error

func (*PhantomJSConverter) Stop

func (p *PhantomJSConverter) Stop() error

type ResourceTags

type ResourceTags struct {
	OnDemandResourceTags []string `json:"on-demand-resource-tags,omitempty"`
}

type SVGConverter

type SVGConverter interface {
	Convert(scale int, height, width float32, svgFile, pngFile string) error
}

type SVGWalker

type SVGWalker struct {
	Converter     SVGConverter
	Catalog       *Catalog
	SanitizePaths bool
	ForceUpdate   bool
}

func (*SVGWalker) AddAppIconSVG

func (s *SVGWalker) AddAppIconSVG(path string) error

func (*SVGWalker) AddPath

func (s *SVGWalker) AddPath(dir, path string, info os.FileInfo) error

func (*SVGWalker) Walk

func (s *SVGWalker) Walk(dir string) error

Directories

Path Synopsis
cmd
createcatalog command

Jump to

Keyboard shortcuts

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