[A Tour of Go] Exercise: Images

newbieski·2023년 4월 10일

golang

목록 보기
1/13

https://go.dev/tour/methods/25

package main

import "golang.org/x/tour/pic"
import "image"
import "image/color"

type Image struct{}

func (img Image) Bounds() (image.Rectangle) {
	return image.Rect(0, 0, 200, 200)
}

func (img Image) ColorModel() (color.Model) {
	return color.RGBAModel
}

func (img Image) At(x, y int) (color.Color) {
	return color.RGBA{uint8((x+y)),uint8((x*y)),uint8((x*y)),uint8((x^y))}
}

func main() {
	m := Image{}
	pic.ShowImage(m)
}
profile
newbieski

2개의 댓글

comment-user-thumbnail
2023년 8월 27일

thanks for info

답글 달기
comment-user-thumbnail
2023년 8월 27일

My online journey took an exciting turn today as I stumbled upon a hidden oasis for creatives - a stock photography website that's nothing short of extraordinary. It's a sanctuary of visual delights, featuring sun ray vector a vast array of meticulously crafted images. Whether you're crafting a blog post, designing an advertisement, or simply seeking visual inspiration, this website is a treasure trove of possibilities.

답글 달기