nanogui: save image in file
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