func PictdepthListSize(list []Pictdepth) int {
	size := 0
	for _, item := range list {
		size += (8 + xgb.Pad((int(item.NumVisuals) * 8)))
	}
	return size
}
PictdepthListSize computes the size (bytes) of a list of Pictdepth values.
package render
import (
	"github.com/BurntSushi/xgb"
	"github.com/BurntSushi/xgb/xproto"
)
func Init(c *xgb.Conn) error {
	reply, err := xproto.QueryExtension(c, 6, "RENDER").Reply()
	switch {
	case err != nil:
		return err
	case !reply.Present:
		return xgb.Errorf("No extension named RENDER could be found on on the server.")
	}
	c.ExtLock.Lock()
	c.Extensions["RENDER"] = reply.MajorOpcode
	c.ExtLock.Unlock()
	for evNum, fun := range xgb.NewExtEventFuncs["RENDER"] {
		xgb.NewEventFuncs[int(reply.FirstEvent)+evNum] = fun
	}
	for errNum, fun := range xgb.NewExtErrorFuncs["RENDER"] {
		xgb.NewErrorFuncs[int(reply.FirstError)+errNum] = fun
	}
	return nil
}
func init() {
	xgb.NewExtEventFuncs["RENDER"] = make(map[int]xgb.NewEventFun)
	xgb.NewExtErrorFuncs["RENDER"] = make(map[int]xgb.NewErrorFun)
}
type Animcursorelt struct {
	Cursor xproto.Cursor
	Delay  uint32
}
func AnimcursoreltRead(buf []byte, v *Animcursorelt) int {
	b := 0
	v.Cursor = xproto.Cursor(xgb.Get32(buf[b:]))
	b += 4
	v.Delay = xgb.Get32(buf[b:])
	b += 4
	return b
}
func AnimcursoreltReadList(buf []byte, dest []Animcursorelt) int {
	b := 0
	for i := 0; i < len(dest); i++ {
		dest[i] = Animcursorelt{}
		b += AnimcursoreltRead(buf[b:], &dest[i])
	}
	return xgb.Pad(b)
}
func (v Animcursorelt) Bytes() []byte {
	buf := make([]byte, 8)
	b := 0
	xgb.Put32(buf[b:], uint32(v.Cursor))
	b += 4
	xgb.Put32(buf[b:], v.Delay)
	b += 4
	return buf[:b]
}
func AnimcursoreltListBytes(buf []byte, list []Animcursorelt) int {
	b := 0
	var structBytes []byte
	for _, item := range list {
		structBytes = item.Bytes()
		copy(buf[b:], structBytes)
		b += len(structBytes)
	}
	return xgb.Pad(b)
}
type Color struct {
	Red   uint16
	Green uint16
	Blue  uint16
	Alpha uint16
}
func ColorRead(buf []byte, v *Color) int {
	b := 0
	v.Red = xgb.Get16(buf[b:])
	b += 2
	v.Green = xgb.Get16(buf[b:])
	b += 2
	v.Blue = xgb.Get16(buf[b:])
	b += 2
	v.Alpha = xgb.Get16(buf[b:])
	b += 2
	return b
}
func ColorReadList(buf []byte, dest []Color) int {
	b := 0
	for i := 0; i < len(dest); i++ {
		dest[i] = Color{}
		b += ColorRead(buf[b:], &dest[i])
	}
	return xgb.Pad(b)
}
func (v Color) Bytes() []byte {
	buf := make([]byte, 8)
	b := 0
	xgb.Put16(buf[b:], v.Red)
	b += 2
	xgb.Put16(buf[b:], v.Green)
	b += 2
	xgb.Put16(buf[b:], v.Blue)
	b += 2
	xgb.Put16(buf[b:], v.Alpha)
	b += 2
	return buf[:b]
}
func ColorListBytes(buf []byte, list []Color) int {
	b := 0
	var structBytes []byte
	for _, item := range list {
		structBytes = item.Bytes()
		copy(buf[b:], structBytes)
		b += len(structBytes)
	}
	return xgb.Pad(b)
}
const (
	CpRepeat           = 1
	CpAlphaMap         = 2
	CpAlphaXOrigin     = 4
	CpAlphaYOrigin     = 8
	CpClipXOrigin      = 16
	CpClipYOrigin      = 32
	CpClipMask         = 64
	CpGraphicsExposure = 128
	CpSubwindowMode    = 256
	CpPolyEdge         = 512
	CpPolyMode         = 1024
	CpDither           = 2048
	CpComponentAlpha   = 4096
)
type Directformat struct {
	RedShift   uint16
	RedMask    uint16
	GreenShift uint16
	GreenMask  uint16
	BlueShift  uint16
	BlueMask   uint16
	AlphaShift uint16
	AlphaMask  uint16
}
func DirectformatRead(buf []byte, v *Directformat) int {
	b := 0
	v.RedShift = xgb.Get16(buf[b:])
	b += 2
	v.RedMask = xgb.Get16(buf[b:])
	b += 2
	v.GreenShift = xgb.Get16(buf[b:])
	b += 2
	v.GreenMask = xgb.Get16(buf[b:])
	b += 2
	v.BlueShift = xgb.Get16(buf[b:])
	b += 2
	v.BlueMask = xgb.Get16(buf[b:])
	b += 2
	v.AlphaShift = xgb.Get16(buf[b:])
	b += 2
	v.AlphaMask = xgb.Get16(buf[b:])
	b += 2
	return b
}
func DirectformatReadList(buf []byte, dest []Directformat) int {
	b := 0
	for i := 0; i < len(dest); i++ {
		dest[i] = Directformat{}
		b += DirectformatRead(buf[b:], &dest[i])
	}
	return xgb.Pad(b)
}
func (v Directformat) Bytes() []byte {
	buf := make([]byte, 16)
	b := 0
	xgb.Put16(buf[b:], v.RedShift)
	b += 2
	xgb.Put16(buf[b:], v.RedMask)
	b += 2
	xgb.Put16(buf[b:], v.GreenShift)
	b += 2
	xgb.Put16(buf[b:], v.GreenMask)
	b += 2
	xgb.Put16(buf[b:], v.BlueShift)
	b += 2
	xgb.Put16(buf[b:], v.BlueMask)
	b += 2
	xgb.Put16(buf[b:], v.AlphaShift)
	b += 2
	xgb.Put16(buf[b:], v.AlphaMask)
	b += 2
	return buf[:b]
}
func DirectformatListBytes(buf []byte, list []Directformat) int {
	b := 0
	var structBytes []byte
	for _, item := range list {
		structBytes = item.Bytes()
		copy(buf[b:], structBytes)
		b += len(structBytes)
	}
	return xgb.Pad(b)
}
type Fixed int32
type Glyph uint32
const BadGlyph = 4
type GlyphError struct {
	Sequence uint16
	NiceName string
}
func GlyphErrorNew(buf []byte) xgb.Error {
	v := GlyphError{}
	v.NiceName = "Glyph"
	b := 1  
	b += 1  
	v.Sequence = xgb.Get16(buf[b:])
	b += 2
	return v
}
func (err GlyphError) SequenceId() uint16 {
	return err.Sequence
}
func (err GlyphError) BadId() uint32 {
	return 0
}
func (err GlyphError) Error() string {
	fieldVals := make([]string, 0, 0)
	fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
	fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence))
	return "BadGlyph {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
	xgb.NewExtErrorFuncs["RENDER"][4] = GlyphErrorNew
}
const BadGlyphSet = 3
type GlyphSetError struct {
	Sequence uint16
	NiceName string
}
func GlyphSetErrorNew(buf []byte) xgb.Error {
	v := GlyphSetError{}
	v.NiceName = "GlyphSet"
	b := 1  
	b += 1  
	v.Sequence = xgb.Get16(buf[b:])
	b += 2
	return v
}
func (err GlyphSetError) SequenceId() uint16 {
	return err.Sequence
}
func (err GlyphSetError) BadId() uint32 {
	return 0
}
func (err GlyphSetError) Error() string {
	fieldVals := make([]string, 0, 0)
	fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
	fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence))
	return "BadGlyphSet {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
	xgb.NewExtErrorFuncs["RENDER"][3] = GlyphSetErrorNew
}
type Glyphinfo struct {
	Width  uint16
	Height uint16
	X      int16
	Y      int16
	XOff   int16
	YOff   int16
}
func GlyphinfoRead(buf []byte, v *Glyphinfo) int {
	b := 0
	v.Width = xgb.Get16(buf[b:])
	b += 2
	v.Height = xgb.Get16(buf[b:])
	b += 2
	v.X = int16(xgb.Get16(buf[b:]))
	b += 2
	v.Y = int16(xgb.Get16(buf[b:]))
	b += 2
	v.XOff = int16(xgb.Get16(buf[b:]))
	b += 2
	v.YOff = int16(xgb.Get16(buf[b:]))
	b += 2
	return b
}
func GlyphinfoReadList(buf []byte, dest []Glyphinfo) int {
	b := 0
	for i := 0; i < len(dest); i++ {
		dest[i] = Glyphinfo{}
		b += GlyphinfoRead(buf[b:], &dest[i])
	}
	return xgb.Pad(b)
}
func (v Glyphinfo) Bytes() []byte {
	buf := make([]byte, 12)
	b := 0
	xgb.Put16(buf[b:], v.Width)
	b += 2
	xgb.Put16(buf[b:], v.Height)
	b += 2
	xgb.Put16(buf[b:], uint16(v.X))
	b += 2
	xgb.Put16(buf[b:], uint16(v.Y))
	b += 2
	xgb.Put16(buf[b:], uint16(v.XOff))
	b += 2
	xgb.Put16(buf[b:], uint16(v.YOff))
	b += 2
	return buf[:b]
}
func GlyphinfoListBytes(buf []byte, list []Glyphinfo) int {
	b := 0
	var structBytes []byte
	for _, item := range list {
		structBytes = item.Bytes()
		copy(buf[b:], structBytes)
		b += len(structBytes)
	}
	return xgb.Pad(b)
}
type Glyphset uint32
func NewGlyphsetId(c *xgb.Conn) (Glyphset, error) {
	id, err := c.NewId()
	if err != nil {
		return 0, err
	}
	return Glyphset(id), nil
}
type Indexvalue struct {
	Pixel uint32
	Red   uint16
	Green uint16
	Blue  uint16
	Alpha uint16
}
func IndexvalueRead(buf []byte, v *Indexvalue) int {
	b := 0
	v.Pixel = xgb.Get32(buf[b:])
	b += 4
	v.Red = xgb.Get16(buf[b:])
	b += 2
	v.Green = xgb.Get16(buf[b:])
	b += 2
	v.Blue = xgb.Get16(buf[b:])
	b += 2
	v.Alpha = xgb.Get16(buf[b:])
	b += 2
	return b
}
func IndexvalueReadList(buf []byte, dest []Indexvalue) int {
	b := 0
	for i := 0; i < len(dest); i++ {
		dest[i] = Indexvalue{}
		b += IndexvalueRead(buf[b:], &dest[i])
	}
	return xgb.Pad(b)
}
func (v Indexvalue) Bytes() []byte {
	buf := make([]byte, 12)
	b := 0
	xgb.Put32(buf[b:], v.Pixel)
	b += 4
	xgb.Put16(buf[b:], v.Red)
	b += 2
	xgb.Put16(buf[b:], v.Green)
	b += 2
	xgb.Put16(buf[b:], v.Blue)
	b += 2
	xgb.Put16(buf[b:], v.Alpha)
	b += 2
	return buf[:b]
}
func IndexvalueListBytes(buf []byte, list []Indexvalue) int {
	b := 0
	var structBytes []byte
	for _, item := range list {
		structBytes = item.Bytes()
		copy(buf[b:], structBytes)
		b += len(structBytes)
	}
	return xgb.Pad(b)
}
type Linefix struct {
	P1 Pointfix
	P2 Pointfix
}
func LinefixRead(buf []byte, v *Linefix) int {
	b := 0
	v.P1 = Pointfix{}
	b += PointfixRead(buf[b:], &v.P1)
	v.P2 = Pointfix{}
	b += PointfixRead(buf[b:], &v.P2)
	return b
}
func LinefixReadList(buf []byte, dest []Linefix) int {
	b := 0
	for i := 0; i < len(dest); i++ {
		dest[i] = Linefix{}
		b += LinefixRead(buf[b:], &dest[i])
	}
	return xgb.Pad(b)
}
func (v Linefix) Bytes() []byte {
	buf := make([]byte, 16)
	b := 0
	{
		structBytes := v.P1.Bytes()
		copy(buf[b:], structBytes)
		b += len(structBytes)
	}
	{
		structBytes := v.P2.Bytes()
		copy(buf[b:], structBytes)
		b += len(structBytes)
	}
	return buf[:b]
}
func LinefixListBytes(buf []byte, list []Linefix) int {
	b := 0
	var structBytes []byte
	for _, item := range list {
		structBytes = item.Bytes()
		copy(buf[b:], structBytes)
		b += len(structBytes)
	}
	return xgb.Pad(b)
}
const BadPictFormat = 0
type PictFormatError struct {
	Sequence uint16
	NiceName string
}
func PictFormatErrorNew(buf []byte) xgb.Error {
	v := PictFormatError{}
	v.NiceName = "PictFormat"
	b := 1  
	b += 1  
	v.Sequence = xgb.Get16(buf[b:])
	b += 2
	return v
}
func (err PictFormatError) SequenceId() uint16 {
	return err.Sequence
}
func (err PictFormatError) BadId() uint32 {
	return 0
}
func (err PictFormatError) Error() string {
	fieldVals := make([]string, 0, 0)
	fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
	fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence))
	return "BadPictFormat {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
	xgb.NewExtErrorFuncs["RENDER"][0] = PictFormatErrorNew
}
const BadPictOp = 2
type PictOpError struct {
	Sequence uint16
	NiceName string
}
func PictOpErrorNew(buf []byte) xgb.Error {
	v := PictOpError{}
	v.NiceName = "PictOp"
	b := 1  
	b += 1  
	v.Sequence = xgb.Get16(buf[b:])
	b += 2
	return v
}
func (err PictOpError) SequenceId() uint16 {
	return err.Sequence
}
func (err PictOpError) BadId() uint32 {
	return 0
}
func (err PictOpError) Error() string {
	fieldVals := make([]string, 0, 0)
	fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
	fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence))
	return "BadPictOp {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
	xgb.NewExtErrorFuncs["RENDER"][2] = PictOpErrorNew
}
const (
	PictOpClear               = 0
	PictOpSrc                 = 1
	PictOpDst                 = 2
	PictOpOver                = 3
	PictOpOverReverse         = 4
	PictOpIn                  = 5
	PictOpInReverse           = 6
	PictOpOut                 = 7
	PictOpOutReverse          = 8
	PictOpAtop                = 9
	PictOpAtopReverse         = 10
	PictOpXor                 = 11
	PictOpAdd                 = 12
	PictOpSaturate            = 13
	PictOpDisjointClear       = 16
	PictOpDisjointSrc         = 17
	PictOpDisjointDst         = 18
	PictOpDisjointOver        = 19
	PictOpDisjointOverReverse = 20
	PictOpDisjointIn          = 21
	PictOpDisjointInReverse   = 22
	PictOpDisjointOut         = 23
	PictOpDisjointOutReverse  = 24
	PictOpDisjointAtop        = 25
	PictOpDisjointAtopReverse = 26
	PictOpDisjointXor         = 27
	PictOpConjointClear       = 32
	PictOpConjointSrc         = 33
	PictOpConjointDst         = 34
	PictOpConjointOver        = 35
	PictOpConjointOverReverse = 36
	PictOpConjointIn          = 37
	PictOpConjointInReverse   = 38
	PictOpConjointOut         = 39
	PictOpConjointOutReverse  = 40
	PictOpConjointAtop        = 41
	PictOpConjointAtopReverse = 42
	PictOpConjointXor         = 43
	PictOpMultiply            = 48
	PictOpScreen              = 49
	PictOpOverlay             = 50
	PictOpDarken              = 51
	PictOpLighten             = 52
	PictOpColorDodge          = 53
	PictOpColorBurn           = 54
	PictOpHardLight           = 55
	PictOpSoftLight           = 56
	PictOpDifference          = 57
	PictOpExclusion           = 58
	PictOpHSLHue              = 59
	PictOpHSLSaturation       = 60
	PictOpHSLColor            = 61
	PictOpHSLLuminosity       = 62
)
const (
	PictTypeIndexed = 0
	PictTypeDirect  = 1
)
type Pictdepth struct {
	Depth byte
	NumVisuals uint16
	Visuals []Pictvisual  
}
func PictdepthRead(buf []byte, v *Pictdepth) int {
	b := 0
	v.Depth = buf[b]
	b += 1
	b += 1  
	v.NumVisuals = xgb.Get16(buf[b:])
	b += 2
	b += 4  
	v.Visuals = make([]Pictvisual, v.NumVisuals)
	b += PictvisualReadList(buf[b:], v.Visuals)
	return b
}
func PictdepthReadList(buf []byte, dest []Pictdepth) int {
	b := 0
	for i := 0; i < len(dest); i++ {
		dest[i] = Pictdepth{}
		b += PictdepthRead(buf[b:], &dest[i])
	}
	return xgb.Pad(b)
}
func (v Pictdepth) Bytes() []byte {
	buf := make([]byte, (8 + xgb.Pad((int(v.NumVisuals) * 8))))
	b := 0
	buf[b] = v.Depth
	b += 1
	b += 1  
	xgb.Put16(buf[b:], v.NumVisuals)
	b += 2
	b += 4  
	b += PictvisualListBytes(buf[b:], v.Visuals)
	return buf[:b]
}
func PictdepthListBytes(buf []byte, list []Pictdepth) int {
	b := 0
	var structBytes []byte
	for _, item := range list {
		structBytes = item.Bytes()
		copy(buf[b:], structBytes)
		b += len(structBytes)
	}
	return xgb.Pad(b)
}