zinelayout

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllImagesSameSize

func AllImagesSameSize(images []image.Image) bool

New function to handle image rotation

func GenerateTestImages

func GenerateTestImages(count, width, height int) ([]image.Image, error)

func GenerateTestImagesBW

func GenerateTestImagesBW(count, width, height int) ([]image.Image, error)

Types

type Border

type Border struct {
	Enabled bool        `yaml:"enabled"`
	Color   CustomColor `yaml:"color"`
	Type    BorderType  `yaml:"type"`
}

type BorderType

type BorderType string

BorderType represents the type of border to draw

const (
	BorderTypePlain  BorderType = "plain"
	BorderTypeDotted BorderType = "dotted"
	BorderTypeDashed BorderType = "dashed"
	BorderTypeCorner BorderType = "corner"
)

func ParseBorderType

func ParseBorderType(borderTypeString string) (BorderType, error)

ParseBorderType converts a string to a BorderType

type CustomColor

type CustomColor struct {
	color.RGBA
}

CustomColor is a wrapper around color.RGBA that implements yaml.Unmarshaler

func (*CustomColor) UnmarshalYAML

func (c *CustomColor) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML implements the yaml.Unmarshaler interface

type Global

type Global struct {
	Border *Border `yaml:"border"`
	PPI    float64 `yaml:"ppi"`
}

type Layout

type Layout struct {
	InputIndex        int      `yaml:"input_index"`
	Position          Position `yaml:"position"`
	Rotation          int      `yaml:"rotation"`
	Margin            *Margin  `yaml:"margin"`
	InnerLayoutBorder *Border  `yaml:"border"`
}

type Margin

type Margin struct {
	Top    MarginValue `yaml:"top"`
	Bottom MarginValue `yaml:"bottom"`
	Left   MarginValue `yaml:"left"`
	Right  MarginValue `yaml:"right"`
	PPI    float64     `yaml:"-"`
}

func (*Margin) ComputePixelValues

func (m *Margin) ComputePixelValues(ppi float64) error

func (Margin) MarshalYAML

func (m Margin) MarshalYAML() (interface{}, error)

func (*Margin) String

func (m *Margin) String() string

func (*Margin) UnmarshalYAML

func (m *Margin) UnmarshalYAML(value *yaml.Node) error

type MarginValue

type MarginValue struct {
	Expression string `yaml:"expression"`
	Pixels     int    `yaml:"-"`
}

func (*MarginValue) String

func (mv *MarginValue) String() string

func (*MarginValue) UpdateExpression

func (mv *MarginValue) UpdateExpression(expression string, ppi float64) error

func (*MarginValue) UpdatePixels

func (mv *MarginValue) UpdatePixels(pixels int, ppi float64)

type OutputPage

type OutputPage struct {
	ID           string    `yaml:"id"`
	Margin       *Margin   `yaml:"margin"`
	Layout       []*Layout `yaml:"layout"`
	LayoutBorder *Border   `yaml:"border"`
}

type PageSetup

type PageSetup struct {
	GridSize struct {
		Rows    int `yaml:"rows"`
		Columns int `yaml:"columns"`
	} `yaml:"grid_size"`
	Margin     *Margin `yaml:"margin"`
	PageBorder *Border `yaml:"border"`
}

type Position

type Position struct {
	Row    int `yaml:"row"`
	Column int `yaml:"column"`
}

Position represents the position of an input page on the output page

type ZineLayout

type ZineLayout struct {
	PageSetup   *PageSetup    `yaml:"page_setup"`
	OutputPages []*OutputPage `yaml:"output_pages"`
	Global      *Global       `yaml:"global"`
}

func (*ZineLayout) ComputeAllMargins

func (zl *ZineLayout) ComputeAllMargins() error

func (*ZineLayout) CreateOutputImage

func (zl *ZineLayout) CreateOutputImage(outputPage *OutputPage, inputImages []image.Image) (image.Image, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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