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

Developer

Forums

Forums:

Hi, BREWers!

I'm new to BREW.

I'm trying to do following. (My Tries in here)

1) Load JPEG image from file. (ISHELL_LoadImage)
2) Decode JPEG image by BREW. (IImage does)
3) Resize & display decoded JPEG image. (IGRAPHICS_StretchBlt)

But I have no idea how to link step 2) and 3). Is it possible?

If possible, Could you explain with some sample codes?

IImage seems not to expose DIB buffer and
IGRAPHICS_StretchBlt wants Window BMP headered DIB as input.

Well, another issue is colordepth for BREW Simulator and real device.

I guess IGRAPHICS_StretchBlt() only accept 8bit color images.

My BREW device has 16bit color display.
Do I have to generate 16bit window BMP to use IGRAPHICS_StretchBlt() for real device?

hi,
Before posting the query just do a little search It will help you lot.
Just see this link
http://brewforums.qualcomm.com/search.php?searchid=91099

hi,
Before posting the query just do a little search It will help you lot.
Just see this link
http://brewforums.qualcomm.com/search.php?searchid=91099

BraveBoy wrote:hi,
Before posting the query just do a little search It will help you lot.
Just see this link
http://brewforums.qualcomm.com/search.php?searchid=91099
Above link has been broken. Please correct link.
Well, I searched whole forum with this issue and found that there's no concrete solution for it.
If a image is in a resource, it may work. But I need the way of using a file as a source.
If a image file is 8bit windows BMP, IGRAPHICS_StretchBlt() works greatly. But I need IImage as input.
Someone suggested capturing display for IImage -> IDIB. But ouside of display area never be captured.
Please help!

BraveBoy wrote:hi,
Before posting the query just do a little search It will help you lot.
Just see this link
http://brewforums.qualcomm.com/search.php?searchid=91099
Above link has been broken. Please correct link.
Well, I searched whole forum with this issue and found that there's no concrete solution for it.
If a image is in a resource, it may work. But I need the way of using a file as a source.
If a image file is 8bit windows BMP, IGRAPHICS_StretchBlt() works greatly. But I need IImage as input.
Someone suggested capturing display for IImage -> IDIB. But ouside of display area never be captured.
Please help!

