Golang image.Alpha type examples

package image

Alpha is an in-memory image whose At method returns color.Alpha values.

Golang image.Alpha type usage examples

Example 1:

 func (self *Surface) GetImage() image.Image {
  width := self.GetWidth()
  height := self.GetHeight()
  stride := self.GetStride()
  data := self.GetData()
  switch self.GetFormat() {

 case FORMAT_A8:
 return &image.Alpha{ // <-- here
 Pix: data,
 Stride: stride,
 Rect: image.Rect(0, 0, width, height),
 }
 ...

Example 2:

 type Font struct {
 name string
 glyphs *image.Alpha
 letters map[byte]image.Rectangle
 avg_width float32
 height int
 }

Reference :

http://golang.org/pkg/image/#Alpha

Advertisement