Help required in using IBitmap_SetPixels() API | developer.brewmp.com Help required in using IBitmap_SetPixels() API | developer.brewmp.com

Developer

Help required in using IBitmap_SetPixels() API

Forums:

Hello All,

 

I am creating IBitmap and accessing the pixel values of it.

I want to modify the original pixel color values and set the new R,G and B values.

 

I am calling IBitmap_SetPixels  API to achieve the same.

But I am getting return values as EUNSUPPORTED indicating API is not supported.

I am using IBitmap_GetPixel,IBitmap_NativeToRGB and IBitmap_RGBToNative APIs along with

IBitmap_SetPixels.

They all are working fine.

 

Can anyone have any idea?

 

Thanks

-Pradnya

 

I'd use IDIB for this.  You can find an example of this in the bitmap sample
https://developer.brewmp.com/file/205657/using-bitmap-interfaces-sample-...

I'd use IDIB for this.  You can find an example of this in the bitmap sample
https://developer.brewmp.com/file/205657/using-bitmap-interfaces-sample-...

Hi,
Thanks for the reply.. It seems BREW Application developer has to use the IBitmapFX and IBitmapScale in order to apply any image processing effects on the original image or to changes its original R,G and B values.
Direct accessing and modifying the pixel values through IBitmap Interface will not help.
 
But the sample code you provided in above reply do not make use of IDIB Interface directly.Everywhere IBitmap is used to perform any action on image.
 
Are there any APIs available which can take IDIB* as input and allow to modify the pixel values ?
 
Thanks
-Pradnya

Hi,
Thanks for the reply.. It seems BREW Application developer has to use the IBitmapFX and IBitmapScale in order to apply any image processing effects on the original image or to changes its original R,G and B values.
Direct accessing and modifying the pixel values through IBitmap Interface will not help.
 
But the sample code you provided in above reply do not make use of IDIB Interface directly.Everywhere IBitmap is used to perform any action on image.
 
Are there any APIs available which can take IDIB* as input and allow to modify the pixel values ?
 
Thanks
-Pradnya

An IBitmap can be QueryInterfaced for it's IDIB.  All newer handsets should support this method to get at the raw data of an IBitmap.
Then you can manually spin through the pixels yourself.  IDIB is mainly to expose the structure of the underlying pixels - including the raw pixel data.  So if you wish to dim the image, for example, you can perform direct operations on the rgb values to lower or raise them.  It's not any different than any other raw graphics operations - once you have the raw buffer and know the bits per pixel (all given in the IDIB format). 

An IBitmap can be QueryInterfaced for it's IDIB.  All newer handsets should support this method to get at the raw data of an IBitmap.
Then you can manually spin through the pixels yourself.  IDIB is mainly to expose the structure of the underlying pixels - including the raw pixel data.  So if you wish to dim the image, for example, you can perform direct operations on the rgb values to lower or raise them.  It's not any different than any other raw graphics operations - once you have the raw buffer and know the bits per pixel (all given in the IDIB format). 

Hi jmiller2_ ,
 Thank you for your response.
I have done the same thing as you mentioned(retrieved  IDIB by  QueryInterface on IBitmap) and then used API IBitmap_SetPixels(where I again need to typecast the 1st parameter to IBitmap* from IDIB*). 
 
Then also I got the return value as 20 indicating API Not Supported.
I am running this code on BREW MP Simulator.Does this API work on Simulator?
 
Thank you
-Pradnya

Hi jmiller2_ ,
 Thank you for your response.
I have done the same thing as you mentioned(retrieved  IDIB by  QueryInterface on IBitmap) and then used API IBitmap_SetPixels(where I again need to typecast the 1st parameter to IBitmap* from IDIB*). 
 
Then also I got the return value as 20 indicating API Not Supported.
I am running this code on BREW MP Simulator.Does this API work on Simulator?
 
Thank you
-Pradnya

Yes QI for IBitmap for IDIB does work on the simulator.  If you want to
simply alter the data of the IDIB's  pixel data, it starts at pBmp and is arranged based on the depth found in the
nDepth member.  Often this is RGB565 but you will want to check and have a switch in your
pixel altering code for the different formats (555, 888, etc).

Yes QI for IBitmap for IDIB does work on the simulator.  If you want to
simply alter the data of the IDIB's  pixel data, it starts at pBmp and is arranged based on the depth found in the
nDepth member.  Often this is RGB565 but you will want to check and have a switch in your
pixel altering code for the different formats (555, 888, etc).