There're three methods by achoho, ruben and Jonathan.
achoho wrote:the way to resize jpeg image has following steps.
1. decode jpeg image, and make IDIB buffer.
- during decoding jpeg image, make the target buffer "IDIB*", so you can get
decoded jpeg data as an IDIB buffer.
(how to do this step depends on the way you use to decode jpeg, so i can not
explain in detail)
2. resize IDIB buffer.
- there are, i guess, lots of ways to resize IDIB(or IBITMAP).
- firstly, you can use IGRAPHICS_StretchBlt() function to resize it.
(I don't think IGRAPHICS_StretchBlt() is stable yet. It works somehow but, sometimes, it fails)
- secondly, if you have qualcomm "qcamera" source code, you can find resizeDIB..something... function. this function does exactly what we want.
- the last way : if you still can not find how to resize IBITMAP or IDIB, plz let me know again. I can give you my function codes.
hope my answer is helpful to you.
if you have any more question, plz let me know.
- achoho -
achoho's method does NOT provide how to get IDIB from IImage.
ruben wrote:From my above mentioned post
[
IImage works on the whatever destination bitmap you set for your default display.
1. Implement your own IBitmap (by constructing VTable) and all the funcitons can be stubs that return EUNSUPPORTED, except BltIn() function.
Now create a instance of your custom bitmap.
2. Call IDisplay_SetDestination and set your custom bitmap as destination.
3. Now use IImage_SetStream interface as descirbed in the previous post.
4. IImage decodes your image and maintains a DIB internally. Now a call to IIMAGE_Draw pass its DIB to IDISPLAY_BitBlt, which passes it to the IBITMAP_BlitIN(), invoked on your current destination bitmap (which is your custom bitmap implementation). Now you got your bitmap pointer with decoded image.
5. You can now use IGRAPHICS interface.
]
Steps are pretty much like this, and it works for me. See BREW extension documenation and SDK header for creating IBitmap interface. At what step you are finding problem? Post code snippet so that forum members can provide more feedback.
ruben
ruben's method is lack of explanation for me. Does anyone succeed by this solution?
Jonathan wrote:The following steps are the easiest way to resize a JPEG:
1.Draw a JPEG to the screen then capture it as a Bitmap.
IIMAGE_Draw(pMe->pIImage, 0, 0);
IDISPLAY_GetDeviceBitmap(pMe->pIDisplay, &pMe->pIBitmap);
2.Query the Bitmap for a Device Independent Bitmap (This will get you a windows Bitmap without a header)
IBITMAP_QueryInterface(pMe->pIBitmap, AEECLSID_DIB, &pMe->pIDIB);
3.Construct and append a windows header to the front of the data. Data (without header) can be obtained through pMe->pIDIB->pBmp.
void* mypic;
myPic = YourFunction(…); //returns a void pointer to header + data
4.Display picture using IGRAPHICS.
IGRAPHICS_StretchBlt(…);
IGRAPHICS_Update(…);
Information on the Bitmap header can be found at:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetco...
Jonathan's method is capturing device display as I mentioned. Capturing ouside of display area is impossible.
So, I think, still there's no concrete solution for my question.

There're three methods by achoho, ruben and Jonathan.
achoho wrote:the way to resize jpeg image has following steps.
1. decode jpeg image, and make IDIB buffer.
- during decoding jpeg image, make the target buffer "IDIB*", so you can get
decoded jpeg data as an IDIB buffer.
(how to do this step depends on the way you use to decode jpeg, so i can not
explain in detail)
2. resize IDIB buffer.
- there are, i guess, lots of ways to resize IDIB(or IBITMAP).
- firstly, you can use IGRAPHICS_StretchBlt() function to resize it.
(I don't think IGRAPHICS_StretchBlt() is stable yet. It works somehow but, sometimes, it fails)
- secondly, if you have qualcomm "qcamera" source code, you can find resizeDIB..something... function. this function does exactly what we want.
- the last way : if you still can not find how to resize IBITMAP or IDIB, plz let me know again. I can give you my function codes.
hope my answer is helpful to you.
if you have any more question, plz let me know.
- achoho -
achoho's method does NOT provide how to get IDIB from IImage.
ruben wrote:From my above mentioned post
[
IImage works on the whatever destination bitmap you set for your default display.
1. Implement your own IBitmap (by constructing VTable) and all the funcitons can be stubs that return EUNSUPPORTED, except BltIn() function.
Now create a instance of your custom bitmap.
2. Call IDisplay_SetDestination and set your custom bitmap as destination.
3. Now use IImage_SetStream interface as descirbed in the previous post.
4. IImage decodes your image and maintains a DIB internally. Now a call to IIMAGE_Draw pass its DIB to IDISPLAY_BitBlt, which passes it to the IBITMAP_BlitIN(), invoked on your current destination bitmap (which is your custom bitmap implementation). Now you got your bitmap pointer with decoded image.
5. You can now use IGRAPHICS interface.
]
Steps are pretty much like this, and it works for me. See BREW extension documenation and SDK header for creating IBitmap interface. At what step you are finding problem? Post code snippet so that forum members can provide more feedback.
ruben
ruben's method is lack of explanation for me. Does anyone succeed by this solution?
Jonathan wrote:The following steps are the easiest way to resize a JPEG:
1.Draw a JPEG to the screen then capture it as a Bitmap.
IIMAGE_Draw(pMe->pIImage, 0, 0);
IDISPLAY_GetDeviceBitmap(pMe->pIDisplay, &pMe->pIBitmap);
2.Query the Bitmap for a Device Independent Bitmap (This will get you a windows Bitmap without a header)
IBITMAP_QueryInterface(pMe->pIBitmap, AEECLSID_DIB, &pMe->pIDIB);
3.Construct and append a windows header to the front of the data. Data (without header) can be obtained through pMe->pIDIB->pBmp.
void* mypic;
myPic = YourFunction(…); //returns a void pointer to header + data
4.Display picture using IGRAPHICS.
IGRAPHICS_StretchBlt(…);
IGRAPHICS_Update(…);
Information on the Bitmap header can be found at:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetco...
Jonathan's method is capturing device display as I mentioned. Capturing ouside of display area is impossible.
So, I think, still there's no concrete solution for my question.

So you want to read the image from file and you want to resize it and you want to display it . Right?
I think it is not possible. So first display the jpeg on the screen then capture the screen then resize it.
If the image size is more than screen size then you have to write your own Algo to resize the jpeg image. Then display it.

So you want to read the image from file and you want to resize it and you want to display it . Right?
I think it is not possible. So first display the jpeg on the screen then capture the screen then resize it.
If the image size is more than screen size then you have to write your own Algo to resize the jpeg image. Then display it.

Yes, you're right, BraveBoy.
So the answer is IMPOSSIBLE, huh?
Then I have to write my own JPEG(,PNG,WBMP,...) decoder codes until
BREW IImage class expose DIB buffer for decoded image.
Thanks for repliers!!

Yes, you're right, BraveBoy.
So the answer is IMPOSSIBLE, huh?
Then I have to write my own JPEG(,PNG,WBMP,...) decoder codes until
BREW IImage class expose DIB buffer for decoded image.
Thanks for repliers!!

Reading a JPG, resizing and displaying is possible. The process looks like this:
JPEG -> IImage
IImage -> IBitmap
Use ITRANSFORM to scale the IBitmap.
Detailed steps (as tested in 3.x simulator):
1) psIImage = ISHELL_LoadImage( psMe->psIShell, JPEG_FULLPATH );
- Load the JPEG into an IImage
2) IIMAGE_Notify( psIImage, FILEBRWS_nvImageDecoded, psMe );
- Callback when JPEG decoded
3) In FILEBRWS_nvImageDecoded()
3.1) psIBitmapDisp = IDISPLAY_GetDestination( psMe->psIDisplay );
IBITMAP_CreateCompatibleBitmap( psIBitmapDisp, &psIBitmapJPEG, JPEG_WIDTH, JPEG_HEIGHT );
- Create an IBitmap to hold the image
3.2) IDISPLAY_SetDestination( psMe->psIDisplay, psIBitmapJPEG );
IIMAGE_Draw( psIImage, 0, 0 );
- Draw the IImage into the IBitmap (ie JPEG -> IBitmap)
3.3) IDISPLAY_SetDestination( psMe->psIDisplay, NULL );
- restore the display
3.4) IBITMAP_CreateCompatibleBitmap( psIBitmapJPEG , psIBitmapScaled, DESIRED_WIDTH, DESIRED_HEIGHT );
- create a new bitmap to hold the scaled picture
3.5) IBITMAP_QueryInterface( psIBitmapScaled, AEECLSID_TRANSFORM, &psITransform );
- Get a transformation instance
3.6) ITRANSFORM_TransformBltComplex( psITransform, ..., psIBitmapJPEG, );
- scale as necessary. psIBitmapScaled now holds the scaled JPEG.

