goqrencode

package module
v0.0.0-...-5a0df19 Latest Latest
Warning

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

Go to latest
Published: May 2, 2018 License: MIT Imports: 12 Imported by: 0

README

goqrencode

libqrencode golang sdk

GoDoc Build Status

Reference

Documentation

Index

Constants

View Source
const (
	QR_MODE_NUL        = C.QR_MODE_NUL        ///< Terminator (NUL character). Internal use only
	QR_MODE_NUM        = C.QR_MODE_NUM        ///< Numeric mode
	QR_MODE_AN         = C.QR_MODE_AN         ///< Alphabet-numeric mode
	QR_MODE_8          = C.QR_MODE_8          ///< 8-bit data mode
	QR_MODE_KANJI      = C.QR_MODE_KANJI      ///< Kanji (shift-jis) mode
	QR_MODE_STRUCTURE  = C.QR_MODE_STRUCTURE  ///< Internal use only
	QR_MODE_ECI        = C.QR_MODE_ECI        ///< ECI mode
	QR_MODE_FNC1FIRST  = C.QR_MODE_FNC1FIRST  ///< FNC1 first position
	QR_MODE_FNC1SECOND = C.QR_MODE_FNC1SECOND ///< FNC1 second position
)

QRencodeMode

View Source
const (
	QR_ECLEVEL_L = C.QR_ECLEVEL_L ///< lowest
	QR_ECLEVEL_M = C.QR_ECLEVEL_M
	QR_ECLEVEL_Q = C.QR_ECLEVEL_Q
	QR_ECLEVEL_H = C.QR_ECLEVEL_H ///< highest
)

QRecLevel

View Source
const (
	IMAGE_OUTPUT_JPEG string = "jpeg"
	IMAGE_OUTPUT_JPG  string = "jpg"
	IMAGE_OUTPUT_PNG  string = "png"
)

Variables

View Source
var (
	ImageDefaultSize            int           = 200
	ImageDefaultBackgroundColor color.Color   = color.White
	ImageDefaultForegroundColor color.Color   = color.Black
	DefaultJPEGOptions          *jpeg.Options = &jpeg.Options{

		Quality: 85,
	}
)

Functions

func ApiVersion

func ApiVersion() (major, minor, micro int)

* Return a string that identifies the library version.

func ApiVersionString

func ApiVersionString() string

* Return a string that identifies the library version.

func InputCheck

func InputCheck(mode C.QRencodeMode, r interface{}) error

* Validate the input data. * See qrencode.h QRinput_check

func ThrowAndCatchException

func ThrowAndCatchException() error

* Exception process

Types

type Image

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

* goqrencode image

func ImageNew

func ImageNew() (ret *Image)

* new image

func (*Image) Draw

func (c *Image) Draw(bitmap [][]bool) *Image

* draw from bitmap

func (*Image) DrawQRcode

func (c *Image) DrawQRcode(qrcode *QRcode) *Image

* draw from qrcode

func (*Image) Encode

func (c *Image) Encode(outputType string, w io.Writer) error

* image encode image.Image

func (*Image) GetBackgroundColor

func (c *Image) GetBackgroundColor() color.Color

* get image background color

func (*Image) GetForegroundColor

func (c *Image) GetForegroundColor() color.Color

* get image foreground color

func (*Image) GetSize

func (c *Image) GetSize() int

* get image size

func (*Image) JPEG

func (c *Image) JPEG(w io.Writer, options *jpeg.Options) error

* image/jpeg

func (*Image) New

func (c *Image) New()

* new image

func (*Image) PNG

func (c *Image) PNG(w io.Writer) error

* image/png

func (*Image) SetBackgroundColor

func (c *Image) SetBackgroundColor(back color.Color) *Image

* set image background color * default black

func (*Image) SetForegroundColor

func (c *Image) SetForegroundColor(fore color.Color) *Image

* set image foreground color * default white

func (*Image) SetSize

func (c *Image) SetSize(size int) *Image

* set image size pixel * default 200

func (*Image) WriteFile

func (c *Image) WriteFile(filename string) error

* write file

type Input

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

* goqrencode Input

func InputNew

func InputNew() (ret *Input, err error)

* create goqrencode Input

func (*Input) Append

func (c *Input) Append(mode C.QRencodeMode, r interface{}) error

* Append data to an input object * The data is copied and appended to the input object. * See qrencode.h QRinput_append *

func (*Input) AppendECIHeader

func (c *Input) AppendECIHeader(ecinum uint) error

* Append ECI header. * See qrcnecode.h QRinput_appendECIheader

func (*Input) Destroy

func (c *Input) Destroy()

* free input object * See qrcnecode.h QRinput_free

func (*Input) GetErrorCorrectionLevel

func (c *Input) GetErrorCorrectionLevel() C.QRecLevel

* Get current error correction level. * See qrcnecode.h QRinput_getErrorCorrectionLevel

func (*Input) GetVersion

func (c *Input) GetVersion() int

* Get current version. * See qrcnecode.h QRinput_getVersion

func (*Input) New

func (c *Input) New() error

* create Input

func (*Input) SetErrorCorrectionLevel

func (c *Input) SetErrorCorrectionLevel(level C.QRecLevel) error

* Set error correction level of the QR code that is to be encoded. * See qrcnecode.h QRinput_setErrorCorrectionLevel

func (*Input) SetVersion

func (c *Input) SetVersion(version int) error

* Set version of the QR code that is to be encoded. * See qrcnecode.h QRinput_setVersion

func (*Input) SetVersionAndErrorCorrectionLevel

func (c *Input) SetVersionAndErrorCorrectionLevel(version int, level C.QRecLevel) error

* Set version and error correction level of the QR code at once. * See qrcnecode.h QRinput_setVersionAndErrorCorrectionLevel

type QRcode

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

* goqrencode QRcode

func EncodeInput

func EncodeInput(input *Input) (*QRcode, error)

* Create a symbol from the input data. * see libqrencode QRcode_encodeInput

func EncodeString

func EncodeString(str string, version int, level C.QRecLevel, mode C.QRencodeMode, casesensitive int) (*QRcode, error)

* Create a symbol from the string. The library automatically parses the input * string and encodes in a QR Code symbol. * see libqrencode QRcode_encodeString

func (*QRcode) Bitmap

func (c *QRcode) Bitmap() (ret [][]bool)

* output matrix

func (*QRcode) Destroy

func (c *QRcode) Destroy()

* free libqrencode QRcode

func (*QRcode) New

func (c *QRcode) New(code *C.QRcode) *QRcode

* new goqrencode qrcode

Jump to

Keyboard shortcuts

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