This file is indexed.

/usr/share/pyshared/xcb/render.py is in python-xpyb 1.3.1-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
#
# This file generated automatically from render.xml by py_client.py.
# Edit at your peril.
#

import xcb
import cStringIO
from struct import pack, unpack_from
from array import array
import xproto

MAJOR_VERSION = 0
MINOR_VERSION = 11

key = xcb.ExtensionKey('RENDER')

class PictType:
    Indexed = 0
    Direct = 1

class Picture:
    _None = 0

class PictOp:
    Clear = 0
    Src = 1
    Dst = 2
    Over = 3
    OverReverse = 4
    In = 5
    InReverse = 6
    Out = 7
    OutReverse = 8
    Atop = 9
    AtopReverse = 10
    Xor = 11
    Add = 12
    Saturate = 13
    DisjointClear = 16
    DisjointSrc = 17
    DisjointDst = 18
    DisjointOver = 19
    DisjointOverReverse = 20
    DisjointIn = 21
    DisjointInReverse = 22
    DisjointOut = 23
    DisjointOutReverse = 24
    DisjointAtop = 25
    DisjointAtopReverse = 26
    DisjointXor = 27
    ConjointClear = 32
    ConjointSrc = 33
    ConjointDst = 34
    ConjointOver = 35
    ConjointOverReverse = 36
    ConjointIn = 37
    ConjointInReverse = 38
    ConjointOut = 39
    ConjointOutReverse = 40
    ConjointAtop = 41
    ConjointAtopReverse = 42
    ConjointXor = 43
    Multiply = 48
    Screen = 49
    Overlay = 50
    Darken = 51
    Lighten = 52
    ColorDodge = 53
    ColorBurn = 54
    HardLight = 55
    SoftLight = 56
    Difference = 57
    Exclusion = 58
    HSLHue = 59
    HSLSaturation = 60
    HSLColor = 61
    HSLLuminosity = 62

class PolyEdge:
    Sharp = 0
    Smooth = 1

class PolyMode:
    Precise = 0
    Imprecise = 1

class CP:
    Repeat = 1
    AlphaMap = 2
    AlphaXOrigin = 4
    AlphaYOrigin = 8
    ClipXOrigin = 16
    ClipYOrigin = 32
    ClipMask = 64
    GraphicsExposure = 128
    SubwindowMode = 256
    PolyEdge = 512
    PolyMode = 1024
    Dither = 2048
    ComponentAlpha = 4096

class SubPixel:
    Unknown = 0
    HorizontalRGB = 1
    HorizontalBGR = 2
    VerticalRGB = 3
    VerticalBGR = 4
    _None = 5

class Repeat:
    _None = 0
    Normal = 1
    Pad = 2
    Reflect = 3

class PictFormatError(xcb.Error):
    def __init__(self, parent, offset=0):
        xcb.Error.__init__(self, parent, offset)

class BadPictFormat(xcb.ProtocolException):
    pass

class PictureError(xcb.Error):
    def __init__(self, parent, offset=0):
        xcb.Error.__init__(self, parent, offset)

class BadPicture(xcb.ProtocolException):
    pass

class PictOpError(xcb.Error):
    def __init__(self, parent, offset=0):
        xcb.Error.__init__(self, parent, offset)

class BadPictOp(xcb.ProtocolException):
    pass

class GlyphSetError(xcb.Error):
    def __init__(self, parent, offset=0):
        xcb.Error.__init__(self, parent, offset)

class BadGlyphSet(xcb.ProtocolException):
    pass

class GlyphError(xcb.Error):
    def __init__(self, parent, offset=0):
        xcb.Error.__init__(self, parent, offset)

class BadGlyph(xcb.ProtocolException):
    pass

class DIRECTFORMAT(xcb.Struct):
    def __init__(self, parent, offset, size):
        xcb.Struct.__init__(self, parent, offset, size)
        (self.red_shift, self.red_mask, self.green_shift, self.green_mask, self.blue_shift, self.blue_mask, self.alpha_shift, self.alpha_mask,) = unpack_from('HHHHHHHH', parent, offset)

class PICTFORMINFO(xcb.Struct):
    def __init__(self, parent, offset, size):
        xcb.Struct.__init__(self, parent, offset, size)
        (self.id, self.type, self.depth,) = unpack_from('IBB2x', parent, offset)
        offset += 8
        self.direct = DIRECTFORMAT(parent, offset, 16)
        offset += 16
        offset += xcb.type_pad(4, offset)
        (self.colormap,) = unpack_from('I', parent, offset)

class PICTVISUAL(xcb.Struct):
    def __init__(self, parent, offset, size):
        xcb.Struct.__init__(self, parent, offset, size)
        (self.visual, self.format,) = unpack_from('II', parent, offset)

