Barcode implementations also implements BarcodeColor interface

This commit is contained in:
zhaori96 2024-08-02 12:33:00 -03:00
parent 49d4ce8a5b
commit d5743d95af
5 changed files with 20 additions and 0 deletions

View File

@ -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)
}

View File

@ -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)
}

View File

@ -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

View File

@ -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)
}

View File

@ -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)
}