selfqr

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2022 License: MIT Imports: 9 Imported by: 0

README

self-qrcode(selfqr)

可生成个性化的二维码

依赖的库

github.com/nfnt/resize
github.com/skip2/go-qrcode

本项目生成的部分样例

qr0 qr1 qr2 qr3 qr4 qr5 qr6 qr7 qr8 qr9 qr10 qr11 qr13

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BullEyeStyle

type BullEyeStyle int
const (
	// BesRectangle 矩形
	BesRectangle BullEyeStyle = iota
	// BesRoundedRectangle 圆角矩形
	BesRoundedRectangle
	// BesCircular 圆形
	BesCircular
	// BesRhombus 菱形
	BesRhombus
)

type CodePointStyle

type CodePointStyle int
const (
	// CpsRectangle 矩形
	CpsRectangle CodePointStyle = iota
	// CpsRoundedRectangle 圆角矩形
	CpsRoundedRectangle
	// CpsCircular 圆形
	CpsCircular
	// CpsRhombus 菱形
	CpsRhombus
	// CpsIsoscelesTop 等边三角形
	CpsIsoscelesTop
	// CpsIsoscelesBottom 尖部向下的等边三角形
	CpsIsoscelesBottom
)

type PersonaQrCode

type PersonaQrCode struct {
	Error error
	// contains filtered or unexported fields
}

func New

func New(text string, size int, level qrcode.RecoveryLevel) *PersonaQrCode

New Create a new QR code processor `text`: Contents of QR Code `size`: Size of QR code `level`: Error correction level of two-dimensional code

func (*PersonaQrCode) Background

func (p *PersonaQrCode) Background(col color.Color)

Background color of the QR code Translucent colors are not recommended

func (*PersonaQrCode) BullEye

func (p *PersonaQrCode) BullEye(os, is BullEyeStyle)

BullEye Draw the bull's eye area

`os`: Bull eye outside style
`is`: Bull eye inside style

func (*PersonaQrCode) CodePoint

func (p *PersonaQrCode) CodePoint(s CodePointStyle, r float64)

CodePoint Draw the two-dimensional code content area This method should be executed before BullEye

`s`: The style of the code point
`r`: The size of the code point The value ranges from 0.1 to 1

func (*PersonaQrCode) ForeImage

func (p *PersonaQrCode) ForeImage(img image.Image, bullEye bool)

ForeImage Foreground color values are based on the image Note that the selected image should not appear transparent or consistent with the background color `bullEye`: Whether to extend the color of the picture to ox eyes. If it is false take the foreground color This method should be executed before CodePoint and BullEye

func (*PersonaQrCode) Foreground

func (p *PersonaQrCode) Foreground(col color.Color)

Foreground color of the QR code Translucent colors are not recommended

func (p *PersonaQrCode) Logo(img image.Image, border bool)

Logo Draw a Logo `border`: Whether to draw a border for the logo. the border color is the background color At present, the detailed parameters of Logo are not extracted and accepted as variables

func (*PersonaQrCode) Result

func (p *PersonaQrCode) Result(border bool) ([]byte, error)

Result Get the QR code that has been processed. Type is []byte `border`: Whether to draw a border area for the QR code. The color is the background color

Jump to

Keyboard shortcuts

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