class PICTDEPTH(xcb.Struct):
    def __init__(self, parent, offset):
        xcb.Struct.__init__(self, parent, offset)
        base = offset
        (self.depth, self.num_visuals,) = unpack_from('BxH4x', parent, offset)
        offset += 8
        self.visuals = xcb.List(parent, offset, self.num_visuals, PICTVISUAL, 8)
        offset += len(self.visuals.buf())
        xcb._resize_obj(self, offset - base)

class PICTSCREEN(xcb.Struct):
    def __init__(self, parent, offset):
        xcb.Struct.__init__(self, parent, offset)
        base = offset
        (self.num_depths, self.fallback,) = unpack_from('II', parent, offset)
        offset += 8
        self.depths = xcb.List(parent, offset, self.num_depths, PICTDEPTH, -1)
        offset += len(self.depths.buf())
        xcb._resize_obj(self, offset - base)

class INDEXVALUE(xcb.Struct):
    def __init__(self, parent, offset, size):
        xcb.Struct.__init__(self, parent, offset, size)
        (self.pixel, self.red, self.green, self.blue, self.alpha,) = unpack_from('IHHHH', parent, offset)

class COLOR(xcb.Struct):
    def __init__(self, parent, offset, size):
        xcb.Struct.__init__(self, parent, offset, size)
        (self.red, self.green, self.blue, self.alpha,) = unpack_from('HHHH', parent, offset)

class POINTFIX(xcb.Struct):
    def __init__(self, parent, offset, size):
        xcb.Struct.__init__(self, parent, offset, size)
        (self.x, self.y,) = unpack_from('ii', parent, offset)

class LINEFIX(xcb.Struct):
    def __init__(self, parent, offset, size):
        xcb.Struct.__init__(self, parent, offset, size)
        self.p1 = POINTFIX(parent, offset, 8)
        offset += 8
        offset += xcb.type_pad(8, offset)
        self.p2 = POINTFIX(parent, offset, 8)

class TRIANGLE(xcb.Struct):
    def __init__(self, parent, offset, size):
        xcb.Struct.__init__(self, parent, offset, size)
        self.p1 = POINTFIX(parent, offset, 8)
        offset += 8
        offset += xcb.type_pad(8, offset)
        self.p2 = POINTFIX(parent, offset, 8)
        offset += 8
        offset += xcb.type_pad(8, offset)
        self.p3 = POINTFIX(parent, offset, 8)

class TRAPEZOID(xcb.Struct):
    def __init__(self, parent, offset, size):
        xcb.Struct.__init__(self, parent, offset, size)
        (self.top, self.bottom,) = unpack_from('ii', parent, offset)
        offset += 8
        self.left = LINEFIX(parent, offset, 16)
        offset += 16
        offset += xcb.type_pad(16, offset)
        self.right = LINEFIX(parent, offset, 16)

class GLYPHINFO(xcb.Struct):
    def __init__(self, parent, offset, size):
        xcb.Struct.__init__(self, parent, offset, size)
        (self.width, self.height, self.x, self.y, self.x_off, self.y_off,) = unpack_from('HHhhhh', parent, offset)

class QueryVersionCookie(xcb.Cookie):
    pass

class QueryVersionReply(xcb.Reply):
    def __init__(self, parent, offset=0):
        xcb.Reply.__init__(self, parent, offset)
        (self.major_version, self.minor_version,) = unpack_from('xx2x4xII16x', parent, offset)

class QueryPictFormatsCookie(xcb.Cookie):
    pass

class QueryPictFormatsReply(xcb.Reply):
    def __init__(self, parent, offset=0):
        xcb.Reply.__init__(self, parent, offset)
        (self.num_formats, self.num_screens, self.num_depths, self.num_visuals, self.num_subpixel,) = unpack_from('xx2x4xIIIII4x', parent, offset)
        offset += 32
        self.formats = xcb.List(parent, offset, self.num_formats, PICTFORMINFO, 28)
        offset += len(self.formats.buf())
        offset += xcb.type_pad(4, offset)
        self.screens = xcb.List(parent, offset, self.num_screens, PICTSCREEN, -1)
        offset += len(self.screens.buf())
        offset += xcb.type_pad(4, offset)
        self.subpixels = xcb.List(parent, offset, self.num_subpixel, 'I', 4)

class QueryPictIndexValuesCookie(xcb.Cookie):
    pass

class QueryPictIndexValuesReply(xcb.Reply):
    def __init__(self, parent, offset=0):
        xcb.Reply.__init__(self, parent, offset)
        (self.num_values,) = unpack_from('xx2x4xI20x', parent, offset)
        offset += 32
        self.values = xcb.List(parent, offset, self.num_values, INDEXVALUE, 12)

class TRANSFORM(xcb.Struct):
    def __init__(self, parent, offset, size):
        xcb.Struct.__init__(self, parent, offset, size)
        (self.matrix11, self.matrix12, self.matrix13, self.matrix21, self.matrix22, self.matrix23, self.matrix31, self.matrix32, self.matrix33,) = unpack_from('iiiiiiiii', parent, offset)

class QueryFiltersCookie(xcb.Cookie):
    pass

class QueryFiltersReply(xcb.Reply):
    def __init__(self, parent, offset=0):
        xcb.Reply.__init__(self, parent, offset)
        (self.num_aliases, self.num_filters,) = unpack_from('xx2x4xII16x', parent, offset)
        offset += 32
        self.aliases = xcb.List(parent, offset, self.num_aliases, 'H', 2)
        offset += len(self.aliases.buf())
        offset += xcb.type_pad(4, offset)
        self.filters = xcb.List(parent, offset, self.num_filters, STR, -1)

class ANIMCURSORELT(xcb.Struct):
    def __init__(self, parent, offset, size):
        xcb.Struct.__init__(self, parent, offset, size)
        (self.cursor, self.delay,) = unpack_from('II', parent, offset)

class SPANFIX(xcb.Struct):
    def __init__(self, parent, offset, size):
        xcb.Struct.__init__(self, parent, offset, size)
        (self.l, self.r, self.y,) = unpack_from('iii', parent, offset)

class TRAP(xcb.Struct):
    def __init__(self, parent, offset, size):
        xcb.Struct.__init__(self, parent, offset, size)
        self.top = SPANFIX(parent, offset, 12)
        offset += 12
        offset += xcb.type_pad(12, offset)
        self.bot = SPANFIX(parent, offset, 12)

