nanogui: Re: server background]
Subject:
[Fwd: Re: [nanogui] server background]
From:
Roberto ####@####.####
Date:
18 Dec 2006 20:21:54 +0000
Message-Id: <4586F827.4090403@tnw2000.org>
Hi Jr,
I played a little with your problem. You may create a pixmap and use
GrSetBackgroundPixmap to map it to the GR_ROOT_WINDOW_ID.
You may try this code:
#include <microwin/nano-X.h>
int main(int argc, char** argv)
{
GR_SCREEN_INFO si;
GR_GC_ID gc;
if (GrOpen() < 0)
return -1;
//get screen info and gc
GrGetScreenInfo(&si);
gc = GrNewGC();
//create pixmap and image
GR_WINDOW_ID pid = GrNewPixmap(si.cols,si.rows,0);
GR_IMAGE_ID imageid = GrLoadImageFromFile("background.gif", 0);
//draw the image to the pixmap
GrDrawImageToFit(pid,gc,0,0,si.cols, si.rows, imageid);
//destreoy all the stuff not needed any more
GrFreeImage(imageid);
GrDestroyGC(gc);
//set it to the root windows backgound
GrSetBackgroundPixmap (GR_ROOT_WINDOW_ID,pid,0);
GrClearWindow(GR_ROOT_WINDOW_ID,GR_TRUE);
//select close event
GR_EVENT event; /* current event */
GrSelectEvents(GR_ROOT_WINDOW_ID, GR_EVENT_MASK_CLOSE_REQ);
//wait until server shuts down
while(1)
{
GrCheckNextEvent(&event);
if(event.type == GR_EVENT_TYPE_CLOSE_REQ)
break;
}
GrClose();
}
Junior wrote:
>Hi All,
>How do I change the nanoX background to an image instead of a colour?
>
>Thanks,
>--Jr.
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: ####@####.####
>For additional commands, e-mail: ####@####.####
>
>
>
>