This file is indexed.

/usr/share/perl5/X11/Protocol/Ext/RENDER.pm is in libx11-protocol-perl 0.56-6.

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
#!/usr/bin/perl

# The X Rendering Extension
package X11::Protocol::Ext::RENDER;

# Copyright (C) 2004 Stephen McCamant. All rights reserved. This program
# is free software; you can redistribute and/or modify it under the same
# terms as Perl itself.

use X11::Protocol qw(pad padding padded make_num_hash);
use Carp;

use strict;
use vars '$VERSION';

$VERSION = 0.01;

sub new
{
    my($pkg, $x, $request_num, $event_num, $error_num) = @_;
    my($self) = {};

    # Constants

    $x->{'ext_const'}{'PictType'} = ['Indexed', 'Direct'];
    $x->{'ext_const_num'}{'PictType'} =
      {make_num_hash($x->{'ext_const'}{'PictType'})};

    $x->{'ext_const'}{'PictOp'} =
      ['Clear', 'Src', 'Dst', 'Over', 'OverReverse', 'In', 'InReverse',
       'Out', 'OutReverse', 'Atop', 'AtopReverse', 'Xor', 'Add', 'Saturate',
       undef, undef,
       'DisjointClear', 'DisjointSrc', 'DisjointDst', 'DisjointOver',
       'DisjointOverReverse', 'DisjointIn', 'DisjointInReverse',
       'DisjointOut', 'DisjointOutReverse', 'DisjointAtop',
       'DisjointAtopReverse', 'DisjointXor',
       undef, undef, undef, undef,
       'ConjointClear', 'ConjointSrc', 'ConjointDst', 'ConjointOver',
       'ConjointOverReverse', 'ConjointIn', 'ConjointInReverse',
       'ConjointOut', 'ConjointOutReverse', 'ConjointAtop',
       'ConjointAtopReverse', 'ConjointXor'];
    $x->{'ext_const_num'}{'PictOp'} =
      {make_num_hash($x->{'ext_const'}{'PictOp'})};

    $x->{'ext_const'}{'SubPixel'} =
      ['Unknown', 'HorizontalRGB', 'HorizontalBGR', 'VerticalRGB',
       'VerticalBGR', 'None'];
    $x->{'ext_const_num'}{'SubPixel'} =
      {make_num_hash($x->{'ext_const'}{'SubPixel'})};

    $x->{'ext_const'}{'PolyEdge'} = ['Sharp', 'Smooth'];
    $x->{'ext_const_num'}{'PolyEdge'} =
      {make_num_hash($x->{'ext_const'}{'PolyEdge'})};

    $x->{'ext_const'}{'PolyMode'} = ['Precise', 'Imprecise'];
    $x->{'ext_const_num'}{'PolyMode'} =
      {make_num_hash($x->{'ext_const'}{'PolyMode'})};

    my @errors = ('PictFormat', 'Picture', 'PictOp', 'GlyphSet', 'Glyph');
    my @error_types = (1, 1, 1, 1, 1);
    my $err;
    for $err (@errors) {
	$x->{'ext_const'}{'Error'}[$error_num] = $err;
	$x->{'ext_error_type'}[$error_num] = shift @error_types;
	$error_num++;
    }
    $x->{'ext_const_num'}{'Error'} =
      {make_num_hash($x->{'ext_const'}{'Error'})};

    # Events: none

    my($Card16, $Int16, $Card8, $Int8);
    if (pack("L", 1) eq "\0\0\0\1") {
	$Int8 = "xxxc";
	$Card8 = "xxxC";
	$Int16 = "xxs";
	$Card16 = "xxS";
    } elsif (pack("L", 1) eq "\1\0\0\0") {
	$Int8 = "cxxx";
	$Card8 = "Cxxx";
	$Int16 = "sxx";
	$Card16 = "Sxx";
    } else {
	croak "Can't determine byte order!\n";
    }

    my @Attributes_ValueMask =
      (['repeat', sub { pack($Card8, $_[1]) }],
#       ['fill_nearest', sub { pack($Card8, $_[1]) }],
       ['alpha_map', sub { $_[1] = 0 if $_[1] eq "None"; pack("L", $_[1]) }],
       ['alpha_x_origin', sub { pack($Int16, $_[1]) }],
       ['alpha_y_origin', sub { pack($Int16, $_[1]) }],
       ['clip_x_origin', sub { pack($Int16, $_[1]) }],
       ['clip_y_origin', sub { pack($Int16, $_[1]) }],
       ['clip_mask', sub { $_[1] = 0 if $_[1] eq "None"; pack("L", $_[1]) }],
       ['graphics_exposures', sub { pack($Card8, $_[1]) }],
       ['subwindow_mode', sub {
	    $_[1] = $_[0]->num('GCSubwindowMode', $_[1]);
	    pack($Card8, $_[1]);
	}],
       ['poly_edge', sub {
	    $_[1] = $_[0]->num('PolyEdge', $_[1]);
	    pack($Card8, $_[1]);
	}],
       ['poly_mode', sub {
	    $_[1] = $_[0]->num('PolyMode', $_[1]);
	    pack($Card8, $_[1]);
	}],
       ['dither', sub { $_[1] = 0 if $_[1] eq "None"; pack("L", $_[1]) }],
       ['component_alpha', sub { pack($Card8, $_[1]) }],
      );

    # Requests
    $x->{'ext_request'}{$request_num} = 
      [
       ["RenderQueryVersion", sub {
	    my $self = shift;
	    return pack("LL", 0, 8); # We suport version 0.8
	}, sub {
	    my $self = shift;
	    my($data) = @_;
	    my($major, $minor) = unpack("xxxxxxxxLLxxxxxxxxxxxxxxx",
					$data);
	    return ($major, $minor);
	}],
       ["RenderQueryPictFormats", sub {
	    my $self = shift;
	    return "";
	}, sub {
	    my $self = shift;
	    my($data) = @_;
	    my($num_formats, $num_screens, $num_depths, $num_visuals,
	       $num_subpixel) = unpack("xxxxxxxxLLLLLxxxx",
				       substr($data, 0, 32));
	    my(@formats, @screens, @subpixels);
	    my $index = 32;
	    for (0 .. $num_formats - 1) {
		push @formats, [unpack("LCCxxSSSSSSSSL",
				      substr($data, $index, 28))];
		$formats[$#formats][1] =
		  $self->interp('PictType', $formats[$#formats][1]);
		$index += 28;
	    }
	    for (0 .. $num_screens - 1) {
		my($ndepths, $fallback) =
		  unpack("LL", substr($data, $index, 8));
		$index += 8;
		my @depths;
		for (0 .. $ndepths - 1) {
		    my($depth, $nvisuals) =
		      unpack("CxSxxxx", substr($data, $index, 8));
		    $index += 8;
		    my @visuals;
		    for (0 .. $nvisuals - 1) {
			my($visual, $format) =
			  unpack("LL", substr($data, $index, 8));
			$index += 8;
			push @visuals, [$visual, $format];
		    }
		    push @depths, [$depth, @visuals];
		}
		push @screens, [$fallback, @depths];
	    }
	    for (0 .. $num_subpixel - 1) {
		my $sp = unpack("L", substr($data, $index, 4));
		$index += 4;
		$sp = $self->interp('SubPixel', $sp);
		push @subpixels, $sp;
	    }
	    return ([@formats], [@screens], [@subpixels]);
	}],
       ["RenderQueryPictIndexValues", sub {
	    my $self = shift;
	    my($format) = @_;
	    return pack("L", $format);
	}, sub {
	    my($self) = shift;
	    my($data) = @_;
	    my($num_vals) = unpack("xxxxxxxxLxxxxxxxxxxxxxxxxxxxx",
				   substr($data, 0, 32));
	    my @values;
	    for my $index (0 .. $num_vals - 1) {
		my($pixel, $r, $g, $b, $alpha) =\
		  unpack("LSSSS", substr($data, 32 + 12*$index, 12));
		push @values, [$index, $r, $g, $b, $alpha];
	    }
	    return @values;
	}],
       ["RenderQueryDithers", sub {
	    die "RenderQueryDithers is unspecified";
	}, sub {
	    die "RenderQueryDithers is unspecified";
	}],
       ["RenderCreatePicture", sub {
	    my $self = shift;
	    my($pid, $drawable, $format, %values) = @_;
	    my($mask, $i, @values);
	    for $i (0 .. 12) {
		if (exists $values{$Attributes_ValueMask[$i][0]}) {
		    $mask |= (1 << $i);
		    push @values, 
		      &{$Attributes_ValueMask[$i][1]}
			($self, $values{$Attributes_ValueMask[$i][0]});
		}
	    }
	    return pack("LLLL", $pid, $drawable, $format, $mask)
	      . join("", @values);
	}],
       ["RenderChangePicture", sub {
	    my $self = shift;
	    my($pid, %values) = @_;
	    my($mask, $i, @values);
	    for $i (0 .. 12) {
		if (exists $values{$Attributes_ValueMask[$i][0]}) {
		    $mask |= (1 << $i);
		    push @values, 
		      &{$Attributes_ValueMask[$i][1]}
			($self, $values{$Attributes_ValueMask[$i][0]});
		}
	    }
	    return pack("LL", $pid, $mask) . join("", @values);
	}],
       ["RenderSetPictureClipRectangles", sub {
	    my $self = shift;
	    my($picture, $x_origin, $y_origin, @rects) = @_;
	    my $r;
	    for $r (@rects) {
		$r = pack("ssSS", @$r);
	    }
	    return pack("Lss", $picture, $x_origin, $y_origin)
	      . join("", @rects);
	}],
       ["RenderFreePicture", sub {
	    my $self = shift;
	    my($picture) = @_;
	    return pack("L", $picture);
	}],
       ["RenderComposite", sub {
	    my $self = shift;
	    my($op, $src, $mask, $dst, $src_x, $src_y, $mask_x, $mask_y,
	       $dst_x, $dst_y, $width, $height) = @_;
	    $op = $self->num('PictOp', $op);
	    $mask = 0 if $mask eq "None";
	    return pack("CxxxLLLssssssSS", $op, $src, $mask, $dst,
			$src_x, $src_y, $mask_x, $mask_y,
			$dst_x, $dst_y, $width, $height);
	}],
       ["RenderScale", sub {
	    die "RenderScale is unspecified";
	}],
       ["RenderTrapezoids", sub {
	    my $self = shift;
	    my($op, $src, $src_x, $src_y, $dst, $mask_format, @traps) = @_;
	    $op = $self->num('PictOp', $op);
	    $mask_format = 0 if $mask_format eq "None";
	    my $trap;
	    for $trap (@traps) {
		my($top, $bottom, $lx1, $ly1, $lx2, $ly2,
		   $rx1, $ry1, $rx2, $ry2) = @$trap;
		$top *= 2**16; $bottom *= 2**16;
		$lx1 *= 2**16; $ly1 *= 2**16;
		$lx2 *= 2**16; $ly2 *= 2**16;
		$rx1 *= 2**16; $ry1 *= 2**16;
		$rx2 *= 2**16; $ry2 *= 2**16;
		$trap = pack("llllllllll", $top, $bottom,
			     $lx1, $ly1, $lx2, $ly2,
			     $rx1, $ry1, $rx2, $ry2);
	    }
	    return pack("CxxxLLLss", $op, $src, $dst, $mask_format,
			$src_x, $src_y) . join("", @traps);
	}],
       ["RenderTriangles", sub {
	    my $self = shift;
	    my($op, $src, $src_x, $src_y, $dst, $mask_format, @tris) = @_;
	    $op = $self->num('PictOp', $op);
	    $mask_format = 0 if $mask_format eq "None";
	    my $tri;
	    for $tri (@tris) {
		my($x1, $y1, $x2, $y2, $x3, $y3) = @$tri;
		$x1 *= 2**16; $y1 *= 2**16;
		$x2 *= 2**16; $y2 *= 2**16;
		$x3 *= 2**16; $y3 *= 2**16;
		$tri = pack("llllll", $x1, $y1, $x2, $y2, $x3, $y3);
	    }
	    return pack("CxxxLLLss", $op, $src, $dst, $mask_format,
			$src_x, $src_y) . join("", @tris);
	}],
       ["RenderTriStrip", sub {
	    my $self = shift;
	    my($op, $src, $src_x, $src_y, $dst, $mask_format, @points) = @_;
	    $op = $self->num('PictOp', $op);
	    $mask_format = 0 if $mask_format eq "None";
	    my $pt;
	    for $pt (@points) {
		my($x, $y) = @$pt;
		$x *= 2**16; $y *= 2**16;
		$pt = pack("ll", $x, $y);
	    }
	    return pack("CxxxLLLss", $op, $src, $dst, $mask_format,
			$src_x, $src_y) . join("", @points);
	}],
       ["RenderTriFan", sub {
	    my $self = shift;
	    my($op, $src, $src_x, $src_y, $dst, $mask_format, @points) = @_;
	    $op = $self->num('PictOp', $op);
	    $mask_format = 0 if $mask_format eq "None";
	    my $pt;
	    for $pt (@points) {
		my($x, $y) = @$pt;
		$x *= 2**16; $y *= 2**16;
		$pt = pack("ll", $x, $y);
	    }
	    return pack("CxxxLLLss", $op, $src, $dst, $mask_format,
			$src_x, $src_y) . join("", @points);
	}],
       ["RenderColorTrapezoids", sub {
	    die "RenderColorTrapezoids is unimplemented";
	    # Also unimplemented in the XFree86 server, BTW.
	}],
       ["RenderColorTriangles", sub {
	    # N.B. This is not implemented in XFree86 yet, so it will
	    # always give a BadImplementation error.
	    my $self = shift;
	    my($op, $dst, @color_tris) = @_;
	    $op = $self->num('PictOp', $op);
	    my $ct;
	    for $ct (@color_tris) {
		my($x1, $y1, $r1, $g1, $b1, $a1,
		   $x2, $y2, $r2, $g2, $b2, $a2,
		   $x3, $y3, $r3, $g3, $b3, $a3) = @$ct;
		$x1 *= 2**16; $y1 *= 2**16;
		$x2 *= 2**16; $y2 *= 2**16;
		$x3 *= 2**16; $y3 *= 2**16;
		$ct = pack("llSSSS llSSSS llSSSS",
			   $x1, $y1, $r1, $g1, $b1, $a1,
			   $x2, $y2, $r2, $g2, $b2, $a2,
			   $x3, $y3, $r3, $g3, $b3, $a3);
	    }
	    return pack("CxxxL", $op, $dst) . join("", @color_tris);
	}],
       ["RenderTransform", sub {
	    die "RenderTransform is unspecified " .
	      "(did you mean RenderSetPictureTransform?)";
	}],
       ["RenderCreateGlyphSet", sub {
	    my $self = shift;
	    my($gsid, $format) = @_;
	    return pack("LL", $gsid, $format);
	}],
       ["RenderReferenceGlyphSet", sub {
	    my $self = shift;
	    my($new, $existing) = @_;
	    return pack("LL", $new, $existing);
	}],
       ["RenderFreeGlyphSet", sub {
	    my $self = shift;
	    my($gsid) = @_;
	    return pack("L", $gsid);
	}],
       ["RenderAddGlyphs", sub {
	    my $self = shift;
	    my($gsid, @glyphs) = @_;
	    my $g;
	    my(@gids, @infos, @datas);
	    for $g (@glyphs) {
		my($id, $width, $height, $x, $y, $x_off, $y_off, $data) = @$g;
		push @gids, $id;
		push @infos, pack("SSssss", $width, $height, $x, $y,
				  $x_off, $y_off);
		push @datas, pack(padded($data), $data);
	    }
	    return pack("LLL*", $gsid, scalar @glyphs, @gids)
	      . join("", @infos) . join("", @datas);
	}],
       ["RenderAddGlyphsFromPicture", sub {
	    die "RenderAddGlyphsFromPicture is unimplemented";
	    # And the specification is broken, since it doesn't say
	    # which glyphs you're adding!
	}],
       ["RenderFreeGlyphs", sub {
	    my $self = shift;
	    my($gsid, @glyphs) = @_;
	    return pack("LL*", $gsid, @glyphs);
	}],
       ["RenderCompositeGlyphs8", sub {
	    my $self = shift;
	    my($op, $src, $dst, $mask_format, $glyphable, $src_x, $src_y,
	       @items) = @_;
	    $op = $self->num('PictOp', $op);
	    $mask_format = 0 if $mask_format eq "None";
	    my $it;
	    for $it (@items) {
		if (ref($it) eq "ARRAY") {
		    my($dx, $dy, $str) = @$it;
		    $it = pack("Cxxxss".padded($str), length($str),
			       $dx, $dy, $str);
		} else {
		    $it = pack("CxxxxxxxL", 255, $it);
		}
	    }
	    return pack("CxxxLLLLss", $op, $src, $dst, $mask_format,
			$glyphable, $src_x, $src_y) . join("", @items);
	}],
       ["RenderCompositeGlyphs16", sub {
	    my $self = shift;
	    my($op, $src, $dst, $mask_format, $glyphable, $src_x, $src_y,
	       @items) = @_;
	    $op = $self->num('PictOp', $op);
	    $mask_format = 0 if $mask_format eq "None";
	    my $it;
	    for $it (@items) {
		if (ref($it) eq "ARRAY") {
		    my($dx, $dy, $str) = @$it;
		    $it = pack("Cxxxss".padded($str), length($str)/2,
			       $dx, $dy, $str);
		} else {
		    $it = pack("CxxxxxxxL", 255, $it);
		}
	    }
	    return pack("CxxxLLLLss", $op, $src, $dst, $mask_format,
			$glyphable, $src_x, $src_y) . join("", @items);
	}],
       ["RenderCompositeGlyphs32", sub {
	    my $self = shift;
	    my($op, $src, $dst, $mask_format, $glyphable, $src_x, $src_y,
	       @items) = @_;
	    $op = $self->num('PictOp', $op);
	    $mask_format = 0 if $mask_format eq "None";
	    my $it;
	    for $it (@items) {
		if (ref($it) eq "ARRAY") {
		    my($dx, $dy, $str) = @$it;
		    $it = pack("Cxxxss".padded($str), length($str)/4,
			       $dx, $dy, $str);
		} else {
		    $it = pack("CxxxxxxxL", 255, $it);
		}
	    }
	    return pack("CxxxLLLLss", $op, $src, $dst, $mask_format,
			$glyphable, $src_x, $src_y) . join("", @items);
	}],
       ["RenderFillRectangles", sub {
	    my $self = shift;
	    my($op, $dst, $color, @rects) = @_;
	    $op = $self->num('PictOp', $op);
	    $color = pack("SSSS", @$color);
	    my $r;
	    for $r (@rects) {
		$r = pack("ssSS", @$r);
	    }
	    return pack("CxxxL", $op, $dst) . $color . join("", @rects);
	}],
       ["RenderCreateCursor", sub {
	    my $self = shift;
	    my($cid, $src, $x, $y) = @_;
	    return pack("LLSS", $cid, $src, $x, $y);
	}],
       ["RenderSetPictureTransform", sub {
	    my $self = shift;
	    my($pict, @trans) = @_;
	    my $trans = pack("l9", map($_ * 2**16, @trans));
	    return pack("L", $pict) . $trans;
	}],
       ["RenderQueryFilters", sub {
	    my $self = shift;
	    my($drawable) = @_;
	    return pack("L", $drawable);
	}, sub {
	    my $self = shift;
	    my($data) = @_;
	    my(@aliases, @filters);
	    my($num_al, $num_filt) =
	      unpack("xxxxxxxxLLxxxxxxxxxxxxxxxx", substr($data, 0, 32));
	    my $index = 32;
	    for (0 .. $num_al - 1) {
		my $alias = unpack("S", substr($data, $index, 2));
		$index += 2;
		push @aliases, $alias;
	    }
	    $index += padding($index);
	    for (0 .. $num_filt) {
		my $len = unpack("C", substr($data, $index, 1));
		$index++;
		my $str = substr($data, $index, $len);
		$index += $len;
		push @filters, $str;
	    }
	    return ([@filters], [@aliases]);
	}],
       ["RenderSetPictureFilter", sub {
	    my $self = shift;
	    my($picture, $filter, @args) = @_;
	    return pack("LSxx".padded($filter)."L*", $picture, length($filter),
			$filter, map($_ * 2**16, @args));
	}],
       ["RenderCreateAnimCursor", sub {
	    my $self = shift;
	    my($cid, @frames) = @_;
	    my $fr;
	    for $fr (@frames) {
		$fr = pack("LL", @$fr);
	    }
	    return pack("L", $cid) . join("", @frames);
	}],
      ];
    my($i);
    for $i (0 .. $#{$x->{'ext_request'}{$request_num}}) {
	$x->{'ext_request_num'}{$x->{'ext_request'}{$request_num}[$i][0]} =
	  [$request_num, $i];
    }
    ($self->{'major'}, $self->{'minor'})
      = $x->req('RenderQueryVersion', 0, 8);
    if ($self->{'major'} != 0) {
	carp "Wrong RENDER version ($self->{'major'} != 0)";
	return 0;
    }
    return bless $self, $pkg;
}

1;
__END__

=head1 NAME

X11::Protocol::Ext::RENDER - Perl module for the X Rendering Extension

=head1 SYNOPSIS

  use X11::Protocol;
  $x = X11::Protocol->new($ENV{'DISPLAY'});
  $x->init_extension('RENDER') or die;

=head1 DESCRIPTION

The RENDER extension adds a new set of drawing primitives which
effectively represent a replacement of the drawing routines in the
core protocol, redesigned based on the needs of more modern
clients. It adds long-desired features such as subpixel positioning,
alpha compositing, direct specification of colors, and multicolored or
animated cursors. On the other hand, it omits features that are no
longer commonly used: wide lines, arbitrary polygons (only triangles
and horizontally-aligned trapezoids are supported), ellipses, bitwise
rendering operations, and server-side fonts (in favor of "glyphs" that
are rendered on the client side and transmitted once).

As of this writing (early 2004), the specification and implementation
both have rough edges, but there are relatively few alternatives for
offloading fancy graphics processing to the server, as is necessary
over slow links or if the client is written in a slow
language. Another possibility you might consider is the 2D subset of
OpenGL, though it doesn't yet have an X11::Protocol-compatible
interface.

=head1 SYMBOLIC CONSTANTS

This extension adds the constant types 'PictType', 'PictOp',
'SubPixel', 'PolyEdge', and 'PolyMode', with values as defined in the
standard.

=head1 REQUESTS

This extension adds several requests, called as shown below:

  $x->RenderQueryVersion($major, $minor)
  =>
  ($major, $minor)

  $x->RenderQueryPictFormats()
  =>
  ([[$id, $type, $depth,
     $red, $red_m, $green, $green_m, $blue, $blue_m,
     $alpha, $alpha_m, $cmap], ...],
   [[$fallback, [$depth, [$visual, $format], ...], ...], ...],
   [$subpixel, ...])

  $x->RenderQueryPictIndexValues($pict_format)
  =>
  ([$index, $red, $green, $blue, $alpha], ...)

  $x->RenderQueryFilters($drawable)
  =>
  ([@filters], [@aliases])

  $x->RenderCreatePicture($picture, $drawable, $format,
                          'attribute' => $value, ...)

  $x->RenderChangePicture($picture, 'attribute' => $value, ...)

  $x->RenderSetPictureClipRectangles($pic, $x_origin, $y_origin,
                                     [$x, $y, $width, $height], ...)

  $x->RenderSetPictureTransform($pict, $m11, $m12, $m13,
                                       $m21, $m22, $m23,
                                       $m31, $m32, $m33);

  $x->RenderSetPictureFilter($pict, $filter, @args)

  $x->RenderComposite($op, $src, $mask, $dst, $src_x, $src_y,
                      $mask_x, $mask_y, $dst_x, $dst_y,
                      $width, $height)

  $x->RenderFillRectangles($op, $dst, [$red, $green, $blue, $alpha],
                           [$x, $y, $width, $height], ...)

  $x->RenderTrapezoids($op, $src, $src_x, $src_y, $dst, $mask_format,
                       [$top, $bottom, $lx1, $ly1, $lx2, $ly2,
                                       $rx1, $ry1, $rx2, $ry2] ,...)

  $x->RenderTriangles($op, $src, $src_x, $src_y, $dst, $mask_format,
                      [$x1, $y1, $x2, $y2, $x3, $y3])

  $x->RenderTriStrip($op, $src, $src_x, $src_y, $dst, $mask_format,
                      [$x, $y], [$x, $y], [$x, $y], [$x, $y], ...)

  $x->RenderTriFan($op, $src, $src_x, $src_y, $dst, $mask_format,
                   [$x, $y], [$x, $y], [$x, $y], [$x, $y], ...)

  $x->RenderCreateGlyphSet($gsid, $format)

  $x->RenderReferenceGlyphSet($gsid, $existing)

  $x->RenderFreeGlyphSet($gsid)

  $x->RenderAddGlyphs($gsid, [$glyph, $width, $height,
                              $x, $y, $x_off, $y_off, $data], ...)

Warning: with some server implementations (including XFree86 through 4.4)
passing more than one glyph to AddGlyphs can hang or crash the server.
So don't do that.

  $x->RenderFreeGylphs($gsid, @glyphs)

  $x->RenderCompositeGlyphs8($op, $src, $dst, $mask_format, $gsid,
                             $src_x, $src_y,
                             [$delta_x, $delta_y, $str], ...)

  $x->RenderCompositeGlyphs16($op, $src, $dst, $mask_format, $gsid,
                              $src_x, $src_y,
                              [$delta_x, $delta_y, $str], ...)

  $x->RenderCompositeGlyphs32($op, $src, $dst, $mask_format, $gsid,
                              $src_x, $src_y,
                              [$delta_x, $delta_y, $str], ...)

In these three requests, new GlyphSetIDs can also be interspersed with
the array references.

  $x->RenderCreateCursor($cid, $source, $hot_x, $hot_y)

  $x->RenderCreateAnimCursor($cid, [$cursor, $delay], ...)

=head1 AUTHOR

Stephen McCamant <SMCCAM@cpan.org>.

=head1 SEE ALSO

L<perl(1)>,
L<X11::Protocol>,
I<The X Rendering Extension (XFree86 draft standard)>.

=cut