mirror of
https://github.com/talgo-cloud/talgo-libwebp.git
synced 2026-03-07 21:48:16 -08:00
Rename ambiguous ColorModel to RGBModel
This commit is contained in:
parent
4ba34829e7
commit
462078c647
2 changed files with 5 additions and 5 deletions
|
|
@ -25,7 +25,7 @@ func NewRGBImage(r image.Rectangle) *RGBImage {
|
|||
|
||||
// ColorModel returns RGB color model.
|
||||
func (p *RGBImage) ColorModel() color.Model {
|
||||
return ColorModel
|
||||
return RGBModel
|
||||
}
|
||||
|
||||
// Bounds implements image.Image.At
|
||||
|
|
@ -48,7 +48,7 @@ func (p *RGBImage) RGBAAt(x, y int) color.RGBA {
|
|||
}
|
||||
|
||||
// ColorModel is RGB color model instance
|
||||
var ColorModel = color.ModelFunc(rgbModel)
|
||||
var RGBModel = color.ModelFunc(rgbModel)
|
||||
|
||||
func rgbModel(c color.Color) color.Color {
|
||||
if _, ok := c.(RGB); ok {
|
||||
|
|
|
|||
|
|
@ -226,7 +226,7 @@ func TestImageInterface(t *testing.T) {
|
|||
rect := image.Rect(0, 0, 100, 100)
|
||||
img := webp.NewRGBImage(rect)
|
||||
|
||||
if got := img.ColorModel(); got != webp.ColorModel {
|
||||
if got := img.ColorModel(); got != webp.RGBModel {
|
||||
t.Errorf("ColorModel() should return rgb.ColorModel, got: %v", got)
|
||||
}
|
||||
|
||||
|
|
@ -248,14 +248,14 @@ func TestImageInterface(t *testing.T) {
|
|||
func TestConvertFromRGBA(t *testing.T) {
|
||||
rgba := color.RGBA{0x11, 0x22, 0x33, 0xFF}
|
||||
expect := webp.RGB{0x11, 0x22, 0x33}
|
||||
if got := webp.ColorModel.Convert(rgba); got != expect {
|
||||
if got := webp.RGBModel.Convert(rgba); got != expect {
|
||||
t.Errorf("got: %v, expect: %v", got, expect)
|
||||
}
|
||||
}
|
||||
|
||||
func TestConvertFromRGB(t *testing.T) {
|
||||
c := webp.RGB{0x11, 0x22, 0x33}
|
||||
if got := webp.ColorModel.Convert(c); got != c {
|
||||
if got := webp.RGBModel.Convert(c); got != c {
|
||||
t.Errorf("got: %v, expect: %v", got, c)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue