nanogui: Thread: save image in file


[<<] [<] Page 1 of 1 [>] [>>]
Subject: save image in file
From: pushparaj muthu ####@####.####
Date: 26 Nov 2007 15:02:02 +0000
Message-Id: <1196089314.474adfe27420f@mail.sify.com>

Hi 

I have created image on window by using Grlines nano -X API . I wanted to save image from window to  particular file . 


As per carlo mail dated on 14 wed 2007

I have enabled LINK_APP_INTO_SERVER  =Y 
and also  used two API GrNewPixmap and GrCopyArea  in my code

I could not able to save image in  file

Herewith my code 

void SaveFileFunction(void )
{
        
        void  *localbuf;

        localbuf = malloc(480000);
        
        if(!localbuf)
        {
               printf("\n Could not allocate memory \n");
               exit(0);
        }
       
	filefd      = open ("testfile.bmp", O_RDWR);
	if (filefd <= 0)
	{
        	printf ("\n Unable to open the current  file \n");
        	exit(0);
   	}
   	
        mapid = GrNewPixmap(600,800 , localbuf);
        
        GrCopyArea(w,gc,0,0,600,800,mapid,0,0,MWROP_SRCCOPY);
         
   	writecont  = write (filefd,(void *)localbuf, sizeof(localbuf));
   
   	if (writecont <= 0)
  	{
        	printf ("\n Unable to write content \n");
        	exit(0);
        }
        free(localbuf); 

        close (filefd);
}
 

Pls do point any mistake i have made .

Regards
Pushparaj

Subject: Re: [nanogui] save image in file
From: "Greg Haerr" ####@####.####
Date: 27 Nov 2007 20:23:44 +0000
Message-Id: <101a01c83133$6c451920$0300a8c0@RDP>

: I have created image on window by using Grlines nano -X API . I wanted to 
save image from window to  particular file .

Your routine leaves much to be desired.  There's already
a routine in nano-X that allows saving the screen into
a .bmp format file, see engine/devopen.c::GdCaptureScreen().

In addition, this function is called to create screen.bmp whenever
the PRINT screen key is pressed, provided you're running the
TTYSCAN driver in your config file (required to identify
the print screen key from its scan code)

Regards,

Greg


[<<] [<] Page 1 of 1 [>] [>>]


Powered by ezmlm-browse 0.20.