Home | History | Annotate | Download | only in examples
      1 /* This example shows how to use 15-bit (which is handled as 16-bit
      2    internally). */
      3 
      4 #include <rfb/rfb.h>
      5 
      6 int main(int argc,char** argv)
      7 {
      8   int i,j;
      9   uint16_t* f;
     10 
     11   rfbScreenInfoPtr server=rfbGetScreen(&argc,argv,400,300,5,3,2);
     12   if(!server)
     13     return 0;
     14   server->frameBuffer=(char*)malloc(400*300*2);
     15   f=(uint16_t*)server->frameBuffer;
     16   for(j=0;j<300;j++)
     17     for(i=0;i<400;i++)
     18       f[j*400+i]=/* red */ ((j*32/300) << 10) |
     19 		 /* green */ (((j+400-i)*32/700) << 5) |
     20 		 /* blue */ ((i*32/400));
     21 
     22   rfbInitServer(server);
     23   rfbRunEventLoop(server,-1,FALSE);
     24   return(0);
     25 }
     26