From d5743d95affe3ce2ea90e5e500269a34bdaf8f91 Mon Sep 17 00:00:00 2001 From: zhaori96 Date: Fri, 2 Aug 2024 12:33:00 -0300 Subject: [PATCH] Barcode implementations also implements BarcodeColor interface --- aztec/azteccode.go | 4 ++++ datamatrix/datamatrixcode.go | 4 ++++ pdf417/pdfcode.go | 4 ++++ qr/qrcode.go | 4 ++++ utils/base1dcode.go | 4 ++++ 5 files changed, 20 insertions(+) diff --git a/aztec/azteccode.go b/aztec/azteccode.go index 48de252..c757ae6 100644 --- a/aztec/azteccode.go +++ b/aztec/azteccode.go @@ -32,6 +32,10 @@ func (c *aztecCode) ColorModel() color.Model { return c.color.Model } +func (c *aztecCode) ColorScheme() barcode.ColorScheme { + return c.color +} + func (c *aztecCode) Bounds() image.Rectangle { return image.Rect(0, 0, c.size, c.size) } diff --git a/datamatrix/datamatrixcode.go b/datamatrix/datamatrixcode.go index c467dce..7e7ca26 100644 --- a/datamatrix/datamatrixcode.go +++ b/datamatrix/datamatrixcode.go @@ -35,6 +35,10 @@ func (c *datamatrixCode) ColorModel() color.Model { return c.color.Model } +func (c *datamatrixCode) ColorScheme() barcode.ColorScheme { + return c.color +} + func (c *datamatrixCode) Bounds() image.Rectangle { return image.Rect(0, 0, c.Columns, c.Rows) } diff --git a/pdf417/pdfcode.go b/pdf417/pdfcode.go index 68c9c3e..a594bd2 100644 --- a/pdf417/pdfcode.go +++ b/pdf417/pdfcode.go @@ -27,6 +27,10 @@ func (c *pdfBarcode) ColorModel() color.Model { return c.color.Model } +func (c *pdfBarcode) ColorScheme() barcode.ColorScheme { + return c.color +} + func (c *pdfBarcode) Bounds() image.Rectangle { height := c.code.Len() / c.width diff --git a/qr/qrcode.go b/qr/qrcode.go index 37f6f47..2fb44ab 100644 --- a/qr/qrcode.go +++ b/qr/qrcode.go @@ -28,6 +28,10 @@ func (qr *qrcode) ColorModel() color.Model { return qr.color.Model } +func (c *qrcode) ColorScheme() barcode.ColorScheme { + return c.color +} + func (qr *qrcode) Bounds() image.Rectangle { return image.Rect(0, 0, qr.dimension, qr.dimension) } diff --git a/utils/base1dcode.go b/utils/base1dcode.go index 646600a..1b77e4f 100644 --- a/utils/base1dcode.go +++ b/utils/base1dcode.go @@ -32,6 +32,10 @@ func (c *base1DCode) ColorModel() color.Model { return c.color.Model } +func (c *base1DCode) ColorScheme() barcode.ColorScheme { + return c.color +} + func (c *base1DCode) Bounds() image.Rectangle { return image.Rect(0, 0, c.Len(), 1) }