Forums | developer.brewmp.com Forums | developer.brewmp.com

Developer

Forums

Forums:

void capure_image(rotate* pMe)
{
AEEBitmapInfo info;
if(SUCCESS == IDISPLAY_GetDeviceBitmap(pMe->a.m_pIDisplay, &pMe->pIBitmap))
{
DBGPRINTF("1.........");
IBITMAP_GetInfo(pMe->pIBitmap,&info,sizeof(AEEBitmapInfo));
if(SUCCESS !=IBITMAP_CreateCompatibleBitmap(pMe->pIBitmap,&pMe->po,(int16)info.cx,(int16)info.cy))
return;
IBITMAP_Release(pMe->pIBitmap);
DBGPRINTF("2.........");
if(pMe->po)
{
if(SUCCESS !=IBITMAP_BltIn(pMe->po, 0,0, info.cx,info.cy,pMe->pIBitmap,0,0, AEE_RO_COPY))
return;
DBGPRINTF("4.........");
if(SUCCESS !=IBITMAP_QueryInterface(pMe->po,AEECLSID_DIB,(void**)&pMe->pDib))
return;
IBITMAP_Release(pMe->po);
DBGPRINTF("5.........");
pMe->RawBuffer = (byte*) MALLOC ((info.cx*info.cy*2)+1);
MEMCPY(pMe->RawBuffer,pMe->pDib->pBmp,(info.cx*info.cy*2));
DBGPRINTF("after copying file");
{
IFileMgr *pIfilemgr=NULL;
IFile *pIfile=NULL;
uint16 result=0;

ISHELL_CreateInstance(pMe->a.m_pIShell,AEECLSID_FILEMGR,(void **)&pIfilemgr);
if (pIfilemgr)
{
if (IFILEMGR_Test(pIfilemgr,"fs:/~/recentsearch.bmp")==SUCCESS)
{
IFILEMGR_Remove(pIfilemgr,"fs:/~/recentsearch.bmp");
}
}
if (IFILEMGR_Test(pIfilemgr,"fs:/~/recentsearch.bmp")!=SUCCESS)
{
DBGPRINTF("in image file creation");
pIfile=IFILEMGR_OpenFile(pIfilemgr,"fs:/~/recentsearch.bmp",_OFM_CREATE);
IFILE_Write(pIfile,pMe->RawBuffer,(info.cx*info.cy*2));
DBGPRINTF("no of bytes written is %d",result);
}
if (pIfile)
{
IFILE_Release(pIfile);
pIfile=NULL;
}

}
}
}

DBGPRINTF("6.........");
IDIB_Release(pMe->pDib);
FREEIF(pMe->RawBuffer);

the above code is not working for me to capture a screen shot, is there anything im missing?

pMe->pDib->pBmp is a invalid pointer in my case? garbage value in it..

am i overlooking smething here...
please reply anyone........

am i overlooking smething here...
please reply anyone........

Can you explain what you are trying to do exactly ? There seems to be a lot of manipulation going on with the DIB.

Can you explain what you are trying to do exactly ? There seems to be a lot of manipulation going on with the DIB.

ash_123 wrote:Can you explain what you are trying to do exactly ?
trying to capture screen diplsay and put it into a file....
ash_123 wrote:
There seems to be a lot of manipulation going on with the DIB.
i dint get u?

ash_123 wrote:Can you explain what you are trying to do exactly ?
trying to capture screen diplsay and put it into a file....
ash_123 wrote:
There seems to be a lot of manipulation going on with the DIB.
i dint get u?

DIB itself is a Bitmap.
Dib->pBMp points to the top row
try using IDIB_TO_IBITMAP() instead of pdib->bmp

DIB itself is a Bitmap.
Dib->pBMp points to the top row
try using IDIB_TO_IBITMAP() instead of pdib->bmp

ash_123 wrote:DIB itself is a Bitmap.
Dib->pBMp points to the top row
try using IDIB_TO_IBITMAP() instead of pdib->bmp
i dont want to get again a bitmap pointer, im trying to copy the data from top row of the bitmap
(info.cx*info.cy*2)-----> this gives me the size of the data to copy
here im copying value to a buffer so that to write it into a file
pMe->RawBuffer = (byte*) MALLOC ((info.cx*info.cy*2)+1); MEMCPY(pMe->RawBuffer,pMe->pDib->pBmp,(info.cx*info.cy*2));

ash_123 wrote:DIB itself is a Bitmap.
Dib->pBMp points to the top row
try using IDIB_TO_IBITMAP() instead of pdib->bmp
i dont want to get again a bitmap pointer, im trying to copy the data from top row of the bitmap
(info.cx*info.cy*2)-----> this gives me the size of the data to copy
here im copying value to a buffer so that to write it into a file
pMe->RawBuffer = (byte*) MALLOC ((info.cx*info.cy*2)+1); MEMCPY(pMe->RawBuffer,pMe->pDib->pBmp,(info.cx*info.cy*2));

hi anyone can help me here,oceans,max.......
im looking for sme idea....

hi anyone can help me here,oceans,max.......
im looking for sme idea....

ash_123 wrote:DIB itself is a Bitmap.
Dib->pBMp points to the top row
try using IDIB_TO_IBITMAP() instead of pdib->bmp
ok as said if i do,i get a bitmap pointer i dunt understand how this helps me to put this to a file(first time im working on bitmap pointer), i need image file of my current display...
can u suggest something??
wat i was doing by having (Dib->pBMp points to the top row) is to copy the data from first row and put that into a buffer... but in my case to use
1.IDIB_TO_IBITMAP()
2.or copy to buffer
im getting invalid data in Dib :confused:

ash_123 wrote:DIB itself is a Bitmap.
Dib->pBMp points to the top row
try using IDIB_TO_IBITMAP() instead of pdib->bmp
ok as said if i do,i get a bitmap pointer i dunt understand how this helps me to put this to a file(first time im working on bitmap pointer), i need image file of my current display...
can u suggest something??
wat i was doing by having (Dib->pBMp points to the top row) is to copy the data from first row and put that into a buffer... but in my case to use
1.IDIB_TO_IBITMAP()
2.or copy to buffer
im getting invalid data in Dib :confused:

If any one interested, I will post the code for the same, that uses IBITMAP_GetPixel() API.
Using this one can save 8 bit(5-6-5) color as well as gray scale device screen bmp files.
On V3C, it save a 176x205 device screenshot in 350ms(The code is not optimized).

If any one interested, I will post the code for the same, that uses IBITMAP_GetPixel() API.
Using this one can save 8 bit(5-6-5) color as well as gray scale device screen bmp files.
On V3C, it save a 176x205 device screenshot in 350ms(The code is not optimized).

Brewin wrote:If any one interested, I will post the code for the same, that uses IBITMAP_GetPixel() API.
please post the code ill have a look
Thanks

Brewin wrote:If any one interested, I will post the code for the same, that uses IBITMAP_GetPixel() API.
please post the code ill have a look
Thanks

Below is a generic way of saving a device screen in bmp format...
Note: (Image width * bits per pixel) % 32 == 0
Else one should add the padding bits to each scan line i.e. for each row to make it a 32bit boundary alignment.
Suppose you are saving a 9x10 image then each scan line is 24bits short to say it to be a 32bit boundary aligned. (9*8=72%32=8 i.e. 32-8=24 short, that means, 10x24=240 padding bits will be added to your overall image, 24 bits per row.)
:cool: :cool: Quote:
typedef struct bmp_file_header _bmpheader;
struct bmp_file_header {
// unsigned short type; // Deleted for safe copying....
unsigned long size;
unsigned long reserved;
unsigned long bitmap_offset;
unsigned long header_size;
signed long width;
signed long height;
unsigned short planes;
unsigned short bits_per_pixel;
unsigned long compression;
unsigned long bitmap_size;
signed long horizontal_resolution;
signed long vertical_resolution;
unsigned long num_colors;
unsigned long num_important_colors;
;
typedef union _test{
byte a[4];
unsigned short b[2];
unsigned long c;
}test;
#define NATIVE_5BIT(x) (uint8)((x*122)/1000)
#define NATIVE_6BIT(x) (uint8)((x*248)/1000)
#define FIVEBIT_8BIT(x) (uint8)((x*10000)/1215)
#define SIXBIT_8BIT(x) (uint8)((x*1000)/247)
typedef union _mynative
{
unsigned short color;
struct{
unsigned short B:5; // 31 - 255 == 0.122
unsigned short G:6; // 63 - 255 == 0.248
unsigned short R:5; // 31 - 255 == 0.122
stct;
mynative;
void saveScreenshot(Myapp *pMe)
{
_bmpheader bmpfile;
uint32 *psaveplatte;
IBitmap *pIBitmap=NULL;
IFile *pIfile=NULL;
test test;
AEEPoint pPoint;
mynative native;
int i=0,j=0;
uint8 nocolors=0;
byte *temp;
byte *pdata;
bmpfile.reserved=0;
bmpfile.header_size=40;
bmpfile.width=176;
bmpfile.height=205;
bmpfile.planes = 1;
bmpfile.bits_per_pixel = 8;
bmpfile.compression=0;
bmpfile.bitmap_size=0;
bmpfile.horizontal_resolution=0;
bmpfile.vertical_resolution=0;
IDISPLAY_GetDeviceBitmap(pMe->a.m_pIDisplay, &pIBitmap);
psaveplatte=(uint32 *)MALLOC(256*sizeof(uint32));
pdata=(byte*)MALLOC(176*205);
temp=pdata;
for(i=204;i>=0;i--) // One can rotate the image in all four directions by changing i and j.
for(j=0;j<176;j++) // 1. i=0 to i<205; 2. j=175 to j>=0; 3. 1 and j=0 to j<176;
{ // 4. The above one which isin normal position....
pPoint.x=j;
pPoint.y=i;
IBITMAP_GetPixel(pIBitmap,j,i,(uint32 *)&native.color);
test.a[0]=FIVEBIT_8BIT(native.stct.B);
test.a[1]=SIXBIT_8BIT(native.stct.G);
test.a[2]=FIVEBIT_8BIT(native.stct.R);
test.a[3]=0;
/********** Gray scale Implementation..... ***************/
/*
// 1st Method.......
test.c=( .30* test.a[2] + .11 * test.a[1] + .59 * test.a[0]) / 1000
// 2nd method.....
test.c=(77 * test.a[2] + 150 * test.a[1] + 28 * test.a[0]) / 255;
// 3nd Method......
test.c=(222 * test.a[2] + 707 * test.a[1] + 71 * test.a[0]) / 1000
// Note that the three formulas lead to different results, however none is better or more correct than the other!
*/
{
int k=0;
for(;kpIFileMgr,"screenshot.bmp",_OFM_CREATE);
if(pIfile)
{ // This takes 170ms to write into a file on V3C....one can implement all the below in a single write....
IFILE_Write(pIfile,"BM",2);
IFILE_Write(pIfile,&bmpfile,52);
IFILE_Write(pIfile,psaveplatte,nocolors*4);
IFILE_Write(pIfile,pdata,bmpfile.width*bmpfile.height);
IFILE_Release(pIfile);
pIfile=NULL;
}
if(psaveplatte)
{
FREE(psaveplatte);
psaveplatte=NULL;
}
if(pdata)
{
FREE(pdata);
pdata=NULL;
}
if(pIBitmap)
{
IBITMAP_Release(pIBitmap);
pIBitmap=NULL;
}

:) :)

Below is a generic way of saving a device screen in bmp format...
Note: (Image width * bits per pixel) % 32 == 0
Else one should add the padding bits to each scan line i.e. for each row to make it a 32bit boundary alignment.
Suppose you are saving a 9x10 image then each scan line is 24bits short to say it to be a 32bit boundary aligned. (9*8=72%32=8 i.e. 32-8=24 short, that means, 10x24=240 padding bits will be added to your overall image, 24 bits per row.)
:cool: :cool: Quote:
typedef struct bmp_file_header _bmpheader;
struct bmp_file_header {
// unsigned short type; // Deleted for safe copying....
unsigned long size;
unsigned long reserved;
unsigned long bitmap_offset;
unsigned long header_size;
signed long width;
signed long height;
unsigned short planes;
unsigned short bits_per_pixel;
unsigned long compression;
unsigned long bitmap_size;
signed long horizontal_resolution;
signed long vertical_resolution;
unsigned long num_colors;
unsigned long num_important_colors;
;
typedef union _test{
byte a[4];
unsigned short b[2];
unsigned long c;
}test;
#define NATIVE_5BIT(x) (uint8)((x*122)/1000)
#define NATIVE_6BIT(x) (uint8)((x*248)/1000)
#define FIVEBIT_8BIT(x) (uint8)((x*10000)/1215)
#define SIXBIT_8BIT(x) (uint8)((x*1000)/247)
typedef union _mynative
{
unsigned short color;
struct{
unsigned short B:5; // 31 - 255 == 0.122
unsigned short G:6; // 63 - 255 == 0.248
unsigned short R:5; // 31 - 255 == 0.122
stct;
mynative;
void saveScreenshot(Myapp *pMe)
{
_bmpheader bmpfile;
uint32 *psaveplatte;
IBitmap *pIBitmap=NULL;
IFile *pIfile=NULL;
test test;
AEEPoint pPoint;
mynative native;
int i=0,j=0;
uint8 nocolors=0;
byte *temp;
byte *pdata;
bmpfile.reserved=0;
bmpfile.header_size=40;
bmpfile.width=176;
bmpfile.height=205;
bmpfile.planes = 1;
bmpfile.bits_per_pixel = 8;
bmpfile.compression=0;
bmpfile.bitmap_size=0;
bmpfile.horizontal_resolution=0;
bmpfile.vertical_resolution=0;
IDISPLAY_GetDeviceBitmap(pMe->a.m_pIDisplay, &pIBitmap);
psaveplatte=(uint32 *)MALLOC(256*sizeof(uint32));
pdata=(byte*)MALLOC(176*205);
temp=pdata;
for(i=204;i>=0;i--) // One can rotate the image in all four directions by changing i and j.
for(j=0;j<176;j++) // 1. i=0 to i<205; 2. j=175 to j>=0; 3. 1 and j=0 to j<176;
{ // 4. The above one which isin normal position....
pPoint.x=j;
pPoint.y=i;
IBITMAP_GetPixel(pIBitmap,j,i,(uint32 *)&native.color);
test.a[0]=FIVEBIT_8BIT(native.stct.B);
test.a[1]=SIXBIT_8BIT(native.stct.G);
test.a[2]=FIVEBIT_8BIT(native.stct.R);
test.a[3]=0;
/********** Gray scale Implementation..... ***************/
/*
// 1st Method.......
test.c=( .30* test.a[2] + .11 * test.a[1] + .59 * test.a[0]) / 1000
// 2nd method.....
test.c=(77 * test.a[2] + 150 * test.a[1] + 28 * test.a[0]) / 255;
// 3nd Method......
test.c=(222 * test.a[2] + 707 * test.a[1] + 71 * test.a[0]) / 1000
// Note that the three formulas lead to different results, however none is better or more correct than the other!
*/
{
int k=0;
for(;kpIFileMgr,"screenshot.bmp",_OFM_CREATE);
if(pIfile)
{ // This takes 170ms to write into a file on V3C....one can implement all the below in a single write....
IFILE_Write(pIfile,"BM",2);
IFILE_Write(pIfile,&bmpfile,52);
IFILE_Write(pIfile,psaveplatte,nocolors*4);
IFILE_Write(pIfile,pdata,bmpfile.width*bmpfile.height);
IFILE_Release(pIfile);
pIfile=NULL;
}
if(psaveplatte)
{
FREE(psaveplatte);
psaveplatte=NULL;
}
if(pdata)
{
FREE(pdata);
pdata=NULL;
}
if(pIBitmap)
{
IBITMAP_Release(pIBitmap);
pIBitmap=NULL;
}

:) :)

Hi brewin,
with the above code a bmp file of 36kb is generated but no preview is available for it, i chkd it in v3c device and devpkg emulator..
edited..
one more thing i noticed is when i debuged in emulator i always
get for all the pixels, the value of
IBITMAP_GetPixel(pIBitmap,j,i,(uint32 *)&native.color);
//for all pixels constant value
native.color=65535
test.a[0]=255//B
test.a[3]=255//G
test.a[2]=255//R

Hi brewin,
with the above code a bmp file of 36kb is generated but no preview is available for it, i chkd it in v3c device and devpkg emulator..
edited..
one more thing i noticed is when i debuged in emulator i always
get for all the pixels, the value of
IBITMAP_GetPixel(pIBitmap,j,i,(uint32 *)&native.color);
//for all pixels constant value
native.color=65535
test.a[0]=255//B
test.a[3]=255//G
test.a[2]=255//R

Are u using 1. IDISPLAY returned IBITMAP or 2. ICAMERA returned IBITMAP????
1st will work.
2nd will not work..
The code is only for saving an image already displayed on the screen.
replace all the following...
Quote:
unsigned long or signed long ----- uint32
unsigned short ----- uint16
#define 5BIT_8BIT ------- #define FIVEBIT_8BIT
#define 6BIT_8BIT ------- #define SIXBIT_8BIT
Before calling the function, make sure to call IDISPLAY_Update.
The code is working fine, I have checked on emulator, V3C, samsung NX1.

Are u using 1. IDISPLAY returned IBITMAP or 2. ICAMERA returned IBITMAP????
1st will work.
2nd will not work..
The code is only for saving an image already displayed on the screen.
replace all the following...
Quote:
unsigned long or signed long ----- uint32
unsigned short ----- uint16
#define 5BIT_8BIT ------- #define FIVEBIT_8BIT
#define 6BIT_8BIT ------- #define SIXBIT_8BIT
Before calling the function, make sure to call IDISPLAY_Update.
The code is working fine, I have checked on emulator, V3C, samsung NX1.

im using the first...
i changed as u suggested but still no result im not getting preview but the file size is 35kb :confused:
can u suggest me something based on my last post i mean the value remains same for all pixel returned by ibitmapgetpixel api

im using the first...
i changed as u suggested but still no result im not getting preview but the file size is 35kb :confused:
can u suggest me something based on my last post i mean the value remains same for all pixel returned by ibitmapgetpixel api

65535 is white, so that means you should atleast get pure white color image..
Can you post the saved bmp image and actual image you have displayed on the screen.

65535 is white, so that means you should atleast get pure white color image..
Can you post the saved bmp image and actual image you have displayed on the screen.

65535 yeah iknow its whit ,but im not getting white preview even.
here is the code...
//display image
case EVT_APP_START:
{
IImage *pImage=ISHELL_LoadImage(pMe->a.m_pIShell,"test1.bmp");
IIMAGE_Draw(pImage,10,10);
IDISPLAY_Update(pMe->a.m_pIDisplay);

return(TRUE);
//capture based on any event
void saveScreenshot(rotate *pMe)
{
rotate bmpfile;
uint32 *psaveplatte;
IFileMgr*pIFileMgr=NULL;
IFile *pIfile=NULL;
test test;
AEEPoint pPoint;
mynative native;
int i=0,j=0;
uint8 nocolors=0;
byte *temp;
byte *pdata;
bmpfile.reserved=0;
bmpfile.header_size=40;
bmpfile.width=pMe->DeviceInfo.cxScreen;
bmpfile.height=pMe->DeviceInfo.cyScreen;
bmpfile.planes = 1;
bmpfile.bits_per_pixel = 8;
bmpfile.compression=0;
bmpfile.bitmap_size=0;
bmpfile.horizontal_resolution=0;
bmpfile.vertical_resolution=0;
IDISPLAY_GetDeviceBitmap(pMe->a.m_pIDisplay, &pMe->pIBitmap);
psaveplatte=(uint32 *)MALLOC(256*sizeof(uint32));
pdata=(byte*)MALLOC(176*205);
temp=pdata;
for(i=204;i>=0;i--) // One can rotate the image in all four directions by changing i and j.
for(j=0;j<176;j++) // 1. i=0 to i<205; 2. j=175 to j>=0; 3. 1 and j=0 to j<176;
{ // 4. The above one which isin normal position....
pPoint.x=j;
pPoint.y=i;
IBITMAP_GetPixel(pMe->pIBitmap,j,i,(uint32 *)&native.color);
test.a[0]=FIVEBIT_8BIT(native.stct.B);
test.a[1]=SIXBIT_8BIT(native.stct.G);
test.a[2]=FIVEBIT_8BIT(native.stct.R);
test.a[3]=0;
/********** Gray scale Implementation..... ***************/
// 1st Method.......
// test.c=( .30* test.a[2] + .11 * test.a[1] + .59 * test.a[0]) / 1000;
// 2nd method.....
// test.c=(77 * test.a[2] + 150 * test.a[1] + 28 * test.a[0]) / 255;
// 3nd Method......
test.c=(222 * test.a[2] + 707 * test.a[1] + 71 * test.a[0]) / 1000;
// Note that the three formulas lead to different results, however none is better or more correct than the other!
{
int k=0;
for(;k
{
if(*(psaveplatte+k)==test.c)
break;
else
continue;
}
if(k==nocolors)
{
*(psaveplatte+k)=test.c;
nocolors++;
}
*(temp++)=k;
}
}
bmpfile.bitmap_offset=(nocolors*4)+54;
bmpfile.size= (bmpfile.width*bmpfile.height) + bmpfile.bitmap_offset;
bmpfile.num_colors=nocolors;
bmpfile.num_important_colors=nocolors;
ISHELL_CreateInstance(pMe->a.m_pIShell,AEECLSID_FILEMGR,(void**)&pIFileMgr);
if (pIFileMgr)
{
if (IFILEMGR_Test(pIFileMgr,"screenshot.bmp")==SUCCESS)
{
IFILEMGR_Remove(pIFileMgr,"screenshot.bmp");
}
}
pIfile=IFILEMGR_OpenFile(pIFileMgr,"screenshot.bmp",_OFM_CREATE);
if(pIfile)
{ // This takes 170ms to write into a file on V3C....one can implement all the below in a single write....
IFILE_Write(pIfile,"BM",2);
IFILE_Write(pIfile,&bmpfile,52);
IFILE_Write(pIfile,psaveplatte,nocolors*4);
IFILE_Write(pIfile,pdata,bmpfile.width*bmpfile.height);
IFILE_Release(pIfile);
pIfile=NULL;
}
if(psaveplatte)
{
FREE(psaveplatte);
psaveplatte=NULL;
}
if(pdata)
{
FREE(pdata);
pdata=NULL;
}
if(pMe->pIBitmap)
{
IBITMAP_Release(pMe->pIBitmap);
pMe->pIBitmap=NULL;
}

65535 yeah iknow its whit ,but im not getting white preview even.
here is the code...
//display image
case EVT_APP_START:
{
IImage *pImage=ISHELL_LoadImage(pMe->a.m_pIShell,"test1.bmp");
IIMAGE_Draw(pImage,10,10);
IDISPLAY_Update(pMe->a.m_pIDisplay);

return(TRUE);
//capture based on any event
void saveScreenshot(rotate *pMe)
{
rotate bmpfile;
uint32 *psaveplatte;
IFileMgr*pIFileMgr=NULL;
IFile *pIfile=NULL;
test test;
AEEPoint pPoint;
mynative native;
int i=0,j=0;
uint8 nocolors=0;
byte *temp;
byte *pdata;
bmpfile.reserved=0;
bmpfile.header_size=40;
bmpfile.width=pMe->DeviceInfo.cxScreen;
bmpfile.height=pMe->DeviceInfo.cyScreen;
bmpfile.planes = 1;
bmpfile.bits_per_pixel = 8;
bmpfile.compression=0;
bmpfile.bitmap_size=0;
bmpfile.horizontal_resolution=0;
bmpfile.vertical_resolution=0;
IDISPLAY_GetDeviceBitmap(pMe->a.m_pIDisplay, &pMe->pIBitmap);
psaveplatte=(uint32 *)MALLOC(256*sizeof(uint32));
pdata=(byte*)MALLOC(176*205);
temp=pdata;
for(i=204;i>=0;i--) // One can rotate the image in all four directions by changing i and j.
for(j=0;j<176;j++) // 1. i=0 to i<205; 2. j=175 to j>=0; 3. 1 and j=0 to j<176;
{ // 4. The above one which isin normal position....
pPoint.x=j;
pPoint.y=i;
IBITMAP_GetPixel(pMe->pIBitmap,j,i,(uint32 *)&native.color);
test.a[0]=FIVEBIT_8BIT(native.stct.B);
test.a[1]=SIXBIT_8BIT(native.stct.G);
test.a[2]=FIVEBIT_8BIT(native.stct.R);
test.a[3]=0;
/********** Gray scale Implementation..... ***************/
// 1st Method.......
// test.c=( .30* test.a[2] + .11 * test.a[1] + .59 * test.a[0]) / 1000;
// 2nd method.....
// test.c=(77 * test.a[2] + 150 * test.a[1] + 28 * test.a[0]) / 255;
// 3nd Method......
test.c=(222 * test.a[2] + 707 * test.a[1] + 71 * test.a[0]) / 1000;
// Note that the three formulas lead to different results, however none is better or more correct than the other!
{
int k=0;
for(;k
{
if(*(psaveplatte+k)==test.c)
break;
else
continue;
}
if(k==nocolors)
{
*(psaveplatte+k)=test.c;
nocolors++;
}
*(temp++)=k;
}
}
bmpfile.bitmap_offset=(nocolors*4)+54;
bmpfile.size= (bmpfile.width*bmpfile.height) + bmpfile.bitmap_offset;
bmpfile.num_colors=nocolors;
bmpfile.num_important_colors=nocolors;
ISHELL_CreateInstance(pMe->a.m_pIShell,AEECLSID_FILEMGR,(void**)&pIFileMgr);
if (pIFileMgr)
{
if (IFILEMGR_Test(pIFileMgr,"screenshot.bmp")==SUCCESS)
{
IFILEMGR_Remove(pIFileMgr,"screenshot.bmp");
}
}
pIfile=IFILEMGR_OpenFile(pIFileMgr,"screenshot.bmp",_OFM_CREATE);
if(pIfile)
{ // This takes 170ms to write into a file on V3C....one can implement all the below in a single write....
IFILE_Write(pIfile,"BM",2);
IFILE_Write(pIfile,&bmpfile,52);
IFILE_Write(pIfile,psaveplatte,nocolors*4);
IFILE_Write(pIfile,pdata,bmpfile.width*bmpfile.height);
IFILE_Release(pIfile);
pIfile=NULL;
}
if(psaveplatte)
{
FREE(psaveplatte);
psaveplatte=NULL;
}
if(pdata)
{
FREE(pdata);
pdata=NULL;
}
if(pMe->pIBitmap)
{
IBITMAP_Release(pMe->pIBitmap);
pMe->pIBitmap=NULL;
}

When you save a V3C full screen the image size will be in between 35.2 to 36.2KB
Header(54)+Pallete(depends on number of colors, max 1024)+pixel data(176x205=36080) bytes
I thing there is some problem in your code that saves the data in the file else
atleast you should able see the preview of white image(as you said all pixels are white) in windows.
Can you post your code.....

When you save a V3C full screen the image size will be in between 35.2 to 36.2KB
Header(54)+Pallete(depends on number of colors, max 1024)+pixel data(176x205=36080) bytes
I thing there is some problem in your code that saves the data in the file else
atleast you should able see the preview of white image(as you said all pixels are white) in windows.
Can you post your code.....

ya size is around 35.2kb,
u may be rite i just copy pasted ur code may be problem with code
do chk the prev code i have posted which i used

ya size is around 35.2kb,
u may be rite i just copy pasted ur code may be problem with code
do chk the prev code i have posted which i used

The below is working......
Quote://display image
case EVT_APP_START:
{
IImage *pImage=ISHELL_LoadImage(pMe->a.m_pIShell,"test1.bmp");
IIMAGE_Draw(pImage,10,10);
IDISPLAY_Update(pMe->a.m_pIDisplay);
//capture based on any event
saveScreenshot(pMe);

return(TRUE);

The below is working......
Quote://display image
case EVT_APP_START:
{
IImage *pImage=ISHELL_LoadImage(pMe->a.m_pIShell,"test1.bmp");
IIMAGE_Draw(pImage,10,10);
IDISPLAY_Update(pMe->a.m_pIDisplay);
//capture based on any event
saveScreenshot(pMe);

return(TRUE);

Brewin wrote:The below is working......
nopes it dosent work for me
no preview from bmp file... why :confused:

Brewin wrote:The below is working......
nopes it dosent work for me
no preview from bmp file... why :confused:

mk.manju wrote:
u may be rite i just copy pasted ur code may be problem with code
do chk the prev code i have posted which i used
I checked the code on three different window based machines....by just copying the code I posted in the forum...
On two I didn't get any problem.
Quote:
But on One I didn't get the preview for the first time(Only once...), but the image was saved. I got no preview on windows image viewer. Then I changed all unsigned long, short to uint32 and uint16.
Then strangely I got the correct image, Again replace uint32 and 16's to unsigned long's and short's but no use I got the correct image.
I am unable to reproduce the first error, I copy pasted the code for 3 to 4 times without modifications other than(5BIT to FIVEBIT,6BIT to SIXBIT and removed the sapce between "bmpfile.hei ght") The code is working and I am getting the correct image.

mk.manju wrote:
u may be rite i just copy pasted ur code may be problem with code
do chk the prev code i have posted which i used
I checked the code on three different window based machines....by just copying the code I posted in the forum...
On two I didn't get any problem.
Quote:
But on One I didn't get the preview for the first time(Only once...), but the image was saved. I got no preview on windows image viewer. Then I changed all unsigned long, short to uint32 and uint16.
Then strangely I got the correct image, Again replace uint32 and 16's to unsigned long's and short's but no use I got the correct image.
I am unable to reproduce the first error, I copy pasted the code for 3 to 4 times without modifications other than(5BIT to FIVEBIT,6BIT to SIXBIT and removed the sapce between "bmpfile.hei ght") The code is working and I am getting the correct image.

Brewin wrote:I checked the code on three different window based machines....by just copying the code I posted in the forum...
On two I didn't get any problem.
nopes even in device i dunt get preview,
i have made all changes which u have said..
but 100% i get no preview in device as wel as emulator with all changes and the code which u pasted

Brewin wrote:I checked the code on three different window based machines....by just copying the code I posted in the forum...
On two I didn't get any problem.
nopes even in device i dunt get preview,
i have made all changes which u have said..
but 100% i get no preview in device as wel as emulator with all changes and the code which u pasted

Download the application...
Attachement contains the following files.
Quote:
myapp.c
myapp.mif
myapp.BID
test1.bmp
Just compile it(It should just compile without any problem) and test in the emulator.
If the application is not working...... :eek: :mad:

Download the application...
Attachement contains the following files.
Quote:
myapp.c
myapp.mif
myapp.BID
test1.bmp
Just compile it(It should just compile without any problem) and test in the emulator.
If the application is not working...... :eek: :mad:

Post your reply..

Post your reply..

Brewin wrote:Post your reply..
thanks a lot brewin, it works finally....

Brewin wrote:Post your reply..
thanks a lot brewin, it works finally....

i tried the same code but i my simulator crashes saying Unhandled Exception in BREW_Simulatore.exe:Access Voilation
when i debug my code , it doesnt move beyond
case EVT_APP_START:
{
pImage=ISHELL_LoadImage(pMe->a.m_pIShell,"test1.bmp");
IIMAGE_Draw(pImage,10,10);
could you suggest me how i can solve this issue .

i tried the same code but i my simulator crashes saying Unhandled Exception in BREW_Simulatore.exe:Access Voilation
when i debug my code , it doesnt move beyond
case EVT_APP_START:
{
pImage=ISHELL_LoadImage(pMe->a.m_pIShell,"test1.bmp");
IIMAGE_Draw(pImage,10,10);
could you suggest me how i can solve this issue .

Do you have test1.bmp file in app running folder? Some pointer prb.
It is better to check pointers for NULL before using them.

Do you have test1.bmp file in app running folder? Some pointer prb.
It is better to check pointers for NULL before using them.

Hi ,
With the code for converting to greyscale now my application does run without error ,.i get the image displayed but the greyscale convertion does'nt take place .could you help me with your suggestions .

Hi ,
With the code for converting to greyscale now my application does run without error ,.i get the image displayed but the greyscale convertion does'nt take place .could you help me with your suggestions .