qrcode

package module
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: May 15, 2025 License: Apache-2.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

View Source
const QRCODE object.Type = "qrcode"

Variables

This section is empty.

Functions

func Create

func Create(ctx context.Context, args ...object.Object) object.Object

Create creates a new QR code with the given content

Arguments:

  • content: the string to encode in the QR code
  • options: (optional) a map of configuration options:
  • encoding_mode: "numeric", "alphanumeric", or "byte"
  • error_correction: "low", "medium", "high", or "highest"
  • width: integer QR code width in pixels (default: 40)

func GetOS

func GetOS(ctx context.Context) os.OS

GetOS returns the OS from the context

func Module

func Module() *object.Module

func Save

func Save(ctx context.Context, args ...object.Object) object.Object

Save saves the QR code to a PNG file using the Risor OS

Arguments:

  • qrcode: the QR code to save
  • path: the file path to save the QR code to
  • style_options: (optional) a map of styling options:
  • bg_transparent: (bool) make the background transparent
  • bg_color_hex: (string) set background color using hex color code (e.g. "#FFFFFF")
  • fg_color_hex: (string) set foreground color using hex color code (e.g. "#000000")
  • logo_image: (image) a Risor image object to use as a logo in the center
  • shape: (string) "circle" or "rectangle" (default: "rectangle")
  • border_width: (int) width of the border around the QR code
  • format: (string) "png" or "jpeg" (default: "png")

Types

type QRCode

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

func New

func New(value *qrcode.QRCode, width uint8) *QRCode

func (*QRCode) Base64

func (q *QRCode) Base64(ctx context.Context, args ...object.Object) object.Object

Base64 returns the QR code as a base64 encoded string The options map can include: - bg_transparent: (bool) make the background transparent - bg_color_hex: (string) set background color using hex color code (e.g. "#FFFFFF") - fg_color_hex: (string) set foreground color using hex color code (e.g. "#000000") - logo_image: (image) a Risor image object to use as a logo in the center - shape: (string) "circle" or "rectangle" (default: "rectangle") - border_width: (int) width of the border around the QR code - format: (string) "png" or "jpeg" (default: "png")

func (*QRCode) Bytes

func (q *QRCode) Bytes(ctx context.Context, args ...object.Object) object.Object

Bytes returns the QR code as a byte slice The options map can include: - bg_transparent: (bool) make the background transparent - bg_color_hex: (string) set background color using hex color code (e.g. "#FFFFFF") - fg_color_hex: (string) set foreground color using hex color code (e.g. "#000000") - logo_image: (image) a Risor image object to use as a logo in the center - shape: (string) "circle" or "rectangle" (default: "rectangle") - border_width: (int) width of the border around the QR code - format: (string) "png" or "jpeg" (default: "png")

func (*QRCode) Cost

func (q *QRCode) Cost() int

func (*QRCode) Dimension

func (q *QRCode) Dimension(ctx context.Context, args ...object.Object) object.Object

Dimension implements the Dimension method of the QRCode type as a Risor method

func (*QRCode) Equals

func (q *QRCode) Equals(other object.Object) object.Object

func (*QRCode) GetAttr

func (q *QRCode) GetAttr(name string) (object.Object, bool)

func (*QRCode) Inspect

func (q *QRCode) Inspect() string

func (*QRCode) Interface

func (q *QRCode) Interface() interface{}

func (*QRCode) IsTruthy

func (q *QRCode) IsTruthy() bool

func (*QRCode) RunOperation

func (q *QRCode) RunOperation(opType op.BinaryOpType, right object.Object) object.Object

func (*QRCode) Save

func (q *QRCode) Save(ctx context.Context, args ...object.Object) object.Object

Save implements the Save method of the QRCode type as a Risor method The options map can include: - bg_transparent: (bool) make the background transparent - bg_color_hex: (string) set background color using hex color code (e.g. "#FFFFFF") - fg_color_hex: (string) set foreground color using hex color code (e.g. "#000000") - logo_image: (image) a Risor image object to use as a logo in the center - shape: (string) "circle" or "rectangle" (default: "rectangle") - border_width: (int) width of the border around the QR code - format: (string) "png" or "jpeg" (default: "png")

func (*QRCode) SetAttr

func (q *QRCode) SetAttr(name string, value object.Object) error

func (*QRCode) Type

func (q *QRCode) Type() object.Type

Jump to

Keyboard shortcuts

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