Exemple #1
0
func DepthOf(m image.Image) int {
	if m, ok := m.(*MemPImage); ok {
		return SizeofKind(m.XDataType) * 8
	}
	if m, ok := m.(MemP); ok {
		return SizeofKind(m.DataType() * 8)
	}
	switch m.(type) {
	case *image.Gray:
		return 1 * 8
	case *image.Gray16:
		return 2 * 8
	case *image.NRGBA:
		return 1 * 8
	case *image.NRGBA64:
		return 2 * 8
	case *image.RGBA:
		return 1 * 8
	case *image.RGBA64:
		return 2 * 8
	case *image.YCbCr:
		return 1 * 8
	}
	return 2 * 8
}