How to get IBitmap from IImage | developer.brewmp.com How to get IBitmap from IImage | developer.brewmp.com

Developer

How to get IBitmap from IImage

Forums:

Hi, all:

Can anybody help me, I am trying to load PNG files and bitblt them to screen. (not simply draw it, but blt them complex) I am not using bmp files because they are too large to download.
The problem is that png files can't be loaded as IBitmap, they can only be loaded as IImage, can a IBitmap be got from a IImage?

Thank you for your help.

The only ways to get a bitmap from a PNG are:
1. Decode the PNG yourself and create a bitmap
2. Draw the IImage to an offscreen bitmap, and use the result

The only ways to get a bitmap from a PNG are:
1. Decode the PNG yourself and create a bitmap
2. Draw the IImage to an offscreen bitmap, and use the result

take these steps and have a try
1. pbmDest = IDISPLAY_GetDestination();
2. IDISPLAY_SetDestination(/*your Bitmap here*/);
3. IIMAGE_Draw(/*your png picture here*/);
4. use IBITMAP_BltIn(...) to get your paticular bitmap from your /*your Bitmap here*/;
5. use IDISPLAY_SetDestination(pbmDest); to restore your display's destination;
remember to release your recources at the end.
best regards
-michael

take these steps and have a try
1. pbmDest = IDISPLAY_GetDestination();
2. IDISPLAY_SetDestination(/*your Bitmap here*/);
3. IIMAGE_Draw(/*your png picture here*/);
4. use IBITMAP_BltIn(...) to get your paticular bitmap from your /*your Bitmap here*/;
5. use IDISPLAY_SetDestination(pbmDest); to restore your display's destination;
remember to release your recources at the end.
best regards
-michael

you can SetDestination to NULL to restore the destination to the default.
-Tyndal

you can SetDestination to NULL to restore the destination to the default.
-Tyndal

Michael,
Can you help me with how to obtain the transparency color for the PNG so I can set it properly before doing a BLT later on with pbmDest ? Also, should I use AEE_RO_COPY or AEE_RO_TRANSPARENT?
I am using BREW 2.x.
Thank-you,
BD
michael wrote:take these steps and have a try
1. pbmDest = IDISPLAY_GetDestination();
2. IDISPLAY_SetDestination(/*your Bitmap here*/);
3. IIMAGE_Draw(/*your png picture here*/);
4. use IBITMAP_BltIn(...) to get your paticular bitmap from your /*your Bitmap here*/;
5. use IDISPLAY_SetDestination(pbmDest); to restore your display's destination;
remember to release your recources at the end.
best regards
-michael

Michael,
Can you help me with how to obtain the transparency color for the PNG so I can set it properly before doing a BLT later on with pbmDest ? Also, should I use AEE_RO_COPY or AEE_RO_TRANSPARENT?
I am using BREW 2.x.
Thank-you,
BD
michael wrote:take these steps and have a try
1. pbmDest = IDISPLAY_GetDestination();
2. IDISPLAY_SetDestination(/*your Bitmap here*/);
3. IIMAGE_Draw(/*your png picture here*/);
4. use IBITMAP_BltIn(...) to get your paticular bitmap from your /*your Bitmap here*/;
5. use IDISPLAY_SetDestination(pbmDest); to restore your display's destination;
remember to release your recources at the end.
best regards
-michael

I'd like to clarify my problem. I have this special effect where an image (first image) is draw in the middle of the screen and then, as another image is moved over it, the first image will appear and then disappear as the moving image moves away. Kind of like a sliding window...
When I used IImage and the original PNGs, everything turned out alright, but when I switched to use IBITMAPs created from original PNGs, well, the first image does not show up at all.
The first image is a 32-bit PNG and the behavior was observed on a 2.1 emulator.
So, well, exactly, how does IImage handle PNGs?
Thanks for all your help!
brewdev_lol wrote:Michael,
Can you help me with how to obtain the transparency color for the PNG so I can set it properly before doing a BLT later on with pbmDest ? Also, should I use AEE_RO_COPY or AEE_RO_TRANSPARENT?
I am using BREW 2.x.
Thank-you,
BD

I'd like to clarify my problem. I have this special effect where an image (first image) is draw in the middle of the screen and then, as another image is moved over it, the first image will appear and then disappear as the moving image moves away. Kind of like a sliding window...
When I used IImage and the original PNGs, everything turned out alright, but when I switched to use IBITMAPs created from original PNGs, well, the first image does not show up at all.
The first image is a 32-bit PNG and the behavior was observed on a 2.1 emulator.
So, well, exactly, how does IImage handle PNGs?
Thanks for all your help!
brewdev_lol wrote:Michael,
Can you help me with how to obtain the transparency color for the PNG so I can set it properly before doing a BLT later on with pbmDest ? Also, should I use AEE_RO_COPY or AEE_RO_TRANSPARENT?
I am using BREW 2.x.
Thank-you,
BD