Reading a JPG, resizing and displaying is possible. The process looks like this:
JPEG -> IImage
IImage -> IBitmap
Use ITRANSFORM to scale the IBitmap.
Detailed steps (as tested in 3.x simulator):
1) psIImage = ISHELL_LoadImage( psMe->psIShell, JPEG_FULLPATH );
- Load the JPEG into an IImage
2) IIMAGE_Notify( psIImage, FILEBRWS_nvImageDecoded, psMe );
- Callback when JPEG decoded
3) In FILEBRWS_nvImageDecoded()
3.1) psIBitmapDisp = IDISPLAY_GetDestination( psMe->psIDisplay );
IBITMAP_CreateCompatibleBitmap( psIBitmapDisp, &psIBitmapJPEG, JPEG_WIDTH, JPEG_HEIGHT );
- Create an IBitmap to hold the image
3.2) IDISPLAY_SetDestination( psMe->psIDisplay, psIBitmapJPEG );
IIMAGE_Draw( psIImage, 0, 0 );
- Draw the IImage into the IBitmap (ie JPEG -> IBitmap)
3.3) IDISPLAY_SetDestination( psMe->psIDisplay, NULL );
- restore the display
3.4) IBITMAP_CreateCompatibleBitmap( psIBitmapJPEG , psIBitmapScaled, DESIRED_WIDTH, DESIRED_HEIGHT );
- create a new bitmap to hold the scaled picture
3.5) IBITMAP_QueryInterface( psIBitmapScaled, AEECLSID_TRANSFORM, &psITransform );
- Get a transformation instance
3.6) ITRANSFORM_TransformBltComplex( psITransform, ..., psIBitmapJPEG, );
- scale as necessary. psIBitmapScaled now holds the scaled JPEG.