class renderExtension(xcb.Extension):

    def QueryVersion(self, client_major_version, client_minor_version):
        buf = cStringIO.StringIO()
        buf.write(pack('=xx2xII', client_major_version, client_minor_version))
        return self.send_request(xcb.Request(buf.getvalue(), 0, False, True),
                                 QueryVersionCookie(),
                                 QueryVersionReply)

    def QueryVersionUnchecked(self, client_major_version, client_minor_version):
        buf = cStringIO.StringIO()
        buf.write(pack('=xx2xII', client_major_version, client_minor_version))
        return self.send_request(xcb.Request(buf.getvalue(), 0, False, False),
                                 QueryVersionCookie(),
                                 QueryVersionReply)

    def QueryPictFormats(self, ):
        buf = cStringIO.StringIO()
        buf.write(pack('=xx2x', ))
        return self.send_request(xcb.Request(buf.getvalue(), 1, False, True),
                                 QueryPictFormatsCookie(),
                                 QueryPictFormatsReply)

    def QueryPictFormatsUnchecked(self, ):
        buf = cStringIO.StringIO()
        buf.write(pack('=xx2x', ))
        return self.send_request(xcb.Request(buf.getvalue(), 1, False, False),
                                 QueryPictFormatsCookie(),
                                 QueryPictFormatsReply)

    def QueryPictIndexValues(self, format):
        buf = cStringIO.StringIO()
        buf.write(pack('=xx2xI', format))
        return self.send_request(xcb.Request(buf.getvalue(), 2, False, True),
                                 QueryPictIndexValuesCookie(),
                                 QueryPictIndexValuesReply)

    def QueryPictIndexValuesUnchecked(self, format):
        buf = cStringIO.StringIO()
        buf.write(pack('=xx2xI', format))
        return self.send_request(xcb.Request(buf.getvalue(), 2, False, False),
                                 QueryPictIndexValuesCookie(),
                                 QueryPictIndexValuesReply)

    def CreatePictureChecked(self, pid, drawable, format, value_mask, value_list):
        buf = cStringIO.StringIO()
        buf.write(pack('=xx2xIIII', pid, drawable, format, value_mask))
        buf.write(str(buffer(array('I', value_list))))
        return self.send_request(xcb.Request(buf.getvalue(), 4, True, True),
                                 xcb.VoidCookie())

    def CreatePicture(self, pid, drawable, format, value_mask, value_list):
        buf = cStringIO.StringIO()
        buf.write(pack('=xx2xIIII', pid, drawable, format, value_mask))
        buf.write(str(buffer(array('I', value_list))))
        return self.send_request(xcb.Request(buf.getvalue(), 4, True, False),
                                 xcb.VoidCookie())

    def ChangePictureChecked(self, picture, value_mask, value_list):
        buf = cStringIO.StringIO()
        buf.write(pack('=xx2xII', picture, value_mask))
        buf.write(str(buffer(array('I', value_list))))
        return self.send_request(xcb.Request(buf.getvalue(), 5, True, True),
                                 xcb.VoidCookie())

    def ChangePicture(self, picture, value_mask, value_list):
        buf = cStringIO.StringIO()
        buf.write(pack('=xx2xII', picture, value_mask))
        buf.write(str(buffer(array('I', value_list))))
        return self.send_request(xcb.Request(buf.getvalue(), 5, True, False),
                                 xcb.VoidCookie())

    def SetPictureClipRectanglesChecked(self, picture, clip_x_origin, clip_y_origin, rectangles_len, rectangles):
        buf = cStringIO.StringIO()
        buf.write(pack('=xx2xIhh', picture, clip_x_origin, clip_y_origin))
        for elt in xcb.Iterator(rectangles, 4, 'rectangles', True):
            buf.write(pack('=hhHH', *elt))
        return self.send_request(xcb.Request(buf.getvalue(), 6, True, True),
                                 xcb.VoidCookie())

    def SetPictureClipRectangles(self, picture, clip_x_origin, clip_y_origin, rectangles_len, rectangles):
        buf = cStringIO.StringIO()
        buf.write(pack('=xx2xIhh', picture, clip_x_origin, clip_y_origin))
        for elt in xcb.Iterator(rectangles, 4, 'rectangles', True):
            buf.write(pack('=hhHH', *elt))
        return self.send_request(xcb.Request(buf.getvalue(), 6, True, False),
                                 xcb.VoidCookie())

    def FreePictureChecked(self, picture):
        buf = cStringIO.StringIO()
        buf.write(pack('=xx2xI', picture))
        return self.send_request(xcb.Request(buf.getvalue(), 7, True, True),
                                 xcb.VoidCookie())

    def FreePicture(self, picture):
        buf = cStringIO.StringIO()
        buf.write(pack('=xx2xI', picture))
        return self.send_request(xcb.Request(buf.getvalue(), 7, True, False),
                                 xcb.VoidCookie())

    def CompositeChecked(self, op, src, mask, dst, src_x, src_y, mask_x, mask_y, dst_x, dst_y, width, height):
        buf = cStringIO.StringIO()
        buf.write(pack('=xx2xB3xIIIhhhhhhHH', op, src, mask, dst, src_x, src_y, mask_x, mask_y, dst_x, dst_y, width, height))
        return self.send_request(xcb.Request(buf.getvalue(), 8, True, True),
                                 xcb.VoidCookie())

    def Composite(self, op, src, mask, dst, src_x, src_y, mask_x, mask_y, dst_x, dst_y, width, height):
        buf = cStringIO.StringIO()
        buf.write(pack('=xx2xB3xIIIhhhhhhHH', op, src, mask, dst, src_x, src_y, mask_x, mask_y, dst_x, dst_y, width, height))
        return self.send_request(xcb.Request(buf.getvalue(), 8, True, False),
                                 xcb.VoidCookie())

    def TrapezoidsChecked(self, op, src, dst, mask_format, src_x, src_y, traps_len, traps):
        buf = cStringIO.StringIO()
        buf.write(pack('=xx2xB3xIIIhh', op, src, dst, mask_format, src_x, src_y))
        for elt in xcb.Iterator(traps, 10, 'traps', True):
            buf.write(pack('=iiiiiiiiii', *elt))
        return self.send_request(xcb.Request(buf.getvalue(), 10, True, True),
                                 xcb.VoidCookie())

    def Trapezoids(self, op, src, dst, mask_format, src_x, src_y, traps_len, traps):
        buf = cStringIO.StringIO()
        buf.write(pack('=xx2xB3xIIIhh', op, src, dst, mask_format, src_x, src_y))
        for elt in xcb.Iterator(traps, 10, 'traps', True):
            buf.write(pack('=iiiiiiiiii', *elt))
        return self.send_request(xcb.Request(buf.getvalue(), 10, True, False),
                                 xcb.VoidCookie())

    def TrianglesChecked(self, op, src, dst, mask_format, src_x, src_y, triangles_len, triangles):
        buf = cStringIO.StringIO()
        buf.write(pack('=xx2xB3xIIIhh', op, src, dst, mask_format, src_x, src_y))
        for elt in xcb.Iterator(triangles, 6, 'triangles', True):
            buf.write(pack('=iiiiii', *elt))
        return self.send_request(xcb.Request(buf.getvalue(), 11, True, True),
                                 xcb.VoidCookie())

    def Triangles(self, op, src, dst, mask_format, src_x, src_y, triangles_len, triangles):
        buf = cStringIO.StringIO()
        buf.write(pack('=xx2xB3xIIIhh', op, src, dst, mask_format, src_x, src_y))
        for elt in xcb.Iterator(triangles, 6, 'triangles', True):
            buf.write(pack('=iiiiii', *elt))
        return self.send_request(xcb.Request(buf.getvalue(), 11, True, False),
                                 xcb.VoidCookie())

    def TriStripChecked(self, op, src, dst, mask_format, src_x, src_y, points_len, points):
        buf = cStringIO.StringIO()
        buf.write(pack('=xx2xB3xIIIhh', op, src, dst, mask_format, src_x, src_y))
        for elt in xcb.Iterator(points, 2, 'points', True):
            buf.write(pack('=ii', *elt))
        return self.send_request(xcb.Request(buf.getvalue(), 12, True, True),
                                 xcb.VoidCookie())

    def TriStrip(self, op, src, dst, mask_format, src_x, src_y, points_len, points):
        buf = cStringIO.StringIO()
        buf.write(pack('=xx2xB3xIIIhh', op, src, dst, mask_format, src_x, src_y))
        for elt in xcb.Iterator(points, 2, 'points', True):
            buf.write(pack('=ii', *elt))
        return self.send_request(xcb.Request(buf.getvalue(), 12, True, False),
                                 xcb.VoidCookie())

    def TriFanChecked(self, op, src, dst, mask_format, src_x, src_y, points_len, points):
        buf = cStringIO.StringIO()
        buf.write(pack('=xx2xB3xIIIhh', op, src, dst, mask_format, src_x, src_y))
        for elt in xcb.Iterator(points, 2, 'points', True):
            buf.write(pack('=ii', *elt))
        return self.send_request(xcb.Request(buf.getvalue(), 13, True, True),
                                 xcb.VoidCookie())

    def TriFan(self, op, src, dst, mask_format, src_x, src_y, points_len, points):
        buf = cStringIO.StringIO()
        buf.write(pack('=xx2xB3xIIIhh', op, src, dst, mask_format, src_x, src_y))
        for elt in xcb.Iterator(points, 2, 'points', True):
            buf.write(pack('=ii', *elt))
        return self.send_request(xcb.Request(buf.getvalue(), 13, True, False),
                                 xcb.VoidCookie())

    def CreateGlyphSetChecked(self, gsid, format):
        buf = cStringIO.StringIO()
        buf.write(pack('=xx2xII', gsid, format))
        return self.send_request(xcb.Request(buf.getvalue(), 17, True, True),
                                 xcb.VoidCookie())

    def CreateGlyphSet(self, gsid, format):
        buf = cStringIO.StringIO()
        buf.write(pack('=xx2xII', gsid, format))
        return self.send_request(xcb.Request(buf.getvalue(), 17, True, False),
                                 xcb.VoidCookie())

    def ReferenceGlyphSetChecked(self, gsid, existing):
        buf = cStringIO.StringIO()
        buf.write(pack('=xx2xII', gsid, existing))
        return self.send_request(xcb.Request(buf.getvalue(), 18, True, True),
                                 xcb.VoidCookie())

    def ReferenceGlyphSet(self, gsid, existing):
        buf = cStringIO.StringIO()
        buf.write(pack('=xx2xII', gsid, existing))
        return self.send_request(xcb.Request(buf.getvalue(), 18, True, False),
                                 xcb.VoidCookie())

    def FreeGlyphSetChecked(self, glyphset):
        buf = cStringIO.StringIO()
        buf.write(pack('=xx2xI', glyphset))
        return self.send_request(xcb.Request(buf.getvalue(), 19, True, True),
                                 xcb.VoidCookie())

    def FreeGlyphSet(self, glyphset):
        buf = cStringIO.StringIO()
        buf.write(pack('=xx2xI', glyphset))
        return self.send_request(xcb.Request(buf.getvalue(), 19, True, False),
                                 xcb.VoidCookie())

    def AddGlyphsChecked(self, glyphset, glyphs_len, glyphids, glyphs, data_len, data):
        buf = cStringIO.StringIO()
        buf.write(pack('=xx2xII', glyphset, glyphs_len))
        buf.write(str(buffer(array('I', glyphids))))
        for elt in xcb.Iterator(glyphs, 6, 'glyphs', True):
            buf.write(pack('=HHhhhh', *elt))
        buf.write(str(buffer(array('B', data))))
        return self.send_request(xcb.Request(buf.getvalue(), 20, True, True),
                                 xcb.VoidCookie())

    def AddGlyphs(self, glyphset, glyphs_len, glyphids, glyphs, data_len, data):
        buf = cStringIO.StringIO()
        buf.write(pack('=xx2xII', glyphset, glyphs_len))
        buf.write(str(buffer(array('I', glyphids))))
        for elt in xcb.Iterator(glyphs, 6, 'glyphs', True):
            buf.write(pack('=HHhhhh', *elt))
        buf.write(str(buffer(array('B', data))))
        return self.send_request(xcb.Request(buf.getvalue(), 20, True, False),
                                 xcb.VoidCookie())

    def FreeGlyphsChecked(self, glyphset, glyphs_len, glyphs):
        buf = cStringIO.StringIO()
        buf.write(pack('=xx2xI', glyphset))
        buf.write(str(buffer(array('I', glyphs))))
        return self.send_request(xcb.Request(buf.getvalue(), 22, True, True),
                                 xcb.VoidCookie())

    def FreeGlyphs(self, glyphset, glyphs_len, glyphs):
        buf = cStringIO.StringIO()
        buf.write(pack('=xx2xI', glyphset))
        buf.write(str(buffer(array('I', glyphs))))
        return self.send_request(xcb.Request(buf.getvalue(), 22, True, False),
                                 xcb.VoidCookie())

    def CompositeGlyphs8Checked(self, op, src, dst, mask_format, glyphset, src_x, src_y, glyphcmds_len, glyphcmds):
        buf = cStringIO.StringIO()
        buf.write(pack('=xx2xB3xIIIIhh', op, src, dst, mask_format, glyphset, src_x, src_y))
        buf.write(str(buffer(array('B', glyphcmds))))
        return self.send_request(xcb.Request(buf.getvalue(), 23, True, True),
                                 xcb.VoidCookie())

    def CompositeGlyphs8(self, op, src, dst, mask_format, glyphset, src_x, src_y, glyphcmds_len, glyphcmds):
        buf = cStringIO.StringIO()
        buf.write(pack('=xx2xB3xIIIIhh', op, src, dst, mask_format, glyphset, src_x, src_y))
        buf.write(str(buffer(array('B', glyphcmds))))
        return self.send_request(xcb.Request(buf.getvalue(), 23, True, False),
                                 xcb.VoidCookie())

    def CompositeGlyphs16Checked(self, op, src, dst, mask_format, glyphset, src_x, src_y, glyphcmds_len, glyphcmds):
        buf = cStringIO.StringIO()
        buf.write(pack('=xx2xB3xIIIIhh', op, src, dst, mask_format, glyphset, src_x, src_y))
        buf.write(str(buffer(array('B', glyphcmds))))
        return self.send_request(xcb.Request(buf.getvalue(), 24, True, True),
                                 xcb.VoidCookie())

    def CompositeGlyphs16(self, op, src, dst, mask_format, glyphset, src_x, src_y, glyphcmds_len, glyphcmds):
        buf = cStringIO.StringIO()
        buf.write(pack('=xx2xB3xIIIIhh', op, src, dst, mask_format, glyphset, src_x, src_y))
        buf.write(str(buffer(array('B', glyphcmds))))
        return self.send_request(xcb.Request(buf.getvalue(), 24, True, False),
                                 xcb.VoidCookie())

    def CompositeGlyphs32Checked(self, op, src, dst, mask_format, glyphset, src_x, src_y, glyphcmds_len, glyphcmds):
        buf = cStringIO.StringIO()
        buf.write(pack('=xx2xB3xIIIIhh', op, src, dst, mask_format, glyphset, src_x, src_y))
        buf.write(str(buffer(array('B', glyphcmds))))
        return self.send_request(xcb.Request(buf.getvalue(), 25, True, True),
                                 xcb.VoidCookie())

    def CompositeGlyphs32(self, op, src, dst, mask_format, glyphset, src_x, src_y, glyphcmds_len, glyphcmds):
        buf = cStringIO.StringIO()
        buf.write(pack('=xx2xB3xIIIIhh', op, src, dst, mask_format, glyphset, src_x, src_y))
        buf.write(str(buffer(array('B', glyphcmds))))
        return self.send_request(xcb.Request(buf.getvalue(), 25, True, False),
                                 xcb.VoidCookie())

    def FillRectanglesChecked(self, op, dst, color, rects_len, rects):
        buf = cStringIO.StringIO()
        buf.write(pack('=xx2xB3xI', op, dst))
        for elt in xcb.Iterator(color, 4, 'color', False):
            buf.write(pack('=HHHH', *elt))
        for elt in xcb.Iterator(rects, 4, 'rects', True):
            buf.write(pack('=hhHH', *elt))
        return self.send_request(xcb.Request(buf.getvalue(), 26, True, True),
                                 xcb.VoidCookie())

    def FillRectangles(self, op, dst, color, rects_len, rects):
        buf = cStringIO.StringIO()
        buf.write(pack('=xx2xB3xI', op, dst))
        for elt in xcb.Iterator(color, 4, 'color', False):
            buf.write(pack('=HHHH', *elt))
        for elt in xcb.Iterator(rects, 4, 'rects', True):
            buf.write(pack('=hhHH', *elt))
        return self.send_request(xcb.Request(buf.getvalue(), 26, True, False),
                                 xcb.VoidCookie())

    def CreateCursorChecked(self, cid, source, x, y):
        buf = cStringIO.StringIO()
        buf.write(pack('=xx2xIIHH', cid, source, x, y))
        return self.send_request(xcb.Request(buf.getvalue(), 27, True, True),
                                 xcb.VoidCookie())

    def CreateCursor(self, cid, source, x, y):
        buf = cStringIO.StringIO()
        buf.write(pack('=xx2xIIHH', cid, source, x, y))
        return self.send_request(xcb.Request(buf.getvalue(), 27, True, False),
                                 xcb.VoidCookie())

    def SetPictureTransformChecked(self, picture, transform):
        buf = cStringIO.StringIO()
        buf.write(pack('=xx2xI', picture))
        for elt in xcb.Iterator(transform, 9, 'transform', False):
            buf.write(pack('=iiiiiiiii', *elt))
        return self.send_request(xcb.Request(buf.getvalue(), 28, True, True),
                                 xcb.VoidCookie())

    def SetPictureTransform(self, picture, transform):
        buf = cStringIO.StringIO()
        buf.write(pack('=xx2xI', picture))
        for elt in xcb.Iterator(transform, 9, 'transform', False):
            buf.write(pack('=iiiiiiiii', *elt))
        return self.send_request(xcb.Request(buf.getvalue(), 28, True, False),
                                 xcb.VoidCookie())

    def QueryFilters(self, drawable):
        buf = cStringIO.StringIO()
        buf.write(pack('=xx2xI', drawable))
        return self.send_request(xcb.Request(buf.getvalue(), 29, False, True),
                                 QueryFiltersCookie(),
                                 QueryFiltersReply)

    def QueryFiltersUnchecked(self, drawable):
        buf = cStringIO.StringIO()
        buf.write(pack('=xx2xI', drawable))
        return self.send_request(xcb.Request(buf.getvalue(), 29, False, False),
                                 QueryFiltersCookie(),
                                 QueryFiltersReply)

    def SetPictureFilterChecked(self, picture, filter_len, filter, values_len, values):
        buf = cStringIO.StringIO()
        buf.write(pack('=xx2xIH2x', picture, filter_len))
        buf.write(str(buffer(array('b', filter))))
        buf.write(str(buffer(array('i', values))))
        return self.send_request(xcb.Request(buf.getvalue(), 30, True, True),
                                 xcb.VoidCookie())

    def SetPictureFilter(self, picture, filter_len, filter, values_len, values):
        buf = cStringIO.StringIO()
        buf.write(pack('=xx2xIH2x', picture, filter_len))
        buf.write(str(buffer(array('b', filter))))
        buf.write(str(buffer(array('i', values))))
        return self.send_request(xcb.Request(buf.getvalue(), 30, True, False),
                                 xcb.VoidCookie())

    def CreateAnimCursorChecked(self, cid, cursors_len, cursors):
        buf = cStringIO.StringIO()
        buf.write(pack('=xx2xI', cid))
        for elt in xcb.Iterator(cursors, 2, 'cursors', True):
            buf.write(pack('=II', *elt))
        return self.send_request(xcb.Request(buf.getvalue(), 31, True, True),
                                 xcb.VoidCookie())

    def CreateAnimCursor(self, cid, cursors_len, cursors):
        buf = cStringIO.StringIO()
        buf.write(pack('=xx2xI', cid))
        for elt in xcb.Iterator(cursors, 2, 'cursors', True):
            buf.write(pack('=II', *elt))
        return self.send_request(xcb.Request(buf.getvalue(), 31, True, False),
                                 xcb.VoidCookie())

    def AddTrapsChecked(self, picture, x_off, y_off, traps_len, traps):
        buf = cStringIO.StringIO()
        buf.write(pack('=xx2xIhh', picture, x_off, y_off))
        for elt in xcb.Iterator(traps, 6, 'traps', True):
            buf.write(pack('=iiiiii', *elt))
        return self.send_request(xcb.Request(buf.getvalue(), 32, True, True),
                                 xcb.VoidCookie())

    def AddTraps(self, picture, x_off, y_off, traps_len, traps):
        buf = cStringIO.StringIO()
        buf.write(pack('=xx2xIhh', picture, x_off, y_off))
        for elt in xcb.Iterator(traps, 6, 'traps', True):
            buf.write(pack('=iiiiii', *elt))
        return self.send_request(xcb.Request(buf.getvalue(), 32, True, False),
                                 xcb.VoidCookie())

    def CreateSolidFillChecked(self, picture, color):
        buf = cStringIO.StringIO()
        buf.write(pack('=xx2xI', picture))
        for elt in xcb.Iterator(color, 4, 'color', False):
            buf.write(pack('=HHHH', *elt))
        return self.send_request(xcb.Request(buf.getvalue(), 33, True, True),
                                 xcb.VoidCookie())

    def CreateSolidFill(self, picture, color):
        buf = cStringIO.StringIO()
        buf.write(pack('=xx2xI', picture))
        for elt in xcb.Iterator(color, 4, 'color', False):
            buf.write(pack('=HHHH', *elt))
        return self.send_request(xcb.Request(buf.getvalue(), 33, True, False),
                                 xcb.VoidCookie())

    def CreateLinearGradientChecked(self, picture, p1, p2, num_stops, stops, colors):
        buf = cStringIO.StringIO()
        buf.write(pack('=xx2xI', picture))
        for elt in xcb.Iterator(p1, 2, 'p1', False):
            buf.write(pack('=ii', *elt))
        for elt in xcb.Iterator(p2, 2, 'p2', False):
            buf.write(pack('=ii', *elt))
        buf.write(pack('=I', num_stops))
        buf.write(str(buffer(array('i', stops))))
        for elt in xcb.Iterator(colors, 4, 'colors', True):
            buf.write(pack('=HHHH', *elt))
        return self.send_request(xcb.Request(buf.getvalue(), 34, True, True),
                                 xcb.VoidCookie())

    def CreateLinearGradient(self, picture, p1, p2, num_stops, stops, colors):
        buf = cStringIO.StringIO()
        buf.write(pack('=xx2xI', picture))
        for elt in xcb.Iterator(p1, 2, 'p1', False):
            buf.write(pack('=ii', *elt))
        for elt in xcb.Iterator(p2, 2, 'p2', False):
            buf.write(pack('=ii', *elt))
        buf.write(pack('=I', num_stops))
        buf.write(str(buffer(array('i', stops))))
        for elt in xcb.Iterator(colors, 4, 'colors', True):
            buf.write(pack('=HHHH', *elt))
        return self.send_request(xcb.Request(buf.getvalue(), 34, True, False),
                                 xcb.VoidCookie())

    def CreateRadialGradientChecked(self, picture, inner, outer, inner_radius, outer_radius, num_stops, stops, colors):
        buf = cStringIO.StringIO()
        buf.write(pack('=xx2xI', picture))
        for elt in xcb.Iterator(inner, 2, 'inner', False):
            buf.write(pack('=ii', *elt))
        for elt in xcb.Iterator(outer, 2, 'outer', False):
            buf.write(pack('=ii', *elt))
        buf.write(pack('=iiI', inner_radius, outer_radius, num_stops))
        buf.write(str(buffer(array('i', stops))))
        for elt in xcb.Iterator(colors, 4, 'colors', True):
            buf.write(pack('=HHHH', *elt))
        return self.send_request(xcb.Request(buf.getvalue(), 35, True, True),
                                 xcb.VoidCookie())

    def CreateRadialGradient(self, picture, inner, outer, inner_radius, outer_radius, num_stops, stops, colors):
        buf = cStringIO.StringIO()
        buf.write(pack('=xx2xI', picture))
        for elt in xcb.Iterator(inner, 2, 'inner', False):
            buf.write(pack('=ii', *elt))
        for elt in xcb.Iterator(outer, 2, 'outer', False):
            buf.write(pack('=ii', *elt))
        buf.write(pack('=iiI', inner_radius, outer_radius, num_stops))
        buf.write(str(buffer(array('i', stops))))
        for elt in xcb.Iterator(colors, 4, 'colors', True):
            buf.write(pack('=HHHH', *elt))
        return self.send_request(xcb.Request(buf.getvalue(), 35, True, False),
                                 xcb.VoidCookie())

    def CreateConicalGradientChecked(self, picture, center, angle, num_stops, stops, colors):
        buf = cStringIO.StringIO()
        buf.write(pack('=xx2xI', picture))
        for elt in xcb.Iterator(center, 2, 'center', False):
            buf.write(pack('=ii', *elt))
        buf.write(pack('=iI', angle, num_stops))
        buf.write(str(buffer(array('i', stops))))
        for elt in xcb.Iterator(colors, 4, 'colors', True):
            buf.write(pack('=HHHH', *elt))
        return self.send_request(xcb.Request(buf.getvalue(), 36, True, True),
                                 xcb.VoidCookie())

    def CreateConicalGradient(self, picture, center, angle, num_stops, stops, colors):
        buf = cStringIO.StringIO()
        buf.write(pack('=xx2xI', picture))
        for elt in xcb.Iterator(center, 2, 'center', False):
            buf.write(pack('=ii', *elt))
        buf.write(pack('=iI', angle, num_stops))
        buf.write(str(buffer(array('i', stops))))
        for elt in xcb.Iterator(colors, 4, 'colors', True):
            buf.write(pack('=HHHH', *elt))
        return self.send_request(xcb.Request(buf.getvalue(), 36, True, False),
                                 xcb.VoidCookie())

_events = {
}

_errors = {
    0 : (PictFormatError, BadPictFormat),
    1 : (PictureError, BadPicture),
    2 : (PictOpError, BadPictOp),
    3 : (GlyphSetError, BadGlyphSet),
    4 : (GlyphError, BadGlyph),
}

xcb._add_ext(key, renderExtension, _events, _errors)