Documentation ¶
Index ¶
- Variables
- func ParseFromHex(s string) color.RGBA
- type ExportOption
- func WithBgColor(c color.Color) ExportOption
- func WithBgColorHex(hex string) ExportOption
- func WithFgColor(c color.Color) ExportOption
- func WithFgColorHex(hex string) ExportOption
- func WithFinderShape(c shapes.FinderDrawConfig) ExportOption
- func WithGradient(d GradientDirection, colors ...color.Color) ExportOption
- func WithImageSize(size int) ExportOption
- func WithLogo(img image.Image) ExportOption
- func WithLogoScale(scale float64) ExportOption
- func WithModuleGap(gap float64) ExportOption
- func WithModuleShape(drawer shapes.ModuleDrawer) ExportOption
- func WithQuietZone(size int) ExportOption
- func WithSpaceAroundLogo() ExportOption
- type Exporter
- type GradientConfig
- type GradientDirection
Constants ¶
This section is empty.
Variables ¶
var DefaultImageOptions = exportOptions{ // contains filtered or unexported fields }
Functions ¶
func ParseFromHex ¶
ParseFromHex convert hex string into color.RGBA
Types ¶
type ExportOption ¶
type ExportOption interface {
// contains filtered or unexported methods
}
func WithFgColor ¶
func WithFgColor(c color.Color) ExportOption
WithFgColor sets color that is used to draw modules (ignored if gradient is set)
func WithFgColorHex ¶
func WithFgColorHex(hex string) ExportOption
WithFgColorHex Hex string to set QR Color
func WithFinderShape ¶
func WithFinderShape(c shapes.FinderDrawConfig) ExportOption
WithFinderShape sets config for drawing 3 finders in corners of QR code. See: shapes.SquareFinderShape, shapes.RoundedFinderShape.
func WithGradient ¶
func WithGradient(d GradientDirection, colors ...color.Color) ExportOption
WithGradient will use gradient to paint modules instead of foregroundColor (if set by WithFgColor or WithFgColorHex)
func WithImageSize ¶
func WithImageSize(size int) ExportOption
WithImageSize sets size of outputted image in pixels Values less than 1 are ignored
func WithLogo ¶
func WithLogo(img image.Image) ExportOption
WithLogo embeds image at the center of the QR
func WithLogoScale ¶ added in v0.3.1
func WithLogoScale(scale float64) ExportOption
WithLogoScale allows to resize logo image relative to the space it clears if WithSpaceAroundLogo is applied.
Allowed values are from 0.5 to 1 (inclusively)
func WithModuleGap ¶
func WithModuleGap(gap float64) ExportOption
WithModuleGap will set gaps between modules in percents relative to dynamic module size (determined by quiet zone and image size)
Note: gap should be in range [0; 1). Other values are ignored
func WithModuleShape ¶
func WithModuleShape(drawer shapes.ModuleDrawer) ExportOption
WithModuleShape sets function that will draw modules on the image See: shapes.SquareModuleShape, shapes.RoundedModuleShape.
func WithQuietZone ¶
func WithQuietZone(size int) ExportOption
WithQuietZone set padding around QR code. Note: actual size of the QR code is equal to size - quietZone * 2 (padding applied on every side )
func WithSpaceAroundLogo ¶
func WithSpaceAroundLogo() ExportOption
WithSpaceAroundLogo adds empty space behind logo, so it's not drawn on top of modules
type Exporter ¶
type Exporter struct {
// contains filtered or unexported fields
}
Exporter exports gqr.Matrix to image.Image
func NewExporter ¶
func NewExporter(opts ...ExportOption) Exporter
NewExporter creates new Exporter. (see DefaultImageOptions)
type GradientConfig ¶
type GradientConfig struct {
// contains filtered or unexported fields
}
type GradientDirection ¶
type GradientDirection = int
const ( // GradientDirectionLTR - Top Left -> Bottom Right GradientDirectionLTR GradientDirection = iota // GradientDirectionRTL - Top Right -> Bottom Left GradientDirectionRTL GradientDirection = iota )