Or just use the jpeg extension (one step).
https://brewx.qualcomm.com/developer/extension.do?appid=5247488
---jeff
richo wrote:Reading a JPG, resizing and displaying is possible. The process looks like this:
JPEG -> IImage
IImage -> IBitmap
Use ITRANSFORM to scale the IBitmap.
Detailed steps (as tested in 3.x simulator):
1) psIImage = ISHELL_LoadImage( psMe->psIShell, JPEG_FULLPATH );
- Load the JPEG into an IImage
2) IIMAGE_Notify( psIImage, FILEBRWS_nvImageDecoded, psMe );
- Callback when JPEG decoded
3) In FILEBRWS_nvImageDecoded()
3.1) psIBitmapDisp = IDISPLAY_GetDestination( psMe->psIDisplay );
IBITMAP_CreateCompatibleBitmap( psIBitmapDisp, &psIBitmapJPEG, JPEG_WIDTH, JPEG_HEIGHT );
- Create an IBitmap to hold the image
3.2) IDISPLAY_SetDestination( psMe->psIDisplay, psIBitmapJPEG );
IIMAGE_Draw( psIImage, 0, 0 );
- Draw the IImage into the IBitmap (ie JPEG -> IBitmap)
3.3) IDISPLAY_SetDestination( psMe->psIDisplay, NULL );
- restore the display
3.4) IBITMAP_CreateCompatibleBitmap( psIBitmapJPEG , psIBitmapScaled, DESIRED_WIDTH, DESIRED_HEIGHT );
- create a new bitmap to hold the scaled picture
3.5) IBITMAP_QueryInterface( psIBitmapScaled, AEECLSID_TRANSFORM, &psITransform );
- Get a transformation instance
3.6) ITRANSFORM_TransformBltComplex( psITransform, ..., psIBitmapJPEG, );
- scale as necessary. psIBitmapScaled now holds the scaled JPEG.

Or just use the jpeg extension (one step).
https://brewx.qualcomm.com/developer/extension.do?appid=5247488
---jeff
richo wrote:Reading a JPG, resizing and displaying is possible. The process looks like this:
JPEG -> IImage
IImage -> IBitmap
Use ITRANSFORM to scale the IBitmap.
Detailed steps (as tested in 3.x simulator):
1) psIImage = ISHELL_LoadImage( psMe->psIShell, JPEG_FULLPATH );
- Load the JPEG into an IImage
2) IIMAGE_Notify( psIImage, FILEBRWS_nvImageDecoded, psMe );
- Callback when JPEG decoded
3) In FILEBRWS_nvImageDecoded()
3.1) psIBitmapDisp = IDISPLAY_GetDestination( psMe->psIDisplay );
IBITMAP_CreateCompatibleBitmap( psIBitmapDisp, &psIBitmapJPEG, JPEG_WIDTH, JPEG_HEIGHT );
- Create an IBitmap to hold the image
3.2) IDISPLAY_SetDestination( psMe->psIDisplay, psIBitmapJPEG );
IIMAGE_Draw( psIImage, 0, 0 );
- Draw the IImage into the IBitmap (ie JPEG -> IBitmap)
3.3) IDISPLAY_SetDestination( psMe->psIDisplay, NULL );
- restore the display
3.4) IBITMAP_CreateCompatibleBitmap( psIBitmapJPEG , psIBitmapScaled, DESIRED_WIDTH, DESIRED_HEIGHT );
- create a new bitmap to hold the scaled picture
3.5) IBITMAP_QueryInterface( psIBitmapScaled, AEECLSID_TRANSFORM, &psITransform );
- Get a transformation instance
3.6) ITRANSFORM_TransformBltComplex( psITransform, ..., psIBitmapJPEG, );
- scale as necessary. psIBitmapScaled now holds the scaled JPEG.

Hi frd's
I have followed the steps mentioned in the above posts but am not able to get the resized image.
IBitmap *psIBitmapJPEG ;
IBitmap *psIBitmapScaled;
ITransform *psITransform;
AEETransformMatrix *pMatrixTransform;
pMatrixTransform = MALLOC(10);
pMatrixTransform->A = 1;
pMatrixTransform->B = 1;
pMatrixTransform->C = 1;
pMatrixTransform->D = 1;
pMe->pImage = ISHELL_LoadImage(pMe->a.m_pIShell, "image015.jpg");
pMe->pIBitmap = IDISPLAY_GetDestination( pMe->pIDisplay );
IBITMAP_CreateCompatibleBitmap( pMe->pIBitmap, &psIBitmapJPEG, 142, 87 );
IDISPLAY_SetDestination( pMe->pIDisplay, psIBitmapJPEG );
IIMAGE_Draw(pMe->pImage, 0, 0 );
IDISPLAY_SetDestination( pMe->pIDisplay, NULL );
IBITMAP_CreateCompatibleBitmap( psIBitmapJPEG , &psIBitmapScaled, 54, 54 );
IBITMAP_QueryInterface( psIBitmapScaled, AEECLSID_TRANSFORM, &psITransform );
ITRANSFORM_TransformBltComplex( psITransform, 0, 0, psIBitmapJPEG, 0, 0, 142, 87, pMatrixTransform, TRANSFORM_SCALE_8 );
Please Help me
thanks in advance
vasuki

