package module
Version: v0.1.1 Latest Latest

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

Go to latest
Published: Sep 13, 2023 License: MIT Imports: 13 Imported by: 0



Go Reference

QR code, Micro QR code and Rectangular Micro QR Code (rMQR) encoder.





This section is empty.


This section is empty.


func Encode

func Encode(data []byte, opts ...EncodeOptions) (image.Image, error)


type EncodeOptions

type EncodeOptions interface {
	// contains filtered or unexported methods

func WithKanji

func WithKanji(use bool) EncodeOptions

func WithLevel

func WithLevel(lv Level) EncodeOptions

func WithModuleSize

func WithModuleSize(size float64) EncodeOptions

func WithQuiteZone

func WithQuiteZone(n int) EncodeOptions

type Level

type Level int

Level is a error correction level.

const (
	LevelL Level = 0b01
	LevelM Level = 0b00
	LevelQ Level = 0b11
	LevelH Level = 0b10

func (Level) IsValid added in v0.1.1

func (lv Level) IsValid() bool

IsValid returns true if the level is valid.

func (Level) String

func (lv Level) String() string

type Mask

type Mask int

Mask is a mask pattern.

const (
	Mask0 Mask = 0b000
	Mask1 Mask = 0b001
	Mask2 Mask = 0b010
	Mask3 Mask = 0b011
	Mask4 Mask = 0b100
	Mask5 Mask = 0b101
	Mask6 Mask = 0b110
	Mask7 Mask = 0b111

	MaskAuto Mask = -1

func (Mask) IsValid added in v0.1.1

func (m Mask) IsValid() bool

IsValid returns true if the mask is valid.

type Mode

type Mode uint8
const (
	// ModeECI is ECI(Extended Channel Interpretation) mode.
	ModeECI Mode = 0b0111

	// ModeNumeric is number mode.
	// The Data must be ascii characters [0-9].
	ModeNumeric Mode = 0b0001

	// ModeAlphanumeric is alphabet and number mode.
	// The Data must be ascii characters [0-9A-Z $%*+\-./:].
	ModeAlphanumeric Mode = 0b0010

	// ModeBytes is 8-bit bytes mode.
	// The Data can include any bytes.
	ModeBytes Mode = 0b0100

	// ModeKanji is Japanese Kanji mode.
	ModeKanji Mode = 0b1000

	// ModeConnected is connected structure mode.
	ModeConnected Mode = 0b0011

	ModeFNC1_1 Mode = 0b0101
	ModeFNC1_2 Mode = 0b1001

	ModeTerminated Mode = 0b0000

func (Mode) String

func (mode Mode) String() string

type QRCode

type QRCode struct {
	Version  Version
	Level    Level
	Mask     Mask
	Segments []Segment

func DecodeBitmap

func DecodeBitmap(img *bitmap.Image) (*QRCode, error)

func New

func New(data []byte, opts ...EncodeOptions) (*QRCode, error)

func (*QRCode) Encode

func (qr *QRCode) Encode(opts ...EncodeOptions) (image.Image, error)

func (*QRCode) EncodeToBitmap

func (qr *QRCode) EncodeToBitmap() (*bitmap.Image, error)

EncodeToBitmap encodes QR Code into bitmap image.

type Segment

type Segment struct {
	Mode Mode
	Data []byte

type Version

type Version int

Version is a version of QR code.

func (Version) IsValid added in v0.1.1

func (v Version) IsValid() bool


Path Synopsis
Package rmqr handles rMRQ Codes.
Package rmqr handles rMRQ Codes.

Jump to

Keyboard shortcuts

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