MCPcopy Create free account
hub / github.com/SolarLune/masterplan / Mix

Method Mix

utils.go:631–644  ·  view source on GitHub ↗
(other Color, percentage float64)

Source from the content-addressed store, hash-verified

629}
630
631func (color Color) Mix(other Color, percentage float64) Color {
632 newColor := NewColor(color.RGBA())
633 for i := range other {
634 diff := uint8(math.Ceil((float64(other[i]) - float64(newColor[i])) * percentage))
635 if percentage >= 1 {
636 newColor[i] = other[i]
637 } else if percentage <= 0 {
638 newColor[i] = color[i]
639 } else {
640 newColor[i] += diff
641 }
642 }
643 return newColor
644}
645
646func (color Color) Clone() Color {
647 return NewColor(color.RGBA())

Callers 4

DrawMethod · 0.95
DrawCardMethod · 0.80
CreateGridTextureMethod · 0.80
DrawMethod · 0.80

Calls 2

RGBAMethod · 0.95
NewColorFunction · 0.85

Tested by

no test coverage detected