Hi frd's
I have followed the steps mentioned in the above posts but am not able to get the resized image.
IBitmap *psIBitmapJPEG ;
IBitmap *psIBitmapScaled;
ITransform *psITransform;
AEETransformMatrix *pMatrixTransform;
pMatrixTransform = MALLOC(10);
pMatrixTransform->A = 1;
pMatrixTransform->B = 1;
pMatrixTransform->C = 1;
pMatrixTransform->D = 1;
pMe->pImage = ISHELL_LoadImage(pMe->a.m_pIShell, "image015.jpg");
pMe->pIBitmap = IDISPLAY_GetDestination( pMe->pIDisplay );
IBITMAP_CreateCompatibleBitmap( pMe->pIBitmap, &psIBitmapJPEG, 142, 87 );
IDISPLAY_SetDestination( pMe->pIDisplay, psIBitmapJPEG );
IIMAGE_Draw(pMe->pImage, 0, 0 );
IDISPLAY_SetDestination( pMe->pIDisplay, NULL );
IBITMAP_CreateCompatibleBitmap( psIBitmapJPEG , &psIBitmapScaled, 54, 54 );
IBITMAP_QueryInterface( psIBitmapScaled, AEECLSID_TRANSFORM, &psITransform );
ITRANSFORM_TransformBltComplex( psITransform, 0, 0, psIBitmapJPEG, 0, 0, 142, 87, pMatrixTransform, TRANSFORM_SCALE_8 );
Please Help me
thanks in advance
vasuki

First, try the simple ITRANSFORM_TransformBltSimple() transform API to ensure there's no problem with your code.
Once that's working, switch back to ITRANSFORM_TransformBltComplex(). Note if you just want to scale, for example by half, then the matrix looks like this:
pMatrixTransform->A = 0.5 * 256;
pMatrixTransform->B = 0;
pMatrixTransform->C = 0;
pMatrixTransform->D = 0.5 * 256;
The transformation matrix uses 8:8 fixed point math, hence the need to multiply by 256 (or <<8).

First, try the simple ITRANSFORM_TransformBltSimple() transform API to ensure there's no problem with your code.
Once that's working, switch back to ITRANSFORM_TransformBltComplex(). Note if you just want to scale, for example by half, then the matrix looks like this:
pMatrixTransform->A = 0.5 * 256;
pMatrixTransform->B = 0;
pMatrixTransform->C = 0;
pMatrixTransform->D = 0.5 * 256;
The transformation matrix uses 8:8 fixed point math, hence the need to multiply by 256 (or <<8).

