paper

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 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.

import "github.com/aslrousta/paper"

p := paper.New(paper.Nostalgia, 800, 300)
draw.Draw(p, p.Bounds(), im, image.Point{0, 0}, draw.Src)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

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) Set

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

type Theme

type Theme func(byte) color.Color
var (
	Nostalgia Theme = defineTheme(
		color.RGBA{45, 40, 14, 255},
		color.RGBA{227, 218, 189, 255},
	)
	Sepia Theme = defineTheme(
		color.RGBA{52, 36, 36, 255},
		color.RGBA{190, 155, 118, 255},
	)
	Night Theme = defineTheme(
		color.RGBA{221, 221, 221, 255},
		color.RGBA{21, 21, 21, 255},
	)
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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