summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authordscho <dscho>2003-02-10 14:16:32 +0000
committerdscho <dscho>2003-02-10 14:16:32 +0000
commitbd9e5747e514ad33adc050a81dc4ff09a2a188e7 (patch)
tree6308f06e021f3956b176068d5c273b413feeba63 /examples
parent4a1355d13cceb68c84917b3022ee02f3af16610a (diff)
downloadlibtdevnc-bd9e5747e514ad33adc050a81dc4ff09a2a188e7.tar.gz
libtdevnc-bd9e5747e514ad33adc050a81dc4ff09a2a188e7.zip
added colourmapexample; fixed LinuxVNC to show the right colours
Diffstat (limited to 'examples')
-rw-r--r--examples/.cvsignore2
-rw-r--r--examples/Makefile.am2
-rw-r--r--examples/colourmaptest.c32
3 files changed, 34 insertions, 2 deletions
diff --git a/examples/.cvsignore b/examples/.cvsignore
index 7aab2d4..61a17ba 100644
--- a/examples/.cvsignore
+++ b/examples/.cvsignore
@@ -9,4 +9,4 @@ storepasswd
vncev
Makefile.in
.deps
-
+colourmaptest
diff --git a/examples/Makefile.am b/examples/Makefile.am
index 6875c21..c7635f5 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -10,7 +10,7 @@ endif
noinst_HEADERS=radon.h
noinst_PROGRAMS=example pnmshow regiontest pnmshow24 fontsel \
- vncev storepasswd $(BACKGROUND_TEST) $(MAC)
+ vncev storepasswd colourmaptest $(BACKGROUND_TEST) $(MAC)
LDADD = -L.. -lvncserver
diff --git a/examples/colourmaptest.c b/examples/colourmaptest.c
new file mode 100644
index 0000000..1e03f9e
--- /dev/null
+++ b/examples/colourmaptest.c
@@ -0,0 +1,32 @@
+#include "rfb.h"
+
+
+int main(int argc,char** argv)
+{
+ int i;
+ uint8_t bytes[256*3];
+
+ rfbScreenInfoPtr server=rfbGetScreen(&argc,argv,256,256,8,1,1);
+
+ server->rfbServerFormat.trueColour=FALSE;
+ server->colourMap.count=256;
+ server->colourMap.is16=FALSE;
+ for(i=0;i<256;i++) {
+ bytes[i*3+0]=255-i; /* red */
+ bytes[i*3+1]=0; /* green */
+ bytes[i*3+2]=i; /* blue */
+ }
+ bytes[128*3+0]=0xff;
+ bytes[128*3+1]=0;
+ bytes[128*3+2]=0;
+ server->colourMap.data.bytes=bytes;
+
+ server->frameBuffer=malloc(256*256);
+ for(i=0;i<256*256;i++)
+ server->frameBuffer[i]=(i/256);
+
+ rfbInitServer(server);
+ rfbRunEventLoop(server,-1,FALSE);
+
+ return(0);
+}