Hi frd's
I tried with the ITRANSFORM_TransformBltSimple() but not able to display image.
EVT_APP_START:
{
pMe->pImage = ISHELL_LoadImage(pMe->a.m_pIShell, "image015.jpg");
IIMAGE_Notify( pMe->pImage, imageLoadedNotify, pMe );
IDISPLAY_Update( pMe->pIDisplay );

pMe->pImage = ISHELL_LoadImage(pMe->a.m_pIShell, "image015.jpg");// 142x87
pMe->pIBitmap = IDISPLAY_GetDestination( pMe->pIDisplay );
r = IBITMAP_CreateCompatibleBitmap( pMe->pIBitmap, &pMe->psIBitmapJPEG, 142, 87 );
r += IDISPLAY_SetDestination( pMe->pIDisplay, pMe->psIBitmapJPEG );
IIMAGE_Draw(pMe->pImage, 0, 0 );
IDISPLAY_Update( pMe->pIDisplay );
r += IDISPLAY_SetDestination( pMe->pIDisplay, NULL );
r += IBITMAP_CreateCompatibleBitmap( pMe->psIBitmapJPEG , &pMe->psIBitmapScaled, 71, 43 ); // half of the image sizes
r += IBITMAP_QueryInterface( pMe->psIBitmapScaled, AEECLSID_TRANSFORM, (void **)&pMe->psITransform );
r += ITRANSFORM_TransformBltComplex( pMe->psITransform, 0, 0, pMe->psIBitmapJPEG, 0, 0, 142, 87, &pMe->pMatrixTransform, TRANSFORM_SCALE_2 );
in all cases r value is "zero".
in the above post the resized jpeg image pointer is the pMe->psIBitmapScaled. But am not able to display that image
please help me
thanks in advance
vasuki

Hi frd's
I tried with the ITRANSFORM_TransformBltSimple() but not able to display image.
EVT_APP_START:
{
pMe->pImage = ISHELL_LoadImage(pMe->a.m_pIShell, "image015.jpg");
IIMAGE_Notify( pMe->pImage, imageLoadedNotify, pMe );
IDISPLAY_Update( pMe->pIDisplay );

pMe->pImage = ISHELL_LoadImage(pMe->a.m_pIShell, "image015.jpg");// 142x87
pMe->pIBitmap = IDISPLAY_GetDestination( pMe->pIDisplay );
r = IBITMAP_CreateCompatibleBitmap( pMe->pIBitmap, &pMe->psIBitmapJPEG, 142, 87 );
r += IDISPLAY_SetDestination( pMe->pIDisplay, pMe->psIBitmapJPEG );
IIMAGE_Draw(pMe->pImage, 0, 0 );
IDISPLAY_Update( pMe->pIDisplay );
r += IDISPLAY_SetDestination( pMe->pIDisplay, NULL );
r += IBITMAP_CreateCompatibleBitmap( pMe->psIBitmapJPEG , &pMe->psIBitmapScaled, 71, 43 ); // half of the image sizes
r += IBITMAP_QueryInterface( pMe->psIBitmapScaled, AEECLSID_TRANSFORM, (void **)&pMe->psITransform );
r += ITRANSFORM_TransformBltComplex( pMe->psITransform, 0, 0, pMe->psIBitmapJPEG, 0, 0, 142, 87, &pMe->pMatrixTransform, TRANSFORM_SCALE_2 );
in all cases r value is "zero".
in the above post the resized jpeg image pointer is the pMe->psIBitmapScaled. But am not able to display that image
please help me
thanks in advance
vasuki

Hi
i have followed the steps mentioned in this post.I am getting all return values properly but how to display the scaled jpeg on to the screen?
thanks
vasuki
richo wrote:Reading a JPG, resizing and displaying is possible. The process looks like this:
JPEG -> IImage
IImage -> IBitmap
Use ITRANSFORM to scale the IBitmap.
Detailed steps (as tested in 3.x simulator):
1) psIImage = ISHELL_LoadImage( psMe->psIShell, JPEG_FULLPATH );
- Load the JPEG into an IImage
2) IIMAGE_Notify( psIImage, FILEBRWS_nvImageDecoded, psMe );
- Callback when JPEG decoded
3) In FILEBRWS_nvImageDecoded()
3.1) psIBitmapDisp = IDISPLAY_GetDestination( psMe->psIDisplay );
IBITMAP_CreateCompatibleBitmap( psIBitmapDisp, &psIBitmapJPEG, JPEG_WIDTH, JPEG_HEIGHT );
- Create an IBitmap to hold the image
3.2) IDISPLAY_SetDestination( psMe->psIDisplay, psIBitmapJPEG );
IIMAGE_Draw( psIImage, 0, 0 );
- Draw the IImage into the IBitmap (ie JPEG -> IBitmap)
3.3) IDISPLAY_SetDestination( psMe->psIDisplay, NULL );
- restore the display
3.4) IBITMAP_CreateCompatibleBitmap( psIBitmapJPEG , psIBitmapScaled, DESIRED_WIDTH, DESIRED_HEIGHT );
- create a new bitmap to hold the scaled picture
3.5) IBITMAP_QueryInterface( psIBitmapScaled, AEECLSID_TRANSFORM, &psITransform );
- Get a transformation instance
3.6) ITRANSFORM_TransformBltComplex( psITransform, ..., psIBitmapJPEG, );
- scale as necessary. psIBitmapScaled now holds the scaled JPEG.

Hi
i have followed the steps mentioned in this post.I am getting all return values properly but how to display the scaled jpeg on to the screen?
thanks
vasuki
richo wrote:Reading a JPG, resizing and displaying is possible. The process looks like this:
JPEG -> IImage
IImage -> IBitmap
Use ITRANSFORM to scale the IBitmap.
Detailed steps (as tested in 3.x simulator):
1) psIImage = ISHELL_LoadImage( psMe->psIShell, JPEG_FULLPATH );
- Load the JPEG into an IImage
2) IIMAGE_Notify( psIImage, FILEBRWS_nvImageDecoded, psMe );
- Callback when JPEG decoded
3) In FILEBRWS_nvImageDecoded()
3.1) psIBitmapDisp = IDISPLAY_GetDestination( psMe->psIDisplay );
IBITMAP_CreateCompatibleBitmap( psIBitmapDisp, &psIBitmapJPEG, JPEG_WIDTH, JPEG_HEIGHT );
- Create an IBitmap to hold the image
3.2) IDISPLAY_SetDestination( psMe->psIDisplay, psIBitmapJPEG );
IIMAGE_Draw( psIImage, 0, 0 );
- Draw the IImage into the IBitmap (ie JPEG -> IBitmap)
3.3) IDISPLAY_SetDestination( psMe->psIDisplay, NULL );
- restore the display
3.4) IBITMAP_CreateCompatibleBitmap( psIBitmapJPEG , psIBitmapScaled, DESIRED_WIDTH, DESIRED_HEIGHT );
- create a new bitmap to hold the scaled picture
3.5) IBITMAP_QueryInterface( psIBitmapScaled, AEECLSID_TRANSFORM, &psITransform );
- Get a transformation instance
3.6) ITRANSFORM_TransformBltComplex( psITransform, ..., psIBitmapJPEG, );
- scale as necessary. psIBitmapScaled now holds the scaled JPEG.

hi,
I have done all the steps given above but the problem is how to display it on the screen. I try to display it on the screen but it show black screen on emulator.
please help me to show it on screen.
thankx

hi,
I have done all the steps given above but the problem is how to display it on the screen. I try to display it on the screen but it show black screen on emulator.
please help me to show it on screen.
thankx

richo wrote:Reading a JPG, resizing and displaying is possible. The process looks like this:
JPEG -> IImage
IImage -> IBitmap
Use ITRANSFORM to scale the IBitmap.
Detailed steps (as tested in 3.x simulator):
1) psIImage = ISHELL_LoadImage( psMe->psIShell, JPEG_FULLPATH );
- Load the JPEG into an IImage
2) IIMAGE_Notify( psIImage, FILEBRWS_nvImageDecoded, psMe );
- Callback when JPEG decoded
3) In FILEBRWS_nvImageDecoded()
3.1) psIBitmapDisp = IDISPLAY_GetDestination( psMe->psIDisplay );
IBITMAP_CreateCompatibleBitmap( psIBitmapDisp, &psIBitmapJPEG, JPEG_WIDTH, JPEG_HEIGHT );
- Create an IBitmap to hold the image
3.2) IDISPLAY_SetDestination( psMe->psIDisplay, psIBitmapJPEG );
IIMAGE_Draw( psIImage, 0, 0 );
- Draw the IImage into the IBitmap (ie JPEG -> IBitmap)
3.3) IDISPLAY_SetDestination( psMe->psIDisplay, NULL );
- restore the display
3.4) IBITMAP_CreateCompatibleBitmap( psIBitmapJPEG , psIBitmapScaled, DESIRED_WIDTH, DESIRED_HEIGHT );
- create a new bitmap to hold the scaled picture
3.5) IBITMAP_QueryInterface( psIBitmapScaled, AEECLSID_TRANSFORM, &psITransform );
- Get a transformation instance
3.6) ITRANSFORM_TransformBltComplex( psITransform, ..., psIBitmapJPEG, );
- scale as necessary. psIBitmapScaled now holds the scaled JPEG.
I have done all the steps given above but the problem is how to display it on the screen. I try to display it on the screen but it show black screen on emulator.
please help me to show it on screen.
Do I have to append bmp header and InfoHeader with psIBitmapScaled
inorder to display the final image to the screen.. :confused:
Please do clarify me
waiting for your response
Regards
Abbay

richo wrote:Reading a JPG, resizing and displaying is possible. The process looks like this:
JPEG -> IImage
IImage -> IBitmap
Use ITRANSFORM to scale the IBitmap.
Detailed steps (as tested in 3.x simulator):
1) psIImage = ISHELL_LoadImage( psMe->psIShell, JPEG_FULLPATH );
- Load the JPEG into an IImage
2) IIMAGE_Notify( psIImage, FILEBRWS_nvImageDecoded, psMe );
- Callback when JPEG decoded
3) In FILEBRWS_nvImageDecoded()
3.1) psIBitmapDisp = IDISPLAY_GetDestination( psMe->psIDisplay );
IBITMAP_CreateCompatibleBitmap( psIBitmapDisp, &psIBitmapJPEG, JPEG_WIDTH, JPEG_HEIGHT );
- Create an IBitmap to hold the image
3.2) IDISPLAY_SetDestination( psMe->psIDisplay, psIBitmapJPEG );
IIMAGE_Draw( psIImage, 0, 0 );
- Draw the IImage into the IBitmap (ie JPEG -> IBitmap)
3.3) IDISPLAY_SetDestination( psMe->psIDisplay, NULL );
- restore the display
3.4) IBITMAP_CreateCompatibleBitmap( psIBitmapJPEG , psIBitmapScaled, DESIRED_WIDTH, DESIRED_HEIGHT );
- create a new bitmap to hold the scaled picture
3.5) IBITMAP_QueryInterface( psIBitmapScaled, AEECLSID_TRANSFORM, &psITransform );
- Get a transformation instance
3.6) ITRANSFORM_TransformBltComplex( psITransform, ..., psIBitmapJPEG, );
- scale as necessary. psIBitmapScaled now holds the scaled JPEG.
I have done all the steps given above but the problem is how to display it on the screen. I try to display it on the screen but it show black screen on emulator.
please help me to show it on screen.
Do I have to append bmp header and InfoHeader with psIBitmapScaled
inorder to display the final image to the screen.. :confused:
Please do clarify me
waiting for your response
Regards
Abbay

Hi,
I have followed all the above mentioned code , but i am getting a blank screen.
How to display the image????

Hi,
I have followed all the above mentioned code , but i am getting a blank screen.
How to display the image????

Yuva wrote:Hi,
I have followed all the above mentioned code , but i am getting a blank screen.
How to display the image????
What handset/BREW version etc?

Yuva wrote:Hi,
I have followed all the above mentioned code , but i am getting a blank screen.
How to display the image????
What handset/BREW version etc?

This code will get the jpgs, scale them and draw them on a new, small bitmapss
IImage * pIImage = ISHELL_LoadImage(m_pApp->GetIShell(), filename.GetBuffer());
if(pIImage)
{
//if image exists set the jpg notifier to it.
IIMAGE_Notify(pIImage, IimageCB, this);

::IimageCB()
{
if (pIImage)
{
IIMAGE_SetParm(pIImage, IPARM_SCALE, m_width, m_height);
IBitmap *psIBitmapJPEG;
IBitmap *psIBitmapDisp = IDISPLAY_GetDestination(m_pApp->GetIDisplay());
IBITMAP_CreateCompatibleBitmap(psIBitmapDisp, &psIBitmapJPEG, m_width, m_height);
IDISPLAY_SetDestination(m_pApp->GetIDisplay(), psIBitmapJPEG );
IIMAGE_Draw(pIImage, 0, 0);
IDISPLAY_SetDestination(m_pApp->GetIDisplay(), NULL);
IIMAGE_Release(pIImage);
IBITMAP_Release(psIBitmapDisp);
}

This code will get the jpgs, scale them and draw them on a new, small bitmapss
IImage * pIImage = ISHELL_LoadImage(m_pApp->GetIShell(), filename.GetBuffer());
if(pIImage)
{
//if image exists set the jpg notifier to it.
IIMAGE_Notify(pIImage, IimageCB, this);

::IimageCB()
{
if (pIImage)
{
IIMAGE_SetParm(pIImage, IPARM_SCALE, m_width, m_height);
IBitmap *psIBitmapJPEG;
IBitmap *psIBitmapDisp = IDISPLAY_GetDestination(m_pApp->GetIDisplay());
IBITMAP_CreateCompatibleBitmap(psIBitmapDisp, &psIBitmapJPEG, m_width, m_height);
IDISPLAY_SetDestination(m_pApp->GetIDisplay(), psIBitmapJPEG );
IIMAGE_Draw(pIImage, 0, 0);
IDISPLAY_SetDestination(m_pApp->GetIDisplay(), NULL);
IIMAGE_Release(pIImage);
IBITMAP_Release(psIBitmapDisp);
}