Golang image.Alpha16 type examples
package image
Alpha16 is an in-memory image whose At method returns color.Alpha64 values.
Golang image.Alpha16 type usage examples
Example 1:
func NewSurfaceFromImage(img image.Image) *Surface {
var format Format
switch img.(type) {
case *image.Alpha, *image.Alpha16:
format = FORMAT_A8
case *extimage.BGRN, *image.Gray, *image.Gray16, *image.YCbCr:
format = FORMAT_RGB24
default:
format = FORMAT_ARGB32
}
surface := NewSurface(format, img.Bounds().Dx(), img.Bounds().Dy())
surface.SetImage(img)
return surface
}
Example 2:
if img, ok := src.(*image.Alpha16); ok {
return img.SubImage(rect)
}
References :
Advertisement
Something interesting
Tutorials
+6.7k Golang : Reverse by word
+26.7k Golang : How to check if a connection to database is still alive ?
+15.3k Golang : How to get Unix file descriptor for console and file
+6.8k Golang : Calculate pivot points for a cross
+14.9k Golang : Basic authentication with .htpasswd file
+12.8k Swift : Convert (cast) Int or int32 value to CGFloat
+19.5k Golang : How to Set or Add Header http.ResponseWriter?
+8.8k Golang : Get final balance from bit coin address example
+47.8k Golang : Convert int to byte array([]byte)
+21.2k Golang : How to get time zone and load different time zone?
+20.5k Golang : Pipe output from one os.Exec(shell command) to another command
+7.3k Golang : How to fix html/template : "somefile" is undefined error?