directly replace image when calling Replace if it is an image
This commit is contained in:
parent
3a0ca2cdcd
commit
f36e11bdff
1 changed files with 6 additions and 0 deletions
|
@ -141,6 +141,12 @@ func (img *Image) Delete() {
|
|||
|
||||
// Replace replaces the image with the new one
|
||||
func (img *Image) Replace(src interface{}) error {
|
||||
if img.src == src {
|
||||
if origImg, ok := img.src.(image.Image); ok {
|
||||
img.img.Replace(origImg)
|
||||
return nil
|
||||
}
|
||||
}
|
||||
newImg, err := img.cv.LoadImage(src)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
Loading…
Reference in a new issue