From ea30f1a0a718e5e86343cceac12104baab1bedca Mon Sep 17 00:00:00 2001 From: "Andrew Gallant (Ocelot)" Date: Sun, 6 May 2012 03:06:02 -0400 Subject: more bug fixes for the rest of the extensions --- nexgb/auto_render.go | 3506 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 3506 insertions(+) create mode 100644 nexgb/auto_render.go (limited to 'nexgb/auto_render.go') diff --git a/nexgb/auto_render.go b/nexgb/auto_render.go new file mode 100644 index 0000000..069ce76 --- /dev/null +++ b/nexgb/auto_render.go @@ -0,0 +1,3506 @@ +package xgb + +/* + This file was generated by render.xml on May 5 2012 6:07:02pm EDT. + This file is automatically generated. Edit at your peril! +*/ + +// Imports are not necessary for XGB because everything is +// in one package. They are still listed here for reference. +// import "xproto" + +// Skipping definition for base type 'Id' + +// Skipping definition for base type 'Card8' + +// Skipping definition for base type 'Int16' + +// Skipping definition for base type 'Int32' + +// Skipping definition for base type 'Void' + +// Skipping definition for base type 'Byte' + +// Skipping definition for base type 'Int8' + +// Skipping definition for base type 'Card16' + +// Skipping definition for base type 'Char' + +// Skipping definition for base type 'Card32' + +// Skipping definition for base type 'Double' + +// Skipping definition for base type 'Bool' + +// Skipping definition for base type 'Float' + +const ( + RenderPictTypeIndexed = 0 + RenderPictTypeDirect = 1 +) + +const ( + RenderPictureNone = 0 +) + +const ( + RenderPictOpClear = 0 + RenderPictOpSrc = 1 + RenderPictOpDst = 2 + RenderPictOpOver = 3 + RenderPictOpOverReverse = 4 + RenderPictOpIn = 5 + RenderPictOpInReverse = 6 + RenderPictOpOut = 7 + RenderPictOpOutReverse = 8 + RenderPictOpAtop = 9 + RenderPictOpAtopReverse = 10 + RenderPictOpXor = 11 + RenderPictOpAdd = 12 + RenderPictOpSaturate = 13 + RenderPictOpDisjointClear = 16 + RenderPictOpDisjointSrc = 17 + RenderPictOpDisjointDst = 18 + RenderPictOpDisjointOver = 19 + RenderPictOpDisjointOverReverse = 20 + RenderPictOpDisjointIn = 21 + RenderPictOpDisjointInReverse = 22 + RenderPictOpDisjointOut = 23 + RenderPictOpDisjointOutReverse = 24 + RenderPictOpDisjointAtop = 25 + RenderPictOpDisjointAtopReverse = 26 + RenderPictOpDisjointXor = 27 + RenderPictOpConjointClear = 32 + RenderPictOpConjointSrc = 33 + RenderPictOpConjointDst = 34 + RenderPictOpConjointOver = 35 + RenderPictOpConjointOverReverse = 36 + RenderPictOpConjointIn = 37 + RenderPictOpConjointInReverse = 38 + RenderPictOpConjointOut = 39 + RenderPictOpConjointOutReverse = 40 + RenderPictOpConjointAtop = 41 + RenderPictOpConjointAtopReverse = 42 + RenderPictOpConjointXor = 43 + RenderPictOpMultiply = 48 + RenderPictOpScreen = 49 + RenderPictOpOverlay = 50 + RenderPictOpDarken = 51 + RenderPictOpLighten = 52 + RenderPictOpColorDodge = 53 + RenderPictOpColorBurn = 54 + RenderPictOpHardLight = 55 + RenderPictOpSoftLight = 56 + RenderPictOpDifference = 57 + RenderPictOpExclusion = 58 + RenderPictOpHSLHue = 59 + RenderPictOpHSLSaturation = 60 + RenderPictOpHSLColor = 61 + RenderPictOpHSLLuminosity = 62 +) + +const ( + RenderPolyEdgeSharp = 0 + RenderPolyEdgeSmooth = 1 +) + +const ( + RenderPolyModePrecise = 0 + RenderPolyModeImprecise = 1 +) + +const ( + RenderCpRepeat = 1 + RenderCpAlphaMap = 2 + RenderCpAlphaXOrigin = 4 + RenderCpAlphaYOrigin = 8 + RenderCpClipXOrigin = 16 + RenderCpClipYOrigin = 32 + RenderCpClipMask = 64 + RenderCpGraphicsExposure = 128 + RenderCpSubwindowMode = 256 + RenderCpPolyEdge = 512 + RenderCpPolyMode = 1024 + RenderCpDither = 2048 + RenderCpComponentAlpha = 4096 +) + +const ( + RenderSubPixelUnknown = 0 + RenderSubPixelHorizontalRGB = 1 + RenderSubPixelHorizontalBGR = 2 + RenderSubPixelVerticalRGB = 3 + RenderSubPixelVerticalBGR = 4 + RenderSubPixelNone = 5 +) + +const ( + RenderRepeatNone = 0 + RenderRepeatNormal = 1 + RenderRepeatPad = 2 + RenderRepeatReflect = 3 +) + +// Skipping resource definition of 'Glyphset' + +// Skipping resource definition of 'Picture' + +// Skipping resource definition of 'Pictformat' + +type RenderGlyph uint32 + +type RenderFixed int32 + +// 'RenderDirectformat' struct definition +// Size: 16 +type RenderDirectformat struct { + RedShift uint16 + RedMask uint16 + GreenShift uint16 + GreenMask uint16 + BlueShift uint16 + BlueMask uint16 + AlphaShift uint16 + AlphaMask uint16 +} + +// Struct read RenderDirectformat +func ReadRenderDirectformat(buf []byte, v *RenderDirectformat) int { + b := 0 + + v.RedShift = Get16(buf[b:]) + b += 2 + + v.RedMask = Get16(buf[b:]) + b += 2 + + v.GreenShift = Get16(buf[b:]) + b += 2 + + v.GreenMask = Get16(buf[b:]) + b += 2 + + v.BlueShift = Get16(buf[b:]) + b += 2 + + v.BlueMask = Get16(buf[b:]) + b += 2 + + v.AlphaShift = Get16(buf[b:]) + b += 2 + + v.AlphaMask = Get16(buf[b:]) + b += 2 + + return b +} + +// Struct list read RenderDirectformat +func ReadRenderDirectformatList(buf []byte, dest []RenderDirectformat) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = RenderDirectformat{} + b += ReadRenderDirectformat(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write RenderDirectformat +func (v RenderDirectformat) Bytes() []byte { + buf := make([]byte, 16) + b := 0 + + Put16(buf[b:], v.RedShift) + b += 2 + + Put16(buf[b:], v.RedMask) + b += 2 + + Put16(buf[b:], v.GreenShift) + b += 2 + + Put16(buf[b:], v.GreenMask) + b += 2 + + Put16(buf[b:], v.BlueShift) + b += 2 + + Put16(buf[b:], v.BlueMask) + b += 2 + + Put16(buf[b:], v.AlphaShift) + b += 2 + + Put16(buf[b:], v.AlphaMask) + b += 2 + + return buf +} + +// Write struct list RenderDirectformat +func RenderDirectformatListBytes(buf []byte, list []RenderDirectformat) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// 'RenderPictforminfo' struct definition +// Size: 28 +type RenderPictforminfo struct { + Id Id + Type byte + Depth byte + // padding: 2 bytes + Direct RenderDirectformat + Colormap Id +} + +// Struct read RenderPictforminfo +func ReadRenderPictforminfo(buf []byte, v *RenderPictforminfo) int { + b := 0 + + v.Id = Id(Get32(buf[b:])) + b += 4 + + v.Type = buf[b] + b += 1 + + v.Depth = buf[b] + b += 1 + + b += 2 // padding + + v.Direct = RenderDirectformat{} + b += ReadRenderDirectformat(buf[b:], &v.Direct) + + v.Colormap = Id(Get32(buf[b:])) + b += 4 + + return b +} + +// Struct list read RenderPictforminfo +func ReadRenderPictforminfoList(buf []byte, dest []RenderPictforminfo) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = RenderPictforminfo{} + b += ReadRenderPictforminfo(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write RenderPictforminfo +func (v RenderPictforminfo) Bytes() []byte { + buf := make([]byte, 28) + b := 0 + + Put32(buf[b:], uint32(v.Id)) + b += 4 + + buf[b] = v.Type + b += 1 + + buf[b] = v.Depth + b += 1 + + b += 2 // padding + + { + structBytes := v.Direct.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + + Put32(buf[b:], uint32(v.Colormap)) + b += 4 + + return buf +} + +// Write struct list RenderPictforminfo +func RenderPictforminfoListBytes(buf []byte, list []RenderPictforminfo) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// 'RenderPictvisual' struct definition +// Size: 8 +type RenderPictvisual struct { + Visual Visualid + Format Id +} + +// Struct read RenderPictvisual +func ReadRenderPictvisual(buf []byte, v *RenderPictvisual) int { + b := 0 + + v.Visual = Visualid(Get32(buf[b:])) + b += 4 + + v.Format = Id(Get32(buf[b:])) + b += 4 + + return b +} + +// Struct list read RenderPictvisual +func ReadRenderPictvisualList(buf []byte, dest []RenderPictvisual) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = RenderPictvisual{} + b += ReadRenderPictvisual(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write RenderPictvisual +func (v RenderPictvisual) Bytes() []byte { + buf := make([]byte, 8) + b := 0 + + Put32(buf[b:], uint32(v.Visual)) + b += 4 + + Put32(buf[b:], uint32(v.Format)) + b += 4 + + return buf +} + +// Write struct list RenderPictvisual +func RenderPictvisualListBytes(buf []byte, list []RenderPictvisual) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// 'RenderPictdepth' struct definition +// Size: (8 + pad((int(NumVisuals) * 8))) +type RenderPictdepth struct { + Depth byte + // padding: 1 bytes + NumVisuals uint16 + // padding: 4 bytes + Visuals []RenderPictvisual // size: pad((int(NumVisuals) * 8)) +} + +// Struct read RenderPictdepth +func ReadRenderPictdepth(buf []byte, v *RenderPictdepth) int { + b := 0 + + v.Depth = buf[b] + b += 1 + + b += 1 // padding + + v.NumVisuals = Get16(buf[b:]) + b += 2 + + b += 4 // padding + + v.Visuals = make([]RenderPictvisual, v.NumVisuals) + b += ReadRenderPictvisualList(buf[b:], v.Visuals) + + return b +} + +// Struct list read RenderPictdepth +func ReadRenderPictdepthList(buf []byte, dest []RenderPictdepth) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = RenderPictdepth{} + b += ReadRenderPictdepth(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write RenderPictdepth +func (v RenderPictdepth) Bytes() []byte { + buf := make([]byte, (8 + pad((int(v.NumVisuals) * 8)))) + b := 0 + + buf[b] = v.Depth + b += 1 + + b += 1 // padding + + Put16(buf[b:], v.NumVisuals) + b += 2 + + b += 4 // padding + + b += RenderPictvisualListBytes(buf[b:], v.Visuals) + + return buf +} + +// Write struct list RenderPictdepth +func RenderPictdepthListBytes(buf []byte, list []RenderPictdepth) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// Struct list size RenderPictdepth +func RenderPictdepthListSize(list []RenderPictdepth) int { + size := 0 + for _, item := range list { + size += (8 + pad((int(item.NumVisuals) * 8))) + } + return size +} + +// 'RenderPictscreen' struct definition +// Size: (8 + RenderPictdepthListSize(Depths)) +type RenderPictscreen struct { + NumDepths uint32 + Fallback Id + Depths []RenderPictdepth // size: RenderPictdepthListSize(Depths) +} + +// Struct read RenderPictscreen +func ReadRenderPictscreen(buf []byte, v *RenderPictscreen) int { + b := 0 + + v.NumDepths = Get32(buf[b:]) + b += 4 + + v.Fallback = Id(Get32(buf[b:])) + b += 4 + + v.Depths = make([]RenderPictdepth, v.NumDepths) + b += ReadRenderPictdepthList(buf[b:], v.Depths) + + return b +} + +// Struct list read RenderPictscreen +func ReadRenderPictscreenList(buf []byte, dest []RenderPictscreen) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = RenderPictscreen{} + b += ReadRenderPictscreen(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write RenderPictscreen +func (v RenderPictscreen) Bytes() []byte { + buf := make([]byte, (8 + RenderPictdepthListSize(v.Depths))) + b := 0 + + Put32(buf[b:], v.NumDepths) + b += 4 + + Put32(buf[b:], uint32(v.Fallback)) + b += 4 + + b += RenderPictdepthListBytes(buf[b:], v.Depths) + + return buf +} + +// Write struct list RenderPictscreen +func RenderPictscreenListBytes(buf []byte, list []RenderPictscreen) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// Struct list size RenderPictscreen +func RenderPictscreenListSize(list []RenderPictscreen) int { + size := 0 + for _, item := range list { + size += (8 + RenderPictdepthListSize(item.Depths)) + } + return size +} + +// 'RenderIndexvalue' struct definition +// Size: 12 +type RenderIndexvalue struct { + Pixel uint32 + Red uint16 + Green uint16 + Blue uint16 + Alpha uint16 +} + +// Struct read RenderIndexvalue +func ReadRenderIndexvalue(buf []byte, v *RenderIndexvalue) int { + b := 0 + + v.Pixel = Get32(buf[b:]) + b += 4 + + v.Red = Get16(buf[b:]) + b += 2 + + v.Green = Get16(buf[b:]) + b += 2 + + v.Blue = Get16(buf[b:]) + b += 2 + + v.Alpha = Get16(buf[b:]) + b += 2 + + return b +} + +// Struct list read RenderIndexvalue +func ReadRenderIndexvalueList(buf []byte, dest []RenderIndexvalue) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = RenderIndexvalue{} + b += ReadRenderIndexvalue(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write RenderIndexvalue +func (v RenderIndexvalue) Bytes() []byte { + buf := make([]byte, 12) + b := 0 + + Put32(buf[b:], v.Pixel) + b += 4 + + Put16(buf[b:], v.Red) + b += 2 + + Put16(buf[b:], v.Green) + b += 2 + + Put16(buf[b:], v.Blue) + b += 2 + + Put16(buf[b:], v.Alpha) + b += 2 + + return buf +} + +// Write struct list RenderIndexvalue +func RenderIndexvalueListBytes(buf []byte, list []RenderIndexvalue) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// 'RenderColor' struct definition +// Size: 8 +type RenderColor struct { + Red uint16 + Green uint16 + Blue uint16 + Alpha uint16 +} + +// Struct read RenderColor +func ReadRenderColor(buf []byte, v *RenderColor) int { + b := 0 + + v.Red = Get16(buf[b:]) + b += 2 + + v.Green = Get16(buf[b:]) + b += 2 + + v.Blue = Get16(buf[b:]) + b += 2 + + v.Alpha = Get16(buf[b:]) + b += 2 + + return b +} + +// Struct list read RenderColor +func ReadRenderColorList(buf []byte, dest []RenderColor) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = RenderColor{} + b += ReadRenderColor(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write RenderColor +func (v RenderColor) Bytes() []byte { + buf := make([]byte, 8) + b := 0 + + Put16(buf[b:], v.Red) + b += 2 + + Put16(buf[b:], v.Green) + b += 2 + + Put16(buf[b:], v.Blue) + b += 2 + + Put16(buf[b:], v.Alpha) + b += 2 + + return buf +} + +// Write struct list RenderColor +func RenderColorListBytes(buf []byte, list []RenderColor) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// 'RenderPointfix' struct definition +// Size: 8 +type RenderPointfix struct { + X RenderFixed + Y RenderFixed +} + +// Struct read RenderPointfix +func ReadRenderPointfix(buf []byte, v *RenderPointfix) int { + b := 0 + + v.X = RenderFixed(Get32(buf[b:])) + b += 4 + + v.Y = RenderFixed(Get32(buf[b:])) + b += 4 + + return b +} + +// Struct list read RenderPointfix +func ReadRenderPointfixList(buf []byte, dest []RenderPointfix) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = RenderPointfix{} + b += ReadRenderPointfix(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write RenderPointfix +func (v RenderPointfix) Bytes() []byte { + buf := make([]byte, 8) + b := 0 + + Put32(buf[b:], uint32(v.X)) + b += 4 + + Put32(buf[b:], uint32(v.Y)) + b += 4 + + return buf +} + +// Write struct list RenderPointfix +func RenderPointfixListBytes(buf []byte, list []RenderPointfix) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// 'RenderLinefix' struct definition +// Size: 16 +type RenderLinefix struct { + P1 RenderPointfix + P2 RenderPointfix +} + +// Struct read RenderLinefix +func ReadRenderLinefix(buf []byte, v *RenderLinefix) int { + b := 0 + + v.P1 = RenderPointfix{} + b += ReadRenderPointfix(buf[b:], &v.P1) + + v.P2 = RenderPointfix{} + b += ReadRenderPointfix(buf[b:], &v.P2) + + return b +} + +// Struct list read RenderLinefix +func ReadRenderLinefixList(buf []byte, dest []RenderLinefix) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = RenderLinefix{} + b += ReadRenderLinefix(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write RenderLinefix +func (v RenderLinefix) Bytes() []byte { + buf := make([]byte, 16) + b := 0 + + { + structBytes := v.P1.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + + { + structBytes := v.P2.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + + return buf +} + +// Write struct list RenderLinefix +func RenderLinefixListBytes(buf []byte, list []RenderLinefix) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// 'RenderTriangle' struct definition +// Size: 24 +type RenderTriangle struct { + P1 RenderPointfix + P2 RenderPointfix + P3 RenderPointfix +} + +// Struct read RenderTriangle +func ReadRenderTriangle(buf []byte, v *RenderTriangle) int { + b := 0 + + v.P1 = RenderPointfix{} + b += ReadRenderPointfix(buf[b:], &v.P1) + + v.P2 = RenderPointfix{} + b += ReadRenderPointfix(buf[b:], &v.P2) + + v.P3 = RenderPointfix{} + b += ReadRenderPointfix(buf[b:], &v.P3) + + return b +} + +// Struct list read RenderTriangle +func ReadRenderTriangleList(buf []byte, dest []RenderTriangle) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = RenderTriangle{} + b += ReadRenderTriangle(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write RenderTriangle +func (v RenderTriangle) Bytes() []byte { + buf := make([]byte, 24) + b := 0 + + { + structBytes := v.P1.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + + { + structBytes := v.P2.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + + { + structBytes := v.P3.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + + return buf +} + +// Write struct list RenderTriangle +func RenderTriangleListBytes(buf []byte, list []RenderTriangle) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// 'RenderTrapezoid' struct definition +// Size: 40 +type RenderTrapezoid struct { + Top RenderFixed + Bottom RenderFixed + Left RenderLinefix + Right RenderLinefix +} + +// Struct read RenderTrapezoid +func ReadRenderTrapezoid(buf []byte, v *RenderTrapezoid) int { + b := 0 + + v.Top = RenderFixed(Get32(buf[b:])) + b += 4 + + v.Bottom = RenderFixed(Get32(buf[b:])) + b += 4 + + v.Left = RenderLinefix{} + b += ReadRenderLinefix(buf[b:], &v.Left) + + v.Right = RenderLinefix{} + b += ReadRenderLinefix(buf[b:], &v.Right) + + return b +} + +// Struct list read RenderTrapezoid +func ReadRenderTrapezoidList(buf []byte, dest []RenderTrapezoid) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = RenderTrapezoid{} + b += ReadRenderTrapezoid(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write RenderTrapezoid +func (v RenderTrapezoid) Bytes() []byte { + buf := make([]byte, 40) + b := 0 + + Put32(buf[b:], uint32(v.Top)) + b += 4 + + Put32(buf[b:], uint32(v.Bottom)) + b += 4 + + { + structBytes := v.Left.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + + { + structBytes := v.Right.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + + return buf +} + +// Write struct list RenderTrapezoid +func RenderTrapezoidListBytes(buf []byte, list []RenderTrapezoid) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// 'RenderGlyphinfo' struct definition +// Size: 12 +type RenderGlyphinfo struct { + Width uint16 + Height uint16 + X int16 + Y int16 + XOff int16 + YOff int16 +} + +// Struct read RenderGlyphinfo +func ReadRenderGlyphinfo(buf []byte, v *RenderGlyphinfo) int { + b := 0 + + v.Width = Get16(buf[b:]) + b += 2 + + v.Height = Get16(buf[b:]) + b += 2 + + v.X = int16(Get16(buf[b:])) + b += 2 + + v.Y = int16(Get16(buf[b:])) + b += 2 + + v.XOff = int16(Get16(buf[b:])) + b += 2 + + v.YOff = int16(Get16(buf[b:])) + b += 2 + + return b +} + +// Struct list read RenderGlyphinfo +func ReadRenderGlyphinfoList(buf []byte, dest []RenderGlyphinfo) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = RenderGlyphinfo{} + b += ReadRenderGlyphinfo(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write RenderGlyphinfo +func (v RenderGlyphinfo) Bytes() []byte { + buf := make([]byte, 12) + b := 0 + + Put16(buf[b:], v.Width) + b += 2 + + Put16(buf[b:], v.Height) + b += 2 + + Put16(buf[b:], uint16(v.X)) + b += 2 + + Put16(buf[b:], uint16(v.Y)) + b += 2 + + Put16(buf[b:], uint16(v.XOff)) + b += 2 + + Put16(buf[b:], uint16(v.YOff)) + b += 2 + + return buf +} + +// Write struct list RenderGlyphinfo +func RenderGlyphinfoListBytes(buf []byte, list []RenderGlyphinfo) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// 'RenderTransform' struct definition +// Size: 36 +type RenderTransform struct { + Matrix11 RenderFixed + Matrix12 RenderFixed + Matrix13 RenderFixed + Matrix21 RenderFixed + Matrix22 RenderFixed + Matrix23 RenderFixed + Matrix31 RenderFixed + Matrix32 RenderFixed + Matrix33 RenderFixed +} + +// Struct read RenderTransform +func ReadRenderTransform(buf []byte, v *RenderTransform) int { + b := 0 + + v.Matrix11 = RenderFixed(Get32(buf[b:])) + b += 4 + + v.Matrix12 = RenderFixed(Get32(buf[b:])) + b += 4 + + v.Matrix13 = RenderFixed(Get32(buf[b:])) + b += 4 + + v.Matrix21 = RenderFixed(Get32(buf[b:])) + b += 4 + + v.Matrix22 = RenderFixed(Get32(buf[b:])) + b += 4 + + v.Matrix23 = RenderFixed(Get32(buf[b:])) + b += 4 + + v.Matrix31 = RenderFixed(Get32(buf[b:])) + b += 4 + + v.Matrix32 = RenderFixed(Get32(buf[b:])) + b += 4 + + v.Matrix33 = RenderFixed(Get32(buf[b:])) + b += 4 + + return b +} + +// Struct list read RenderTransform +func ReadRenderTransformList(buf []byte, dest []RenderTransform) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = RenderTransform{} + b += ReadRenderTransform(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write RenderTransform +func (v RenderTransform) Bytes() []byte { + buf := make([]byte, 36) + b := 0 + + Put32(buf[b:], uint32(v.Matrix11)) + b += 4 + + Put32(buf[b:], uint32(v.Matrix12)) + b += 4 + + Put32(buf[b:], uint32(v.Matrix13)) + b += 4 + + Put32(buf[b:], uint32(v.Matrix21)) + b += 4 + + Put32(buf[b:], uint32(v.Matrix22)) + b += 4 + + Put32(buf[b:], uint32(v.Matrix23)) + b += 4 + + Put32(buf[b:], uint32(v.Matrix31)) + b += 4 + + Put32(buf[b:], uint32(v.Matrix32)) + b += 4 + + Put32(buf[b:], uint32(v.Matrix33)) + b += 4 + + return buf +} + +// Write struct list RenderTransform +func RenderTransformListBytes(buf []byte, list []RenderTransform) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// 'RenderAnimcursorelt' struct definition +// Size: 8 +type RenderAnimcursorelt struct { + Cursor Id + Delay uint32 +} + +// Struct read RenderAnimcursorelt +func ReadRenderAnimcursorelt(buf []byte, v *RenderAnimcursorelt) int { + b := 0 + + v.Cursor = Id(Get32(buf[b:])) + b += 4 + + v.Delay = Get32(buf[b:]) + b += 4 + + return b +} + +// Struct list read RenderAnimcursorelt +func ReadRenderAnimcursoreltList(buf []byte, dest []RenderAnimcursorelt) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = RenderAnimcursorelt{} + b += ReadRenderAnimcursorelt(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write RenderAnimcursorelt +func (v RenderAnimcursorelt) Bytes() []byte { + buf := make([]byte, 8) + b := 0 + + Put32(buf[b:], uint32(v.Cursor)) + b += 4 + + Put32(buf[b:], v.Delay) + b += 4 + + return buf +} + +// Write struct list RenderAnimcursorelt +func RenderAnimcursoreltListBytes(buf []byte, list []RenderAnimcursorelt) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// 'RenderSpanfix' struct definition +// Size: 12 +type RenderSpanfix struct { + L RenderFixed + R RenderFixed + Y RenderFixed +} + +// Struct read RenderSpanfix +func ReadRenderSpanfix(buf []byte, v *RenderSpanfix) int { + b := 0 + + v.L = RenderFixed(Get32(buf[b:])) + b += 4 + + v.R = RenderFixed(Get32(buf[b:])) + b += 4 + + v.Y = RenderFixed(Get32(buf[b:])) + b += 4 + + return b +} + +// Struct list read RenderSpanfix +func ReadRenderSpanfixList(buf []byte, dest []RenderSpanfix) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = RenderSpanfix{} + b += ReadRenderSpanfix(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write RenderSpanfix +func (v RenderSpanfix) Bytes() []byte { + buf := make([]byte, 12) + b := 0 + + Put32(buf[b:], uint32(v.L)) + b += 4 + + Put32(buf[b:], uint32(v.R)) + b += 4 + + Put32(buf[b:], uint32(v.Y)) + b += 4 + + return buf +} + +// Write struct list RenderSpanfix +func RenderSpanfixListBytes(buf []byte, list []RenderSpanfix) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// 'RenderTrap' struct definition +// Size: 24 +type RenderTrap struct { + Top RenderSpanfix + Bot RenderSpanfix +} + +// Struct read RenderTrap +func ReadRenderTrap(buf []byte, v *RenderTrap) int { + b := 0 + + v.Top = RenderSpanfix{} + b += ReadRenderSpanfix(buf[b:], &v.Top) + + v.Bot = RenderSpanfix{} + b += ReadRenderSpanfix(buf[b:], &v.Bot) + + return b +} + +// Struct list read RenderTrap +func ReadRenderTrapList(buf []byte, dest []RenderTrap) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = RenderTrap{} + b += ReadRenderTrap(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write RenderTrap +func (v RenderTrap) Bytes() []byte { + buf := make([]byte, 24) + b := 0 + + { + structBytes := v.Top.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + + { + structBytes := v.Bot.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + + return buf +} + +// Write struct list RenderTrap +func RenderTrapListBytes(buf []byte, list []RenderTrap) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// Error definition RenderPictFormat (0) +// Size: 32 + +const BadRenderPictFormat = 0 + +type RenderPictFormatError struct { + Sequence uint16 + NiceName string +} + +// Error read RenderPictFormat +func NewRenderPictFormatError(buf []byte) Error { + v := RenderPictFormatError{} + v.NiceName = "RenderPictFormat" + + b := 1 // skip error determinant + b += 1 // don't read error number + + v.Sequence = Get16(buf[b:]) + b += 2 + + return v +} + +func (err RenderPictFormatError) ImplementsError() {} + +func (err RenderPictFormatError) SequenceId() uint16 { + return err.Sequence +} + +func (err RenderPictFormatError) BadId() Id { + return 0 +} + +func (err RenderPictFormatError) Error() string { + fieldVals := make([]string, 0, 0) + fieldVals = append(fieldVals, "NiceName: "+err.NiceName) + fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence)) + return "BadRenderPictFormat {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newErrorFuncs[0] = NewRenderPictFormatError +} + +// Error definition RenderPicture (1) +// Size: 32 + +const BadRenderPicture = 1 + +type RenderPictureError struct { + Sequence uint16 + NiceName string +} + +// Error read RenderPicture +func NewRenderPictureError(buf []byte) Error { + v := RenderPictureError{} + v.NiceName = "RenderPicture" + + b := 1 // skip error determinant + b += 1 // don't read error number + + v.Sequence = Get16(buf[b:]) + b += 2 + + return v +} + +func (err RenderPictureError) ImplementsError() {} + +func (err RenderPictureError) SequenceId() uint16 { + return err.Sequence +} + +func (err RenderPictureError) BadId() Id { + return 0 +} + +func (err RenderPictureError) Error() string { + fieldVals := make([]string, 0, 0) + fieldVals = append(fieldVals, "NiceName: "+err.NiceName) + fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence)) + return "BadRenderPicture {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newErrorFuncs[1] = NewRenderPictureError +} + +// Error definition RenderPictOp (2) +// Size: 32 + +const BadRenderPictOp = 2 + +type RenderPictOpError struct { + Sequence uint16 + NiceName string +} + +// Error read RenderPictOp +func NewRenderPictOpError(buf []byte) Error { + v := RenderPictOpError{} + v.NiceName = "RenderPictOp" + + b := 1 // skip error determinant + b += 1 // don't read error number + + v.Sequence = Get16(buf[b:]) + b += 2 + + return v +} + +func (err RenderPictOpError) ImplementsError() {} + +func (err RenderPictOpError) SequenceId() uint16 { + return err.Sequence +} + +func (err RenderPictOpError) BadId() Id { + return 0 +} + +func (err RenderPictOpError) Error() string { + fieldVals := make([]string, 0, 0) + fieldVals = append(fieldVals, "NiceName: "+err.NiceName) + fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence)) + return "BadRenderPictOp {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newErrorFuncs[2] = NewRenderPictOpError +} + +// Error definition RenderGlyphSet (3) +// Size: 32 + +const BadRenderGlyphSet = 3 + +type RenderGlyphSetError struct { + Sequence uint16 + NiceName string +} + +// Error read RenderGlyphSet +func NewRenderGlyphSetError(buf []byte) Error { + v := RenderGlyphSetError{} + v.NiceName = "RenderGlyphSet" + + b := 1 // skip error determinant + b += 1 // don't read error number + + v.Sequence = Get16(buf[b:]) + b += 2 + + return v +} + +func (err RenderGlyphSetError) ImplementsError() {} + +func (err RenderGlyphSetError) SequenceId() uint16 { + return err.Sequence +} + +func (err RenderGlyphSetError) BadId() Id { + return 0 +} + +func (err RenderGlyphSetError) Error() string { + fieldVals := make([]string, 0, 0) + fieldVals = append(fieldVals, "NiceName: "+err.NiceName) + fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence)) + return "BadRenderGlyphSet {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newErrorFuncs[3] = NewRenderGlyphSetError +} + +// Error definition RenderGlyph (4) +// Size: 32 + +const BadRenderGlyph = 4 + +type RenderGlyphError struct { + Sequence uint16 + NiceName string +} + +// Error read RenderGlyph +func NewRenderGlyphError(buf []byte) Error { + v := RenderGlyphError{} + v.NiceName = "RenderGlyph" + + b := 1 // skip error determinant + b += 1 // don't read error number + + v.Sequence = Get16(buf[b:]) + b += 2 + + return v +} + +func (err RenderGlyphError) ImplementsError() {} + +func (err RenderGlyphError) SequenceId() uint16 { + return err.Sequence +} + +func (err RenderGlyphError) BadId() Id { + return 0 +} + +func (err RenderGlyphError) Error() string { + fieldVals := make([]string, 0, 0) + fieldVals = append(fieldVals, "NiceName: "+err.NiceName) + fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence)) + return "BadRenderGlyph {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newErrorFuncs[4] = NewRenderGlyphError +} + +// Request RenderQueryVersion +// size: 12 +type RenderQueryVersionCookie struct { + *cookie +} + +func (c *Conn) RenderQueryVersion(ClientMajorVersion uint32, ClientMinorVersion uint32) RenderQueryVersionCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.renderQueryVersionRequest(ClientMajorVersion, ClientMinorVersion), cookie) + return RenderQueryVersionCookie{cookie} +} + +func (c *Conn) RenderQueryVersionUnchecked(ClientMajorVersion uint32, ClientMinorVersion uint32) RenderQueryVersionCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.renderQueryVersionRequest(ClientMajorVersion, ClientMinorVersion), cookie) + return RenderQueryVersionCookie{cookie} +} + +// Request reply for RenderQueryVersion +// size: 32 +type RenderQueryVersionReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + MajorVersion uint32 + MinorVersion uint32 + // padding: 16 bytes +} + +// Waits and reads reply data from request RenderQueryVersion +func (cook RenderQueryVersionCookie) Reply() (*RenderQueryVersionReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return renderQueryVersionReply(buf), nil +} + +// Read reply into structure from buffer for RenderQueryVersion +func renderQueryVersionReply(buf []byte) *RenderQueryVersionReply { + v := new(RenderQueryVersionReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.MajorVersion = Get32(buf[b:]) + b += 4 + + v.MinorVersion = Get32(buf[b:]) + b += 4 + + b += 16 // padding + + return v +} + +func (cook RenderQueryVersionCookie) Check() error { + return cook.check() +} + +// Write request to wire for RenderQueryVersion +func (c *Conn) renderQueryVersionRequest(ClientMajorVersion uint32, ClientMinorVersion uint32) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["RENDER"] + b += 1 + + buf[b] = 0 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], ClientMajorVersion) + b += 4 + + Put32(buf[b:], ClientMinorVersion) + b += 4 + + return buf +} + +// Request RenderQueryPictFormats +// size: 4 +type RenderQueryPictFormatsCookie struct { + *cookie +} + +func (c *Conn) RenderQueryPictFormats() RenderQueryPictFormatsCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.renderQueryPictFormatsRequest(), cookie) + return RenderQueryPictFormatsCookie{cookie} +} + +func (c *Conn) RenderQueryPictFormatsUnchecked() RenderQueryPictFormatsCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.renderQueryPictFormatsRequest(), cookie) + return RenderQueryPictFormatsCookie{cookie} +} + +// Request reply for RenderQueryPictFormats +// size: (((32 + pad((int(NumFormats) * 28))) + RenderPictscreenListSize(Screens)) + pad((int(NumSubpixel) * 4))) +type RenderQueryPictFormatsReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + NumFormats uint32 + NumScreens uint32 + NumDepths uint32 + NumVisuals uint32 + NumSubpixel uint32 + // padding: 4 bytes + Formats []RenderPictforminfo // size: pad((int(NumFormats) * 28)) + Screens []RenderPictscreen // size: RenderPictscreenListSize(Screens) + Subpixels []uint32 // size: pad((int(NumSubpixel) * 4)) +} + +// Waits and reads reply data from request RenderQueryPictFormats +func (cook RenderQueryPictFormatsCookie) Reply() (*RenderQueryPictFormatsReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return renderQueryPictFormatsReply(buf), nil +} + +// Read reply into structure from buffer for RenderQueryPictFormats +func renderQueryPictFormatsReply(buf []byte) *RenderQueryPictFormatsReply { + v := new(RenderQueryPictFormatsReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.NumFormats = Get32(buf[b:]) + b += 4 + + v.NumScreens = Get32(buf[b:]) + b += 4 + + v.NumDepths = Get32(buf[b:]) + b += 4 + + v.NumVisuals = Get32(buf[b:]) + b += 4 + + v.NumSubpixel = Get32(buf[b:]) + b += 4 + + b += 4 // padding + + v.Formats = make([]RenderPictforminfo, v.NumFormats) + b += ReadRenderPictforminfoList(buf[b:], v.Formats) + + v.Screens = make([]RenderPictscreen, v.NumScreens) + b += ReadRenderPictscreenList(buf[b:], v.Screens) + + v.Subpixels = make([]uint32, v.NumSubpixel) + for i := 0; i < int(v.NumSubpixel); i++ { + v.Subpixels[i] = Get32(buf[b:]) + b += 4 + } + b = pad(b) + + return v +} + +func (cook RenderQueryPictFormatsCookie) Check() error { + return cook.check() +} + +// Write request to wire for RenderQueryPictFormats +func (c *Conn) renderQueryPictFormatsRequest() []byte { + size := 4 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["RENDER"] + b += 1 + + buf[b] = 1 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + return buf +} + +// Request RenderQueryPictIndexValues +// size: 8 +type RenderQueryPictIndexValuesCookie struct { + *cookie +} + +func (c *Conn) RenderQueryPictIndexValues(Format Id) RenderQueryPictIndexValuesCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.renderQueryPictIndexValuesRequest(Format), cookie) + return RenderQueryPictIndexValuesCookie{cookie} +} + +func (c *Conn) RenderQueryPictIndexValuesUnchecked(Format Id) RenderQueryPictIndexValuesCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.renderQueryPictIndexValuesRequest(Format), cookie) + return RenderQueryPictIndexValuesCookie{cookie} +} + +// Request reply for RenderQueryPictIndexValues +// size: (32 + pad((int(NumValues) * 12))) +type RenderQueryPictIndexValuesReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + NumValues uint32 + // padding: 20 bytes + Values []RenderIndexvalue // size: pad((int(NumValues) * 12)) +} + +// Waits and reads reply data from request RenderQueryPictIndexValues +func (cook RenderQueryPictIndexValuesCookie) Reply() (*RenderQueryPictIndexValuesReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return renderQueryPictIndexValuesReply(buf), nil +} + +// Read reply into structure from buffer for RenderQueryPictIndexValues +func renderQueryPictIndexValuesReply(buf []byte) *RenderQueryPictIndexValuesReply { + v := new(RenderQueryPictIndexValuesReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.NumValues = Get32(buf[b:]) + b += 4 + + b += 20 // padding + + v.Values = make([]RenderIndexvalue, v.NumValues) + b += ReadRenderIndexvalueList(buf[b:], v.Values) + + return v +} + +func (cook RenderQueryPictIndexValuesCookie) Check() error { + return cook.check() +} + +// Write request to wire for RenderQueryPictIndexValues +func (c *Conn) renderQueryPictIndexValuesRequest(Format Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["RENDER"] + b += 1 + + buf[b] = 2 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Format)) + b += 4 + + return buf +} + +// Request RenderCreatePicture +// size: pad((16 + (4 + pad((4 * popCount(int(ValueMask))))))) +type RenderCreatePictureCookie struct { + *cookie +} + +// Write request to wire for RenderCreatePicture +func (c *Conn) RenderCreatePicture(Pid Id, Drawable Id, Format Id, ValueMask uint32, ValueList []uint32) RenderCreatePictureCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.renderCreatePictureRequest(Pid, Drawable, Format, ValueMask, ValueList), cookie) + return RenderCreatePictureCookie{cookie} +} + +func (c *Conn) RenderCreatePictureChecked(Pid Id, Drawable Id, Format Id, ValueMask uint32, ValueList []uint32) RenderCreatePictureCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.renderCreatePictureRequest(Pid, Drawable, Format, ValueMask, ValueList), cookie) + return RenderCreatePictureCookie{cookie} +} + +func (cook RenderCreatePictureCookie) Check() error { + return cook.check() +} + +// Write request to wire for RenderCreatePicture +func (c *Conn) renderCreatePictureRequest(Pid Id, Drawable Id, Format Id, ValueMask uint32, ValueList []uint32) []byte { + size := pad((16 + (4 + pad((4 * popCount(int(ValueMask))))))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["RENDER"] + b += 1 + + buf[b] = 4 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Pid)) + b += 4 + + Put32(buf[b:], uint32(Drawable)) + b += 4 + + Put32(buf[b:], uint32(Format)) + b += 4 + + Put32(buf[b:], ValueMask) + b += 4 + for i := 0; i < popCount(int(ValueMask)); i++ { + Put32(buf[b:], ValueList[i]) + b += 4 + } + b = pad(b) + + return buf +} + +// Request RenderChangePicture +// size: pad((8 + (4 + pad((4 * popCount(int(ValueMask))))))) +type RenderChangePictureCookie struct { + *cookie +} + +// Write request to wire for RenderChangePicture +func (c *Conn) RenderChangePicture(Picture Id, ValueMask uint32, ValueList []uint32) RenderChangePictureCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.renderChangePictureRequest(Picture, ValueMask, ValueList), cookie) + return RenderChangePictureCookie{cookie} +} + +func (c *Conn) RenderChangePictureChecked(Picture Id, ValueMask uint32, ValueList []uint32) RenderChangePictureCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.renderChangePictureRequest(Picture, ValueMask, ValueList), cookie) + return RenderChangePictureCookie{cookie} +} + +func (cook RenderChangePictureCookie) Check() error { + return cook.check() +} + +// Write request to wire for RenderChangePicture +func (c *Conn) renderChangePictureRequest(Picture Id, ValueMask uint32, ValueList []uint32) []byte { + size := pad((8 + (4 + pad((4 * popCount(int(ValueMask))))))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["RENDER"] + b += 1 + + buf[b] = 5 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Picture)) + b += 4 + + Put32(buf[b:], ValueMask) + b += 4 + for i := 0; i < popCount(int(ValueMask)); i++ { + Put32(buf[b:], ValueList[i]) + b += 4 + } + b = pad(b) + + return buf +} + +// Request RenderSetPictureClipRectangles +// size: pad((12 + pad((len(Rectangles) * 8)))) +type RenderSetPictureClipRectanglesCookie struct { + *cookie +} + +// Write request to wire for RenderSetPictureClipRectangles +func (c *Conn) RenderSetPictureClipRectangles(Picture Id, ClipXOrigin int16, ClipYOrigin int16, Rectangles []Rectangle) RenderSetPictureClipRectanglesCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.renderSetPictureClipRectanglesRequest(Picture, ClipXOrigin, ClipYOrigin, Rectangles), cookie) + return RenderSetPictureClipRectanglesCookie{cookie} +} + +func (c *Conn) RenderSetPictureClipRectanglesChecked(Picture Id, ClipXOrigin int16, ClipYOrigin int16, Rectangles []Rectangle) RenderSetPictureClipRectanglesCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.renderSetPictureClipRectanglesRequest(Picture, ClipXOrigin, ClipYOrigin, Rectangles), cookie) + return RenderSetPictureClipRectanglesCookie{cookie} +} + +func (cook RenderSetPictureClipRectanglesCookie) Check() error { + return cook.check() +} + +// Write request to wire for RenderSetPictureClipRectangles +func (c *Conn) renderSetPictureClipRectanglesRequest(Picture Id, ClipXOrigin int16, ClipYOrigin int16, Rectangles []Rectangle) []byte { + size := pad((12 + pad((len(Rectangles) * 8)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["RENDER"] + b += 1 + + buf[b] = 6 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Picture)) + b += 4 + + Put16(buf[b:], uint16(ClipXOrigin)) + b += 2 + + Put16(buf[b:], uint16(ClipYOrigin)) + b += 2 + + b += RectangleListBytes(buf[b:], Rectangles) + + return buf +} + +// Request RenderFreePicture +// size: 8 +type RenderFreePictureCookie struct { + *cookie +} + +// Write request to wire for RenderFreePicture +func (c *Conn) RenderFreePicture(Picture Id) RenderFreePictureCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.renderFreePictureRequest(Picture), cookie) + return RenderFreePictureCookie{cookie} +} + +func (c *Conn) RenderFreePictureChecked(Picture Id) RenderFreePictureCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.renderFreePictureRequest(Picture), cookie) + return RenderFreePictureCookie{cookie} +} + +func (cook RenderFreePictureCookie) Check() error { + return cook.check() +} + +// Write request to wire for RenderFreePicture +func (c *Conn) renderFreePictureRequest(Picture Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["RENDER"] + b += 1 + + buf[b] = 7 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Picture)) + b += 4 + + return buf +} + +// Request RenderComposite +// size: 36 +type RenderCompositeCookie struct { + *cookie +} + +// Write request to wire for RenderComposite +func (c *Conn) RenderComposite(Op byte, Src Id, Mask Id, Dst Id, SrcX int16, SrcY int16, MaskX int16, MaskY int16, DstX int16, DstY int16, Width uint16, Height uint16) RenderCompositeCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.renderCompositeRequest(Op, Src, Mask, Dst, SrcX, SrcY, MaskX, MaskY, DstX, DstY, Width, Height), cookie) + return RenderCompositeCookie{cookie} +} + +func (c *Conn) RenderCompositeChecked(Op byte, Src Id, Mask Id, Dst Id, SrcX int16, SrcY int16, MaskX int16, MaskY int16, DstX int16, DstY int16, Width uint16, Height uint16) RenderCompositeCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.renderCompositeRequest(Op, Src, Mask, Dst, SrcX, SrcY, MaskX, MaskY, DstX, DstY, Width, Height), cookie) + return RenderCompositeCookie{cookie} +} + +func (cook RenderCompositeCookie) Check() error { + return cook.check() +} + +// Write request to wire for RenderComposite +func (c *Conn) renderCompositeRequest(Op byte, Src Id, Mask Id, Dst Id, SrcX int16, SrcY int16, MaskX int16, MaskY int16, DstX int16, DstY int16, Width uint16, Height uint16) []byte { + size := 36 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["RENDER"] + b += 1 + + buf[b] = 8 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + buf[b] = Op + b += 1 + + b += 3 // padding + + Put32(buf[b:], uint32(Src)) + b += 4 + + Put32(buf[b:], uint32(Mask)) + b += 4 + + Put32(buf[b:], uint32(Dst)) + b += 4 + + Put16(buf[b:], uint16(SrcX)) + b += 2 + + Put16(buf[b:], uint16(SrcY)) + b += 2 + + Put16(buf[b:], uint16(MaskX)) + b += 2 + + Put16(buf[b:], uint16(MaskY)) + b += 2 + + Put16(buf[b:], uint16(DstX)) + b += 2 + + Put16(buf[b:], uint16(DstY)) + b += 2 + + Put16(buf[b:], Width) + b += 2 + + Put16(buf[b:], Height) + b += 2 + + return buf +} + +// Request RenderTrapezoids +// size: pad((24 + pad((len(Traps) * 40)))) +type RenderTrapezoidsCookie struct { + *cookie +} + +// Write request to wire for RenderTrapezoids +func (c *Conn) RenderTrapezoids(Op byte, Src Id, Dst Id, MaskFormat Id, SrcX int16, SrcY int16, Traps []RenderTrapezoid) RenderTrapezoidsCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.renderTrapezoidsRequest(Op, Src, Dst, MaskFormat, SrcX, SrcY, Traps), cookie) + return RenderTrapezoidsCookie{cookie} +} + +func (c *Conn) RenderTrapezoidsChecked(Op byte, Src Id, Dst Id, MaskFormat Id, SrcX int16, SrcY int16, Traps []RenderTrapezoid) RenderTrapezoidsCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.renderTrapezoidsRequest(Op, Src, Dst, MaskFormat, SrcX, SrcY, Traps), cookie) + return RenderTrapezoidsCookie{cookie} +} + +func (cook RenderTrapezoidsCookie) Check() error { + return cook.check() +} + +// Write request to wire for RenderTrapezoids +func (c *Conn) renderTrapezoidsRequest(Op byte, Src Id, Dst Id, MaskFormat Id, SrcX int16, SrcY int16, Traps []RenderTrapezoid) []byte { + size := pad((24 + pad((len(Traps) * 40)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["RENDER"] + b += 1 + + buf[b] = 10 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + buf[b] = Op + b += 1 + + b += 3 // padding + + Put32(buf[b:], uint32(Src)) + b += 4 + + Put32(buf[b:], uint32(Dst)) + b += 4 + + Put32(buf[b:], uint32(MaskFormat)) + b += 4 + + Put16(buf[b:], uint16(SrcX)) + b += 2 + + Put16(buf[b:], uint16(SrcY)) + b += 2 + + b += RenderTrapezoidListBytes(buf[b:], Traps) + + return buf +} + +// Request RenderTriangles +// size: pad((24 + pad((len(Triangles) * 24)))) +type RenderTrianglesCookie struct { + *cookie +} + +// Write request to wire for RenderTriangles +func (c *Conn) RenderTriangles(Op byte, Src Id, Dst Id, MaskFormat Id, SrcX int16, SrcY int16, Triangles []RenderTriangle) RenderTrianglesCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.renderTrianglesRequest(Op, Src, Dst, MaskFormat, SrcX, SrcY, Triangles), cookie) + return RenderTrianglesCookie{cookie} +} + +func (c *Conn) RenderTrianglesChecked(Op byte, Src Id, Dst Id, MaskFormat Id, SrcX int16, SrcY int16, Triangles []RenderTriangle) RenderTrianglesCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.renderTrianglesRequest(Op, Src, Dst, MaskFormat, SrcX, SrcY, Triangles), cookie) + return RenderTrianglesCookie{cookie} +} + +func (cook RenderTrianglesCookie) Check() error { + return cook.check() +} + +// Write request to wire for RenderTriangles +func (c *Conn) renderTrianglesRequest(Op byte, Src Id, Dst Id, MaskFormat Id, SrcX int16, SrcY int16, Triangles []RenderTriangle) []byte { + size := pad((24 + pad((len(Triangles) * 24)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["RENDER"] + b += 1 + + buf[b] = 11 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + buf[b] = Op + b += 1 + + b += 3 // padding + + Put32(buf[b:], uint32(Src)) + b += 4 + + Put32(buf[b:], uint32(Dst)) + b += 4 + + Put32(buf[b:], uint32(MaskFormat)) + b += 4 + + Put16(buf[b:], uint16(SrcX)) + b += 2 + + Put16(buf[b:], uint16(SrcY)) + b += 2 + + b += RenderTriangleListBytes(buf[b:], Triangles) + + return buf +} + +// Request RenderTriStrip +// size: pad((24 + pad((len(Points) * 8)))) +type RenderTriStripCookie struct { + *cookie +} + +// Write request to wire for RenderTriStrip +func (c *Conn) RenderTriStrip(Op byte, Src Id, Dst Id, MaskFormat Id, SrcX int16, SrcY int16, Points []RenderPointfix) RenderTriStripCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.renderTriStripRequest(Op, Src, Dst, MaskFormat, SrcX, SrcY, Points), cookie) + return RenderTriStripCookie{cookie} +} + +func (c *Conn) RenderTriStripChecked(Op byte, Src Id, Dst Id, MaskFormat Id, SrcX int16, SrcY int16, Points []RenderPointfix) RenderTriStripCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.renderTriStripRequest(Op, Src, Dst, MaskFormat, SrcX, SrcY, Points), cookie) + return RenderTriStripCookie{cookie} +} + +func (cook RenderTriStripCookie) Check() error { + return cook.check() +} + +// Write request to wire for RenderTriStrip +func (c *Conn) renderTriStripRequest(Op byte, Src Id, Dst Id, MaskFormat Id, SrcX int16, SrcY int16, Points []RenderPointfix) []byte { + size := pad((24 + pad((len(Points) * 8)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["RENDER"] + b += 1 + + buf[b] = 12 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + buf[b] = Op + b += 1 + + b += 3 // padding + + Put32(buf[b:], uint32(Src)) + b += 4 + + Put32(buf[b:], uint32(Dst)) + b += 4 + + Put32(buf[b:], uint32(MaskFormat)) + b += 4 + + Put16(buf[b:], uint16(SrcX)) + b += 2 + + Put16(buf[b:], uint16(SrcY)) + b += 2 + + b += RenderPointfixListBytes(buf[b:], Points) + + return buf +} + +// Request RenderTriFan +// size: pad((24 + pad((len(Points) * 8)))) +type RenderTriFanCookie struct { + *cookie +} + +// Write request to wire for RenderTriFan +func (c *Conn) RenderTriFan(Op byte, Src Id, Dst Id, MaskFormat Id, SrcX int16, SrcY int16, Points []RenderPointfix) RenderTriFanCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.renderTriFanRequest(Op, Src, Dst, MaskFormat, SrcX, SrcY, Points), cookie) + return RenderTriFanCookie{cookie} +} + +func (c *Conn) RenderTriFanChecked(Op byte, Src Id, Dst Id, MaskFormat Id, SrcX int16, SrcY int16, Points []RenderPointfix) RenderTriFanCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.renderTriFanRequest(Op, Src, Dst, MaskFormat, SrcX, SrcY, Points), cookie) + return RenderTriFanCookie{cookie} +} + +func (cook RenderTriFanCookie) Check() error { + return cook.check() +} + +// Write request to wire for RenderTriFan +func (c *Conn) renderTriFanRequest(Op byte, Src Id, Dst Id, MaskFormat Id, SrcX int16, SrcY int16, Points []RenderPointfix) []byte { + size := pad((24 + pad((len(Points) * 8)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["RENDER"] + b += 1 + + buf[b] = 13 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + buf[b] = Op + b += 1 + + b += 3 // padding + + Put32(buf[b:], uint32(Src)) + b += 4 + + Put32(buf[b:], uint32(Dst)) + b += 4 + + Put32(buf[b:], uint32(MaskFormat)) + b += 4 + + Put16(buf[b:], uint16(SrcX)) + b += 2 + + Put16(buf[b:], uint16(SrcY)) + b += 2 + + b += RenderPointfixListBytes(buf[b:], Points) + + return buf +} + +// Request RenderCreateGlyphSet +// size: 12 +type RenderCreateGlyphSetCookie struct { + *cookie +} + +// Write request to wire for RenderCreateGlyphSet +func (c *Conn) RenderCreateGlyphSet(Gsid Id, Format Id) RenderCreateGlyphSetCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.renderCreateGlyphSetRequest(Gsid, Format), cookie) + return RenderCreateGlyphSetCookie{cookie} +} + +func (c *Conn) RenderCreateGlyphSetChecked(Gsid Id, Format Id) RenderCreateGlyphSetCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.renderCreateGlyphSetRequest(Gsid, Format), cookie) + return RenderCreateGlyphSetCookie{cookie} +} + +func (cook RenderCreateGlyphSetCookie) Check() error { + return cook.check() +} + +// Write request to wire for RenderCreateGlyphSet +func (c *Conn) renderCreateGlyphSetRequest(Gsid Id, Format Id) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["RENDER"] + b += 1 + + buf[b] = 17 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Gsid)) + b += 4 + + Put32(buf[b:], uint32(Format)) + b += 4 + + return buf +} + +// Request RenderReferenceGlyphSet +// size: 12 +type RenderReferenceGlyphSetCookie struct { + *cookie +} + +// Write request to wire for RenderReferenceGlyphSet +func (c *Conn) RenderReferenceGlyphSet(Gsid Id, Existing Id) RenderReferenceGlyphSetCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.renderReferenceGlyphSetRequest(Gsid, Existing), cookie) + return RenderReferenceGlyphSetCookie{cookie} +} + +func (c *Conn) RenderReferenceGlyphSetChecked(Gsid Id, Existing Id) RenderReferenceGlyphSetCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.renderReferenceGlyphSetRequest(Gsid, Existing), cookie) + return RenderReferenceGlyphSetCookie{cookie} +} + +func (cook RenderReferenceGlyphSetCookie) Check() error { + return cook.check() +} + +// Write request to wire for RenderReferenceGlyphSet +func (c *Conn) renderReferenceGlyphSetRequest(Gsid Id, Existing Id) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["RENDER"] + b += 1 + + buf[b] = 18 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Gsid)) + b += 4 + + Put32(buf[b:], uint32(Existing)) + b += 4 + + return buf +} + +// Request RenderFreeGlyphSet +// size: 8 +type RenderFreeGlyphSetCookie struct { + *cookie +} + +// Write request to wire for RenderFreeGlyphSet +func (c *Conn) RenderFreeGlyphSet(Glyphset Id) RenderFreeGlyphSetCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.renderFreeGlyphSetRequest(Glyphset), cookie) + return RenderFreeGlyphSetCookie{cookie} +} + +func (c *Conn) RenderFreeGlyphSetChecked(Glyphset Id) RenderFreeGlyphSetCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.renderFreeGlyphSetRequest(Glyphset), cookie) + return RenderFreeGlyphSetCookie{cookie} +} + +func (cook RenderFreeGlyphSetCookie) Check() error { + return cook.check() +} + +// Write request to wire for RenderFreeGlyphSet +func (c *Conn) renderFreeGlyphSetRequest(Glyphset Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["RENDER"] + b += 1 + + buf[b] = 19 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Glyphset)) + b += 4 + + return buf +} + +// Request RenderAddGlyphs +// size: pad((((12 + pad((int(GlyphsLen) * 4))) + pad((int(GlyphsLen) * 12))) + pad((len(Data) * 1)))) +type RenderAddGlyphsCookie struct { + *cookie +} + +// Write request to wire for RenderAddGlyphs +func (c *Conn) RenderAddGlyphs(Glyphset Id, GlyphsLen uint32, Glyphids []uint32, Glyphs []RenderGlyphinfo, Data []byte) RenderAddGlyphsCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.renderAddGlyphsRequest(Glyphset, GlyphsLen, Glyphids, Glyphs, Data), cookie) + return RenderAddGlyphsCookie{cookie} +} + +func (c *Conn) RenderAddGlyphsChecked(Glyphset Id, GlyphsLen uint32, Glyphids []uint32, Glyphs []RenderGlyphinfo, Data []byte) RenderAddGlyphsCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.renderAddGlyphsRequest(Glyphset, GlyphsLen, Glyphids, Glyphs, Data), cookie) + return RenderAddGlyphsCookie{cookie} +} + +func (cook RenderAddGlyphsCookie) Check() error { + return cook.check() +} + +// Write request to wire for RenderAddGlyphs +func (c *Conn) renderAddGlyphsRequest(Glyphset Id, GlyphsLen uint32, Glyphids []uint32, Glyphs []RenderGlyphinfo, Data []byte) []byte { + size := pad((((12 + pad((int(GlyphsLen) * 4))) + pad((int(GlyphsLen) * 12))) + pad((len(Data) * 1)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["RENDER"] + b += 1 + + buf[b] = 20 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Glyphset)) + b += 4 + + Put32(buf[b:], GlyphsLen) + b += 4 + + for i := 0; i < int(GlyphsLen); i++ { + Put32(buf[b:], Glyphids[i]) + b += 4 + } + b = pad(b) + + b += RenderGlyphinfoListBytes(buf[b:], Glyphs) + + copy(buf[b:], Data[:len(Data)]) + b += pad(int(len(Data))) + + return buf +} + +// Request RenderFreeGlyphs +// size: pad((8 + pad((len(Glyphs) * 4)))) +type RenderFreeGlyphsCookie struct { + *cookie +} + +// Write request to wire for RenderFreeGlyphs +func (c *Conn) RenderFreeGlyphs(Glyphset Id, Glyphs []RenderGlyph) RenderFreeGlyphsCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.renderFreeGlyphsRequest(Glyphset, Glyphs), cookie) + return RenderFreeGlyphsCookie{cookie} +} + +func (c *Conn) RenderFreeGlyphsChecked(Glyphset Id, Glyphs []RenderGlyph) RenderFreeGlyphsCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.renderFreeGlyphsRequest(Glyphset, Glyphs), cookie) + return RenderFreeGlyphsCookie{cookie} +} + +func (cook RenderFreeGlyphsCookie) Check() error { + return cook.check() +} + +// Write request to wire for RenderFreeGlyphs +func (c *Conn) renderFreeGlyphsRequest(Glyphset Id, Glyphs []RenderGlyph) []byte { + size := pad((8 + pad((len(Glyphs) * 4)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["RENDER"] + b += 1 + + buf[b] = 22 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Glyphset)) + b += 4 + + for i := 0; i < int(len(Glyphs)); i++ { + Put32(buf[b:], uint32(Glyphs[i])) + b += 4 + } + b = pad(b) + + return buf +} + +// Request RenderCompositeGlyphs8 +// size: pad((28 + pad((len(Glyphcmds) * 1)))) +type RenderCompositeGlyphs8Cookie struct { + *cookie +} + +// Write request to wire for RenderCompositeGlyphs8 +func (c *Conn) RenderCompositeGlyphs8(Op byte, Src Id, Dst Id, MaskFormat Id, Glyphset Id, SrcX int16, SrcY int16, Glyphcmds []byte) RenderCompositeGlyphs8Cookie { + cookie := c.newCookie(false, false) + c.newRequest(c.renderCompositeGlyphs8Request(Op, Src, Dst, MaskFormat, Glyphset, SrcX, SrcY, Glyphcmds), cookie) + return RenderCompositeGlyphs8Cookie{cookie} +} + +func (c *Conn) RenderCompositeGlyphs8Checked(Op byte, Src Id, Dst Id, MaskFormat Id, Glyphset Id, SrcX int16, SrcY int16, Glyphcmds []byte) RenderCompositeGlyphs8Cookie { + cookie := c.newCookie(true, false) + c.newRequest(c.renderCompositeGlyphs8Request(Op, Src, Dst, MaskFormat, Glyphset, SrcX, SrcY, Glyphcmds), cookie) + return RenderCompositeGlyphs8Cookie{cookie} +} + +func (cook RenderCompositeGlyphs8Cookie) Check() error { + return cook.check() +} + +// Write request to wire for RenderCompositeGlyphs8 +func (c *Conn) renderCompositeGlyphs8Request(Op byte, Src Id, Dst Id, MaskFormat Id, Glyphset Id, SrcX int16, SrcY int16, Glyphcmds []byte) []byte { + size := pad((28 + pad((len(Glyphcmds) * 1)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["RENDER"] + b += 1 + + buf[b] = 23 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + buf[b] = Op + b += 1 + + b += 3 // padding + + Put32(buf[b:], uint32(Src)) + b += 4 + + Put32(buf[b:], uint32(Dst)) + b += 4 + + Put32(buf[b:], uint32(MaskFormat)) + b += 4 + + Put32(buf[b:], uint32(Glyphset)) + b += 4 + + Put16(buf[b:], uint16(SrcX)) + b += 2 + + Put16(buf[b:], uint16(SrcY)) + b += 2 + + copy(buf[b:], Glyphcmds[:len(Glyphcmds)]) + b += pad(int(len(Glyphcmds))) + + return buf +} + +// Request RenderCompositeGlyphs16 +// size: pad((28 + pad((len(Glyphcmds) * 1)))) +type RenderCompositeGlyphs16Cookie struct { + *cookie +} + +// Write request to wire for RenderCompositeGlyphs16 +func (c *Conn) RenderCompositeGlyphs16(Op byte, Src Id, Dst Id, MaskFormat Id, Glyphset Id, SrcX int16, SrcY int16, Glyphcmds []byte) RenderCompositeGlyphs16Cookie { + cookie := c.newCookie(false, false) + c.newRequest(c.renderCompositeGlyphs16Request(Op, Src, Dst, MaskFormat, Glyphset, SrcX, SrcY, Glyphcmds), cookie) + return RenderCompositeGlyphs16Cookie{cookie} +} + +func (c *Conn) RenderCompositeGlyphs16Checked(Op byte, Src Id, Dst Id, MaskFormat Id, Glyphset Id, SrcX int16, SrcY int16, Glyphcmds []byte) RenderCompositeGlyphs16Cookie { + cookie := c.newCookie(true, false) + c.newRequest(c.renderCompositeGlyphs16Request(Op, Src, Dst, MaskFormat, Glyphset, SrcX, SrcY, Glyphcmds), cookie) + return RenderCompositeGlyphs16Cookie{cookie} +} + +func (cook RenderCompositeGlyphs16Cookie) Check() error { + return cook.check() +} + +// Write request to wire for RenderCompositeGlyphs16 +func (c *Conn) renderCompositeGlyphs16Request(Op byte, Src Id, Dst Id, MaskFormat Id, Glyphset Id, SrcX int16, SrcY int16, Glyphcmds []byte) []byte { + size := pad((28 + pad((len(Glyphcmds) * 1)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["RENDER"] + b += 1 + + buf[b] = 24 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + buf[b] = Op + b += 1 + + b += 3 // padding + + Put32(buf[b:], uint32(Src)) + b += 4 + + Put32(buf[b:], uint32(Dst)) + b += 4 + + Put32(buf[b:], uint32(MaskFormat)) + b += 4 + + Put32(buf[b:], uint32(Glyphset)) + b += 4 + + Put16(buf[b:], uint16(SrcX)) + b += 2 + + Put16(buf[b:], uint16(SrcY)) + b += 2 + + copy(buf[b:], Glyphcmds[:len(Glyphcmds)]) + b += pad(int(len(Glyphcmds))) + + return buf +} + +// Request RenderCompositeGlyphs32 +// size: pad((28 + pad((len(Glyphcmds) * 1)))) +type RenderCompositeGlyphs32Cookie struct { + *cookie +} + +// Write request to wire for RenderCompositeGlyphs32 +func (c *Conn) RenderCompositeGlyphs32(Op byte, Src Id, Dst Id, MaskFormat Id, Glyphset Id, SrcX int16, SrcY int16, Glyphcmds []byte) RenderCompositeGlyphs32Cookie { + cookie := c.newCookie(false, false) + c.newRequest(c.renderCompositeGlyphs32Request(Op, Src, Dst, MaskFormat, Glyphset, SrcX, SrcY, Glyphcmds), cookie) + return RenderCompositeGlyphs32Cookie{cookie} +} + +func (c *Conn) RenderCompositeGlyphs32Checked(Op byte, Src Id, Dst Id, MaskFormat Id, Glyphset Id, SrcX int16, SrcY int16, Glyphcmds []byte) RenderCompositeGlyphs32Cookie { + cookie := c.newCookie(true, false) + c.newRequest(c.renderCompositeGlyphs32Request(Op, Src, Dst, MaskFormat, Glyphset, SrcX, SrcY, Glyphcmds), cookie) + return RenderCompositeGlyphs32Cookie{cookie} +} + +func (cook RenderCompositeGlyphs32Cookie) Check() error { + return cook.check() +} + +// Write request to wire for RenderCompositeGlyphs32 +func (c *Conn) renderCompositeGlyphs32Request(Op byte, Src Id, Dst Id, MaskFormat Id, Glyphset Id, SrcX int16, SrcY int16, Glyphcmds []byte) []byte { + size := pad((28 + pad((len(Glyphcmds) * 1)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["RENDER"] + b += 1 + + buf[b] = 25 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + buf[b] = Op + b += 1 + + b += 3 // padding + + Put32(buf[b:], uint32(Src)) + b += 4 + + Put32(buf[b:], uint32(Dst)) + b += 4 + + Put32(buf[b:], uint32(MaskFormat)) + b += 4 + + Put32(buf[b:], uint32(Glyphset)) + b += 4 + + Put16(buf[b:], uint16(SrcX)) + b += 2 + + Put16(buf[b:], uint16(SrcY)) + b += 2 + + copy(buf[b:], Glyphcmds[:len(Glyphcmds)]) + b += pad(int(len(Glyphcmds))) + + return buf +} + +// Request RenderFillRectangles +// size: pad((20 + pad((len(Rects) * 8)))) +type RenderFillRectanglesCookie struct { + *cookie +} + +// Write request to wire for RenderFillRectangles +func (c *Conn) RenderFillRectangles(Op byte, Dst Id, Color RenderColor, Rects []Rectangle) RenderFillRectanglesCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.renderFillRectanglesRequest(Op, Dst, Color, Rects), cookie) + return RenderFillRectanglesCookie{cookie} +} + +func (c *Conn) RenderFillRectanglesChecked(Op byte, Dst Id, Color RenderColor, Rects []Rectangle) RenderFillRectanglesCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.renderFillRectanglesRequest(Op, Dst, Color, Rects), cookie) + return RenderFillRectanglesCookie{cookie} +} + +func (cook RenderFillRectanglesCookie) Check() error { + return cook.check() +} + +// Write request to wire for RenderFillRectangles +func (c *Conn) renderFillRectanglesRequest(Op byte, Dst Id, Color RenderColor, Rects []Rectangle) []byte { + size := pad((20 + pad((len(Rects) * 8)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["RENDER"] + b += 1 + + buf[b] = 26 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + buf[b] = Op + b += 1 + + b += 3 // padding + + Put32(buf[b:], uint32(Dst)) + b += 4 + + { + structBytes := Color.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + + b += RectangleListBytes(buf[b:], Rects) + + return buf +} + +// Request RenderCreateCursor +// size: 16 +type RenderCreateCursorCookie struct { + *cookie +} + +// Write request to wire for RenderCreateCursor +func (c *Conn) RenderCreateCursor(Cid Id, Source Id, X uint16, Y uint16) RenderCreateCursorCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.renderCreateCursorRequest(Cid, Source, X, Y), cookie) + return RenderCreateCursorCookie{cookie} +} + +func (c *Conn) RenderCreateCursorChecked(Cid Id, Source Id, X uint16, Y uint16) RenderCreateCursorCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.renderCreateCursorRequest(Cid, Source, X, Y), cookie) + return RenderCreateCursorCookie{cookie} +} + +func (cook RenderCreateCursorCookie) Check() error { + return cook.check() +} + +// Write request to wire for RenderCreateCursor +func (c *Conn) renderCreateCursorRequest(Cid Id, Source Id, X uint16, Y uint16) []byte { + size := 16 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["RENDER"] + b += 1 + + buf[b] = 27 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Cid)) + b += 4 + + Put32(buf[b:], uint32(Source)) + b += 4 + + Put16(buf[b:], X) + b += 2 + + Put16(buf[b:], Y) + b += 2 + + return buf +} + +// Request RenderSetPictureTransform +// size: 44 +type RenderSetPictureTransformCookie struct { + *cookie +} + +// Write request to wire for RenderSetPictureTransform +func (c *Conn) RenderSetPictureTransform(Picture Id, Transform RenderTransform) RenderSetPictureTransformCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.renderSetPictureTransformRequest(Picture, Transform), cookie) + return RenderSetPictureTransformCookie{cookie} +} + +func (c *Conn) RenderSetPictureTransformChecked(Picture Id, Transform RenderTransform) RenderSetPictureTransformCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.renderSetPictureTransformRequest(Picture, Transform), cookie) + return RenderSetPictureTransformCookie{cookie} +} + +func (cook RenderSetPictureTransformCookie) Check() error { + return cook.check() +} + +// Write request to wire for RenderSetPictureTransform +func (c *Conn) renderSetPictureTransformRequest(Picture Id, Transform RenderTransform) []byte { + size := 44 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["RENDER"] + b += 1 + + buf[b] = 28 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Picture)) + b += 4 + + { + structBytes := Transform.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + + return buf +} + +// Request RenderQueryFilters +// size: 8 +type RenderQueryFiltersCookie struct { + *cookie +} + +func (c *Conn) RenderQueryFilters(Drawable Id) RenderQueryFiltersCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.renderQueryFiltersRequest(Drawable), cookie) + return RenderQueryFiltersCookie{cookie} +} + +func (c *Conn) RenderQueryFiltersUnchecked(Drawable Id) RenderQueryFiltersCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.renderQueryFiltersRequest(Drawable), cookie) + return RenderQueryFiltersCookie{cookie} +} + +// Request reply for RenderQueryFilters +// size: ((32 + pad((int(NumAliases) * 2))) + StrListSize(Filters)) +type RenderQueryFiltersReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + NumAliases uint32 + NumFilters uint32 + // padding: 16 bytes + Aliases []uint16 // size: pad((int(NumAliases) * 2)) + Filters []Str // size: StrListSize(Filters) +} + +// Waits and reads reply data from request RenderQueryFilters +func (cook RenderQueryFiltersCookie) Reply() (*RenderQueryFiltersReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return renderQueryFiltersReply(buf), nil +} + +// Read reply into structure from buffer for RenderQueryFilters +func renderQueryFiltersReply(buf []byte) *RenderQueryFiltersReply { + v := new(RenderQueryFiltersReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.NumAliases = Get32(buf[b:]) + b += 4 + + v.NumFilters = Get32(buf[b:]) + b += 4 + + b += 16 // padding + + v.Aliases = make([]uint16, v.NumAliases) + for i := 0; i < int(v.NumAliases); i++ { + v.Aliases[i] = Get16(buf[b:]) + b += 2 + } + b = pad(b) + + v.Filters = make([]Str, v.NumFilters) + b += ReadStrList(buf[b:], v.Filters) + + return v +} + +func (cook RenderQueryFiltersCookie) Check() error { + return cook.check() +} + +// Write request to wire for RenderQueryFilters +func (c *Conn) renderQueryFiltersRequest(Drawable Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["RENDER"] + b += 1 + + buf[b] = 29 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Drawable)) + b += 4 + + return buf +} + +// Request RenderSetPictureFilter +// size: pad(((12 + pad((int(FilterLen) * 1))) + pad((len(Values) * 4)))) +type RenderSetPictureFilterCookie struct { + *cookie +} + +// Write request to wire for RenderSetPictureFilter +func (c *Conn) RenderSetPictureFilter(Picture Id, FilterLen uint16, Filter string, Values []RenderFixed) RenderSetPictureFilterCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.renderSetPictureFilterRequest(Picture, FilterLen, Filter, Values), cookie) + return RenderSetPictureFilterCookie{cookie} +} + +func (c *Conn) RenderSetPictureFilterChecked(Picture Id, FilterLen uint16, Filter string, Values []RenderFixed) RenderSetPictureFilterCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.renderSetPictureFilterRequest(Picture, FilterLen, Filter, Values), cookie) + return RenderSetPictureFilterCookie{cookie} +} + +func (cook RenderSetPictureFilterCookie) Check() error { + return cook.check() +} + +// Write request to wire for RenderSetPictureFilter +func (c *Conn) renderSetPictureFilterRequest(Picture Id, FilterLen uint16, Filter string, Values []RenderFixed) []byte { + size := pad(((12 + pad((int(FilterLen) * 1))) + pad((len(Values) * 4)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["RENDER"] + b += 1 + + buf[b] = 30 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Picture)) + b += 4 + + Put16(buf[b:], FilterLen) + b += 2 + + b += 2 // padding + + copy(buf[b:], Filter[:FilterLen]) + b += pad(int(FilterLen)) + + for i := 0; i < int(len(Values)); i++ { + Put32(buf[b:], uint32(Values[i])) + b += 4 + } + b = pad(b) + + return buf +} + +// Request RenderCreateAnimCursor +// size: pad((8 + pad((len(Cursors) * 8)))) +type RenderCreateAnimCursorCookie struct { + *cookie +} + +// Write request to wire for RenderCreateAnimCursor +func (c *Conn) RenderCreateAnimCursor(Cid Id, Cursors []RenderAnimcursorelt) RenderCreateAnimCursorCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.renderCreateAnimCursorRequest(Cid, Cursors), cookie) + return RenderCreateAnimCursorCookie{cookie} +} + +func (c *Conn) RenderCreateAnimCursorChecked(Cid Id, Cursors []RenderAnimcursorelt) RenderCreateAnimCursorCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.renderCreateAnimCursorRequest(Cid, Cursors), cookie) + return RenderCreateAnimCursorCookie{cookie} +} + +func (cook RenderCreateAnimCursorCookie) Check() error { + return cook.check() +} + +// Write request to wire for RenderCreateAnimCursor +func (c *Conn) renderCreateAnimCursorRequest(Cid Id, Cursors []RenderAnimcursorelt) []byte { + size := pad((8 + pad((len(Cursors) * 8)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["RENDER"] + b += 1 + + buf[b] = 31 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Cid)) + b += 4 + + b += RenderAnimcursoreltListBytes(buf[b:], Cursors) + + return buf +} + +// Request RenderAddTraps +// size: pad((12 + pad((len(Traps) * 24)))) +type RenderAddTrapsCookie struct { + *cookie +} + +// Write request to wire for RenderAddTraps +func (c *Conn) RenderAddTraps(Picture Id, XOff int16, YOff int16, Traps []RenderTrap) RenderAddTrapsCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.renderAddTrapsRequest(Picture, XOff, YOff, Traps), cookie) + return RenderAddTrapsCookie{cookie} +} + +func (c *Conn) RenderAddTrapsChecked(Picture Id, XOff int16, YOff int16, Traps []RenderTrap) RenderAddTrapsCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.renderAddTrapsRequest(Picture, XOff, YOff, Traps), cookie) + return RenderAddTrapsCookie{cookie} +} + +func (cook RenderAddTrapsCookie) Check() error { + return cook.check() +} + +// Write request to wire for RenderAddTraps +func (c *Conn) renderAddTrapsRequest(Picture Id, XOff int16, YOff int16, Traps []RenderTrap) []byte { + size := pad((12 + pad((len(Traps) * 24)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["RENDER"] + b += 1 + + buf[b] = 32 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Picture)) + b += 4 + + Put16(buf[b:], uint16(XOff)) + b += 2 + + Put16(buf[b:], uint16(YOff)) + b += 2 + + b += RenderTrapListBytes(buf[b:], Traps) + + return buf +} + +// Request RenderCreateSolidFill +// size: 16 +type RenderCreateSolidFillCookie struct { + *cookie +} + +// Write request to wire for RenderCreateSolidFill +func (c *Conn) RenderCreateSolidFill(Picture Id, Color RenderColor) RenderCreateSolidFillCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.renderCreateSolidFillRequest(Picture, Color), cookie) + return RenderCreateSolidFillCookie{cookie} +} + +func (c *Conn) RenderCreateSolidFillChecked(Picture Id, Color RenderColor) RenderCreateSolidFillCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.renderCreateSolidFillRequest(Picture, Color), cookie) + return RenderCreateSolidFillCookie{cookie} +} + +func (cook RenderCreateSolidFillCookie) Check() error { + return cook.check() +} + +// Write request to wire for RenderCreateSolidFill +func (c *Conn) renderCreateSolidFillRequest(Picture Id, Color RenderColor) []byte { + size := 16 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["RENDER"] + b += 1 + + buf[b] = 33 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Picture)) + b += 4 + + { + structBytes := Color.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + + return buf +} + +// Request RenderCreateLinearGradient +// size: pad(((28 + pad((int(NumStops) * 4))) + pad((int(NumStops) * 8)))) +type RenderCreateLinearGradientCookie struct { + *cookie +} + +// Write request to wire for RenderCreateLinearGradient +func (c *Conn) RenderCreateLinearGradient(Picture Id, P1 RenderPointfix, P2 RenderPointfix, NumStops uint32, Stops []RenderFixed, Colors []RenderColor) RenderCreateLinearGradientCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.renderCreateLinearGradientRequest(Picture, P1, P2, NumStops, Stops, Colors), cookie) + return RenderCreateLinearGradientCookie{cookie} +} + +func (c *Conn) RenderCreateLinearGradientChecked(Picture Id, P1 RenderPointfix, P2 RenderPointfix, NumStops uint32, Stops []RenderFixed, Colors []RenderColor) RenderCreateLinearGradientCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.renderCreateLinearGradientRequest(Picture, P1, P2, NumStops, Stops, Colors), cookie) + return RenderCreateLinearGradientCookie{cookie} +} + +func (cook RenderCreateLinearGradientCookie) Check() error { + return cook.check() +} + +// Write request to wire for RenderCreateLinearGradient +func (c *Conn) renderCreateLinearGradientRequest(Picture Id, P1 RenderPointfix, P2 RenderPointfix, NumStops uint32, Stops []RenderFixed, Colors []RenderColor) []byte { + size := pad(((28 + pad((int(NumStops) * 4))) + pad((int(NumStops) * 8)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["RENDER"] + b += 1 + + buf[b] = 34 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Picture)) + b += 4 + + { + structBytes := P1.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + + { + structBytes := P2.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + + Put32(buf[b:], NumStops) + b += 4 + + for i := 0; i < int(NumStops); i++ { + Put32(buf[b:], uint32(Stops[i])) + b += 4 + } + b = pad(b) + + b += RenderColorListBytes(buf[b:], Colors) + + return buf +} + +// Request RenderCreateRadialGradient +// size: pad(((36 + pad((int(NumStops) * 4))) + pad((int(NumStops) * 8)))) +type RenderCreateRadialGradientCookie struct { + *cookie +} + +// Write request to wire for RenderCreateRadialGradient +func (c *Conn) RenderCreateRadialGradient(Picture Id, Inner RenderPointfix, Outer RenderPointfix, InnerRadius RenderFixed, OuterRadius RenderFixed, NumStops uint32, Stops []RenderFixed, Colors []RenderColor) RenderCreateRadialGradientCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.renderCreateRadialGradientRequest(Picture, Inner, Outer, InnerRadius, OuterRadius, NumStops, Stops, Colors), cookie) + return RenderCreateRadialGradientCookie{cookie} +} + +func (c *Conn) RenderCreateRadialGradientChecked(Picture Id, Inner RenderPointfix, Outer RenderPointfix, InnerRadius RenderFixed, OuterRadius RenderFixed, NumStops uint32, Stops []RenderFixed, Colors []RenderColor) RenderCreateRadialGradientCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.renderCreateRadialGradientRequest(Picture, Inner, Outer, InnerRadius, OuterRadius, NumStops, Stops, Colors), cookie) + return RenderCreateRadialGradientCookie{cookie} +} + +func (cook RenderCreateRadialGradientCookie) Check() error { + return cook.check() +} + +// Write request to wire for RenderCreateRadialGradient +func (c *Conn) renderCreateRadialGradientRequest(Picture Id, Inner RenderPointfix, Outer RenderPointfix, InnerRadius RenderFixed, OuterRadius RenderFixed, NumStops uint32, Stops []RenderFixed, Colors []RenderColor) []byte { + size := pad(((36 + pad((int(NumStops) * 4))) + pad((int(NumStops) * 8)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["RENDER"] + b += 1 + + buf[b] = 35 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Picture)) + b += 4 + + { + structBytes := Inner.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + + { + structBytes := Outer.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + + Put32(buf[b:], uint32(InnerRadius)) + b += 4 + + Put32(buf[b:], uint32(OuterRadius)) + b += 4 + + Put32(buf[b:], NumStops) + b += 4 + + for i := 0; i < int(NumStops); i++ { + Put32(buf[b:], uint32(Stops[i])) + b += 4 + } + b = pad(b) + + b += RenderColorListBytes(buf[b:], Colors) + + return buf +} + +// Request RenderCreateConicalGradient +// size: pad(((24 + pad((int(NumStops) * 4))) + pad((int(NumStops) * 8)))) +type RenderCreateConicalGradientCookie struct { + *cookie +} + +// Write request to wire for RenderCreateConicalGradient +func (c *Conn) RenderCreateConicalGradient(Picture Id, Center RenderPointfix, Angle RenderFixed, NumStops uint32, Stops []RenderFixed, Colors []RenderColor) RenderCreateConicalGradientCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.renderCreateConicalGradientRequest(Picture, Center, Angle, NumStops, Stops, Colors), cookie) + return RenderCreateConicalGradientCookie{cookie} +} + +func (c *Conn) RenderCreateConicalGradientChecked(Picture Id, Center RenderPointfix, Angle RenderFixed, NumStops uint32, Stops []RenderFixed, Colors []RenderColor) RenderCreateConicalGradientCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.renderCreateConicalGradientRequest(Picture, Center, Angle, NumStops, Stops, Colors), cookie) + return RenderCreateConicalGradientCookie{cookie} +} + +func (cook RenderCreateConicalGradientCookie) Check() error { + return cook.check() +} + +// Write request to wire for RenderCreateConicalGradient +func (c *Conn) renderCreateConicalGradientRequest(Picture Id, Center RenderPointfix, Angle RenderFixed, NumStops uint32, Stops []RenderFixed, Colors []RenderColor) []byte { + size := pad(((24 + pad((int(NumStops) * 4))) + pad((int(NumStops) * 8)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["RENDER"] + b += 1 + + buf[b] = 36 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Picture)) + b += 4 + + { + structBytes := Center.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + + Put32(buf[b:], uint32(Angle)) + b += 4 + + Put32(buf[b:], NumStops) + b += 4 + + for i := 0; i < int(NumStops); i++ { + Put32(buf[b:], uint32(Stops[i])) + b += 4 + } + b = pad(b) + + b += RenderColorListBytes(buf[b:], Colors) + + return buf +} -- cgit v1.2.3-70-g09d2