Last active
August 29, 2015 14:20
-
-
Save esdrasbeleza/e805d7ee12e4997ca0cb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type ImageContainer interface { | |
GetImage() image.Image | |
} | |
type FileImageContainer struct { | |
Filename string | |
} | |
func (f FileImageContainer) GetImage() image.Image { | |
file, _ := os.Open(f.filename) | |
defer file.Close() | |
image, _, _ := image.Decode(file) | |
return image | |
} | |
type ImageItselfContainer struct { | |
Image image.Image | |
} | |
func (i ImageItselfContainer) GetImage() image.Image { | |
return i.Image | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment