Results for: IBITMAP_GetPixel | developer.brewmp.com Results for: IBITMAP_GetPixel | developer.brewmp.com

Developer

Results for: IBITMAP_GetPixel

Forums:

Hi.

I tried to get the RGB value of each pixel of input image,
doing like below
---------------------
uint32 nColor;
IBitmap * pIBitmap;
IBitmap * pIBitsrc;

pIBitmap = ISHELL_LoadBitmap(pMe->a.m_pIShell, "kkk.bmp");
IBITMAP_QueryInterface(pIBitmap, AEECLSID_BITMAP, &pIBitsrc)

IBITMAP_GetPixel(pIBitsrc, j, i, &nColor);
---------------------

But doing this,
I always get the error code of "EUNSUPPORTED" from
the IBITMAP Interface.(--;

Could you explain what the problem is?
Is it depend on the hand set which I'm using now?

GetPixel() is not implemented for this particular bitmap implementation. There are two bitmap implementation that you will commonly find on a BREW device: device compatible and device independent (DIB). (Not to be confused with the IDIB interface. The DIB implementation exports the IDIB interface, but the device compatible implementation may or may not. Both export the IBitmap interface.) Bitmaps from ISHELL_LoadBitmap(), ISHELL_LoadResBitmap(), and IDISPLAY_CreateDIBitmap() use the DIB implementation.
Anyway, calling GetPixel() for every pixel in a bitmap would be very slow. Even if GetPixel() was implemented, you would probably be better off getting the IDIB interface with QueryInterface() and accessing the bitmap data directly.
BTW, this:
Quote:IBITMAP_QueryInterface(pIBitmap, AEECLSID_BITMAP, &pIBitsrc)
is kind of silly. You already have an IBitmap interface for this object, so there is no point in asking for it again. This code is equivalent to this:
IBITMAP_AddRef(pIBitmap);
pIBitsrc = pIBitmap;

GetPixel() is not implemented for this particular bitmap implementation. There are two bitmap implementation that you will commonly find on a BREW device: device compatible and device independent (DIB). (Not to be confused with the IDIB interface. The DIB implementation exports the IDIB interface, but the device compatible implementation may or may not. Both export the IBitmap interface.) Bitmaps from ISHELL_LoadBitmap(), ISHELL_LoadResBitmap(), and IDISPLAY_CreateDIBitmap() use the DIB implementation.
Anyway, calling GetPixel() for every pixel in a bitmap would be very slow. Even if GetPixel() was implemented, you would probably be better off getting the IDIB interface with QueryInterface() and accessing the bitmap data directly.
BTW, this:
Quote:IBITMAP_QueryInterface(pIBitmap, AEECLSID_BITMAP, &pIBitsrc)
is kind of silly. You already have an IBitmap interface for this object, so there is no point in asking for it again. This code is equivalent to this:
IBITMAP_AddRef(pIBitmap);
pIBitsrc = pIBitmap;

Hi!
I could solve the problem with your advice.
Thank you so much for your relies.

Hi!
I could solve the problem with your advice.
Thank you so much for your relies.

Why IBITMAP_GetPixel() and IBITMAP_BltOut() can not supported by SDK?
??
I invoke them on simulator, but return value is 20, this value indicate that simulator can not support them, WHY?! They are very useful!

Why IBITMAP_GetPixel() and IBITMAP_BltOut() can not supported by SDK?
??
I invoke them on simulator, but return value is 20, this value indicate that simulator can not support them, WHY?! They are very useful!

Hy all, i'm coding a applet to rotate bitmap, but when i call getPixel this return 20(EUNSUPPORTED) in all devices that come with emulator, someone know a way to fix this? All help is useful hehehe even a code hack :D Thanks all.

Hy all, i'm coding a applet to rotate bitmap, but when i call getPixel this return 20(EUNSUPPORTED) in all devices that come with emulator, someone know a way to fix this? All help is useful hehehe even a code hack :D Thanks all.

You probably have a "simple DIB". These bitmaps do not support GetPixel() or any drawing operations. These are created via IDISPLAY_CreateDIBitmap[Ex] and ISHELL_Load[Res]Bitmap.
If you need a bitmap that supports these operations, you need a device compatible bitmap. This includes the device bitmap and bitmaps created by calling IBITMAP_CreateCompatibleBitmap() on other device compatible bitmaps.

You probably have a "simple DIB". These bitmaps do not support GetPixel() or any drawing operations. These are created via IDISPLAY_CreateDIBitmap[Ex] and ISHELL_Load[Res]Bitmap.
If you need a bitmap that supports these operations, you need a device compatible bitmap. This includes the device bitmap and bitmaps created by calling IBITMAP_CreateCompatibleBitmap() on other device compatible bitmaps.

By the way, just to clarify Mark's comment, you need to call IDISPLAY_GetDeviceBitmap and then call CreateCompatibleBitmap

By the way, just to clarify Mark's comment, you need to call IDISPLAY_GetDeviceBitmap and then call CreateCompatibleBitmap

thanks! now my bitmaps can move and rotate ;)

thanks! now my bitmaps can move and rotate ;)

I am using IBITMAP_GetPixel() to get NativeColorValue of a bitmap but it is returns EUNSUPPORTED.
In the same app i am using IBITMAP_GetInfo() which is working properly..
regards,
V N Maheshwari

I am using IBITMAP_GetPixel() to get NativeColorValue of a bitmap but it is returns EUNSUPPORTED.
In the same app i am using IBITMAP_GetInfo() which is working properly..
regards,
V N Maheshwari

Merging related threads. Please search the forums in the future.

Merging related threads. Please search the forums in the future.