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

Developer

Forums

Forums:

Can one get images using an IWEB object?

It looks to me that the ISOURCE in IWebResp object can only be read into a string? Is that correct?

Has anyone any ideas about how to read an image over a network connection?

Hi.
I have suggestion for your subject.
How about using IAStream?
In BREW SDK 1.1 BREWAPIReference.pdf file, described your subject at IAStream Interface. Check it.

Hi.
I have suggestion for your subject.
How about using IAStream?
In BREW SDK 1.1 BREWAPIReference.pdf file, described your subject at IAStream Interface. Check it.

and you can receive the image from the isource
and use the image_setstream pass it into a image
and show it

and you can receive the image from the isource
and use the image_setstream pass it into a image
and show it

Hi,
I am looking at the ISource documentation, the destination is a char * pointer. So how can you read an image?
Thanks

Hi,
I am looking at the ISource documentation, the destination is a char * pointer. So how can you read an image?
Thanks

AEECLSID cls;
IImage *pIImage = NULL;
IMemAStream *pMemStream = NULL;
// Determine the class ID of the handler function for BMPs and then
// create an instance of this BREW class
cls = ISHELL_GetHandler(pMe->a.m_pIShell, HTYPE_VIEWER, "image/bmp");
if (cls) {
ISHELL_CreateInstance(pMe->a.m_pIShell, cls, (void **)(&pIImage));

if (pMe->pBmpData) {
ISHELL_CreateInstance(pMe->a.m_pIShell, AEECLSID_MEMASTREAM,
(void **)(&pMemStream));
if (pMemStream) {
//Create MEMSTREAM and use it as stream for the in-memory
bitmap.
IMEMASTREAM_Set(pMemStream, pMe->pBmpData,
sizeof(pMe->pBmpData), 0, 0);
IIMAGE_SetStream(pIImage, (IAStream*)pMemStream);
// use your IIMAGE methods as normal now
IIMAGE_Draw(pIImage, ? ?;
IDISPLAY_UpdateEx(pMe->a.m_pIDisplay, TRUE);
}

-----------------------------------
pMe->pBmpData can be a char * buffer

AEECLSID cls;
IImage *pIImage = NULL;
IMemAStream *pMemStream = NULL;
// Determine the class ID of the handler function for BMPs and then
// create an instance of this BREW class
cls = ISHELL_GetHandler(pMe->a.m_pIShell, HTYPE_VIEWER, "image/bmp");
if (cls) {
ISHELL_CreateInstance(pMe->a.m_pIShell, cls, (void **)(&pIImage));

if (pMe->pBmpData) {
ISHELL_CreateInstance(pMe->a.m_pIShell, AEECLSID_MEMASTREAM,
(void **)(&pMemStream));
if (pMemStream) {
//Create MEMSTREAM and use it as stream for the in-memory
bitmap.
IMEMASTREAM_Set(pMemStream, pMe->pBmpData,
sizeof(pMe->pBmpData), 0, 0);
IIMAGE_SetStream(pIImage, (IAStream*)pMemStream);
// use your IIMAGE methods as normal now
IIMAGE_Draw(pIImage, ? ?;
IDISPLAY_UpdateEx(pMe->a.m_pIDisplay, TRUE);
}

-----------------------------------
pMe->pBmpData can be a char * buffer

i have a error
you must use the buffer true size not this like this

i have a error
you must use the buffer true size not this like this

Quote:Originally posted by rkuppala
Hi,
I am looking at the ISource documentation, the destination is a char * pointer. So how can you read an image?
Thanks
You can cast the buffer to byte *. But that is also not required. As nedi specified u can use the IASTREAM to display the image or save the image on to phone if necessary.
Regrds
Arun Bangari

Quote:Originally posted by rkuppala
Hi,
I am looking at the ISource documentation, the destination is a char * pointer. So how can you read an image?
Thanks
You can cast the buffer to byte *. But that is also not required. As nedi specified u can use the IASTREAM to display the image or save the image on to phone if necessary.
Regrds
Arun Bangari

object created from the interface didn't release who can tell me how to release and release what ?(because i when i exit the app i get a white screen with the app name)
if (pMe->m_BodyBuffer) {
ISHELL_CreateInstance(pMe->a.m_pIShell, AEECLSID_MEMASTREAM,(void **)(&pMemStream));
if (pMemStream) {
IMEMASTREAM_Set(pMemStream, pMe->m_BodyBuffer,pMe->m_BodySize, 0, 0);
IIMAGE_SetStream(pMe->m_downLoadImg, (IAStream*)pMemStream);
}
}

object created from the interface didn't release who can tell me how to release and release what ?(because i when i exit the app i get a white screen with the app name)
if (pMe->m_BodyBuffer) {
ISHELL_CreateInstance(pMe->a.m_pIShell, AEECLSID_MEMASTREAM,(void **)(&pMemStream));
if (pMemStream) {
IMEMASTREAM_Set(pMemStream, pMe->m_BodyBuffer,pMe->m_BodySize, 0, 0);
IIMAGE_SetStream(pMe->m_downLoadImg, (IAStream*)pMemStream);
}
}

ai ,who can tell me

ai ,who can tell me

From the information that you have provided you need to release pMemStream interface and pMe->m_BodyBuffer. Use IMEMSTREAM_Release for cleaning up the interface. U dont have to free pMe->m_bodyBuffer as IMEMSTREAM_Release itself clean up the buffer. Hope this helps
Regrds
Arun Bangari

From the information that you have provided you need to release pMemStream interface and pMe->m_BodyBuffer. Use IMEMSTREAM_Release for cleaning up the interface. U dont have to free pMe->m_bodyBuffer as IMEMSTREAM_Release itself clean up the buffer. Hope this helps
Regrds
Arun Bangari

it say that have duplicated free error int the brew output windows

it say that have duplicated free error int the brew output windows

Can you paste tht piece of code here.
Regrds
Arun Bangari

Can you paste tht piece of code here.
Regrds
Arun Bangari

if (pMe->m_BodyBuffer) {
ISHELL_CreateInstance(pMe->a.m_pIShell, AEECLSID_MEMASTREAM,(void **)(&pMemStream));
if (pMemStream) {
IMEMASTREAM_Set(pMemStream, pMe->m_BodyBuffer,pMe->m_BodySize, 0, 0);
IIMAGE_SetStream(pMe->m_downLoadImg, (IAStream*)pMemStream);
if(pMemStream){
IMEMASTREAM_Release(pMemStream);

}

if (pMe->m_BodyBuffer) {
ISHELL_CreateInstance(pMe->a.m_pIShell, AEECLSID_MEMASTREAM,(void **)(&pMemStream));
if (pMemStream) {
IMEMASTREAM_Set(pMemStream, pMe->m_BodyBuffer,pMe->m_BodySize, 0, 0);
IIMAGE_SetStream(pMe->m_downLoadImg, (IAStream*)pMemStream);
if(pMemStream){
IMEMASTREAM_Release(pMemStream);

}

Are you displaying image after realisng the IMEMSTREAM? In that case release the IIMAGE interface first(after drawing image), then release IMEMSTREAM. This may work but not sure....
Regrds
Arun Bangari

Are you displaying image after realisng the IMEMSTREAM? In that case release the IIMAGE interface first(after drawing image), then release IMEMSTREAM. This may work but not sure....
Regrds
Arun Bangari

i think it's a bug of brew

i think it's a bug of brew

It can not be bug of BREW, i have used IMEMSTREAM interface along with IIMAGE interface to display the images in many of the projects and never had problems. Check out the reference count of IMEMSTREAM interface and IIMAGE interface while releasing them. The problem could be ther in some other piece of your code.
Regrds
Arun Bangari

It can not be bug of BREW, i have used IMEMSTREAM interface along with IIMAGE interface to display the images in many of the projects and never had problems. Check out the reference count of IMEMSTREAM interface and IIMAGE interface while releasing them. The problem could be ther in some other piece of your code.
Regrds
Arun Bangari

if i don't create that instance
comment the following code,it have no memory problem
---------------------
/*
ISHELL_CreateInstance(pMe->a.m_pIShell, AEECLSID_MEMASTREAM,(void **)(&pMemStream));
if (pMemStream) {
IMEMASTREAM_Set(pMemStream, pMe->m_BodyBuffer,pMe->m_BodySize, 0, 0);
IIMAGE_SetStream(pMe->m_downLoadImg, (IAStream*)pMemStream);
}
*/

if i don't create that instance
comment the following code,it have no memory problem
---------------------
/*
ISHELL_CreateInstance(pMe->a.m_pIShell, AEECLSID_MEMASTREAM,(void **)(&pMemStream));
if (pMemStream) {
IMEMASTREAM_Set(pMemStream, pMe->m_BodyBuffer,pMe->m_BodySize, 0, 0);
IIMAGE_SetStream(pMe->m_downLoadImg, (IAStream*)pMemStream);
}
*/

Can someone post some sample code which works for downloading an image over the network?
Thanks

Can someone post some sample code which works for downloading an image over the network?
Thanks

it has a sample to connect a url
tuhis url can be a bmp,you can read it into abuffer and show it

it has a sample to connect a url
tuhis url can be a bmp,you can read it into abuffer and show it