paper

package module
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2023 License: MIT Imports: 2 Imported by: 0

README

Paper

Paper is a Go library to simulate monochromic old print papers, as shown in the following sample picture.

Collage

Getting Started

The Paper struct defined in this library implements the draw.Image interface; i.e. it can be used as a drawing canvas to overlay images and to draw shapes and texts.

Note: The Paper needs to be Mask-ed and Unmask-ed before and after the drawing is done for paper theme to be applied correctly.

import "github.com/aslrousta/paper"

p := paper.New(paper.Nostalgia, 800, 300)

p.Mask()
draw.Draw(p, p.Bounds(), im, image.Point{0, 0}, draw.Src)
p.Unmask()

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Modern = Theme{
		Primary:    color.RGBA{21, 21, 21, 255},
		Background: color.RGBA{221, 221, 221, 255},
	}
	Nostalgia = Theme{
		Primary:    color.RGBA{45, 40, 14, 255},
		Background: color.RGBA{227, 218, 189, 255},
	}
	Sepia = Theme{
		Primary:    color.RGBA{52, 36, 36, 255},
		Background: color.RGBA{190, 155, 118, 255},
	}
	Night = Theme{
		Primary:    color.RGBA{221, 221, 221, 255},
		Background: color.RGBA{21, 21, 21, 255},
	}
)

Functions

This section is empty.

Types

type Paper

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

func New

func New(th Theme, w, h int) *Paper

func (*Paper) At

func (p *Paper) At(x, y int) color.Color

func (*Paper) Bounds

func (p *Paper) Bounds() image.Rectangle

func (*Paper) ColorModel

func (p *Paper) ColorModel() color.Model

func (*Paper) ExtendHeight added in v1.1.0

func (p *Paper) ExtendHeight(extra int)

func (*Paper) ExtendWidth added in v1.1.0

func (p *Paper) ExtendWidth(extra int)

func (*Paper) Mask added in v1.2.0

func (p *Paper) Mask()

func (*Paper) Set

func (p *Paper) Set(x, y int, c color.Color)

func (*Paper) Unmask added in v1.2.0

func (p *Paper) Unmask()

type Theme

type Theme struct {
	Primary    color.RGBA
	Background color.RGBA
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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