码迷,mamicode.com
首页 > 其他好文 > 详细

A Tour of Go Images

时间:2014-10-28 23:49:25      阅读:220      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   io   color   ar   for   sp   div   

Package image defines the Image interface:

package image

type Image interface {
    ColorModel() color.Model
    Bounds() Rectangle
    At(x, y int) color.Color
}

(See the documentation for all the details.)

Also, color.Color and color.Model are interfaces, but we‘ll ignore that by using the predefined implementations color.RGBA and color.RGBAModel. These interfaces and types are specified by the image/color package

 

 

package main

import (
    "fmt"
    "image"
)

func main() {
    m := image.NewRGBA(image.Rect(0, 0, 100, 100))
    fmt.Println(m.Bounds())
    fmt.Println(m.At(0, 0).RGBA())
}

 

A Tour of Go Images

标签:style   blog   http   io   color   ar   for   sp   div   

原文地址:http://www.cnblogs.com/ghgyj/p/4058220.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!