1 <!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4 <!-- Copyright 2008 Google Inc. All rights reserved. -->
6 <title> SRPC Display Shared Memory Example
</title>
7 <script type='application/x-javascript'
>
19 // The page begins by saving the display shared memory object.
20 var Init = function() {
21 // Get the plugin element.
22 plugin = document.getElementById('nacl');
23 // Save the geometry parameters.
24 height = plugin.height;
26 al_elt = document.getElementById('al');
27 rd_elt = document.getElementById('rd');
28 gr_elt = document.getElementById('gr');
29 bl_elt = document.getElementById('bl');
30 // Get the plugin's display shared memory object.
31 dpy = plugin.__displayShm;
34 // set the default color.
38 var setColor = function(str) {
40 var pixmap_size = height * width;
42 for (i = 0; i < pixmap_size; i++) {
45 dpy.write(0, pixmap_size * 4, pixmap);
49 var changeColor = function() {
50 var alpha = parseInt(al_elt.value);
51 var red = parseInt(rd_elt.value);
52 var green = parseInt(gr_elt.value);
53 var blue = parseInt(bl_elt.value);
54 var color = String.fromCharCode(blue, green, red, alpha);
60 <body onload=
"Init();">
61 <h1> SRPC Display Shared Memory Example
</h1>
62 <table summary=
"A colored box with ARGB inputs">
65 <embed height=
256 width=
256 type=
"application/x-nacl-srpc"
69 <table summary=
"ARGB settings for controlling the color of the box">
71 <td align=right
> Alpha
</td>
73 <input type=
"text" id=
"al" />
77 <td align=right
> Red
</td>
79 <input type=
"text" id=
"rd" />
83 <td align=right
> Green
</td>
85 <input type=
"text" id=
"gr" />
89 <td align=right
> Blue
</td>
91 <input type=
"text" id=
"bl" />
99 <button type=
"button" onclick=
"changeColor()">